stream-chat-angular 3.8.0 → 3.8.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.
- package/assets/version.d.ts +1 -1
- package/bundles/stream-chat-angular.umd.js +29 -15
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel.service.js +19 -17
- package/fesm2015/stream-chat-angular.js +19 -17
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/version.ts +1 -1
|
@@ -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.8.
|
|
20
|
+
const version = '3.8.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.
|
|
@@ -288,11 +288,8 @@ class ChannelService {
|
|
|
288
288
|
const currentChannels = this.channelsSubject.getValue() || [];
|
|
289
289
|
const newChannels = channels.filter((c) => !currentChannels.find((channel) => channel.cid === c.cid));
|
|
290
290
|
const deletedChannels = currentChannels.filter((c) => !(channels === null || channels === void 0 ? void 0 : channels.find((channel) => channel.cid === c.cid)));
|
|
291
|
-
this.addChannelsFromNotification(newChannels);
|
|
291
|
+
void this.addChannelsFromNotification(newChannels);
|
|
292
292
|
this.removeChannelsFromChannelList(deletedChannels.map((c) => c.cid));
|
|
293
|
-
if (!newChannels.length && !deletedChannels.length) {
|
|
294
|
-
this.channelsSubject.next(channels);
|
|
295
|
-
}
|
|
296
293
|
};
|
|
297
294
|
this.messageListSetter = (messages) => {
|
|
298
295
|
this.activeChannelMessagesSubject.next(messages);
|
|
@@ -781,26 +778,31 @@ class ChannelService {
|
|
|
781
778
|
}
|
|
782
779
|
handleNewMessageNotification(clientEvent) {
|
|
783
780
|
if (clientEvent.event.channel) {
|
|
784
|
-
this.addChannelsFromNotification([clientEvent.event.channel]);
|
|
781
|
+
void this.addChannelsFromNotification([clientEvent.event.channel]);
|
|
785
782
|
}
|
|
786
783
|
}
|
|
787
784
|
handleAddedToChannelNotification(clientEvent) {
|
|
788
785
|
if (clientEvent.event.channel) {
|
|
789
|
-
this.addChannelsFromNotification([clientEvent.event.channel]);
|
|
786
|
+
void this.addChannelsFromNotification([clientEvent.event.channel]);
|
|
790
787
|
}
|
|
791
788
|
}
|
|
792
789
|
addChannelsFromNotification(channelResponses) {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
const
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
790
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
791
|
+
let newChannels = [];
|
|
792
|
+
const watchRequests = [];
|
|
793
|
+
channelResponses.forEach((channelResponse) => {
|
|
794
|
+
const channel = this.chatClientService.chatClient.channel(channelResponse.type, channelResponse.id);
|
|
795
|
+
watchRequests.push(channel.watch());
|
|
796
|
+
newChannels.push(channel);
|
|
797
|
+
});
|
|
798
|
+
yield Promise.all(watchRequests);
|
|
799
|
+
const currentChannels = this.channelsSubject.getValue() || [];
|
|
800
|
+
newChannels = newChannels.filter((newChannel) => !currentChannels.find((c) => c.cid === newChannel.cid));
|
|
801
|
+
if (newChannels.length > 0) {
|
|
802
|
+
newChannels.forEach((c) => this.watchForChannelEvents(c));
|
|
803
|
+
this.channelsSubject.next([...newChannels, ...currentChannels]);
|
|
804
|
+
}
|
|
799
805
|
});
|
|
800
|
-
this.channelsSubject.next([
|
|
801
|
-
...newChannels,
|
|
802
|
-
...(this.channelsSubject.getValue() || []),
|
|
803
|
-
]);
|
|
804
806
|
}
|
|
805
807
|
removeChannelsFromChannelList(cids) {
|
|
806
808
|
var _a;
|