stream-chat-angular 3.2.2 → 3.4.0
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 +37 -5
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel.service.js +33 -5
- package/fesm2015/stream-chat-angular.js +33 -5
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/channel.service.d.ts +11 -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 = "3.
|
|
1
|
+
export declare const version = "3.4.0";
|
|
@@ -354,7 +354,7 @@
|
|
|
354
354
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
355
355
|
}
|
|
356
356
|
|
|
357
|
-
var version = '3.
|
|
357
|
+
var version = '3.4.0';
|
|
358
358
|
|
|
359
359
|
/**
|
|
360
360
|
* The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
|
|
@@ -671,6 +671,7 @@
|
|
|
671
671
|
this.messageToQuoteSubject = new rxjs.BehaviorSubject(undefined);
|
|
672
672
|
this.usersTypingInChannelSubject = new rxjs.BehaviorSubject([]);
|
|
673
673
|
this.usersTypingInThreadSubject = new rxjs.BehaviorSubject([]);
|
|
674
|
+
this._shouldMarkActiveChannelAsRead = true;
|
|
674
675
|
this.channelListSetter = function (channels) {
|
|
675
676
|
var currentChannels = _this.channelsSubject.getValue() || [];
|
|
676
677
|
var newChannels = channels.filter(function (c) { return !currentChannels.find(function (channel) { return channel.cid === c.cid; }); });
|
|
@@ -727,6 +728,26 @@
|
|
|
727
728
|
this.latestMessageDateByUserByChannels$ =
|
|
728
729
|
this.latestMessageDateByUserByChannelsSubject.asObservable();
|
|
729
730
|
}
|
|
731
|
+
Object.defineProperty(ChannelService.prototype, "shouldMarkActiveChannelAsRead", {
|
|
732
|
+
/**
|
|
733
|
+
* 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.
|
|
734
|
+
*/
|
|
735
|
+
get: function () {
|
|
736
|
+
return this._shouldMarkActiveChannelAsRead;
|
|
737
|
+
},
|
|
738
|
+
/**
|
|
739
|
+
* 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.
|
|
740
|
+
*/
|
|
741
|
+
set: function (shouldMarkActiveChannelAsRead) {
|
|
742
|
+
var _a;
|
|
743
|
+
if (!this._shouldMarkActiveChannelAsRead && shouldMarkActiveChannelAsRead) {
|
|
744
|
+
(_a = this.activeChannelSubject.getValue()) === null || _a === void 0 ? void 0 : _a.markRead();
|
|
745
|
+
}
|
|
746
|
+
this._shouldMarkActiveChannelAsRead = shouldMarkActiveChannelAsRead;
|
|
747
|
+
},
|
|
748
|
+
enumerable: false,
|
|
749
|
+
configurable: true
|
|
750
|
+
});
|
|
730
751
|
/**
|
|
731
752
|
* Sets the given `channel` as active and marks it as read.
|
|
732
753
|
* @param channel
|
|
@@ -739,7 +760,7 @@
|
|
|
739
760
|
channel.state.messages.forEach(function (m) {
|
|
740
761
|
m.readBy = getReadBy(m, channel);
|
|
741
762
|
});
|
|
742
|
-
if (this.canSendReadEvents) {
|
|
763
|
+
if (this.canSendReadEvents && this.shouldMarkActiveChannelAsRead) {
|
|
743
764
|
void channel.markRead();
|
|
744
765
|
}
|
|
745
766
|
this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
|
|
@@ -755,6 +776,7 @@
|
|
|
755
776
|
if (!activeChannel) {
|
|
756
777
|
return;
|
|
757
778
|
}
|
|
779
|
+
this.stopWatchForActiveChannelEvents(activeChannel);
|
|
758
780
|
this.activeChannelMessagesSubject.next([]);
|
|
759
781
|
this.activeChannelSubject.next(undefined);
|
|
760
782
|
this.activeParentMessageIdSubject.next(undefined);
|
|
@@ -878,10 +900,11 @@
|
|
|
878
900
|
message_limit: this.messagePageSize,
|
|
879
901
|
};
|
|
880
902
|
this.sort = sort || { last_message_at: -1, updated_at: -1 };
|
|
881
|
-
|
|
903
|
+
this.shouldSetActiveChannel = shouldSetActiveChannel;
|
|
904
|
+
return [4 /*yield*/, this.queryChannels(this.shouldSetActiveChannel)];
|
|
882
905
|
case 1:
|
|
883
906
|
result = _h.sent();
|
|
884
|
-
this.chatClientService.events$.subscribe(function (notification) { return void _this.handleNotification(notification); });
|
|
907
|
+
this.clientEventsSubscription = this.chatClientService.events$.subscribe(function (notification) { return void _this.handleNotification(notification); });
|
|
885
908
|
return [2 /*return*/, result];
|
|
886
909
|
}
|
|
887
910
|
});
|
|
@@ -891,8 +914,10 @@
|
|
|
891
914
|
* Resets the `activeChannel$`, `channels$` and `activeChannelMessages$` Observables. Useful when disconnecting a chat user, use in combination with [`disconnectUser`](./ChatClientService.mdx/#disconnectuser).
|
|
892
915
|
*/
|
|
893
916
|
ChannelService.prototype.reset = function () {
|
|
917
|
+
var _a;
|
|
894
918
|
this.deselectActiveChannel();
|
|
895
919
|
this.channelsSubject.next(undefined);
|
|
920
|
+
(_a = this.clientEventsSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
896
921
|
};
|
|
897
922
|
/**
|
|
898
923
|
* 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.
|
|
@@ -1225,6 +1250,13 @@
|
|
|
1225
1250
|
ChannelService.prototype.handleNotification = function (clientEvent) {
|
|
1226
1251
|
var _this = this;
|
|
1227
1252
|
switch (clientEvent.eventType) {
|
|
1253
|
+
case 'connection.recovered': {
|
|
1254
|
+
this.ngZone.run(function () {
|
|
1255
|
+
_this.reset();
|
|
1256
|
+
void _this.init(_this.filters, _this.sort, _this.options, _this.shouldSetActiveChannel);
|
|
1257
|
+
});
|
|
1258
|
+
break;
|
|
1259
|
+
}
|
|
1228
1260
|
case 'notification.message_new': {
|
|
1229
1261
|
this.ngZone.run(function () {
|
|
1230
1262
|
if (_this.customNewMessageNotificationHandler) {
|
|
@@ -1307,7 +1339,7 @@
|
|
|
1307
1339
|
? _this.activeThreadMessagesSubject.next(__spreadArray([], __read(channel.state.threads[event.message.parent_id])))
|
|
1308
1340
|
: _this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
|
|
1309
1341
|
_this.activeChannel$.pipe(operators.first()).subscribe(function (c) {
|
|
1310
|
-
if (_this.canSendReadEvents) {
|
|
1342
|
+
if (_this.canSendReadEvents && _this.shouldMarkActiveChannelAsRead) {
|
|
1311
1343
|
void (c === null || c === void 0 ? void 0 : c.markRead());
|
|
1312
1344
|
}
|
|
1313
1345
|
});
|