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.
@@ -6,9 +6,8 @@ import { version } from '../assets/version';
6
6
  import * as i0 from "@angular/core";
7
7
  import * as i1 from "./notification.service";
8
8
  export class ChatClientService {
9
- constructor(ngZone, appRef, notificationService) {
9
+ constructor(ngZone, notificationService) {
10
10
  this.ngZone = ngZone;
11
- this.appRef = appRef;
12
11
  this.notificationService = notificationService;
13
12
  this.notificationSubject = new ReplaySubject(1);
14
13
  this.connectionStateSubject = new ReplaySubject(1);
@@ -23,42 +22,30 @@ export class ChatClientService {
23
22
  yield this.ngZone.runOutsideAngular(() => __awaiter(this, void 0, void 0, function* () {
24
23
  yield this.chatClient.connectUser({ id: userId }, userToken);
25
24
  this.chatClient.setUserAgent(`stream-chat-angular-${version}-${this.chatClient.getUserAgent()}`);
25
+ this.chatClient.getAppSettings;
26
26
  }));
27
27
  this.appSettingsSubject.next(undefined);
28
- this.chatClient.on('notification.added_to_channel', (e) => {
28
+ this.chatClient.on((e) => {
29
29
  this.notificationSubject.next({
30
- eventType: 'notification.added_to_channel',
30
+ eventType: e.type,
31
31
  event: e,
32
32
  });
33
- this.appRef.tick();
34
- });
35
- this.chatClient.on('notification.message_new', (e) => {
36
- this.notificationSubject.next({
37
- eventType: 'notification.message_new',
38
- event: e,
39
- });
40
- this.appRef.tick();
41
- });
42
- this.chatClient.on('notification.removed_from_channel', (e) => {
43
- this.notificationSubject.next({
44
- eventType: 'notification.removed_from_channel',
45
- event: e,
46
- });
47
- this.appRef.tick();
48
33
  });
49
34
  let removeNotification;
50
35
  this.chatClient.on('connection.changed', (e) => {
51
- const isOnline = e.online;
52
- if (isOnline) {
53
- if (removeNotification) {
54
- removeNotification();
36
+ this.ngZone.run(() => {
37
+ const isOnline = e.online;
38
+ if (isOnline) {
39
+ if (removeNotification) {
40
+ removeNotification();
41
+ }
55
42
  }
56
- }
57
- else {
58
- removeNotification = this.notificationService.addPermanentNotification('streamChat.Connection failure, reconnecting now...');
59
- }
60
- this.connectionStateSubject.next(isOnline ? 'online' : 'offline');
61
- this.appRef.tick();
43
+ else {
44
+ removeNotification =
45
+ this.notificationService.addPermanentNotification('streamChat.Connection failure, reconnecting now...');
46
+ }
47
+ this.connectionStateSubject.next(isOnline ? 'online' : 'offline');
48
+ });
62
49
  });
63
50
  });
64
51
  }
@@ -92,12 +79,12 @@ export class ChatClientService {
92
79
  });
93
80
  }
94
81
  }
95
- ChatClientService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChatClientService, deps: [{ token: i0.NgZone }, { token: i0.ApplicationRef }, { token: i1.NotificationService }], target: i0.ɵɵFactoryTarget.Injectable });
82
+ ChatClientService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChatClientService, deps: [{ token: i0.NgZone }, { token: i1.NotificationService }], target: i0.ɵɵFactoryTarget.Injectable });
96
83
  ChatClientService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChatClientService, providedIn: 'root' });
97
84
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChatClientService, decorators: [{
98
85
  type: Injectable,
99
86
  args: [{
100
87
  providedIn: 'root',
101
88
  }]
102
- }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ApplicationRef }, { type: i1.NotificationService }]; } });
103
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdC1jbGllbnQuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL3N0cmVhbS1jaGF0LWFuZ3VsYXIvc3JjL2xpYi9jaGF0LWNsaWVudC5zZXJ2aWNlLnRzIl0sIm5h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iAgYXN5bmMgYXV0b2NvbXBsZXRlVXNlcnMoc2VhcmNoVGVybTogc3RyaW5nKSB7XG4gICAgaWYgKCFzZWFyY2hUZXJtKSB7XG4gICAgICByZXR1cm4gW107XG4gICAgfVxuICAgIGNvbnN0IHJlc3VsdCA9IGF3YWl0IHRoaXMuY2hhdENsaWVudC5xdWVyeVVzZXJzKHtcbiAgICAgICRvcjogW1xuICAgICAgICB7IGlkOiB7ICRhdXRvY29tcGxldGU6IHNlYXJjaFRlcm0gfSB9LFxuICAgICAgICB7IG5hbWU6IHsgJGF1dG9jb21wbGV0ZTogc2VhcmNoVGVybSB9IH0sXG4gICAgICBdLFxuICAgICAgaWQ6IHsgJG5lOiB0aGlzLmNoYXRDbGllbnQudXNlcklEISB9LFxuICAgIH0pO1xuICAgIHJldHVybiByZXN1bHQudXNlcnM7XG4gIH1cbn1cbiJdfQ==
89
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i1.NotificationService }]; } });
90
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hhdC1jbGllbnQuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL3N0cmVhbS1jaGF0LWFuZ3VsYXIvc3JjL2xpYi9jaGF0LWNsaWVudC5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFVLE1BQU0sZUFBZSxDQUFDO0FBQ25ELE9BQU8sRUFBRSxlQUFlLEVBQWMsYUFBYSxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBQ2xFLE9BQU8sRUFBc0IsVUFBVSxFQUFFLE1BQU0sYUFBYSxDQUFDO0FBQzdELE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQzs7O0FBVzVDLE1BQU0sT0FBTyxpQkFBaUI7SUFXN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pZiAodGhpcy5hcHBTZXR0aW5nc1N1YmplY3QuZ2V0VmFsdWUoKSkge1xuICAgICAgcmV0dXJuO1xuICAgIH1cbiAgICBjb25zdCBzZXR0aW5ncyA9IGF3YWl0IHRoaXMuY2hhdENsaWVudC5nZXRBcHBTZXR0aW5ncygpO1xuICAgIHRoaXMuYXBwU2V0dGluZ3NTdWJqZWN0Lm5leHQoc2V0dGluZ3MuYXBwIHx8IHt9KTtcbiAgfVxuXG4gIGFzeW5jIGZsYWdNZXNzYWdlKG1lc3NhZ2VJZDogc3RyaW5nKSB7XG4gICAgYXdhaXQgdGhpcy5jaGF0Q2xpZW50LmZsYWdNZXNzYWdlKG1lc3NhZ2VJZCk7XG4gIH1cblxuICBhc3luYyBhdXRvY29tcGxldGVVc2VycyhzZWFyY2hUZXJtOiBzdHJpbmcpIHtcbiAgICBpZiAoIXNlYXJjaFRlcm0pIHtcbiAgICAgIHJldHVybiBbXTtcbiAgICB9XG4gICAgY29uc3QgcmVzdWx0ID0gYXdhaXQgdGhpcy5jaGF0Q2xpZW50LnF1ZXJ5VXNlcnMoe1xuICAgICAgJG9yOiBbXG4gICAgICAgIHsgaWQ6IHsgJGF1dG9jb21wbGV0ZTogc2VhcmNoVGVybSB9IH0sXG4gICAgICAgIHsgbmFtZTogeyAkYXV0b2NvbXBsZXRlOiBzZWFyY2hUZXJtIH0gfSxcbiAgICAgIF0sXG4gICAgICBpZDogeyAkbmU6IHRoaXMuY2hhdENsaWVudC51c2VySUQhIH0sXG4gICAgfSk7XG4gICAgcmV0dXJuIHJlc3VsdC51c2VycztcbiAgfVxufVxuIl19
@@ -16,7 +16,7 @@ import transliterate from '@stream-io/transliterate';
16
16
  import * as i5 from 'angular-mentions';
17
17
  import { MentionModule } from 'angular-mentions';
18
18
 
19
- const version = '2.6.0';
19
+ const version = '2.6.1';
20
20
 
21
21
  class NotificationService {
22
22
  constructor() {
@@ -61,9 +61,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImpor
61
61
  }], ctorParameters: function () { return []; } });
62
62
 
63
63
  class ChatClientService {
64
- constructor(ngZone, appRef, notificationService) {
64
+ constructor(ngZone, notificationService) {
65
65
  this.ngZone = ngZone;
66
- this.appRef = appRef;
67
66
  this.notificationService = notificationService;
68
67
  this.notificationSubject = new ReplaySubject(1);
69
68
  this.connectionStateSubject = new ReplaySubject(1);
@@ -78,42 +77,30 @@ class ChatClientService {
78
77
  yield this.ngZone.runOutsideAngular(() => __awaiter(this, void 0, void 0, function* () {
79
78
  yield this.chatClient.connectUser({ id: userId }, userToken);
80
79
  this.chatClient.setUserAgent(`stream-chat-angular-${version}-${this.chatClient.getUserAgent()}`);
80
+ this.chatClient.getAppSettings;
81
81
  }));
82
82
  this.appSettingsSubject.next(undefined);
83
- this.chatClient.on('notification.added_to_channel', (e) => {
83
+ this.chatClient.on((e) => {
84
84
  this.notificationSubject.next({
85
- eventType: 'notification.added_to_channel',
85
+ eventType: e.type,
86
86
  event: e,
87
87
  });
88
- this.appRef.tick();
89
- });
90
- this.chatClient.on('notification.message_new', (e) => {
91
- this.notificationSubject.next({
92
- eventType: 'notification.message_new',
93
- event: e,
94
- });
95
- this.appRef.tick();
96
- });
97
- this.chatClient.on('notification.removed_from_channel', (e) => {
98
- this.notificationSubject.next({
99
- eventType: 'notification.removed_from_channel',
100
- event: e,
101
- });
102
- this.appRef.tick();
103
88
  });
104
89
  let removeNotification;
105
90
  this.chatClient.on('connection.changed', (e) => {
106
- const isOnline = e.online;
107
- if (isOnline) {
108
- if (removeNotification) {
109
- removeNotification();
91
+ this.ngZone.run(() => {
92
+ const isOnline = e.online;
93
+ if (isOnline) {
94
+ if (removeNotification) {
95
+ removeNotification();
96
+ }
110
97
  }
111
- }
112
- else {
113
- removeNotification = this.notificationService.addPermanentNotification('streamChat.Connection failure, reconnecting now...');
114
- }
115
- this.connectionStateSubject.next(isOnline ? 'online' : 'offline');
116
- this.appRef.tick();
98
+ else {
99
+ removeNotification =
100
+ this.notificationService.addPermanentNotification('streamChat.Connection failure, reconnecting now...');
101
+ }
102
+ this.connectionStateSubject.next(isOnline ? 'online' : 'offline');
103
+ });
117
104
  });
118
105
  });
119
106
  }
@@ -147,14 +134,14 @@ class ChatClientService {
147
134
  });
148
135
  }
149
136
  }
150
- ChatClientService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChatClientService, deps: [{ token: i0.NgZone }, { token: i0.ApplicationRef }, { token: NotificationService }], target: i0.ɵɵFactoryTarget.Injectable });
137
+ ChatClientService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChatClientService, deps: [{ token: i0.NgZone }, { token: NotificationService }], target: i0.ɵɵFactoryTarget.Injectable });
151
138
  ChatClientService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChatClientService, providedIn: 'root' });
152
139
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChatClientService, decorators: [{
153
140
  type: Injectable,
154
141
  args: [{
155
142
  providedIn: 'root',
156
143
  }]
157
- }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ApplicationRef }, { type: NotificationService }]; } });
144
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: NotificationService }]; } });
158
145
 
159
146
  const createMessagePreview = (user, text, attachments, mentionedUsers) => {
160
147
  const clientSideId = `${user.id}-${v4()}`;
@@ -187,9 +174,8 @@ const getReadBy = (message, channel) => {
187
174
  };
188
175
 
189
176
  class ChannelService {
190
- constructor(chatClientService, appRef, ngZone) {
177
+ constructor(chatClientService, ngZone) {
191
178
  this.chatClientService = chatClientService;
192
- this.appRef = appRef;
193
179
  this.ngZone = ngZone;
194
180
  this.channelsSubject = new BehaviorSubject(undefined);
195
181
  this.activeChannelSubject = new BehaviorSubject(undefined);
@@ -400,39 +386,43 @@ class ChannelService {
400
386
  return __awaiter(this, void 0, void 0, function* () {
401
387
  switch (notification.eventType) {
402
388
  case 'notification.message_new': {
403
- if (this.customNewMessageNotificationHandler) {
404
- this.customNewMessageNotificationHandler(notification, this.channelListSetter);
405
- }
406
- else {
407
- yield this.handleNewMessageNotification(notification);
408
- }
389
+ yield this.ngZone.run(() => __awaiter(this, void 0, void 0, function* () {
390
+ if (this.customNewMessageNotificationHandler) {
391
+ this.customNewMessageNotificationHandler(notification, this.channelListSetter);
392
+ }
393
+ else {
394
+ yield this.handleNewMessageNotification(notification);
395
+ }
396
+ }));
409
397
  break;
410
398
  }
411
399
  case 'notification.added_to_channel': {
412
- if (this.customAddedToChannelNotificationHandler) {
413
- this.customAddedToChannelNotificationHandler(notification, this.channelListSetter);
414
- }
415
- else {
416
- yield this.handleAddedToChannelNotification(notification);
417
- }
400
+ yield this.ngZone.run(() => __awaiter(this, void 0, void 0, function* () {
401
+ if (this.customAddedToChannelNotificationHandler) {
402
+ this.customAddedToChannelNotificationHandler(notification, this.channelListSetter);
403
+ }
404
+ else {
405
+ yield this.handleAddedToChannelNotification(notification);
406
+ }
407
+ }));
418
408
  break;
419
409
  }
420
410
  case 'notification.removed_from_channel': {
421
- if (this.customRemovedFromChannelNotificationHandler) {
422
- this.customRemovedFromChannelNotificationHandler(notification, this.channelListSetter);
423
- }
424
- else {
425
- this.handleRemovedFromChannelNotification(notification);
426
- }
411
+ this.ngZone.run(() => {
412
+ if (this.customRemovedFromChannelNotificationHandler) {
413
+ this.customRemovedFromChannelNotificationHandler(notification, this.channelListSetter);
414
+ }
415
+ else {
416
+ this.handleRemovedFromChannelNotification(notification);
417
+ }
418
+ });
427
419
  }
428
420
  }
429
421
  });
430
422
  }
431
423
  handleRemovedFromChannelNotification(notification) {
432
- this.ngZone.run(() => {
433
- const channelIdToBeRemoved = notification.event.channel.cid;
434
- this.removeFromChannelList(channelIdToBeRemoved);
435
- });
424
+ const channelIdToBeRemoved = notification.event.channel.cid;
425
+ this.removeFromChannelList(channelIdToBeRemoved);
436
426
  }
437
427
  handleNewMessageNotification(notification) {
438
428
  return __awaiter(this, void 0, void 0, function* () {
@@ -450,12 +440,10 @@ class ChannelService {
450
440
  const channel = this.chatClientService.chatClient.channel((_a = notification.event.channel) === null || _a === void 0 ? void 0 : _a.type, (_b = notification.event.channel) === null || _b === void 0 ? void 0 : _b.id);
451
441
  yield channel.watch();
452
442
  this.watchForChannelEvents(channel);
453
- this.ngZone.run(() => {
454
- this.channelsSubject.next([
455
- channel,
456
- ...(this.channelsSubject.getValue() || []),
457
- ]);
458
- });
443
+ this.channelsSubject.next([
444
+ channel,
445
+ ...(this.channelsSubject.getValue() || []),
446
+ ]);
459
447
  });
460
448
  }
461
449
  removeFromChannelList(cid) {
@@ -484,15 +472,17 @@ class ChannelService {
484
472
  this.activeChannelSubscriptions.push(channel.on('reaction.deleted', (e) => this.messageReactionEventReceived(e)));
485
473
  this.activeChannelSubscriptions.push(channel.on('reaction.updated', (e) => this.messageReactionEventReceived(e)));
486
474
  this.activeChannelSubscriptions.push(channel.on('message.read', (e) => {
487
- let latestMessage;
488
- this.activeChannelMessages$.pipe(first()).subscribe((messages) => {
489
- latestMessage = messages[messages.length - 1];
475
+ this.ngZone.run(() => {
476
+ let latestMessage;
477
+ this.activeChannelMessages$.pipe(first()).subscribe((messages) => {
478
+ latestMessage = messages[messages.length - 1];
479
+ });
480
+ if (!latestMessage || !e.user) {
481
+ return;
482
+ }
483
+ latestMessage.readBy = getReadBy(latestMessage, channel);
484
+ this.activeChannelMessagesSubject.next(this.activeChannelMessagesSubject.getValue());
490
485
  });
491
- if (!latestMessage || !e.user) {
492
- return;
493
- }
494
- latestMessage.readBy = getReadBy(latestMessage, channel);
495
- this.activeChannelMessagesSubject.next(this.activeChannelMessagesSubject.getValue());
496
486
  }));
497
487
  }
498
488
  messageUpdated(event) {
@@ -566,66 +556,72 @@ class ChannelService {
566
556
  channel.on((event) => {
567
557
  switch (event.type) {
568
558
  case 'message.new': {
569
- if (this.customNewMessageHandler) {
570
- this.customNewMessageHandler(event, channel, this.channelListSetter, this.messageListSetter);
571
- }
572
- else {
573
- this.handleNewMessage(event, channel);
574
- }
559
+ this.ngZone.run(() => {
560
+ if (this.customNewMessageHandler) {
561
+ this.customNewMessageHandler(event, channel, this.channelListSetter, this.messageListSetter);
562
+ }
563
+ else {
564
+ this.handleNewMessage(event, channel);
565
+ }
566
+ });
575
567
  break;
576
568
  }
577
569
  case 'channel.hidden': {
578
- if (this.customChannelHiddenHandler) {
579
- this.customChannelHiddenHandler(event, channel, this.channelListSetter, this.messageListSetter);
580
- }
581
- else {
582
- this.handleChannelHidden(event);
583
- }
584
- this.appRef.tick();
570
+ this.ngZone.run(() => {
571
+ if (this.customChannelHiddenHandler) {
572
+ this.customChannelHiddenHandler(event, channel, this.channelListSetter, this.messageListSetter);
573
+ }
574
+ else {
575
+ this.handleChannelHidden(event);
576
+ }
577
+ });
585
578
  break;
586
579
  }
587
580
  case 'channel.deleted': {
588
- if (this.customChannelDeletedHandler) {
589
- this.customChannelDeletedHandler(event, channel, this.channelListSetter, this.messageListSetter);
590
- }
591
- else {
592
- this.handleChannelDeleted(event);
593
- }
594
- this.appRef.tick();
581
+ this.ngZone.run(() => {
582
+ if (this.customChannelDeletedHandler) {
583
+ this.customChannelDeletedHandler(event, channel, this.channelListSetter, this.messageListSetter);
584
+ }
585
+ else {
586
+ this.handleChannelDeleted(event);
587
+ }
588
+ });
595
589
  break;
596
590
  }
597
591
  case 'channel.visible': {
598
- if (this.customChannelVisibleHandler) {
599
- this.customChannelVisibleHandler(event, channel, this.channelListSetter, this.messageListSetter);
600
- }
601
- else {
602
- this.handleChannelVisible(event, channel);
603
- }
604
- this.appRef.tick();
592
+ this.ngZone.run(() => {
593
+ if (this.customChannelVisibleHandler) {
594
+ this.customChannelVisibleHandler(event, channel, this.channelListSetter, this.messageListSetter);
595
+ }
596
+ else {
597
+ this.handleChannelVisible(event, channel);
598
+ }
599
+ });
605
600
  break;
606
601
  }
607
602
  case 'channel.updated': {
608
- if (this.customChannelUpdatedHandler) {
609
- this.customChannelUpdatedHandler(event, channel, this.channelListSetter, this.messageListSetter);
610
- }
611
- else {
612
- this.handleChannelUpdate(event);
613
- }
614
- this.appRef.tick();
603
+ this.ngZone.run(() => {
604
+ if (this.customChannelUpdatedHandler) {
605
+ this.customChannelUpdatedHandler(event, channel, this.channelListSetter, this.messageListSetter);
606
+ }
607
+ else {
608
+ this.handleChannelUpdate(event);
609
+ }
610
+ });
615
611
  break;
616
612
  }
617
613
  case 'channel.truncated': {
618
- if (this.customChannelTruncatedHandler) {
619
- this.customChannelTruncatedHandler(event, channel, this.channelListSetter, this.messageListSetter);
620
- }
621
- else {
622
- this.handleChannelTruncate(event);
623
- }
624
- this.appRef.tick();
614
+ this.ngZone.run(() => {
615
+ if (this.customChannelTruncatedHandler) {
616
+ this.customChannelTruncatedHandler(event, channel, this.channelListSetter, this.messageListSetter);
617
+ }
618
+ else {
619
+ this.handleChannelTruncate(event);
620
+ }
621
+ });
625
622
  break;
626
623
  }
627
624
  }
628
- setTimeout(() => this.appRef.tick(), 0);
629
625
  });
630
626
  }
631
627
  handleNewMessage(_, channel) {
@@ -684,14 +680,14 @@ class ChannelService {
684
680
  return capabilites.indexOf('read-events') !== -1;
685
681
  }
686
682
  }
687
- ChannelService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChannelService, deps: [{ token: ChatClientService }, { token: i0.ApplicationRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
683
+ ChannelService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChannelService, deps: [{ token: ChatClientService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
688
684
  ChannelService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChannelService, providedIn: 'root' });
689
685
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChannelService, decorators: [{
690
686
  type: Injectable,
691
687
  args: [{
692
688
  providedIn: 'root',
693
689
  }]
694
- }], ctorParameters: function () { return [{ type: ChatClientService }, { type: i0.ApplicationRef }, { type: i0.NgZone }]; } });
690
+ }], ctorParameters: function () { return [{ type: ChatClientService }, { type: i0.NgZone }]; } });
695
691
 
696
692
  class ThemeService {
697
693
  constructor() {
@@ -1847,8 +1843,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImpor
1847
1843
  }], ctorParameters: function () { return [{ type: ChannelService }, { type: ChannelListToggleService }]; } });
1848
1844
 
1849
1845
  class ChannelPreviewComponent {
1850
- constructor(channelService) {
1846
+ constructor(channelService, ngZone) {
1851
1847
  this.channelService = channelService;
1848
+ this.ngZone = ngZone;
1852
1849
  this.isActive = false;
1853
1850
  this.isUnread = false;
1854
1851
  this.latestMessage = 'Nothing yet...';
@@ -1869,8 +1866,10 @@ class ChannelPreviewComponent {
1869
1866
  this.subscriptions.push(this.channel.on('message.updated', this.handleMessageEvent.bind(this)));
1870
1867
  this.subscriptions.push(this.channel.on('message.deleted', this.handleMessageEvent.bind(this)));
1871
1868
  this.subscriptions.push(this.channel.on('channel.truncated', this.handleMessageEvent.bind(this)));
1872
- this.subscriptions.push(this.channel.on('message.read', () => (this.isUnread =
1873
- !!this.channel.countUnread() && this.canSendReadEvents)));
1869
+ this.subscriptions.push(this.channel.on('message.read', () => this.ngZone.run(() => {
1870
+ this.isUnread =
1871
+ !!this.channel.countUnread() && this.canSendReadEvents;
1872
+ })));
1874
1873
  }
1875
1874
  ngOnDestroy() {
1876
1875
  this.subscriptions.forEach((s) => s.unsubscribe());
@@ -1891,17 +1890,19 @@ class ChannelPreviewComponent {
1891
1890
  void this.channelService.setAsActiveChannel(this.channel);
1892
1891
  }
1893
1892
  handleMessageEvent(event) {
1894
- var _a, _b, _c;
1895
- if (((_a = this.channel) === null || _a === void 0 ? void 0 : _a.state.messages.length) === 0) {
1896
- this.latestMessage = 'Nothing yet...';
1897
- return;
1898
- }
1899
- if (!event.message ||
1900
- ((_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) {
1901
- return;
1902
- }
1903
- this.setLatestMessage(event.message);
1904
- this.isUnread = !!this.channel.countUnread() && this.canSendReadEvents;
1893
+ this.ngZone.run(() => {
1894
+ var _a, _b, _c;
1895
+ if (((_a = this.channel) === null || _a === void 0 ? void 0 : _a.state.messages.length) === 0) {
1896
+ this.latestMessage = 'Nothing yet...';
1897
+ return;
1898
+ }
1899
+ if (!event.message ||
1900
+ ((_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) {
1901
+ return;
1902
+ }
1903
+ this.setLatestMessage(event.message);
1904
+ this.isUnread = !!this.channel.countUnread() && this.canSendReadEvents;
1905
+ });
1905
1906
  }
1906
1907
  setLatestMessage(message) {
1907
1908
  if (message === null || message === void 0 ? void 0 : message.deleted_at) {
@@ -1915,7 +1916,7 @@ class ChannelPreviewComponent {
1915
1916
  }
1916
1917
  }
1917
1918
  }
1918
- ChannelPreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChannelPreviewComponent, deps: [{ token: ChannelService }], target: i0.ɵɵFactoryTarget.Component });
1919
+ ChannelPreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChannelPreviewComponent, deps: [{ token: ChannelService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
1919
1920
  ChannelPreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.5", type: ChannelPreviewComponent, selector: "stream-channel-preview", inputs: { channel: "channel" }, ngImport: i0, 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.TranslatePipe } });
1920
1921
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: ChannelPreviewComponent, decorators: [{
1921
1922
  type: Component,
@@ -1924,7 +1925,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImpor
1924
1925
  templateUrl: './channel-preview.component.html',
1925
1926
  styles: [],
1926
1927
  }]
1927
- }], ctorParameters: function () { return [{ type: ChannelService }]; }, propDecorators: { channel: [{
1928
+ }], ctorParameters: function () { return [{ type: ChannelService }, { type: i0.NgZone }]; }, propDecorators: { channel: [{
1928
1929
  type: Input
1929
1930
  }] } });
1930
1931