stream-chat-angular 2.6.0 → 2.6.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 +156 -141
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel-preview/channel-preview.component.js +22 -17
- package/esm2015/lib/channel.service.js +92 -83
- package/esm2015/lib/chat-client.service.js +19 -32
- package/fesm2015/stream-chat-angular.js +131 -130
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/channel-preview/channel-preview.component.d.ts +3 -2
- package/lib/channel.service.d.ts +2 -3
- package/lib/chat-client.service.d.ts +3 -4
- 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 = "2.6.
|
|
1
|
+
export declare const version = "2.6.1";
|
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
-
var version = '2.6.
|
|
356
|
+
var version = '2.6.1';
|
|
357
357
|
|
|
358
358
|
var NotificationService = /** @class */ (function () {
|
|
359
359
|
function NotificationService() {
|
|
@@ -403,9 +403,8 @@
|
|
|
403
403
|
}], ctorParameters: function () { return []; } });
|
|
404
404
|
|
|
405
405
|
var ChatClientService = /** @class */ (function () {
|
|
406
|
-
function ChatClientService(ngZone,
|
|
406
|
+
function ChatClientService(ngZone, notificationService) {
|
|
407
407
|
this.ngZone = ngZone;
|
|
408
|
-
this.appRef = appRef;
|
|
409
408
|
this.notificationService = notificationService;
|
|
410
409
|
this.notificationSubject = new rxjs.ReplaySubject(1);
|
|
411
410
|
this.connectionStateSubject = new rxjs.ReplaySubject(1);
|
|
@@ -429,6 +428,7 @@
|
|
|
429
428
|
case 1:
|
|
430
429
|
_a.sent();
|
|
431
430
|
this.chatClient.setUserAgent("stream-chat-angular-" + version + "-" + this.chatClient.getUserAgent());
|
|
431
|
+
this.chatClient.getAppSettings;
|
|
432
432
|
return [2 /*return*/];
|
|
433
433
|
}
|
|
434
434
|
});
|
|
@@ -436,39 +436,26 @@
|
|
|
436
436
|
case 1:
|
|
437
437
|
_a.sent();
|
|
438
438
|
this.appSettingsSubject.next(undefined);
|
|
439
|
-
this.chatClient.on(
|
|
439
|
+
this.chatClient.on(function (e) {
|
|
440
440
|
_this.notificationSubject.next({
|
|
441
|
-
eventType:
|
|
441
|
+
eventType: e.type,
|
|
442
442
|
event: e,
|
|
443
443
|
});
|
|
444
|
-
_this.appRef.tick();
|
|
445
|
-
});
|
|
446
|
-
this.chatClient.on('notification.message_new', function (e) {
|
|
447
|
-
_this.notificationSubject.next({
|
|
448
|
-
eventType: 'notification.message_new',
|
|
449
|
-
event: e,
|
|
450
|
-
});
|
|
451
|
-
_this.appRef.tick();
|
|
452
|
-
});
|
|
453
|
-
this.chatClient.on('notification.removed_from_channel', function (e) {
|
|
454
|
-
_this.notificationSubject.next({
|
|
455
|
-
eventType: 'notification.removed_from_channel',
|
|
456
|
-
event: e,
|
|
457
|
-
});
|
|
458
|
-
_this.appRef.tick();
|
|
459
444
|
});
|
|
460
445
|
this.chatClient.on('connection.changed', function (e) {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
if (
|
|
464
|
-
removeNotification
|
|
446
|
+
_this.ngZone.run(function () {
|
|
447
|
+
var isOnline = e.online;
|
|
448
|
+
if (isOnline) {
|
|
449
|
+
if (removeNotification) {
|
|
450
|
+
removeNotification();
|
|
451
|
+
}
|
|
465
452
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
453
|
+
else {
|
|
454
|
+
removeNotification =
|
|
455
|
+
_this.notificationService.addPermanentNotification('streamChat.Connection failure, reconnecting now...');
|
|
456
|
+
}
|
|
457
|
+
_this.connectionStateSubject.next(isOnline ? 'online' : 'offline');
|
|
458
|
+
});
|
|
472
459
|
});
|
|
473
460
|
return [2 /*return*/];
|
|
474
461
|
}
|
|
@@ -530,14 +517,14 @@
|
|
|
530
517
|
};
|
|
531
518
|
return ChatClientService;
|
|
532
519
|
}());
|
|
533
|
-
ChatClientService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChatClientService, deps: [{ token: i0__namespace.NgZone }, { token:
|
|
520
|
+
ChatClientService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChatClientService, deps: [{ token: i0__namespace.NgZone }, { token: NotificationService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
534
521
|
ChatClientService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChatClientService, providedIn: 'root' });
|
|
535
522
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChatClientService, decorators: [{
|
|
536
523
|
type: i0.Injectable,
|
|
537
524
|
args: [{
|
|
538
525
|
providedIn: 'root',
|
|
539
526
|
}]
|
|
540
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.NgZone }, { type:
|
|
527
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.NgZone }, { type: NotificationService }]; } });
|
|
541
528
|
|
|
542
529
|
var createMessagePreview = function (user, text, attachments, mentionedUsers) {
|
|
543
530
|
var clientSideId = user.id + "-" + uuid.v4();
|
|
@@ -570,10 +557,9 @@
|
|
|
570
557
|
};
|
|
571
558
|
|
|
572
559
|
var ChannelService = /** @class */ (function () {
|
|
573
|
-
function ChannelService(chatClientService,
|
|
560
|
+
function ChannelService(chatClientService, ngZone) {
|
|
574
561
|
var _this = this;
|
|
575
562
|
this.chatClientService = chatClientService;
|
|
576
|
-
this.appRef = appRef;
|
|
577
563
|
this.ngZone = ngZone;
|
|
578
564
|
this.channelsSubject = new rxjs.BehaviorSubject(undefined);
|
|
579
565
|
this.activeChannelSubject = new rxjs.BehaviorSubject(undefined);
|
|
@@ -891,55 +877,73 @@
|
|
|
891
877
|
ChannelService.prototype.handleNotification = function (notification) {
|
|
892
878
|
return __awaiter(this, void 0, void 0, function () {
|
|
893
879
|
var _e;
|
|
880
|
+
var _this = this;
|
|
894
881
|
return __generator(this, function (_f) {
|
|
895
882
|
switch (_f.label) {
|
|
896
883
|
case 0:
|
|
897
884
|
_e = notification.eventType;
|
|
898
885
|
switch (_e) {
|
|
899
886
|
case 'notification.message_new': return [3 /*break*/, 1];
|
|
900
|
-
case 'notification.added_to_channel': return [3 /*break*/,
|
|
901
|
-
case 'notification.removed_from_channel': return [3 /*break*/,
|
|
887
|
+
case 'notification.added_to_channel': return [3 /*break*/, 3];
|
|
888
|
+
case 'notification.removed_from_channel': return [3 /*break*/, 5];
|
|
902
889
|
}
|
|
903
|
-
return [3 /*break*/,
|
|
904
|
-
case 1:
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
890
|
+
return [3 /*break*/, 6];
|
|
891
|
+
case 1: return [4 /*yield*/, this.ngZone.run(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
892
|
+
return __generator(this, function (_e) {
|
|
893
|
+
switch (_e.label) {
|
|
894
|
+
case 0:
|
|
895
|
+
if (!this.customNewMessageNotificationHandler) return [3 /*break*/, 1];
|
|
896
|
+
this.customNewMessageNotificationHandler(notification, this.channelListSetter);
|
|
897
|
+
return [3 /*break*/, 3];
|
|
898
|
+
case 1: return [4 /*yield*/, this.handleNewMessageNotification(notification)];
|
|
899
|
+
case 2:
|
|
900
|
+
_e.sent();
|
|
901
|
+
_e.label = 3;
|
|
902
|
+
case 3: return [2 /*return*/];
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
}); })];
|
|
906
|
+
case 2:
|
|
910
907
|
_f.sent();
|
|
911
|
-
|
|
912
|
-
case
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
908
|
+
return [3 /*break*/, 6];
|
|
909
|
+
case 3: return [4 /*yield*/, this.ngZone.run(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
910
|
+
return __generator(this, function (_e) {
|
|
911
|
+
switch (_e.label) {
|
|
912
|
+
case 0:
|
|
913
|
+
if (!this.customAddedToChannelNotificationHandler) return [3 /*break*/, 1];
|
|
914
|
+
this.customAddedToChannelNotificationHandler(notification, this.channelListSetter);
|
|
915
|
+
return [3 /*break*/, 3];
|
|
916
|
+
case 1: return [4 /*yield*/, this.handleAddedToChannelNotification(notification)];
|
|
917
|
+
case 2:
|
|
918
|
+
_e.sent();
|
|
919
|
+
_e.label = 3;
|
|
920
|
+
case 3: return [2 /*return*/];
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
}); })];
|
|
924
|
+
case 4:
|
|
919
925
|
_f.sent();
|
|
920
|
-
|
|
921
|
-
case
|
|
922
|
-
case 9:
|
|
926
|
+
return [3 /*break*/, 6];
|
|
927
|
+
case 5:
|
|
923
928
|
{
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
929
|
+
this.ngZone.run(function () {
|
|
930
|
+
if (_this.customRemovedFromChannelNotificationHandler) {
|
|
931
|
+
_this.customRemovedFromChannelNotificationHandler(notification, _this.channelListSetter);
|
|
932
|
+
}
|
|
933
|
+
else {
|
|
934
|
+
_this.handleRemovedFromChannelNotification(notification);
|
|
935
|
+
}
|
|
936
|
+
});
|
|
930
937
|
}
|
|
931
|
-
_f.label =
|
|
932
|
-
case
|
|
938
|
+
_f.label = 6;
|
|
939
|
+
case 6: return [2 /*return*/];
|
|
933
940
|
}
|
|
934
941
|
});
|
|
935
942
|
});
|
|
936
943
|
};
|
|
937
944
|
ChannelService.prototype.handleRemovedFromChannelNotification = function (notification) {
|
|
938
|
-
var
|
|
939
|
-
this.
|
|
940
|
-
var channelIdToBeRemoved = notification.event.channel.cid;
|
|
941
|
-
_this.removeFromChannelList(channelIdToBeRemoved);
|
|
942
|
-
});
|
|
945
|
+
var channelIdToBeRemoved = notification.event.channel.cid;
|
|
946
|
+
this.removeFromChannelList(channelIdToBeRemoved);
|
|
943
947
|
};
|
|
944
948
|
ChannelService.prototype.handleNewMessageNotification = function (notification) {
|
|
945
949
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -969,7 +973,6 @@
|
|
|
969
973
|
var _a, _b;
|
|
970
974
|
return __awaiter(this, void 0, void 0, function () {
|
|
971
975
|
var channel;
|
|
972
|
-
var _this = this;
|
|
973
976
|
return __generator(this, function (_e) {
|
|
974
977
|
switch (_e.label) {
|
|
975
978
|
case 0:
|
|
@@ -978,11 +981,9 @@
|
|
|
978
981
|
case 1:
|
|
979
982
|
_e.sent();
|
|
980
983
|
this.watchForChannelEvents(channel);
|
|
981
|
-
this.
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
], __read((_this.channelsSubject.getValue() || []))));
|
|
985
|
-
});
|
|
984
|
+
this.channelsSubject.next(__spreadArray([
|
|
985
|
+
channel
|
|
986
|
+
], __read((this.channelsSubject.getValue() || []))));
|
|
986
987
|
return [2 /*return*/];
|
|
987
988
|
}
|
|
988
989
|
});
|
|
@@ -1015,15 +1016,17 @@
|
|
|
1015
1016
|
this.activeChannelSubscriptions.push(channel.on('reaction.deleted', function (e) { return _this.messageReactionEventReceived(e); }));
|
|
1016
1017
|
this.activeChannelSubscriptions.push(channel.on('reaction.updated', function (e) { return _this.messageReactionEventReceived(e); }));
|
|
1017
1018
|
this.activeChannelSubscriptions.push(channel.on('message.read', function (e) {
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1019
|
+
_this.ngZone.run(function () {
|
|
1020
|
+
var latestMessage;
|
|
1021
|
+
_this.activeChannelMessages$.pipe(operators.first()).subscribe(function (messages) {
|
|
1022
|
+
latestMessage = messages[messages.length - 1];
|
|
1023
|
+
});
|
|
1024
|
+
if (!latestMessage || !e.user) {
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
latestMessage.readBy = getReadBy(latestMessage, channel);
|
|
1028
|
+
_this.activeChannelMessagesSubject.next(_this.activeChannelMessagesSubject.getValue());
|
|
1021
1029
|
});
|
|
1022
|
-
if (!latestMessage || !e.user) {
|
|
1023
|
-
return;
|
|
1024
|
-
}
|
|
1025
|
-
latestMessage.readBy = getReadBy(latestMessage, channel);
|
|
1026
|
-
_this.activeChannelMessagesSubject.next(_this.activeChannelMessagesSubject.getValue());
|
|
1027
1030
|
}));
|
|
1028
1031
|
};
|
|
1029
1032
|
ChannelService.prototype.messageUpdated = function (event) {
|
|
@@ -1112,66 +1115,72 @@
|
|
|
1112
1115
|
channel.on(function (event) {
|
|
1113
1116
|
switch (event.type) {
|
|
1114
1117
|
case 'message.new': {
|
|
1115
|
-
|
|
1116
|
-
_this.customNewMessageHandler
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1118
|
+
_this.ngZone.run(function () {
|
|
1119
|
+
if (_this.customNewMessageHandler) {
|
|
1120
|
+
_this.customNewMessageHandler(event, channel, _this.channelListSetter, _this.messageListSetter);
|
|
1121
|
+
}
|
|
1122
|
+
else {
|
|
1123
|
+
_this.handleNewMessage(event, channel);
|
|
1124
|
+
}
|
|
1125
|
+
});
|
|
1121
1126
|
break;
|
|
1122
1127
|
}
|
|
1123
1128
|
case 'channel.hidden': {
|
|
1124
|
-
|
|
1125
|
-
_this.customChannelHiddenHandler
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1129
|
+
_this.ngZone.run(function () {
|
|
1130
|
+
if (_this.customChannelHiddenHandler) {
|
|
1131
|
+
_this.customChannelHiddenHandler(event, channel, _this.channelListSetter, _this.messageListSetter);
|
|
1132
|
+
}
|
|
1133
|
+
else {
|
|
1134
|
+
_this.handleChannelHidden(event);
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1131
1137
|
break;
|
|
1132
1138
|
}
|
|
1133
1139
|
case 'channel.deleted': {
|
|
1134
|
-
|
|
1135
|
-
_this.customChannelDeletedHandler
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1140
|
+
_this.ngZone.run(function () {
|
|
1141
|
+
if (_this.customChannelDeletedHandler) {
|
|
1142
|
+
_this.customChannelDeletedHandler(event, channel, _this.channelListSetter, _this.messageListSetter);
|
|
1143
|
+
}
|
|
1144
|
+
else {
|
|
1145
|
+
_this.handleChannelDeleted(event);
|
|
1146
|
+
}
|
|
1147
|
+
});
|
|
1141
1148
|
break;
|
|
1142
1149
|
}
|
|
1143
1150
|
case 'channel.visible': {
|
|
1144
|
-
|
|
1145
|
-
_this.customChannelVisibleHandler
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
+
_this.ngZone.run(function () {
|
|
1152
|
+
if (_this.customChannelVisibleHandler) {
|
|
1153
|
+
_this.customChannelVisibleHandler(event, channel, _this.channelListSetter, _this.messageListSetter);
|
|
1154
|
+
}
|
|
1155
|
+
else {
|
|
1156
|
+
_this.handleChannelVisible(event, channel);
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1151
1159
|
break;
|
|
1152
1160
|
}
|
|
1153
1161
|
case 'channel.updated': {
|
|
1154
|
-
|
|
1155
|
-
_this.customChannelUpdatedHandler
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1162
|
+
_this.ngZone.run(function () {
|
|
1163
|
+
if (_this.customChannelUpdatedHandler) {
|
|
1164
|
+
_this.customChannelUpdatedHandler(event, channel, _this.channelListSetter, _this.messageListSetter);
|
|
1165
|
+
}
|
|
1166
|
+
else {
|
|
1167
|
+
_this.handleChannelUpdate(event);
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1161
1170
|
break;
|
|
1162
1171
|
}
|
|
1163
1172
|
case 'channel.truncated': {
|
|
1164
|
-
|
|
1165
|
-
_this.customChannelTruncatedHandler
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1173
|
+
_this.ngZone.run(function () {
|
|
1174
|
+
if (_this.customChannelTruncatedHandler) {
|
|
1175
|
+
_this.customChannelTruncatedHandler(event, channel, _this.channelListSetter, _this.messageListSetter);
|
|
1176
|
+
}
|
|
1177
|
+
else {
|
|
1178
|
+
_this.handleChannelTruncate(event);
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1171
1181
|
break;
|
|
1172
1182
|
}
|
|
1173
1183
|
}
|
|
1174
|
-
setTimeout(function () { return _this.appRef.tick(); }, 0);
|
|
1175
1184
|
});
|
|
1176
1185
|
};
|
|
1177
1186
|
ChannelService.prototype.handleNewMessage = function (_, channel) {
|
|
@@ -1240,14 +1249,14 @@
|
|
|
1240
1249
|
});
|
|
1241
1250
|
return ChannelService;
|
|
1242
1251
|
}());
|
|
1243
|
-
ChannelService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelService, deps: [{ token: ChatClientService }, { token: i0__namespace.
|
|
1252
|
+
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 }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1244
1253
|
ChannelService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelService, providedIn: 'root' });
|
|
1245
1254
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelService, decorators: [{
|
|
1246
1255
|
type: i0.Injectable,
|
|
1247
1256
|
args: [{
|
|
1248
1257
|
providedIn: 'root',
|
|
1249
1258
|
}]
|
|
1250
|
-
}], ctorParameters: function () { return [{ type: ChatClientService }, { type: i0__namespace.
|
|
1259
|
+
}], ctorParameters: function () { return [{ type: ChatClientService }, { type: i0__namespace.NgZone }]; } });
|
|
1251
1260
|
|
|
1252
1261
|
var ThemeService = /** @class */ (function () {
|
|
1253
1262
|
function ThemeService() {
|
|
@@ -2588,8 +2597,9 @@
|
|
|
2588
2597
|
}], ctorParameters: function () { return [{ type: ChannelService }, { type: ChannelListToggleService }]; } });
|
|
2589
2598
|
|
|
2590
2599
|
var ChannelPreviewComponent = /** @class */ (function () {
|
|
2591
|
-
function ChannelPreviewComponent(channelService) {
|
|
2600
|
+
function ChannelPreviewComponent(channelService, ngZone) {
|
|
2592
2601
|
this.channelService = channelService;
|
|
2602
|
+
this.ngZone = ngZone;
|
|
2593
2603
|
this.isActive = false;
|
|
2594
2604
|
this.isUnread = false;
|
|
2595
2605
|
this.latestMessage = 'Nothing yet...';
|
|
@@ -2611,8 +2621,10 @@
|
|
|
2611
2621
|
this.subscriptions.push(this.channel.on('message.updated', this.handleMessageEvent.bind(this)));
|
|
2612
2622
|
this.subscriptions.push(this.channel.on('message.deleted', this.handleMessageEvent.bind(this)));
|
|
2613
2623
|
this.subscriptions.push(this.channel.on('channel.truncated', this.handleMessageEvent.bind(this)));
|
|
2614
|
-
this.subscriptions.push(this.channel.on('message.read', function () { return
|
|
2615
|
-
|
|
2624
|
+
this.subscriptions.push(this.channel.on('message.read', function () { return _this.ngZone.run(function () {
|
|
2625
|
+
_this.isUnread =
|
|
2626
|
+
!!_this.channel.countUnread() && _this.canSendReadEvents;
|
|
2627
|
+
}); }));
|
|
2616
2628
|
};
|
|
2617
2629
|
ChannelPreviewComponent.prototype.ngOnDestroy = function () {
|
|
2618
2630
|
this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
|
|
@@ -2645,17 +2657,20 @@
|
|
|
2645
2657
|
void this.channelService.setAsActiveChannel(this.channel);
|
|
2646
2658
|
};
|
|
2647
2659
|
ChannelPreviewComponent.prototype.handleMessageEvent = function (event) {
|
|
2648
|
-
var
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2660
|
+
var _this = this;
|
|
2661
|
+
this.ngZone.run(function () {
|
|
2662
|
+
var _a, _b, _c;
|
|
2663
|
+
if (((_a = _this.channel) === null || _a === void 0 ? void 0 : _a.state.messages.length) === 0) {
|
|
2664
|
+
_this.latestMessage = 'Nothing yet...';
|
|
2665
|
+
return;
|
|
2666
|
+
}
|
|
2667
|
+
if (!event.message ||
|
|
2668
|
+
((_b = _this.channel) === null || _b === void 0 ? void 0 : _b.state.messages[((_c = _this.channel) === null || _c === void 0 ? void 0 : _c.state.messages.length) - 1].id) !== event.message.id) {
|
|
2669
|
+
return;
|
|
2670
|
+
}
|
|
2671
|
+
_this.setLatestMessage(event.message);
|
|
2672
|
+
_this.isUnread = !!_this.channel.countUnread() && _this.canSendReadEvents;
|
|
2673
|
+
});
|
|
2659
2674
|
};
|
|
2660
2675
|
ChannelPreviewComponent.prototype.setLatestMessage = function (message) {
|
|
2661
2676
|
if (message === null || message === void 0 ? void 0 : message.deleted_at) {
|
|
@@ -2670,7 +2685,7 @@
|
|
|
2670
2685
|
};
|
|
2671
2686
|
return ChannelPreviewComponent;
|
|
2672
2687
|
}());
|
|
2673
|
-
ChannelPreviewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelPreviewComponent, deps: [{ token: ChannelService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2688
|
+
ChannelPreviewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelPreviewComponent, deps: [{ token: ChannelService }, { token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
2674
2689
|
ChannelPreviewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: ChannelPreviewComponent, selector: "stream-channel-preview", inputs: { channel: "channel" }, ngImport: i0__namespace, template: "<button\n class=\"str-chat__channel-preview-messenger\"\n [class.str-chat__channel-preview-messenger--active]=\"isActive\"\n [class.str-chat__channel-preview-messenger--unread]=\"isUnread\"\n (click)=\"setAsActiveChannel()\"\n data-testid=\"channel-preview-container\"\n>\n <div class=\"str-chat__channel-preview-messenger--left\">\n <stream-avatar\n imageUrl=\"{{ avatarImage }}\"\n name=\"{{ avatarName }}\"\n [size]=\"40\"\n ></stream-avatar>\n </div>\n <div class=\"str-chat__channel-preview-messenger--right\">\n <div class=\"str-chat__channel-preview-messenger--name\">\n <span data-testid=\"channel-preview-title\">{{ title }}</span>\n </div>\n <div\n data-testid=\"latest-message\"\n class=\"str-chat__channel-preview-messenger--last-message\"\n >\n {{ latestMessage | translate }}\n </div>\n </div>\n</button>\n", components: [{ type: AvatarComponent, selector: "stream-avatar", inputs: ["name", "imageUrl", "size"] }], pipes: { "translate": i10__namespace.TranslatePipe } });
|
|
2675
2690
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0__namespace, type: ChannelPreviewComponent, decorators: [{
|
|
2676
2691
|
type: i0.Component,
|
|
@@ -2679,7 +2694,7 @@
|
|
|
2679
2694
|
templateUrl: './channel-preview.component.html',
|
|
2680
2695
|
styles: [],
|
|
2681
2696
|
}]
|
|
2682
|
-
}], ctorParameters: function () { return [{ type: ChannelService }]; }, propDecorators: { channel: [{
|
|
2697
|
+
}], ctorParameters: function () { return [{ type: ChannelService }, { type: i0__namespace.NgZone }]; }, propDecorators: { channel: [{
|
|
2683
2698
|
type: i0.Input
|
|
2684
2699
|
}] } });
|
|
2685
2700
|
|