stream-chat-angular 4.39.2 → 4.39.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/bundles/stream-chat-angular.umd.js +25 -16
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel.service.js +21 -8
- package/esm2015/lib/message-list/message-list.component.js +5 -9
- package/fesm2015/stream-chat-angular.js +25 -16
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/channel.service.d.ts +17 -0
- 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.3";
|
|
@@ -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.3';
|
|
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.
|
|
@@ -790,9 +790,11 @@
|
|
|
790
790
|
* If set to false, read events won't be sent as new messages are received. If set to true active channel (if any) will immediately be marked as read.
|
|
791
791
|
*/
|
|
792
792
|
set: function (shouldMarkActiveChannelAsRead) {
|
|
793
|
-
var _a;
|
|
794
793
|
if (!this._shouldMarkActiveChannelAsRead && shouldMarkActiveChannelAsRead) {
|
|
795
|
-
|
|
794
|
+
var activeChannel = this.activeChannelSubject.getValue();
|
|
795
|
+
if (activeChannel && this.canSendReadEvents) {
|
|
796
|
+
void activeChannel.markRead();
|
|
797
|
+
}
|
|
796
798
|
}
|
|
797
799
|
this._shouldMarkActiveChannelAsRead = shouldMarkActiveChannelAsRead;
|
|
798
800
|
},
|
|
@@ -806,11 +808,18 @@
|
|
|
806
808
|
* @param channel
|
|
807
809
|
*/
|
|
808
810
|
ChannelService.prototype.setAsActiveChannel = function (channel) {
|
|
811
|
+
var _a, _b;
|
|
809
812
|
var prevActiveChannel = this.activeChannelSubject.getValue();
|
|
810
813
|
if ((prevActiveChannel === null || prevActiveChannel === void 0 ? void 0 : prevActiveChannel.cid) === channel.cid) {
|
|
811
814
|
return;
|
|
812
815
|
}
|
|
813
816
|
this.stopWatchForActiveChannelEvents(prevActiveChannel);
|
|
817
|
+
this.activeChannelLastReadMessageId =
|
|
818
|
+
(_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
|
+
this.activeChannelLastReadMessageId = undefined;
|
|
822
|
+
}
|
|
814
823
|
this.watchForActiveChannelEvents(channel);
|
|
815
824
|
this.addChannel(channel);
|
|
816
825
|
this.activeChannelSubject.next(channel);
|
|
@@ -835,6 +844,7 @@
|
|
|
835
844
|
this.activeChannelPinnedMessagesSubject.next([]);
|
|
836
845
|
this.usersTypingInChannelSubject.next([]);
|
|
837
846
|
this.usersTypingInThreadSubject.next([]);
|
|
847
|
+
this.activeChannelLastReadMessageId = undefined;
|
|
838
848
|
};
|
|
839
849
|
/**
|
|
840
850
|
* Sets the given `message` as an active parent message. If `undefined` is provided, it will deleselect the current parent message.
|
|
@@ -1608,8 +1618,8 @@
|
|
|
1608
1618
|
: null
|
|
1609
1619
|
: _this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
|
|
1610
1620
|
_this.activeChannel$.pipe(operators.first()).subscribe(function (c) {
|
|
1611
|
-
if (
|
|
1612
|
-
|
|
1621
|
+
if (c) {
|
|
1622
|
+
_this.markRead(c);
|
|
1613
1623
|
}
|
|
1614
1624
|
});
|
|
1615
1625
|
_this.updateLatestMessages(event);
|
|
@@ -2041,9 +2051,7 @@
|
|
|
2041
2051
|
m.quoted_message.translation = getMessageTranslation(m.quoted_message, channel, _this.chatClientService.chatClient.user);
|
|
2042
2052
|
}
|
|
2043
2053
|
});
|
|
2044
|
-
|
|
2045
|
-
void channel.markRead();
|
|
2046
|
-
}
|
|
2054
|
+
this.markRead(channel);
|
|
2047
2055
|
this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
|
|
2048
2056
|
this.activeChannelPinnedMessagesSubject.next(__spreadArray([], __read(channel.state.pinnedMessages)));
|
|
2049
2057
|
this.activeParentMessageIdSubject.next(undefined);
|
|
@@ -2052,6 +2060,11 @@
|
|
|
2052
2060
|
this.usersTypingInChannelSubject.next([]);
|
|
2053
2061
|
this.usersTypingInThreadSubject.next([]);
|
|
2054
2062
|
};
|
|
2063
|
+
ChannelService.prototype.markRead = function (channel) {
|
|
2064
|
+
if (this.canSendReadEvents && this.shouldMarkActiveChannelAsRead) {
|
|
2065
|
+
void channel.markRead();
|
|
2066
|
+
}
|
|
2067
|
+
};
|
|
2055
2068
|
return ChannelService;
|
|
2056
2069
|
}());
|
|
2057
2070
|
ChannelService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelService, deps: [{ token: ChatClientService }, { token: i0__namespace.NgZone }, { token: NotificationService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -6120,7 +6133,7 @@
|
|
|
6120
6133
|
this.subscriptions = [];
|
|
6121
6134
|
this.isLatestMessageInList = true;
|
|
6122
6135
|
this.subscriptions.push(this.channelService.activeChannel$.subscribe(function (channel) {
|
|
6123
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
6136
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6124
6137
|
(_b = (_a = _this.chatClientService.chatClient) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.call(_a, 'info', ((channel === null || channel === void 0 ? void 0 : channel.cid) || 'undefined') + " selected", { tags: "message list " + _this.mode });
|
|
6125
6138
|
if (_this.channelId !== (channel === null || channel === void 0 ? void 0 : channel.id)) {
|
|
6126
6139
|
(_e = (_d = (_c = _this.chatClientService) === null || _c === void 0 ? void 0 : _c.chatClient) === null || _d === void 0 ? void 0 : _d.logger) === null || _e === void 0 ? void 0 : _e.call(_d, 'info', "new channel is different from prev channel, reseting scroll state", { tags: "message list " + _this.mode });
|
|
@@ -6129,11 +6142,7 @@
|
|
|
6129
6142
|
if (_this.openMessageListAt === 'last-read-message' &&
|
|
6130
6143
|
_this.mode === 'main') {
|
|
6131
6144
|
_this.lastReadMessageId =
|
|
6132
|
-
|
|
6133
|
-
if (channel &&
|
|
6134
|
-
channel.state.latestMessages[channel.state.latestMessages.length - 1].id === _this.lastReadMessageId) {
|
|
6135
|
-
_this.lastReadMessageId = undefined;
|
|
6136
|
-
}
|
|
6145
|
+
_this.channelService.activeChannelLastReadMessageId;
|
|
6137
6146
|
if (_this.lastReadMessageId) {
|
|
6138
6147
|
_this.isJumpingToLatestUnreadMessage = true;
|
|
6139
6148
|
void _this.channelService.jumpToMessage(_this.lastReadMessageId);
|
|
@@ -6143,11 +6152,11 @@
|
|
|
6143
6152
|
_this.lastReadMessageId = undefined;
|
|
6144
6153
|
}
|
|
6145
6154
|
}
|
|
6146
|
-
var capabilites = (
|
|
6155
|
+
var capabilites = (_f = channel === null || channel === void 0 ? void 0 : channel.data) === null || _f === void 0 ? void 0 : _f.own_capabilities;
|
|
6147
6156
|
if (capabilites) {
|
|
6148
6157
|
_this.enabledMessageActions = capabilites;
|
|
6149
6158
|
}
|
|
6150
|
-
(
|
|
6159
|
+
(_g = _this.newMessageSubscription) === null || _g === void 0 ? void 0 : _g.unsubscribe();
|
|
6151
6160
|
if (channel) {
|
|
6152
6161
|
_this.newMessageSubscription = channel.on('message.new', function (event) {
|
|
6153
6162
|
// If we display main channel messages and we're switched to an older message set -> use message.new event to update unread count and detect new messages sent by current user
|