stream-chat-angular 4.39.4 → 4.39.6
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 +28 -15
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel.service.js +26 -15
- package/fesm2015/stream-chat-angular.js +26 -15
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/channel.service.d.ts +10 -21
- package/package.json +1 -1
- package/src/assets/version.ts +1 -1
package/assets/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.39.
|
|
1
|
+
export declare const version = "4.39.6";
|
|
@@ -356,7 +356,7 @@
|
|
|
356
356
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
var version = '4.39.
|
|
359
|
+
var version = '4.39.6';
|
|
360
360
|
|
|
361
361
|
/**
|
|
362
362
|
* The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
|
|
@@ -709,6 +709,7 @@
|
|
|
709
709
|
this.activeChannelPinnedMessagesSubject = new rxjs.BehaviorSubject([]);
|
|
710
710
|
this.hasMoreChannelsSubject = new rxjs.ReplaySubject(1);
|
|
711
711
|
this.activeChannelSubscriptions = [];
|
|
712
|
+
this.channelSubscriptions = {};
|
|
712
713
|
this.activeParentMessageIdSubject = new rxjs.BehaviorSubject(undefined);
|
|
713
714
|
this.activeThreadMessagesSubject = new rxjs.BehaviorSubject([]);
|
|
714
715
|
this.jumpToMessageSubject = new rxjs.BehaviorSubject({ id: undefined, parentId: undefined });
|
|
@@ -720,12 +721,13 @@
|
|
|
720
721
|
this._shouldMarkActiveChannelAsRead = true;
|
|
721
722
|
this.isStateRecoveryInProgress = false;
|
|
722
723
|
this.channelQueryStateSubject = new rxjs.BehaviorSubject(undefined);
|
|
723
|
-
this.channelListSetter = function (channels) {
|
|
724
|
+
this.channelListSetter = function (channels, shouldStopWatchingRemovedChannels) {
|
|
725
|
+
if (shouldStopWatchingRemovedChannels === void 0) { shouldStopWatchingRemovedChannels = true; }
|
|
724
726
|
var currentChannels = _this.channelsSubject.getValue() || [];
|
|
725
727
|
var newChannels = channels.filter(function (c) { return !currentChannels.find(function (channel) { return channel.cid === c.cid; }); });
|
|
726
728
|
var deletedChannels = currentChannels.filter(function (c) { return !(channels === null || channels === void 0 ? void 0 : channels.find(function (channel) { return channel.cid === c.cid; })); });
|
|
727
729
|
void _this.addChannelsFromNotification(newChannels);
|
|
728
|
-
_this.removeChannelsFromChannelList(deletedChannels.map(function (c) { return c.cid; }));
|
|
730
|
+
_this.removeChannelsFromChannelList(deletedChannels.map(function (c) { return c.cid; }), shouldStopWatchingRemovedChannels);
|
|
729
731
|
};
|
|
730
732
|
this.messageListSetter = function (messages) {
|
|
731
733
|
_this.activeChannelMessagesSubject.next(messages);
|
|
@@ -808,7 +810,7 @@
|
|
|
808
810
|
* @param channel
|
|
809
811
|
*/
|
|
810
812
|
ChannelService.prototype.setAsActiveChannel = function (channel) {
|
|
811
|
-
var _a, _b;
|
|
813
|
+
var _a, _b, _c;
|
|
812
814
|
var prevActiveChannel = this.activeChannelSubject.getValue();
|
|
813
815
|
if ((prevActiveChannel === null || prevActiveChannel === void 0 ? void 0 : prevActiveChannel.cid) === channel.cid) {
|
|
814
816
|
return;
|
|
@@ -816,8 +818,7 @@
|
|
|
816
818
|
this.stopWatchForActiveChannelEvents(prevActiveChannel);
|
|
817
819
|
this.activeChannelLastReadMessageId =
|
|
818
820
|
(_b = channel.state.read[((_a = this.chatClientService.chatClient.user) === null || _a === void 0 ? void 0 : _a.id) || '']) === null || _b === void 0 ? void 0 : _b.last_read_message_id;
|
|
819
|
-
if (channel.state.latestMessages[channel.state.latestMessages.length - 1]
|
|
820
|
-
.id === this.activeChannelLastReadMessageId) {
|
|
821
|
+
if (((_c = channel.state.latestMessages[channel.state.latestMessages.length - 1]) === null || _c === void 0 ? void 0 : _c.id) === this.activeChannelLastReadMessageId) {
|
|
821
822
|
this.activeChannelLastReadMessageId = undefined;
|
|
822
823
|
}
|
|
823
824
|
this.watchForActiveChannelEvents(channel);
|
|
@@ -1010,6 +1011,7 @@
|
|
|
1010
1011
|
* Resets the `activeChannel$`, `channels$` and `activeChannelMessages$` Observables. Useful when disconnecting a chat user, use in combination with [`disconnectUser`](./ChatClientService.mdx/#disconnectuser).
|
|
1011
1012
|
*/
|
|
1012
1013
|
ChannelService.prototype.reset = function () {
|
|
1014
|
+
var _this = this;
|
|
1013
1015
|
var _a, _b;
|
|
1014
1016
|
this.deselectActiveChannel();
|
|
1015
1017
|
this.channelsSubject.next(undefined);
|
|
@@ -1017,6 +1019,10 @@
|
|
|
1017
1019
|
(_a = this.clientEventsSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
1018
1020
|
(_b = this.dismissErrorNotification) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
1019
1021
|
this.dismissErrorNotification = undefined;
|
|
1022
|
+
Object.keys(this.channelSubscriptions).forEach(function (cid) {
|
|
1023
|
+
_this.channelSubscriptions[cid]();
|
|
1024
|
+
});
|
|
1025
|
+
this.channelSubscriptions = {};
|
|
1020
1026
|
};
|
|
1021
1027
|
/**
|
|
1022
1028
|
* Loads the next page of channels. The page size can be set in the [query option](https://getstream.io/chat/docs/javascript/query_channels/?language=javascript#query-options) object.
|
|
@@ -1547,7 +1553,7 @@
|
|
|
1547
1553
|
};
|
|
1548
1554
|
ChannelService.prototype.handleRemovedFromChannelNotification = function (clientEvent) {
|
|
1549
1555
|
var channelIdToBeRemoved = clientEvent.event.channel.cid;
|
|
1550
|
-
this.removeChannelsFromChannelList([channelIdToBeRemoved]);
|
|
1556
|
+
this.removeChannelsFromChannelList([channelIdToBeRemoved], true);
|
|
1551
1557
|
};
|
|
1552
1558
|
ChannelService.prototype.handleNewMessageNotification = function (clientEvent) {
|
|
1553
1559
|
if (clientEvent.event.channel) {
|
|
@@ -1587,14 +1593,20 @@
|
|
|
1587
1593
|
});
|
|
1588
1594
|
});
|
|
1589
1595
|
};
|
|
1590
|
-
ChannelService.prototype.removeChannelsFromChannelList = function (cids) {
|
|
1596
|
+
ChannelService.prototype.removeChannelsFromChannelList = function (cids, shouldStopWatching) {
|
|
1591
1597
|
var _this = this;
|
|
1592
1598
|
var _a;
|
|
1593
1599
|
var channels = this.channels.filter(function (c) { return !cids.includes(c.cid || ''); });
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1600
|
+
if (shouldStopWatching) {
|
|
1601
|
+
cids.forEach(function (cid) {
|
|
1602
|
+
var _a;
|
|
1603
|
+
if (_this.channelSubscriptions[cid]) {
|
|
1604
|
+
_this.channelSubscriptions[cid]();
|
|
1605
|
+
delete _this.channelSubscriptions.cid;
|
|
1606
|
+
}
|
|
1607
|
+
void ((_a = _this.chatClientService.chatClient.activeChannels[cid]) === null || _a === void 0 ? void 0 : _a.stopWatching());
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1598
1610
|
if (channels.length < this.channels.length) {
|
|
1599
1611
|
this.channelsSubject.next(channels);
|
|
1600
1612
|
if (cids.includes(((_a = this.activeChannelSubject.getValue()) === null || _a === void 0 ? void 0 : _a.cid) || '')) {
|
|
@@ -1816,7 +1828,7 @@
|
|
|
1816
1828
|
};
|
|
1817
1829
|
ChannelService.prototype.watchForChannelEvents = function (channel) {
|
|
1818
1830
|
var _this = this;
|
|
1819
|
-
channel.on(function (event) {
|
|
1831
|
+
var unsubscribe = channel.on(function (event) {
|
|
1820
1832
|
switch (event.type) {
|
|
1821
1833
|
case 'message.new': {
|
|
1822
1834
|
_this.ngZone.run(function () {
|
|
@@ -1886,6 +1898,7 @@
|
|
|
1886
1898
|
}
|
|
1887
1899
|
}
|
|
1888
1900
|
});
|
|
1901
|
+
this.channelSubscriptions[channel.cid] = unsubscribe.unsubscribe;
|
|
1889
1902
|
};
|
|
1890
1903
|
ChannelService.prototype.handleNewMessage = function (_, channel) {
|
|
1891
1904
|
var channelIndex = this.channels.findIndex(function (c) { return c.cid === channel.cid; });
|
|
@@ -1893,10 +1906,10 @@
|
|
|
1893
1906
|
this.channelsSubject.next(__spreadArray([channel], __read(this.channels)));
|
|
1894
1907
|
};
|
|
1895
1908
|
ChannelService.prototype.handleChannelHidden = function (event) {
|
|
1896
|
-
this.removeChannelsFromChannelList([event.channel.cid]);
|
|
1909
|
+
this.removeChannelsFromChannelList([event.channel.cid], false);
|
|
1897
1910
|
};
|
|
1898
1911
|
ChannelService.prototype.handleChannelDeleted = function (event) {
|
|
1899
|
-
this.removeChannelsFromChannelList([event.channel.cid]);
|
|
1912
|
+
this.removeChannelsFromChannelList([event.channel.cid], true);
|
|
1900
1913
|
};
|
|
1901
1914
|
ChannelService.prototype.handleChannelVisible = function (event, channel) {
|
|
1902
1915
|
var _this = this;
|