@@ -224,10 +224,6 @@ export class ChannelService<
224224 url : string ,
225225 channel : Channel < T >
226226 ) => Promise < void > ;
227- /**
228- * If set to false, read events won't be sent as new messages are received
229- */
230- shouldMarkActiveChannelAsRead = true ;
231227 private channelsSubject = new BehaviorSubject < Channel < T > [ ] | undefined > (
232228 undefined
233229 ) ;
@@ -261,6 +257,7 @@ export class ChannelService<
261257 private usersTypingInThreadSubject = new BehaviorSubject < UserResponse < T > [ ] > (
262258 [ ]
263259 ) ;
260+ private _shouldMarkActiveChannelAsRead = true ;
264261
265262 private channelListSetter = (
266263 channels : ( Channel < T > | ChannelResponse < T > ) [ ]
@@ -349,6 +346,23 @@ export class ChannelService<
349346 this . latestMessageDateByUserByChannelsSubject . asObservable ( ) ;
350347 }
351348
349+ /**
350+ * If set to false, read events won't be sent as new messages are received. If set to true active channel (if any) will immediately be marked as read.
351+ */
352+ get shouldMarkActiveChannelAsRead ( ) {
353+ return this . _shouldMarkActiveChannelAsRead ;
354+ }
355+
356+ /**
357+ * If set to false, read events won't be sent as new messages are received. If set to true active channel (if any) will immediately be marked as read.
358+ */
359+ set shouldMarkActiveChannelAsRead ( shouldMarkActiveChannelAsRead : boolean ) {
360+ if ( ! this . _shouldMarkActiveChannelAsRead && shouldMarkActiveChannelAsRead ) {
361+ this . activeChannelSubject . getValue ( ) ?. markRead ( ) ;
362+ }
363+ this . _shouldMarkActiveChannelAsRead = shouldMarkActiveChannelAsRead ;
364+ }
365+
352366 /**
353367 * Sets the given `channel` as active and marks it as read.
354368 * @param channel
0 commit comments