2727using StreamChat . Libs . Websockets ;
2828using StreamChat . Core . LowLevelClient . Requests ;
2929using System . Linq ;
30+ using StreamChat . Core . Helpers ;
3031
3132#if STREAM_TESTS_ENABLED
3233using System . Runtime . CompilerServices ;
@@ -752,45 +753,45 @@ private void RegisterEventHandlers()
752753
753754 RegisterEventType < NotificationMarkReadEventInternalDTO , EventNotificationMarkRead > (
754755 WSEventType . NotificationMarkRead ,
755- ( e , dto ) => NotificationMarkRead ? . Invoke ( e ) , dto => InternalNotificationMarkRead ? . Invoke ( dto ) ) ;
756+ ( e , dto ) => NotificationMarkRead ? . Invoke ( e ) , dto => InternalNotificationMarkRead ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
756757 RegisterEventType < NotificationNewMessageEventInternalDTO , EventNotificationMessageNew > (
757758 WSEventType . NotificationMessageNew ,
758759 ( e , dto ) => NotificationMessageReceived ? . Invoke ( e ) ,
759- dto => InternalNotificationMessageReceived ? . Invoke ( dto ) ) ;
760+ dto => InternalNotificationMessageReceived ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
760761
761762 RegisterEventType < NotificationChannelDeletedEventInternalDTO , EventNotificationChannelDeleted > (
762763 WSEventType . NotificationChannelDeleted ,
763764 ( e , dto ) => NotificationChannelDeleted ? . Invoke ( e ) ,
764- dto => InternalNotificationChannelDeleted ? . Invoke ( dto ) ) ;
765+ dto => InternalNotificationChannelDeleted ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
765766 RegisterEventType < NotificationChannelTruncatedEventInternalDTO , EventNotificationChannelTruncated > (
766767 WSEventType . NotificationChannelTruncated ,
767768 ( e , dto ) => NotificationChannelTruncated ? . Invoke ( e ) ,
768- dto => InternalNotificationChannelTruncated ? . Invoke ( dto ) ) ;
769+ dto => InternalNotificationChannelTruncated ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
769770
770771 RegisterEventType < NotificationAddedToChannelEventInternalDTO , EventNotificationAddedToChannel > (
771772 WSEventType . NotificationAddedToChannel ,
772773 ( e , dto ) => NotificationAddedToChannel ? . Invoke ( e ) ,
773- dto => InternalNotificationAddedToChannel ? . Invoke ( dto ) ) ;
774+ dto => InternalNotificationAddedToChannel ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
774775 RegisterEventType < NotificationRemovedFromChannelEventInternalDTO , EventNotificationRemovedFromChannel > (
775776 WSEventType . NotificationRemovedFromChannel ,
776777 ( e , dto ) => NotificationRemovedFromChannel ? . Invoke ( e ) ,
777- dto => InternalNotificationRemovedFromChannel ? . Invoke ( dto ) ) ;
778+ dto => InternalNotificationRemovedFromChannel ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
778779
779780 RegisterEventType < NotificationInvitedEventInternalDTO , EventNotificationInvited > (
780781 WSEventType . NotificationInvited ,
781- ( e , dto ) => NotificationInvited ? . Invoke ( e ) , dto => InternalNotificationInvited ? . Invoke ( dto ) ) ;
782+ ( e , dto ) => NotificationInvited ? . Invoke ( e ) , dto => InternalNotificationInvited ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
782783 RegisterEventType < NotificationInviteAcceptedEventInternalDTO , EventNotificationInviteAccepted > (
783784 WSEventType . NotificationInviteAccepted ,
784785 ( e , dto ) => NotificationInviteAccepted ? . Invoke ( e ) ,
785- dto => InternalNotificationInviteAccepted ? . Invoke ( dto ) ) ;
786+ dto => InternalNotificationInviteAccepted ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
786787 RegisterEventType < NotificationInviteRejectedEventInternalDTO , EventNotificationInviteRejected > (
787788 WSEventType . NotificationInviteRejected ,
788789 ( e , dto ) => NotificationInviteRejected ? . Invoke ( e ) ,
789- dto => InternalNotificationInviteRejected ? . Invoke ( dto ) ) ;
790+ dto => InternalNotificationInviteRejected ? . Invoke ( dto ) , InternalNotificationsHelper . FixMissingChannelTypeAndId ) ;
790791 }
791792
792793 private void RegisterEventType < TDto , TEvent > ( string key ,
793- Action < TEvent , TDto > handler , Action < TDto > internalHandler = null )
794+ Action < TEvent , TDto > handler , Action < TDto > internalHandler = null , Action < TDto > postprocess = null )
794795 where TEvent : EventBase , ILoadableFrom < TDto , TEvent > , new ( )
795796 {
796797 if ( _eventKeyToHandler . ContainsKey ( key ) )
@@ -804,6 +805,7 @@ private void RegisterEventType<TDto, TEvent>(string key,
804805 try
805806 {
806807 var eventObj = DeserializeEvent < TDto , TEvent > ( serializedContent , out var dto ) ;
808+ postprocess ? . Invoke ( dto ) ;
807809 _lastEventReceivedAt = eventObj . CreatedAt ;
808810 handler ? . Invoke ( eventObj , dto ) ;
809811 internalHandler ? . Invoke ( dto ) ;
0 commit comments