stream-chat-angular 4.33.0 → 4.34.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 +28 -7
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel.service.js +4 -1
- package/esm2015/lib/message-list/message-list.component.js +25 -7
- package/fesm2015/stream-chat-angular.js +28 -7
- package/fesm2015/stream-chat-angular.js.map +1 -1
- 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.
|
|
1
|
+
export declare const version = "4.34.1";
|
|
@@ -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.
|
|
359
|
+
var version = '4.34.1';
|
|
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.
|
|
@@ -808,6 +808,9 @@
|
|
|
808
808
|
ChannelService.prototype.setAsActiveChannel = function (channel) {
|
|
809
809
|
var _this = this;
|
|
810
810
|
var prevActiveChannel = this.activeChannelSubject.getValue();
|
|
811
|
+
if ((prevActiveChannel === null || prevActiveChannel === void 0 ? void 0 : prevActiveChannel.cid) === channel.cid) {
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
811
814
|
this.stopWatchForActiveChannelEvents(prevActiveChannel);
|
|
812
815
|
this.watchForActiveChannelEvents(channel);
|
|
813
816
|
this.addChannel(channel);
|
|
@@ -6090,14 +6093,16 @@
|
|
|
6090
6093
|
this.subscriptions = [];
|
|
6091
6094
|
this.isLatestMessageInList = true;
|
|
6092
6095
|
this.subscriptions.push(this.channelService.activeChannel$.subscribe(function (channel) {
|
|
6093
|
-
var _a, _b, _c, _d;
|
|
6096
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6097
|
+
(_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 });
|
|
6094
6098
|
if (_this.channelId !== (channel === null || channel === void 0 ? void 0 : channel.id)) {
|
|
6099
|
+
(_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 });
|
|
6095
6100
|
_this.resetScrollState();
|
|
6096
6101
|
_this.channelId = channel === null || channel === void 0 ? void 0 : channel.id;
|
|
6097
6102
|
if (_this.openMessageListAt === 'last-unread-message' &&
|
|
6098
6103
|
_this.mode === 'main') {
|
|
6099
6104
|
_this.lastReadMessageId =
|
|
6100
|
-
(
|
|
6105
|
+
(_g = channel === null || channel === void 0 ? void 0 : channel.state.read[((_f = _this.chatClientService.chatClient.user) === null || _f === void 0 ? void 0 : _f.id) || '']) === null || _g === void 0 ? void 0 : _g.last_read_message_id;
|
|
6101
6106
|
if (_this.lastReadMessageId) {
|
|
6102
6107
|
_this.isJumpingToLatestUnreadMessage = true;
|
|
6103
6108
|
void _this.channelService.jumpToMessage(_this.lastReadMessageId);
|
|
@@ -6107,11 +6112,11 @@
|
|
|
6107
6112
|
_this.lastReadMessageId = undefined;
|
|
6108
6113
|
}
|
|
6109
6114
|
}
|
|
6110
|
-
var capabilites = (
|
|
6115
|
+
var capabilites = (_h = channel === null || channel === void 0 ? void 0 : channel.data) === null || _h === void 0 ? void 0 : _h.own_capabilities;
|
|
6111
6116
|
if (capabilites) {
|
|
6112
6117
|
_this.enabledMessageActions = capabilites;
|
|
6113
6118
|
}
|
|
6114
|
-
(
|
|
6119
|
+
(_j = _this.newMessageSubscription) === null || _j === void 0 ? void 0 : _j.unsubscribe();
|
|
6115
6120
|
if (channel) {
|
|
6116
6121
|
_this.newMessageSubscription = channel.on('message.new', function (event) {
|
|
6117
6122
|
// 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
|
|
@@ -6163,6 +6168,7 @@
|
|
|
6163
6168
|
this.subscriptions.push(this.channelService.jumpToMessage$
|
|
6164
6169
|
.pipe(operators.filter(function (config) { return !!config.id; }))
|
|
6165
6170
|
.subscribe(function (config) {
|
|
6171
|
+
var _a, _b;
|
|
6166
6172
|
var messageId = undefined;
|
|
6167
6173
|
if (_this.mode === 'main') {
|
|
6168
6174
|
messageId = config.parentId || config.id;
|
|
@@ -6170,6 +6176,7 @@
|
|
|
6170
6176
|
else if (config.parentId) {
|
|
6171
6177
|
messageId = config.id;
|
|
6172
6178
|
}
|
|
6179
|
+
(_b = (_a = _this.chatClientService.chatClient) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.call(_a, 'info', "Jumping to " + (messageId || ''), { tags: "message list " + _this.mode });
|
|
6173
6180
|
if (messageId) {
|
|
6174
6181
|
if (messageId === 'latest') {
|
|
6175
6182
|
_this.scrollToLatestMessage();
|
|
@@ -6182,6 +6189,7 @@
|
|
|
6182
6189
|
}));
|
|
6183
6190
|
};
|
|
6184
6191
|
MessageListComponent.prototype.ngAfterViewChecked = function () {
|
|
6192
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6185
6193
|
if (this.highlightedMessageId) {
|
|
6186
6194
|
// Turn off programatic scroll adjustments while jump to message is in progress
|
|
6187
6195
|
this.hasNewMessages = false;
|
|
@@ -6200,6 +6208,7 @@
|
|
|
6200
6208
|
else {
|
|
6201
6209
|
if (this.hasNewMessages) {
|
|
6202
6210
|
if (!this.isUserScrolled || this.isNewMessageSentByUser) {
|
|
6211
|
+
(_b = (_a = this.chatClientService.chatClient) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.call(_a, 'info', "User has new messages, and not scrolled or sent new messages, therefore we " + (this.isLatestMessageInList ? 'scroll' : 'jump') + " to latest message", { tags: "message list " + this.mode });
|
|
6203
6212
|
this.isLatestMessageInList
|
|
6204
6213
|
? this.scrollToBottom()
|
|
6205
6214
|
: this.jumpToLatestMessage();
|
|
@@ -6208,6 +6217,7 @@
|
|
|
6208
6217
|
this.containerHeight = this.scrollContainer.nativeElement.scrollHeight;
|
|
6209
6218
|
}
|
|
6210
6219
|
else if (this.olderMassagesLoaded) {
|
|
6220
|
+
(_d = (_c = this.chatClientService.chatClient) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.call(_c, 'info', "Older messages are loaded, we preserve the scroll position", { tags: "message list " + this.mode });
|
|
6211
6221
|
this.preserveScrollbarPosition();
|
|
6212
6222
|
this.containerHeight = this.scrollContainer.nativeElement.scrollHeight;
|
|
6213
6223
|
this.olderMassagesLoaded = false;
|
|
@@ -6215,6 +6225,7 @@
|
|
|
6215
6225
|
else if (this.getScrollPosition() !== 'bottom' &&
|
|
6216
6226
|
!this.isUserScrolled &&
|
|
6217
6227
|
!this.highlightedMessageId) {
|
|
6228
|
+
(_f = (_e = this.chatClientService.chatClient) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.call(_e, 'info', "Container grew and user didn't scroll therefore we " + (this.isLatestMessageInList ? 'scroll' : 'jump') + " to latest message", { tags: "message list " + this.mode });
|
|
6218
6229
|
this.isLatestMessageInList
|
|
6219
6230
|
? this.scrollToBottom()
|
|
6220
6231
|
: this.jumpToLatestMessage();
|
|
@@ -6249,6 +6260,7 @@
|
|
|
6249
6260
|
};
|
|
6250
6261
|
MessageListComponent.prototype.scrolled = function () {
|
|
6251
6262
|
var _this = this;
|
|
6263
|
+
var _a, _b;
|
|
6252
6264
|
this.isScrollInProgress = true;
|
|
6253
6265
|
if (this.scrollEndTimeout) {
|
|
6254
6266
|
clearTimeout(this.scrollEndTimeout);
|
|
@@ -6261,6 +6273,7 @@
|
|
|
6261
6273
|
return;
|
|
6262
6274
|
}
|
|
6263
6275
|
var scrollPosition = this.getScrollPosition();
|
|
6276
|
+
(_b = (_a = this.chatClientService.chatClient) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.call(_a, 'info', "Scrolled - scroll position: " + scrollPosition, { tags: "message list " + this.mode });
|
|
6264
6277
|
this.isUserScrolled =
|
|
6265
6278
|
(this.direction === 'bottom-to-top'
|
|
6266
6279
|
? scrollPosition !== 'bottom'
|
|
@@ -6355,11 +6368,18 @@
|
|
|
6355
6368
|
this.messages$ = (this.mode === 'main'
|
|
6356
6369
|
? this.channelService.activeChannelMessages$
|
|
6357
6370
|
: this.channelService.activeThreadMessages$).pipe(operators.tap(function (messages) {
|
|
6371
|
+
var _a, _b, _c, _d;
|
|
6358
6372
|
_this.isLoading = false;
|
|
6359
6373
|
if (messages.length === 0) {
|
|
6374
|
+
(_b = (_a = _this.chatClientService.chatClient) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.call(_a, 'info', "Empty messages array, reseting scroll state", {
|
|
6375
|
+
tags: "message list " + _this.mode,
|
|
6376
|
+
});
|
|
6360
6377
|
_this.resetScrollState();
|
|
6361
6378
|
return;
|
|
6362
6379
|
}
|
|
6380
|
+
(_d = (_c = _this.chatClientService.chatClient) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.call(_c, 'info', "Received one or more messages", {
|
|
6381
|
+
tags: "message list " + _this.mode,
|
|
6382
|
+
});
|
|
6363
6383
|
var currentLatestMessage = messages[messages.length - 1];
|
|
6364
6384
|
_this.newMessageReceived(currentLatestMessage);
|
|
6365
6385
|
var currentOldestMessage = messages[0];
|
|
@@ -6450,13 +6470,14 @@
|
|
|
6450
6470
|
}
|
|
6451
6471
|
};
|
|
6452
6472
|
MessageListComponent.prototype.newMessageReceived = function (message) {
|
|
6453
|
-
var _a, _b, _c, _d;
|
|
6473
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6454
6474
|
if (!this.latestMessage ||
|
|
6455
6475
|
((_a = this.latestMessage.created_at) === null || _a === void 0 ? void 0 : _a.getTime()) < message.created_at.getTime()) {
|
|
6476
|
+
(_c = (_b = this.chatClientService.chatClient) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.call(_b, 'info', "Received new message", { tags: "message list " + this.mode });
|
|
6456
6477
|
this.latestMessage = message;
|
|
6457
6478
|
this.hasNewMessages = true;
|
|
6458
6479
|
this.isNewMessageSentByUser =
|
|
6459
|
-
((
|
|
6480
|
+
((_d = message.user) === null || _d === void 0 ? void 0 : _d.id) === ((_f = (_e = this.chatClientService.chatClient) === null || _e === void 0 ? void 0 : _e.user) === null || _f === void 0 ? void 0 : _f.id);
|
|
6460
6481
|
if (this.isUserScrolled) {
|
|
6461
6482
|
this.unreadMessageCount++;
|
|
6462
6483
|
}
|