stream-chat-angular 5.1.1 → 5.1.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.
- package/assets/version.d.ts +1 -1
- package/esm2020/assets/version.mjs +2 -2
- package/esm2020/lib/channel.service.mjs +32 -3
- package/fesm2015/stream-chat-angular.mjs +33 -3
- package/fesm2015/stream-chat-angular.mjs.map +1 -1
- package/fesm2020/stream-chat-angular.mjs +32 -3
- package/fesm2020/stream-chat-angular.mjs.map +1 -1
- package/lib/channel.service.d.ts +5 -0
- package/package.json +1 -1
- package/src/assets/version.ts +1 -1
|
@@ -20,7 +20,7 @@ import transliterate from '@stream-io/transliterate';
|
|
|
20
20
|
import * as i8$1 from 'angular-mentions';
|
|
21
21
|
import { MentionModule } from 'angular-mentions';
|
|
22
22
|
|
|
23
|
-
const version = '5.1.
|
|
23
|
+
const version = '5.1.3';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
|
|
@@ -495,6 +495,7 @@ class ChannelService {
|
|
|
495
495
|
this.activeParentMessageIdSubject.next(message === null || message === void 0 ? void 0 : message.id);
|
|
496
496
|
};
|
|
497
497
|
this.areReadEventsPaused = false;
|
|
498
|
+
this.markReadThrottleTime = 1050;
|
|
498
499
|
this.channels$ = this.channelsSubject.asObservable().pipe(shareReplay(1));
|
|
499
500
|
this.activeChannel$ = this.activeChannelSubject
|
|
500
501
|
.asObservable()
|
|
@@ -598,6 +599,7 @@ class ChannelService {
|
|
|
598
599
|
return;
|
|
599
600
|
}
|
|
600
601
|
this.stopWatchForActiveChannelEvents(prevActiveChannel);
|
|
602
|
+
this.flushMarkReadQueue();
|
|
601
603
|
this.areReadEventsPaused = false;
|
|
602
604
|
const readState = channel.state.read[((_a = this.chatClientService.chatClient.user) === null || _a === void 0 ? void 0 : _a.id) || ''];
|
|
603
605
|
this.activeChannelLastReadMessageId = readState === null || readState === void 0 ? void 0 : readState.last_read_message_id;
|
|
@@ -623,6 +625,7 @@ class ChannelService {
|
|
|
623
625
|
return;
|
|
624
626
|
}
|
|
625
627
|
this.stopWatchForActiveChannelEvents(activeChannel);
|
|
628
|
+
this.flushMarkReadQueue();
|
|
626
629
|
this.activeChannelMessagesSubject.next([]);
|
|
627
630
|
this.activeChannelSubject.next(undefined);
|
|
628
631
|
this.activeParentMessageIdSubject.next(undefined);
|
|
@@ -1907,12 +1910,39 @@ class ChannelService {
|
|
|
1907
1910
|
this.usersTypingInChannelSubject.next([]);
|
|
1908
1911
|
this.usersTypingInThreadSubject.next([]);
|
|
1909
1912
|
}
|
|
1910
|
-
markRead(channel) {
|
|
1913
|
+
markRead(channel, isThrottled = true) {
|
|
1911
1914
|
if (this.canSendReadEvents &&
|
|
1912
1915
|
this.shouldMarkActiveChannelAsRead &&
|
|
1913
1916
|
!this.areReadEventsPaused) {
|
|
1914
|
-
|
|
1917
|
+
if (isThrottled) {
|
|
1918
|
+
this.markReadThrottled(channel);
|
|
1919
|
+
}
|
|
1920
|
+
else {
|
|
1921
|
+
void channel.markRead();
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
markReadThrottled(channel) {
|
|
1926
|
+
if (!this.markReadTimeout) {
|
|
1927
|
+
this.markRead(channel, false);
|
|
1928
|
+
this.markReadTimeout = setTimeout(() => {
|
|
1929
|
+
this.flushMarkReadQueue();
|
|
1930
|
+
}, this.markReadThrottleTime);
|
|
1915
1931
|
}
|
|
1932
|
+
else {
|
|
1933
|
+
clearTimeout(this.markReadTimeout);
|
|
1934
|
+
this.scheduledMarkReadRequest = () => this.markRead(channel, false);
|
|
1935
|
+
this.markReadTimeout = setTimeout(() => {
|
|
1936
|
+
this.flushMarkReadQueue();
|
|
1937
|
+
}, this.markReadThrottleTime);
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
flushMarkReadQueue() {
|
|
1941
|
+
var _a;
|
|
1942
|
+
(_a = this.scheduledMarkReadRequest) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
1943
|
+
this.scheduledMarkReadRequest = undefined;
|
|
1944
|
+
clearTimeout(this.markReadTimeout);
|
|
1945
|
+
this.markReadTimeout = undefined;
|
|
1916
1946
|
}
|
|
1917
1947
|
_init(settings) {
|
|
1918
1948
|
return __awaiter(this, void 0, void 0, function* () {
|