stream-chat-angular 3.2.1 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ import transliterate from '@stream-io/transliterate';
17
17
  import * as i7 from 'angular-mentions';
18
18
  import { MentionModule } from 'angular-mentions';
19
19
 
20
- const version = '3.2.1';
20
+ const version = '3.3.1';
21
21
 
22
22
  /**
23
23
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -271,6 +271,7 @@ class ChannelService {
271
271
  this.messageToQuoteSubject = new BehaviorSubject(undefined);
272
272
  this.usersTypingInChannelSubject = new BehaviorSubject([]);
273
273
  this.usersTypingInThreadSubject = new BehaviorSubject([]);
274
+ this._shouldMarkActiveChannelAsRead = true;
274
275
  this.channelListSetter = (channels) => {
275
276
  const currentChannels = this.channelsSubject.getValue() || [];
276
277
  const newChannels = channels.filter((c) => !currentChannels.find((channel) => channel.cid === c.cid));
@@ -326,6 +327,22 @@ class ChannelService {
326
327
  this.latestMessageDateByUserByChannels$ =
327
328
  this.latestMessageDateByUserByChannelsSubject.asObservable();
328
329
  }
330
+ /**
331
+ * 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.
332
+ */
333
+ get shouldMarkActiveChannelAsRead() {
334
+ return this._shouldMarkActiveChannelAsRead;
335
+ }
336
+ /**
337
+ * 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.
338
+ */
339
+ set shouldMarkActiveChannelAsRead(shouldMarkActiveChannelAsRead) {
340
+ var _a;
341
+ if (!this._shouldMarkActiveChannelAsRead && shouldMarkActiveChannelAsRead) {
342
+ (_a = this.activeChannelSubject.getValue()) === null || _a === void 0 ? void 0 : _a.markRead();
343
+ }
344
+ this._shouldMarkActiveChannelAsRead = shouldMarkActiveChannelAsRead;
345
+ }
329
346
  /**
330
347
  * Sets the given `channel` as active and marks it as read.
331
348
  * @param channel
@@ -338,7 +355,7 @@ class ChannelService {
338
355
  channel.state.messages.forEach((m) => {
339
356
  m.readBy = getReadBy(m, channel);
340
357
  });
341
- if (this.canSendReadEvents) {
358
+ if (this.canSendReadEvents && this.shouldMarkActiveChannelAsRead) {
342
359
  void channel.markRead();
343
360
  }
344
361
  this.activeChannelMessagesSubject.next([...channel.state.messages]);
@@ -778,7 +795,7 @@ class ChannelService {
778
795
  ...channel.state.messages,
779
796
  ]);
780
797
  this.activeChannel$.pipe(first()).subscribe((c) => {
781
- if (this.canSendReadEvents) {
798
+ if (this.canSendReadEvents && this.shouldMarkActiveChannelAsRead) {
782
799
  void (c === null || c === void 0 ? void 0 : c.markRead());
783
800
  }
784
801
  });
@@ -3101,7 +3118,7 @@ class ChannelPreviewComponent {
3101
3118
  this.chatClientService = chatClientService;
3102
3119
  this.isActive = false;
3103
3120
  this.isUnread = false;
3104
- this.latestMessage = 'Nothing yet...';
3121
+ this.latestMessage = 'streamChat.Nothing yet...';
3105
3122
  this.subscriptions = [];
3106
3123
  this.canSendReadEvents = true;
3107
3124
  }
@@ -3155,7 +3172,7 @@ class ChannelPreviewComponent {
3155
3172
  this.ngZone.run(() => {
3156
3173
  var _a, _b, _c;
3157
3174
  if (((_a = this.channel) === null || _a === void 0 ? void 0 : _a.state.messages.length) === 0) {
3158
- this.latestMessage = 'Nothing yet...';
3175
+ this.latestMessage = 'streamChat.Nothing yet...';
3159
3176
  return;
3160
3177
  }
3161
3178
  if (!event.message ||