stream-chat-angular 4.39.5 → 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 +26 -12
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel.service.js +24 -12
- package/fesm2015/stream-chat-angular.js +24 -12
- 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);
|
|
@@ -1009,6 +1011,7 @@
|
|
|
1009
1011
|
* Resets the `activeChannel$`, `channels$` and `activeChannelMessages$` Observables. Useful when disconnecting a chat user, use in combination with [`disconnectUser`](./ChatClientService.mdx/#disconnectuser).
|
|
1010
1012
|
*/
|
|
1011
1013
|
ChannelService.prototype.reset = function () {
|
|
1014
|
+
var _this = this;
|
|
1012
1015
|
var _a, _b;
|
|
1013
1016
|
this.deselectActiveChannel();
|
|
1014
1017
|
this.channelsSubject.next(undefined);
|
|
@@ -1016,6 +1019,10 @@
|
|
|
1016
1019
|
(_a = this.clientEventsSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
1017
1020
|
(_b = this.dismissErrorNotification) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
1018
1021
|
this.dismissErrorNotification = undefined;
|
|
1022
|
+
Object.keys(this.channelSubscriptions).forEach(function (cid) {
|
|
1023
|
+
_this.channelSubscriptions[cid]();
|
|
1024
|
+
});
|
|
1025
|
+
this.channelSubscriptions = {};
|
|
1019
1026
|
};
|
|
1020
1027
|
/**
|
|
1021
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.
|
|
@@ -1546,7 +1553,7 @@
|
|
|
1546
1553
|
};
|
|
1547
1554
|
ChannelService.prototype.handleRemovedFromChannelNotification = function (clientEvent) {
|
|
1548
1555
|
var channelIdToBeRemoved = clientEvent.event.channel.cid;
|
|
1549
|
-
this.removeChannelsFromChannelList([channelIdToBeRemoved]);
|
|
1556
|
+
this.removeChannelsFromChannelList([channelIdToBeRemoved], true);
|
|
1550
1557
|
};
|
|
1551
1558
|
ChannelService.prototype.handleNewMessageNotification = function (clientEvent) {
|
|
1552
1559
|
if (clientEvent.event.channel) {
|
|
@@ -1586,14 +1593,20 @@
|
|
|
1586
1593
|
});
|
|
1587
1594
|
});
|
|
1588
1595
|
};
|
|
1589
|
-
ChannelService.prototype.removeChannelsFromChannelList = function (cids) {
|
|
1596
|
+
ChannelService.prototype.removeChannelsFromChannelList = function (cids, shouldStopWatching) {
|
|
1590
1597
|
var _this = this;
|
|
1591
1598
|
var _a;
|
|
1592
1599
|
var channels = this.channels.filter(function (c) { return !cids.includes(c.cid || ''); });
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
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
|
+
}
|
|
1597
1610
|
if (channels.length < this.channels.length) {
|
|
1598
1611
|
this.channelsSubject.next(channels);
|
|
1599
1612
|
if (cids.includes(((_a = this.activeChannelSubject.getValue()) === null || _a === void 0 ? void 0 : _a.cid) || '')) {
|
|
@@ -1815,7 +1828,7 @@
|
|
|
1815
1828
|
};
|
|
1816
1829
|
ChannelService.prototype.watchForChannelEvents = function (channel) {
|
|
1817
1830
|
var _this = this;
|
|
1818
|
-
channel.on(function (event) {
|
|
1831
|
+
var unsubscribe = channel.on(function (event) {
|
|
1819
1832
|
switch (event.type) {
|
|
1820
1833
|
case 'message.new': {
|
|
1821
1834
|
_this.ngZone.run(function () {
|
|
@@ -1885,6 +1898,7 @@
|
|
|
1885
1898
|
}
|
|
1886
1899
|
}
|
|
1887
1900
|
});
|
|
1901
|
+
this.channelSubscriptions[channel.cid] = unsubscribe.unsubscribe;
|
|
1888
1902
|
};
|
|
1889
1903
|
ChannelService.prototype.handleNewMessage = function (_, channel) {
|
|
1890
1904
|
var channelIndex = this.channels.findIndex(function (c) { return c.cid === channel.cid; });
|
|
@@ -1892,10 +1906,10 @@
|
|
|
1892
1906
|
this.channelsSubject.next(__spreadArray([channel], __read(this.channels)));
|
|
1893
1907
|
};
|
|
1894
1908
|
ChannelService.prototype.handleChannelHidden = function (event) {
|
|
1895
|
-
this.removeChannelsFromChannelList([event.channel.cid]);
|
|
1909
|
+
this.removeChannelsFromChannelList([event.channel.cid], false);
|
|
1896
1910
|
};
|
|
1897
1911
|
ChannelService.prototype.handleChannelDeleted = function (event) {
|
|
1898
|
-
this.removeChannelsFromChannelList([event.channel.cid]);
|
|
1912
|
+
this.removeChannelsFromChannelList([event.channel.cid], true);
|
|
1899
1913
|
};
|
|
1900
1914
|
ChannelService.prototype.handleChannelVisible = function (event, channel) {
|
|
1901
1915
|
var _this = this;
|