stream-chat-angular 4.5.3 → 4.6.0
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/bundles/stream-chat-angular.umd.js +20 -13
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel.service.js +19 -13
- package/fesm2015/stream-chat-angular.js +19 -13
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/version.ts +1 -1
|
@@ -3,7 +3,7 @@ import * as i0 from '@angular/core';
|
|
|
3
3
|
import { Injectable, Component, Input, EventEmitter, Output, ViewChild, InjectionToken, Directive, HostBinding, Inject, NgModule } from '@angular/core';
|
|
4
4
|
import { BehaviorSubject, ReplaySubject, combineLatest, Subject, timer, of } from 'rxjs';
|
|
5
5
|
import { StreamChat } from 'stream-chat';
|
|
6
|
-
import { map, shareReplay,
|
|
6
|
+
import { map, shareReplay, first, take, tap, catchError, startWith, distinctUntilChanged, filter, debounceTime } from 'rxjs/operators';
|
|
7
7
|
import { v4 } from 'uuid';
|
|
8
8
|
import * as i6 from '@ngx-translate/core';
|
|
9
9
|
import { TranslateModule } from '@ngx-translate/core';
|
|
@@ -19,7 +19,7 @@ import transliterate from '@stream-io/transliterate';
|
|
|
19
19
|
import * as i8 from 'angular-mentions';
|
|
20
20
|
import { MentionModule } from 'angular-mentions';
|
|
21
21
|
|
|
22
|
-
const version = '4.
|
|
22
|
+
const version = '4.6.0';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
|
|
@@ -360,11 +360,6 @@ class ChannelService {
|
|
|
360
360
|
}), shareReplay());
|
|
361
361
|
this.messageToQuote$ = this.messageToQuoteSubject.asObservable();
|
|
362
362
|
this.jumpToMessage$ = this.jumpToMessageSubject.asObservable();
|
|
363
|
-
this.chatClientService.connectionState$
|
|
364
|
-
.pipe(filter((s) => s === 'online'))
|
|
365
|
-
.subscribe(() => {
|
|
366
|
-
void this.setAsActiveParentMessage(undefined);
|
|
367
|
-
});
|
|
368
363
|
this.usersTypingInChannel$ =
|
|
369
364
|
this.usersTypingInChannelSubject.asObservable();
|
|
370
365
|
this.usersTypingInThread$ = this.usersTypingInThreadSubject.asObservable();
|
|
@@ -870,9 +865,13 @@ class ChannelService {
|
|
|
870
865
|
return;
|
|
871
866
|
}
|
|
872
867
|
this.isStateRecoveryInProgress = true;
|
|
873
|
-
this.reset();
|
|
874
868
|
try {
|
|
875
|
-
|
|
869
|
+
if (this.options) {
|
|
870
|
+
this.options.offset = 0;
|
|
871
|
+
}
|
|
872
|
+
yield this.queryChannels(false, true);
|
|
873
|
+
// Thread messages are not refetched so active thread gets deselected to avoid displaying stale messages
|
|
874
|
+
void this.setAsActiveParentMessage(undefined);
|
|
876
875
|
this.isStateRecoveryInProgress = false;
|
|
877
876
|
}
|
|
878
877
|
catch (_a) {
|
|
@@ -1096,18 +1095,25 @@ class ChannelService {
|
|
|
1096
1095
|
this.activeChannelSubscriptions.forEach((s) => s.unsubscribe());
|
|
1097
1096
|
this.activeChannelSubscriptions = [];
|
|
1098
1097
|
}
|
|
1099
|
-
queryChannels(shouldSetActiveChannel) {
|
|
1098
|
+
queryChannels(shouldSetActiveChannel, recoverState = false) {
|
|
1100
1099
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1101
1100
|
try {
|
|
1102
|
-
const channels = yield this.chatClientService.chatClient.queryChannels(this.filters, this.sort, this.options);
|
|
1101
|
+
const channels = yield this.chatClientService.chatClient.queryChannels(this.filters, this.sort || {}, this.options);
|
|
1103
1102
|
channels.forEach((c) => this.watchForChannelEvents(c));
|
|
1104
|
-
const prevChannels =
|
|
1103
|
+
const prevChannels = recoverState
|
|
1104
|
+
? []
|
|
1105
|
+
: this.channelsSubject.getValue() || [];
|
|
1105
1106
|
this.channelsSubject.next([...prevChannels, ...channels]);
|
|
1107
|
+
const currentActiveChannel = this.activeChannelSubject.getValue();
|
|
1106
1108
|
if (channels.length > 0 &&
|
|
1107
|
-
!
|
|
1109
|
+
!currentActiveChannel &&
|
|
1108
1110
|
shouldSetActiveChannel) {
|
|
1109
1111
|
this.setAsActiveChannel(channels[0]);
|
|
1110
1112
|
}
|
|
1113
|
+
if (recoverState &&
|
|
1114
|
+
!channels.find((c) => c.cid === (currentActiveChannel === null || currentActiveChannel === void 0 ? void 0 : currentActiveChannel.cid))) {
|
|
1115
|
+
this.deselectActiveChannel();
|
|
1116
|
+
}
|
|
1111
1117
|
this.hasMoreChannelsSubject.next(channels.length >= this.options.limit);
|
|
1112
1118
|
return channels;
|
|
1113
1119
|
}
|