@amityco/ts-sdk-react-native 6.32.6-35556b2.0 → 6.32.7-289cad7.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/dist/@types/domains/channel.d.ts +2 -1
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannels/ChannelLiveCollectionController.d.ts.map +1 -1
- package/dist/channelRepository/observers/observeChannel.d.ts +1 -1
- package/dist/channelRepository/observers/observeChannel.d.ts.map +1 -1
- package/dist/channelRepository/utils/{prepateUnreadCountInfo.d.ts → prepareUnreadCountInfo.d.ts} +1 -1
- package/dist/channelRepository/utils/prepareUnreadCountInfo.d.ts.map +1 -0
- package/dist/channelRepository/utils/resolveUnreadInfoOnChannelEvent.d.ts +1 -1
- package/dist/channelRepository/utils/resolveUnreadInfoOnChannelEvent.d.ts.map +1 -1
- package/dist/index.cjs.js +33 -21
- package/dist/index.esm.js +33 -21
- package/dist/index.umd.js +2 -2
- package/dist/marker/events/onUserFeedMarkerUpdated.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/domains/channel.ts +2 -1
- package/src/channelRepository/api/getChannel.ts +1 -1
- package/src/channelRepository/api/getChannelByIds.ts +1 -1
- package/src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts +33 -17
- package/src/channelRepository/observers/getChannels/ChannelQueryStreamController.ts +1 -1
- package/src/channelRepository/utils/resolveUnreadInfoOnChannelEvent.ts +2 -5
- package/src/marker/events/onUserFeedMarkerUpdated.ts +2 -0
- package/dist/channelRepository/utils/prepateUnreadCountInfo.d.ts.map +0 -1
- /package/src/channelRepository/utils/{prepateUnreadCountInfo.ts → prepareUnreadCountInfo.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onUserFeedMarkerUpdated.d.ts","sourceRoot":"","sources":["../../../src/marker/events/onUserFeedMarkerUpdated.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,aACxB,MAAM,QAAQ,CAAC,MAAM,UAAU,CAAC,KACzC,MAAM,
|
|
1
|
+
{"version":3,"file":"onUserFeedMarkerUpdated.d.ts","sourceRoot":"","sources":["../../../src/marker/events/onUserFeedMarkerUpdated.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,aACxB,MAAM,QAAQ,CAAC,MAAM,UAAU,CAAC,KACzC,MAAM,YAiBR,CAAC"}
|
package/package.json
CHANGED
|
@@ -16,7 +16,8 @@ declare global {
|
|
|
16
16
|
| 'onChannelMemberRoleRemoved';
|
|
17
17
|
|
|
18
18
|
const enum ChannelActionType {
|
|
19
|
-
|
|
19
|
+
OnResolveChannel = 'onResolveChannel',
|
|
20
|
+
OnResolveUnread = 'OnResolveUnread',
|
|
20
21
|
OnFetch = 'onFetch',
|
|
21
22
|
OnCreate = 'onCreate',
|
|
22
23
|
OnUpdate = 'onUpdate',
|
|
@@ -8,7 +8,7 @@ import { checkIfShouldGoesToTombstone } from '~/cache/utils';
|
|
|
8
8
|
import { pushToTombstone } from '~/cache/api/pushToTombstone';
|
|
9
9
|
|
|
10
10
|
import { prepareChannelPayload } from '../utils';
|
|
11
|
-
import { prepareUnreadCountInfo } from '../utils/
|
|
11
|
+
import { prepareUnreadCountInfo } from '../utils/prepareUnreadCountInfo';
|
|
12
12
|
import { constructChannelDynamicValue } from '../utils/constructChannelDynamicValue';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -7,7 +7,7 @@ import { checkIfShouldGoesToTombstone } from '~/cache/utils';
|
|
|
7
7
|
import { pushToTombstone } from '~/cache/api/pushToTombstone';
|
|
8
8
|
import { prepareChannelPayload } from '../utils';
|
|
9
9
|
import { fireEvent } from '~/core/events';
|
|
10
|
-
import { prepareUnreadCountInfo } from '../utils/
|
|
10
|
+
import { prepareUnreadCountInfo } from '../utils/prepareUnreadCountInfo';
|
|
11
11
|
import { LinkedObject } from '~/utils/linkedObject';
|
|
12
12
|
import { constructChannelDynamicValue } from '../utils/constructChannelDynamicValue';
|
|
13
13
|
|
|
@@ -51,7 +51,7 @@ import { PaginationController } from '~/core/liveCollection/PaginationController
|
|
|
51
51
|
import { onSubChannelCreated } from '~/subChannelRepository';
|
|
52
52
|
|
|
53
53
|
import ObjectResolverEngine from '~/client/utils/ObjectResolver/objectResolverEngine';
|
|
54
|
-
import { prepareUnreadCountInfo } from '~/channelRepository/utils/
|
|
54
|
+
import { prepareUnreadCountInfo } from '~/channelRepository/utils/prepareUnreadCountInfo';
|
|
55
55
|
import { resolveUnreadInfoOnChannelEvent } from '~/channelRepository/utils/resolveUnreadInfoOnChannelEvent';
|
|
56
56
|
import { onChannelResolved } from '~/channelRepository/events/onChannelResolved';
|
|
57
57
|
import { onUserMessageFeedMarkerResolved } from '~/marker/events/onUserMessageFeedMarkerResolved';
|
|
@@ -250,18 +250,31 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
250
250
|
fn: convertEventPayload(
|
|
251
251
|
(callback: Amity.Listener<Amity.InternalMessage>) => {
|
|
252
252
|
return onMessageCreatedMqtt(message => {
|
|
253
|
-
const
|
|
253
|
+
const objectResolverEngine = ObjectResolverEngine.getInstance();
|
|
254
|
+
|
|
255
|
+
const cachedSubChannelUnread = pullFromCache<Amity.SubChannelUnreadInfo>([
|
|
256
|
+
'subChannelUnreadInfo',
|
|
257
|
+
'get',
|
|
258
|
+
message.subChannelId,
|
|
259
|
+
])?.data;
|
|
260
|
+
|
|
261
|
+
if (!cachedSubChannelUnread)
|
|
262
|
+
objectResolverEngine.resolve(
|
|
263
|
+
message.subChannelId,
|
|
264
|
+
Amity.ReferenceType.USER_MESSAGE_FEED_MARKER,
|
|
265
|
+
);
|
|
266
|
+
|
|
267
|
+
const channelCache = pullFromCache<Amity.Channel>([
|
|
254
268
|
'channel',
|
|
255
269
|
'get',
|
|
256
270
|
message.channelId,
|
|
257
271
|
])?.data;
|
|
258
272
|
|
|
259
|
-
if (!
|
|
260
|
-
const objectResolverEngine = ObjectResolverEngine.getInstance();
|
|
273
|
+
if (!channelCache) {
|
|
261
274
|
// channelId from message event payload is channelInternalId
|
|
262
275
|
objectResolverEngine.resolve(message.channelId, Amity.ReferenceType.CHANNEL);
|
|
263
276
|
} else {
|
|
264
|
-
updateChannelCache(
|
|
277
|
+
updateChannelCache(channelCache, {
|
|
265
278
|
lastActivity: message.createdAt,
|
|
266
279
|
});
|
|
267
280
|
|
|
@@ -304,7 +317,9 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
304
317
|
{
|
|
305
318
|
fn: (callback: Amity.Listener<Amity.StaticInternalChannel>) => {
|
|
306
319
|
return onChannelJoined(channel => {
|
|
307
|
-
resolveUnreadInfoOnChannelEvent(channel
|
|
320
|
+
resolveUnreadInfoOnChannelEvent(channel);
|
|
321
|
+
|
|
322
|
+
callback(channel);
|
|
308
323
|
});
|
|
309
324
|
},
|
|
310
325
|
action: Amity.ChannelActionType.OnJoin,
|
|
@@ -526,22 +541,22 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
526
541
|
},
|
|
527
542
|
{
|
|
528
543
|
fn: onChannelResolved,
|
|
529
|
-
action: Amity.ChannelActionType.
|
|
544
|
+
action: Amity.ChannelActionType.OnResolveChannel,
|
|
530
545
|
},
|
|
531
546
|
{
|
|
532
547
|
fn: (callback: Amity.Listener<Amity.StaticInternalChannel[]>) => {
|
|
533
548
|
const handleUserFeedMarkerResolved = async (
|
|
534
|
-
marker: Amity.
|
|
549
|
+
marker: Amity.Events['local.userMessageFeedMarkers.resolved'],
|
|
535
550
|
) => {
|
|
536
551
|
if (marker.feedMarkers) {
|
|
537
|
-
const
|
|
538
|
-
...new Set(marker.feedMarkers.map(feedMarker => feedMarker.entityId)),
|
|
539
|
-
];
|
|
540
|
-
|
|
541
|
-
const channels = channelIds
|
|
552
|
+
const channels = marker.feedMarkers
|
|
542
553
|
.map(
|
|
543
|
-
|
|
544
|
-
pullFromCache<Amity.StaticInternalChannel>([
|
|
554
|
+
feedMarker =>
|
|
555
|
+
pullFromCache<Amity.StaticInternalChannel>([
|
|
556
|
+
'channel',
|
|
557
|
+
'get',
|
|
558
|
+
feedMarker.entityId,
|
|
559
|
+
])?.data,
|
|
545
560
|
)
|
|
546
561
|
.filter(Boolean) as Amity.StaticInternalChannel[];
|
|
547
562
|
|
|
@@ -550,7 +565,7 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
550
565
|
};
|
|
551
566
|
return onUserMessageFeedMarkerResolved(handleUserFeedMarkerResolved);
|
|
552
567
|
},
|
|
553
|
-
action: Amity.ChannelActionType.
|
|
568
|
+
action: Amity.ChannelActionType.OnResolveUnread,
|
|
554
569
|
},
|
|
555
570
|
{
|
|
556
571
|
fn: convertEventPayload(onChannelUnreadUpdatedLocal, 'channelId', 'channel'),
|
|
@@ -564,7 +579,8 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
564
579
|
{
|
|
565
580
|
fn: (callback: Amity.Listener<Amity.StaticInternalChannel>) => {
|
|
566
581
|
return onChannelCreated(channel => {
|
|
567
|
-
resolveUnreadInfoOnChannelEvent(channel
|
|
582
|
+
resolveUnreadInfoOnChannelEvent(channel);
|
|
583
|
+
callback(channel);
|
|
568
584
|
});
|
|
569
585
|
},
|
|
570
586
|
action: Amity.ChannelActionType.OnCreate,
|
|
@@ -76,7 +76,7 @@ export class ChannelQueryStreamController extends QueryStreamController<
|
|
|
76
76
|
[
|
|
77
77
|
Amity.ChannelActionType.OnCreate,
|
|
78
78
|
Amity.ChannelActionType.OnJoin,
|
|
79
|
-
Amity.ChannelActionType.
|
|
79
|
+
Amity.ChannelActionType.OnResolveChannel,
|
|
80
80
|
].includes(action)
|
|
81
81
|
) {
|
|
82
82
|
if (Array.isArray(payload)) {
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
2
|
import ObjectResolverEngine from '~/client/utils/ObjectResolver/objectResolverEngine';
|
|
3
3
|
|
|
4
|
-
export const resolveUnreadInfoOnChannelEvent = (
|
|
5
|
-
channel: Amity.StaticInternalChannel,
|
|
6
|
-
callback: Amity.Listener<Amity.StaticInternalChannel>,
|
|
7
|
-
) => {
|
|
4
|
+
export const resolveUnreadInfoOnChannelEvent = (channel: Amity.StaticInternalChannel) => {
|
|
8
5
|
const client = getActiveClient();
|
|
9
6
|
|
|
10
7
|
if (client.isUnreadCountEnabled && client.getMarkerSyncConsistentMode()) {
|
|
11
8
|
const objectResolverEngine = ObjectResolverEngine.getInstance();
|
|
12
9
|
|
|
13
10
|
objectResolverEngine.resolve(channel.channelId, Amity.ReferenceType.USER_MESSAGE_FEED_MARKER);
|
|
14
|
-
}
|
|
11
|
+
}
|
|
15
12
|
};
|
|
@@ -23,6 +23,8 @@ export const onUserFeedMarkerUpdated = (
|
|
|
23
23
|
const client = getActiveClient();
|
|
24
24
|
|
|
25
25
|
const filter = (payload: Amity.Events['marker.userFeed-updated']) => {
|
|
26
|
+
persistUnreadCountInfo(payload);
|
|
27
|
+
|
|
26
28
|
payload.feedMarkers.forEach(feedMarker => {
|
|
27
29
|
callback(feedMarker);
|
|
28
30
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prepateUnreadCountInfo.d.ts","sourceRoot":"","sources":["../../../src/channelRepository/utils/prepateUnreadCountInfo.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB,eAAsB,MAAM,cAAc,kBAgB5E,CAAC"}
|
/package/src/channelRepository/utils/{prepateUnreadCountInfo.ts → prepareUnreadCountInfo.ts}
RENAMED
|
File without changes
|