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.
@@ -21,7 +21,7 @@ import transliterate from '@stream-io/transliterate';
21
21
  import * as i7 from 'angular-mentions';
22
22
  import { MentionModule } from 'angular-mentions';
23
23
 
24
- const version = '5.7.1';
24
+ const version = '5.7.3';
25
25
 
26
26
  /**
27
27
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -5804,7 +5804,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
5804
5804
  }]
5805
5805
  }], ctorParameters: function () { return []; } });
5806
5806
 
5807
- const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
5807
+ const isSafari = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
5808
5808
 
5809
5809
  var MediaRecordingState;
5810
5810
  (function (MediaRecordingState) {
@@ -6239,7 +6239,7 @@ class AudioRecorderService extends MultimediaRecorder {
6239
6239
  * - For all other browsers we use audio/webm (which is then transcoded to wav)
6240
6240
  */
6241
6241
  this.config = {
6242
- mimeType: isSafari ? 'audio/mp4;codecs=mp4a.40.2' : 'audio/webm',
6242
+ mimeType: isSafari() ? 'audio/mp4;codecs=mp4a.40.2' : 'audio/webm',
6243
6243
  };
6244
6244
  }
6245
6245
  enrichWithExtraData() {
@@ -7673,6 +7673,7 @@ class MessageListComponent {
7673
7673
  this.parsedDates = new Map();
7674
7674
  this.isViewInited = false;
7675
7675
  this.forceRepaintSubject = new Subject();
7676
+ this.isSafari = isSafari();
7676
7677
  this.scrollPosition$ = new BehaviorSubject('bottom');
7677
7678
  this.messageNotificationJumpClicked = () => {
7678
7679
  this.jumpToFirstUnreadMessage();
@@ -7771,6 +7772,9 @@ class MessageListComponent {
7771
7772
  }
7772
7773
  }));
7773
7774
  this.subscriptions.push(this.channelService.activeParentMessage$.subscribe((message) => {
7775
+ if (!message && this.parentMessage && this.mode === 'thread') {
7776
+ this.resetScrollState();
7777
+ }
7774
7778
  if (message &&
7775
7779
  this.parentMessage &&
7776
7780
  message.id !== this.parentMessage.id &&
@@ -7917,7 +7921,7 @@ class MessageListComponent {
7917
7921
  scrollToBottom() {
7918
7922
  this.scrollContainer.nativeElement.scrollTop =
7919
7923
  this.scrollContainer.nativeElement.scrollHeight + 0.1;
7920
- if (isSafari) {
7924
+ if (this.isSafari) {
7921
7925
  this.forceRepaintSubject.next();
7922
7926
  }
7923
7927
  }
@@ -7934,6 +7938,12 @@ class MessageListComponent {
7934
7938
  }
7935
7939
  return;
7936
7940
  }
7941
+ if (this.scrollContainer.nativeElement.scrollHeight >
7942
+ this.scrollContainer.nativeElement.clientHeight) {
7943
+ if (!this.isJumpToLatestButtonVisible) {
7944
+ this.isJumpToLatestButtonVisible = true;
7945
+ }
7946
+ }
7937
7947
  this.scroll$.next();
7938
7948
  let scrollPosition = this.getScrollPosition();
7939
7949
  const isUserScrolled = (this.direction === 'bottom-to-top'
@@ -8040,7 +8050,7 @@ class MessageListComponent {
8040
8050
  (messageToAlignTo?.getBoundingClientRect()?.top || 0) -
8041
8051
  (this.anchorMessageTopOffset || 0);
8042
8052
  this.anchorMessageTopOffset = undefined;
8043
- if (isSafari) {
8053
+ if (this.isSafari) {
8044
8054
  this.forceRepaintSubject.next();
8045
8055
  }
8046
8056
  }
@@ -8052,16 +8062,16 @@ class MessageListComponent {
8052
8062
  }
8053
8063
  getScrollPosition() {
8054
8064
  let position = 'middle';
8055
- if (Math.floor(this.scrollContainer.nativeElement.scrollTop) <=
8056
- (this.parentMessageElement?.nativeElement.clientHeight || 0)) {
8057
- position = 'top';
8058
- }
8059
- else if (Math.ceil(this.scrollContainer.nativeElement.scrollTop) +
8065
+ if (Math.ceil(this.scrollContainer.nativeElement.scrollTop) +
8060
8066
  this.scrollContainer.nativeElement.clientHeight +
8061
8067
  1 >=
8062
8068
  this.scrollContainer.nativeElement.scrollHeight) {
8063
8069
  position = 'bottom';
8064
8070
  }
8071
+ else if (Math.floor(this.scrollContainer.nativeElement.scrollTop) <=
8072
+ (this.parentMessageElement?.nativeElement?.clientHeight || 0)) {
8073
+ position = 'top';
8074
+ }
8065
8075
  return position;
8066
8076
  }
8067
8077
  setMessages$() {
@@ -8079,11 +8089,7 @@ class MessageListComponent {
8079
8089
  }
8080
8090
  }
8081
8091
  });
8082
- this.messages$ = this.virtualizedList.virtualizedItems$.pipe(tap((messages) => {
8083
- if (messages.length === 0) {
8084
- this.resetScrollState();
8085
- return;
8086
- }
8092
+ this.messages$ = this.virtualizedList.virtualizedItems$.pipe(tap(() => {
8087
8093
  if (this.isEmpty) {
8088
8094
  // cdRef.detectChanges() isn't enough here, test will fail
8089
8095
  setTimeout(() => (this.isEmpty = false), 0);
@@ -8108,6 +8114,8 @@ class MessageListComponent {
8108
8114
  this.isLatestMessageInList =
8109
8115
  !latestMessageInList ||
8110
8116
  latestMessageInList.cid !== channel?.cid ||
8117
+ (this.mode === 'thread' &&
8118
+ latestMessageInList?.parent_id !== this.parentMessage?.id) ||
8111
8119
  latestMessageInList?.id ===
8112
8120
  messagesFromState[messagesFromState.length - 1]?.id;
8113
8121
  if (!this.isLatestMessageInList) {