stream-chat-angular 5.7.1 → 5.7.3

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.
@@ -22,7 +22,7 @@ import transliterate from '@stream-io/transliterate';
22
22
  import * as i7 from 'angular-mentions';
23
23
  import { MentionModule } from 'angular-mentions';
24
24
 
25
- const version = '5.7.1';
25
+ const version = '5.7.3';
26
26
 
27
27
  /**
28
28
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -5909,7 +5909,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
5909
5909
  }]
5910
5910
  }], ctorParameters: function () { return []; } });
5911
5911
 
5912
- const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
5912
+ const isSafari = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
5913
5913
 
5914
5914
  var MediaRecordingState;
5915
5915
  (function (MediaRecordingState) {
@@ -6359,7 +6359,7 @@ class AudioRecorderService extends MultimediaRecorder {
6359
6359
  * - For all other browsers we use audio/webm (which is then transcoded to wav)
6360
6360
  */
6361
6361
  this.config = {
6362
- mimeType: isSafari ? 'audio/mp4;codecs=mp4a.40.2' : 'audio/webm',
6362
+ mimeType: isSafari() ? 'audio/mp4;codecs=mp4a.40.2' : 'audio/webm',
6363
6363
  };
6364
6364
  }
6365
6365
  enrichWithExtraData() {
@@ -7820,6 +7820,7 @@ class MessageListComponent {
7820
7820
  this.parsedDates = new Map();
7821
7821
  this.isViewInited = false;
7822
7822
  this.forceRepaintSubject = new Subject();
7823
+ this.isSafari = isSafari();
7823
7824
  this.scrollPosition$ = new BehaviorSubject('bottom');
7824
7825
  this.messageNotificationJumpClicked = () => {
7825
7826
  this.jumpToFirstUnreadMessage();
@@ -7920,6 +7921,9 @@ class MessageListComponent {
7920
7921
  }
7921
7922
  }));
7922
7923
  this.subscriptions.push(this.channelService.activeParentMessage$.subscribe((message) => {
7924
+ if (!message && this.parentMessage && this.mode === 'thread') {
7925
+ this.resetScrollState();
7926
+ }
7923
7927
  if (message &&
7924
7928
  this.parentMessage &&
7925
7929
  message.id !== this.parentMessage.id &&
@@ -8071,7 +8075,7 @@ class MessageListComponent {
8071
8075
  scrollToBottom() {
8072
8076
  this.scrollContainer.nativeElement.scrollTop =
8073
8077
  this.scrollContainer.nativeElement.scrollHeight + 0.1;
8074
- if (isSafari) {
8078
+ if (this.isSafari) {
8075
8079
  this.forceRepaintSubject.next();
8076
8080
  }
8077
8081
  }
@@ -8089,6 +8093,12 @@ class MessageListComponent {
8089
8093
  }
8090
8094
  return;
8091
8095
  }
8096
+ if (this.scrollContainer.nativeElement.scrollHeight >
8097
+ this.scrollContainer.nativeElement.clientHeight) {
8098
+ if (!this.isJumpToLatestButtonVisible) {
8099
+ this.isJumpToLatestButtonVisible = true;
8100
+ }
8101
+ }
8092
8102
  this.scroll$.next();
8093
8103
  let scrollPosition = this.getScrollPosition();
8094
8104
  const isUserScrolled = (this.direction === 'bottom-to-top'
@@ -8196,7 +8206,7 @@ class MessageListComponent {
8196
8206
  (((_a = messageToAlignTo === null || messageToAlignTo === void 0 ? void 0 : messageToAlignTo.getBoundingClientRect()) === null || _a === void 0 ? void 0 : _a.top) || 0) -
8197
8207
  (this.anchorMessageTopOffset || 0);
8198
8208
  this.anchorMessageTopOffset = undefined;
8199
- if (isSafari) {
8209
+ if (this.isSafari) {
8200
8210
  this.forceRepaintSubject.next();
8201
8211
  }
8202
8212
  }
@@ -8207,18 +8217,18 @@ class MessageListComponent {
8207
8217
  this.scrollContainer.nativeElement.style.display = '';
8208
8218
  }
8209
8219
  getScrollPosition() {
8210
- var _a;
8220
+ var _a, _b;
8211
8221
  let position = 'middle';
8212
- if (Math.floor(this.scrollContainer.nativeElement.scrollTop) <=
8213
- (((_a = this.parentMessageElement) === null || _a === void 0 ? void 0 : _a.nativeElement.clientHeight) || 0)) {
8214
- position = 'top';
8215
- }
8216
- else if (Math.ceil(this.scrollContainer.nativeElement.scrollTop) +
8222
+ if (Math.ceil(this.scrollContainer.nativeElement.scrollTop) +
8217
8223
  this.scrollContainer.nativeElement.clientHeight +
8218
8224
  1 >=
8219
8225
  this.scrollContainer.nativeElement.scrollHeight) {
8220
8226
  position = 'bottom';
8221
8227
  }
8228
+ else if (Math.floor(this.scrollContainer.nativeElement.scrollTop) <=
8229
+ (((_b = (_a = this.parentMessageElement) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0)) {
8230
+ position = 'top';
8231
+ }
8222
8232
  return position;
8223
8233
  }
8224
8234
  setMessages$() {
@@ -8237,11 +8247,7 @@ class MessageListComponent {
8237
8247
  }
8238
8248
  }
8239
8249
  });
8240
- this.messages$ = this.virtualizedList.virtualizedItems$.pipe(tap((messages) => {
8241
- if (messages.length === 0) {
8242
- this.resetScrollState();
8243
- return;
8244
- }
8250
+ this.messages$ = this.virtualizedList.virtualizedItems$.pipe(tap(() => {
8245
8251
  if (this.isEmpty) {
8246
8252
  // cdRef.detectChanges() isn't enough here, test will fail
8247
8253
  setTimeout(() => (this.isEmpty = false), 0);
@@ -8265,7 +8271,7 @@ class MessageListComponent {
8265
8271
  m.status !== 'sending';
8266
8272
  })) === null || _a === void 0 ? void 0 : _a.id);
8267
8273
  }), tap((messages) => {
8268
- var _a, _b;
8274
+ var _a, _b, _c;
8269
8275
  const latestMessageInList = messages[messages.length - 1];
8270
8276
  const channel = this.channelService.activeChannel;
8271
8277
  const messagesFromState = (this.mode === 'main'
@@ -8274,8 +8280,10 @@ class MessageListComponent {
8274
8280
  this.isLatestMessageInList =
8275
8281
  !latestMessageInList ||
8276
8282
  latestMessageInList.cid !== (channel === null || channel === void 0 ? void 0 : channel.cid) ||
8283
+ (this.mode === 'thread' &&
8284
+ (latestMessageInList === null || latestMessageInList === void 0 ? void 0 : latestMessageInList.parent_id) !== ((_b = this.parentMessage) === null || _b === void 0 ? void 0 : _b.id)) ||
8277
8285
  (latestMessageInList === null || latestMessageInList === void 0 ? void 0 : latestMessageInList.id) ===
8278
- ((_b = messagesFromState[messagesFromState.length - 1]) === null || _b === void 0 ? void 0 : _b.id);
8286
+ ((_c = messagesFromState[messagesFromState.length - 1]) === null || _c === void 0 ? void 0 : _c.id);
8279
8287
  if (!this.isLatestMessageInList) {
8280
8288
  this.isUserScrolled = true;
8281
8289
  }