@amityco/ts-sdk 7.1.1-611ceb49.0 → 7.1.1-67cf0d9.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/core/events.d.ts +2 -5
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +2 -4
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +0 -18
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/core/readReceipt.d.ts +12 -1
- package/dist/@types/core/readReceipt.d.ts.map +1 -1
- package/dist/@types/domains/channel.d.ts +10 -0
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/@types/domains/client.d.ts +2 -0
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/channelRepository/api/markChannelsAsReadBySegment.d.ts +16 -0
- package/dist/channelRepository/api/markChannelsAsReadBySegment.d.ts.map +1 -0
- package/dist/channelRepository/events/onChannelDeleted.d.ts.map +1 -1
- package/dist/channelRepository/events/onChannelLeft.d.ts.map +1 -1
- package/dist/{marker → channelRepository}/events/onChannelUnreadUpdatedLocal.d.ts +2 -2
- package/dist/channelRepository/events/onChannelUnreadUpdatedLocal.d.ts.map +1 -0
- package/dist/channelRepository/internalApi/getTotalChannelsUnread.d.ts +11 -0
- package/dist/channelRepository/internalApi/getTotalChannelsUnread.d.ts.map +1 -0
- package/dist/channelRepository/observers/getChannel.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannels/ChannelLiveCollectionController.d.ts.map +1 -1
- package/dist/channelRepository/observers/getTotalChannelsUnread.d.ts +20 -0
- package/dist/channelRepository/observers/getTotalChannelsUnread.d.ts.map +1 -0
- package/dist/channelRepository/observers/index.d.ts +1 -0
- package/dist/channelRepository/observers/index.d.ts.map +1 -1
- package/dist/channelRepository/utils/constructChannelDynamicValue.d.ts.map +1 -1
- package/dist/channelRepository/utils/getLegacyChannelUnread.d.ts +2 -0
- package/dist/channelRepository/utils/getLegacyChannelUnread.d.ts.map +1 -0
- package/dist/channelRepository/utils/prepareChannelPayload.d.ts.map +1 -1
- package/dist/client/api/createClient.d.ts +1 -0
- package/dist/client/api/createClient.d.ts.map +1 -1
- package/dist/client/api/enableUnreadCount.d.ts.map +1 -1
- package/dist/client/api/login.d.ts.map +1 -1
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts +33 -0
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.d.ts.map +1 -0
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts +3 -0
- package/dist/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.d.ts.map +1 -0
- package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngine.d.ts +2 -4
- package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngine.d.ts.map +1 -1
- package/dist/client/utils/endpoints.d.ts +1 -0
- package/dist/client/utils/endpoints.d.ts.map +1 -1
- package/dist/client/utils/setClientToken.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/index.cjs.js +599 -477
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +580 -457
- package/dist/index.umd.js +4 -4
- package/dist/marker/events/onChannelUnreadInfoUpdatedLocal.d.ts +12 -0
- package/dist/marker/events/onChannelUnreadInfoUpdatedLocal.d.ts.map +1 -0
- package/dist/messageRepository/events/onMessageCreated.d.ts.map +1 -1
- package/dist/messageRepository/observers/getMessage.d.ts.map +1 -1
- package/dist/messageRepository/utils/markReadMessage.d.ts.map +1 -1
- package/dist/utils/linkedObject/index.d.ts +0 -1
- package/dist/utils/linkedObject/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/core/events.ts +2 -6
- package/src/@types/core/model.ts +4 -6
- package/src/@types/core/payload.ts +0 -25
- package/src/@types/core/readReceipt.ts +14 -1
- package/src/@types/domains/channel.ts +13 -0
- package/src/@types/domains/client.ts +3 -0
- package/src/channelRepository/api/markChannelsAsReadBySegment.ts +29 -0
- package/src/channelRepository/events/onChannelDeleted.ts +17 -4
- package/src/channelRepository/events/onChannelLeft.ts +11 -3
- package/src/{marker → channelRepository}/events/onChannelUnreadUpdatedLocal.ts +3 -3
- package/src/channelRepository/internalApi/getTotalChannelsUnread.ts +38 -0
- package/src/channelRepository/observers/getChannel.ts +3 -1
- package/src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts +6 -1
- package/src/channelRepository/observers/getTotalChannelsUnread.ts +129 -0
- package/src/channelRepository/observers/index.ts +1 -0
- package/src/channelRepository/utils/constructChannelDynamicValue.ts +12 -2
- package/src/channelRepository/utils/getLegacyChannelUnread.ts +5 -0
- package/src/channelRepository/utils/prepareChannelPayload.ts +68 -17
- package/src/client/api/createClient.ts +7 -1
- package/src/client/api/enableUnreadCount.ts +1 -0
- package/src/client/api/login.ts +5 -1
- package/src/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine.ts +267 -0
- package/src/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngineOnLoginHandler.ts +21 -0
- package/src/client/utils/ReadReceiptSync/readReceiptSyncEngine.ts +74 -99
- package/src/client/utils/endpoints.ts +1 -0
- package/src/client/utils/setClientToken.ts +8 -0
- package/src/core/model/idResolvers.ts +2 -3
- package/src/core/model/index.ts +0 -2
- package/src/fileRepository/api/uploadFile.ts +1 -1
- package/src/fileRepository/api/uploadImage.ts +1 -1
- package/src/fileRepository/api/uploadVideo.ts +1 -1
- package/src/index.ts +0 -2
- package/src/marker/events/onChannelUnreadInfoUpdatedLocal.ts +29 -0
- package/src/messageRepository/events/onMessageCreated.ts +45 -1
- package/src/messageRepository/observers/getMessage.ts +0 -1
- package/src/messageRepository/utils/markReadMessage.ts +10 -3
- package/src/utils/linkedObject/index.ts +0 -2
- package/dist/@types/domains/notification.d.ts +0 -81
- package/dist/@types/domains/notification.d.ts.map +0 -1
- package/dist/marker/events/onChannelUnreadUpdatedLocal.d.ts.map +0 -1
- package/dist/notificationTrayRepository/api/index.d.ts +0 -3
- package/dist/notificationTrayRepository/api/index.d.ts.map +0 -1
- package/dist/notificationTrayRepository/api/markNotificationItemsSeen.d.ts +0 -16
- package/dist/notificationTrayRepository/api/markNotificationItemsSeen.d.ts.map +0 -1
- package/dist/notificationTrayRepository/api/markNotificationTraySeen.d.ts +0 -19
- package/dist/notificationTrayRepository/api/markNotificationTraySeen.d.ts.map +0 -1
- package/dist/notificationTrayRepository/events/index.d.ts +0 -2
- package/dist/notificationTrayRepository/events/index.d.ts.map +0 -1
- package/dist/notificationTrayRepository/events/onNotificationTraySeenUpdated.d.ts +0 -17
- package/dist/notificationTrayRepository/events/onNotificationTraySeenUpdated.d.ts.map +0 -1
- package/dist/notificationTrayRepository/index.d.ts +0 -4
- package/dist/notificationTrayRepository/index.d.ts.map +0 -1
- package/dist/notificationTrayRepository/internalApi/getNotificationTraySeen.d.ts +0 -30
- package/dist/notificationTrayRepository/internalApi/getNotificationTraySeen.d.ts.map +0 -1
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts +0 -13
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +0 -1
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts +0 -9
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +0 -1
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts +0 -9
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +0 -1
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems.d.ts +0 -12
- package/dist/notificationTrayRepository/observers/getNotificationTrayItems.d.ts.map +0 -1
- package/dist/notificationTrayRepository/observers/getNotificationTraySeen.d.ts +0 -21
- package/dist/notificationTrayRepository/observers/getNotificationTraySeen.d.ts.map +0 -1
- package/dist/notificationTrayRepository/observers/index.d.ts +0 -3
- package/dist/notificationTrayRepository/observers/index.d.ts.map +0 -1
- package/dist/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload.d.ts +0 -2
- package/dist/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload.d.ts.map +0 -1
- package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts +0 -2
- package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts.map +0 -1
- package/src/@types/domains/notification.ts +0 -90
- package/src/notificationTrayRepository/api/index.ts +0 -2
- package/src/notificationTrayRepository/api/markNotificationItemsSeen.ts +0 -59
- package/src/notificationTrayRepository/api/markNotificationTraySeen.ts +0 -65
- package/src/notificationTrayRepository/events/index.ts +0 -1
- package/src/notificationTrayRepository/events/onNotificationTraySeenUpdated.ts +0 -36
- package/src/notificationTrayRepository/index.ts +0 -3
- package/src/notificationTrayRepository/internalApi/getNotificationTraySeen.ts +0 -81
- package/src/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts +0 -96
- package/src/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts +0 -31
- package/src/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts +0 -68
- package/src/notificationTrayRepository/observers/getNotificationTrayItems.ts +0 -44
- package/src/notificationTrayRepository/observers/getNotificationTraySeen.ts +0 -43
- package/src/notificationTrayRepository/observers/index.ts +0 -2
- package/src/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload.ts +0 -12
- package/src/utils/linkedObject/notificationTrayLinkedObject.ts +0 -28
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { pullFromCache, pushToCache, queryCache } from '~/cache/api';
|
|
2
2
|
import { getActiveClient } from '../../api/activeClient';
|
|
3
|
-
import { markAsReadBySegment } from '~/subChannelRepository/api/markAsReadBySegment';
|
|
4
|
-
import { reCalculateChannelUnreadInfo } from '~/marker/utils/reCalculateChannelUnreadInfo';
|
|
5
3
|
import { fireEvent } from '~/core/events';
|
|
4
|
+
import { markChannelsAsReadBySegment } from '~/channelRepository/api/markChannelsAsReadBySegment';
|
|
6
5
|
|
|
7
6
|
export class MessageReadReceiptSyncEngine {
|
|
8
7
|
private client: Amity.Client;
|
|
@@ -38,9 +37,9 @@ export class MessageReadReceiptSyncEngine {
|
|
|
38
37
|
syncReadReceipts(): void {
|
|
39
38
|
if (this.jobQueue.length === 0 || this.isActive === false) return;
|
|
40
39
|
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
this.markReadApi(
|
|
40
|
+
const readReceipts = this.getReadReceipts();
|
|
41
|
+
if (readReceipts) {
|
|
42
|
+
this.markReadApi(readReceipts);
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
|
|
@@ -52,79 +51,64 @@ export class MessageReadReceiptSyncEngine {
|
|
|
52
51
|
|
|
53
52
|
// Enqueue unsync read receipts to the job queue
|
|
54
53
|
readReceipts?.forEach(({ data: readReceipt }) => {
|
|
55
|
-
this.enqueueReadReceipt(readReceipt.
|
|
54
|
+
this.enqueueReadReceipt(readReceipt.channelId, readReceipt.latestSegment);
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
private
|
|
60
|
-
//
|
|
61
|
-
const syncJob = this.jobQueue
|
|
58
|
+
private getReadReceipts(): Amity.ReadReceiptSyncJob[] | undefined {
|
|
59
|
+
// get all read receipts from queue, now the queue is empty
|
|
60
|
+
const syncJob = this.jobQueue.splice(0, this.jobQueue.length);
|
|
61
|
+
if (syncJob.length === 0) return;
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
'readReceipt',
|
|
70
|
-
syncJob.subChannelId,
|
|
71
|
-
])?.data;
|
|
72
|
-
|
|
73
|
-
if (!readReceipt) return;
|
|
74
|
-
|
|
75
|
-
if (readReceipt?.latestSegment > readReceipt?.latestSyncSegment) {
|
|
76
|
-
syncJob.segment = readReceipt.latestSegment;
|
|
77
|
-
return syncJob;
|
|
78
|
-
}
|
|
79
|
-
// Clear all synced job in job queue
|
|
80
|
-
this.removeSynedReceipt(readReceipt.subChannelId, readReceipt.latestSegment);
|
|
81
|
-
|
|
82
|
-
// Recursion getReadReceipt() until get unsync read receipt or job queue is empty
|
|
83
|
-
return this.getReadReceipt();
|
|
63
|
+
return syncJob.filter(job => {
|
|
64
|
+
const readReceipt = pullFromCache<Amity.ReadReceipt>(['readReceipt', job.channelId])?.data;
|
|
65
|
+
if (!readReceipt) return false;
|
|
66
|
+
if (readReceipt.latestSegment > readReceipt.latestSyncSegment) return true;
|
|
67
|
+
return false;
|
|
68
|
+
});
|
|
84
69
|
}
|
|
85
70
|
|
|
86
|
-
private async markReadApi(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
71
|
+
private async markReadApi(syncJobs: Amity.ReadReceiptSyncJob[]): Promise<void> {
|
|
72
|
+
// constuct payload
|
|
73
|
+
// example: [{ channelId: 'channelId', readToSegment: 2 }]
|
|
74
|
+
const syncJobsPayload = syncJobs.map(job => {
|
|
75
|
+
return {
|
|
76
|
+
channelId: job.channelId,
|
|
77
|
+
readToSegment: job.segment,
|
|
78
|
+
};
|
|
79
|
+
});
|
|
91
80
|
|
|
92
|
-
const response = await
|
|
81
|
+
const response = await markChannelsAsReadBySegment(syncJobsPayload);
|
|
93
82
|
|
|
94
83
|
if (response) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
latestSyncSegment: segment,
|
|
105
|
-
});
|
|
106
|
-
} else if (!response) {
|
|
107
|
-
if (newSyncJob.retryCount > this.MAX_RETRY) {
|
|
108
|
-
this.removeJobFromQueue(newSyncJob);
|
|
109
|
-
} else {
|
|
110
|
-
newSyncJob.retryCount += 1;
|
|
111
|
-
newSyncJob.syncState = Amity.ReadReceiptSyncState.CREATED;
|
|
84
|
+
for (let i = 0; i < syncJobs.length; i += 1) {
|
|
85
|
+
// update lastestSyncSegment in read receipt cache
|
|
86
|
+
const cacheKey = ['readReceipt', syncJobs[i].channelId];
|
|
87
|
+
const readReceiptCache = pullFromCache<Amity.ReadReceipt>(cacheKey)?.data;
|
|
88
|
+
|
|
89
|
+
pushToCache(cacheKey, {
|
|
90
|
+
...readReceiptCache,
|
|
91
|
+
latestSyncSegment: syncJobs[i].segment,
|
|
92
|
+
});
|
|
112
93
|
}
|
|
113
|
-
}
|
|
114
|
-
|
|
94
|
+
} else {
|
|
95
|
+
for (let i = 0; i < syncJobs.length; i += 1) {
|
|
96
|
+
// push them back to queue if the syncing is failed and retry count is less than max retry
|
|
97
|
+
if (syncJobs[i].retryCount >= this.MAX_RETRY) return;
|
|
115
98
|
|
|
116
|
-
|
|
117
|
-
|
|
99
|
+
const updatedJob = {
|
|
100
|
+
...syncJobs[i],
|
|
101
|
+
syncState: Amity.ReadReceiptSyncState.CREATED,
|
|
102
|
+
retryCount: syncJobs[i].retryCount + 1,
|
|
103
|
+
};
|
|
118
104
|
|
|
119
|
-
|
|
120
|
-
if (job.subChannelId === subChannelId && job.segment <= segment) {
|
|
121
|
-
this.removeJobFromQueue(job);
|
|
105
|
+
this.enqueueJob(updatedJob);
|
|
122
106
|
}
|
|
123
|
-
}
|
|
107
|
+
}
|
|
124
108
|
}
|
|
125
109
|
|
|
126
110
|
private startObservingReadReceiptQueue(): void {
|
|
127
|
-
if (this.client.
|
|
111
|
+
if (this.client.useLegacyUnreadCount) {
|
|
128
112
|
this.isActive = true;
|
|
129
113
|
this.startSyncReadReceipt();
|
|
130
114
|
}
|
|
@@ -133,8 +117,7 @@ export class MessageReadReceiptSyncEngine {
|
|
|
133
117
|
private stopObservingReadReceiptQueue(): void {
|
|
134
118
|
this.isActive = false;
|
|
135
119
|
|
|
136
|
-
|
|
137
|
-
syncJobs.map(job => {
|
|
120
|
+
this.jobQueue.map(job => {
|
|
138
121
|
if (job.syncState === Amity.ReadReceiptSyncState.SYNCING) {
|
|
139
122
|
return { ...job, syncState: Amity.ReadReceiptSyncState.CREATED };
|
|
140
123
|
}
|
|
@@ -170,50 +153,51 @@ export class MessageReadReceiptSyncEngine {
|
|
|
170
153
|
this.startObservingReadReceiptQueue();
|
|
171
154
|
}
|
|
172
155
|
|
|
173
|
-
markRead(
|
|
174
|
-
// Step 1: Optimistic update of
|
|
175
|
-
const cacheKey = ['
|
|
176
|
-
const
|
|
156
|
+
markRead(channelId: string, segment: number): void {
|
|
157
|
+
// Step 1: Optimistic update of channelUnread.readToSegment to message.segment and update unreadCount value
|
|
158
|
+
const cacheKey = ['channelUnread', 'get', channelId];
|
|
159
|
+
const channelUnread = pullFromCache<Amity.ChannelUnread>(cacheKey)?.data;
|
|
177
160
|
|
|
178
|
-
if (
|
|
179
|
-
|
|
180
|
-
|
|
161
|
+
if (
|
|
162
|
+
typeof channelUnread?.readToSegment === 'number' &&
|
|
163
|
+
channelUnread &&
|
|
164
|
+
segment > channelUnread.readToSegment
|
|
165
|
+
) {
|
|
166
|
+
channelUnread.readToSegment = segment;
|
|
167
|
+
channelUnread.unreadCount = Math.max(channelUnread.lastSegment - segment, 0);
|
|
181
168
|
|
|
182
|
-
|
|
183
|
-
fireEvent('local.channelUnread.updated',
|
|
184
|
-
|
|
185
|
-
pushToCache(cacheKey, subChannelUnreadInfo);
|
|
186
|
-
fireEvent('local.subChannelUnread.updated', subChannelUnreadInfo);
|
|
169
|
+
pushToCache(cacheKey, channelUnread);
|
|
170
|
+
fireEvent('local.channelUnread.updated', channelUnread);
|
|
187
171
|
}
|
|
188
172
|
|
|
189
173
|
// Step 2: Enqueue the read receipt
|
|
190
|
-
this.enqueueReadReceipt(
|
|
174
|
+
this.enqueueReadReceipt(channelId, segment);
|
|
191
175
|
}
|
|
192
176
|
|
|
193
|
-
private enqueueReadReceipt(
|
|
194
|
-
const readReceipt = pullFromCache<Amity.ReadReceipt>(['readReceipt',
|
|
177
|
+
private enqueueReadReceipt(channelId: string, segment: number): void {
|
|
178
|
+
const readReceipt = pullFromCache<Amity.ReadReceipt>(['readReceipt', channelId])?.data;
|
|
195
179
|
|
|
196
|
-
// Create new read receipt if it's not exists and add job to queue
|
|
180
|
+
// Create new read receipt if it's not exists and add the job to queue
|
|
197
181
|
if (!readReceipt) {
|
|
198
|
-
const
|
|
199
|
-
|
|
182
|
+
const readReceiptChannel: Amity.ReadReceipt = {
|
|
183
|
+
channelId,
|
|
200
184
|
latestSegment: segment,
|
|
201
185
|
latestSyncSegment: 0,
|
|
202
186
|
};
|
|
203
|
-
|
|
204
|
-
pushToCache(['readReceipt', subChannelId], readReceiptSubChannel);
|
|
187
|
+
pushToCache(['readReceipt', channelId], readReceiptChannel);
|
|
205
188
|
} else if (readReceipt.latestSegment < segment) {
|
|
206
|
-
|
|
189
|
+
// Update latestSegment in read receipt cache
|
|
190
|
+
pushToCache(['readReceipt', channelId], { ...readReceipt, latestSegment: segment });
|
|
207
191
|
} else if (readReceipt.latestSyncSegment >= segment) {
|
|
208
192
|
// Skip the job when lastSyncSegment > = segment
|
|
209
193
|
return;
|
|
210
194
|
}
|
|
211
195
|
|
|
212
|
-
let syncJob: Amity.ReadReceiptSyncJob | null = this.getSyncJob(
|
|
196
|
+
let syncJob: Amity.ReadReceiptSyncJob | null = this.getSyncJob(channelId);
|
|
213
197
|
|
|
214
198
|
if (syncJob === null || syncJob.syncState === Amity.ReadReceiptSyncState.SYNCING) {
|
|
215
199
|
syncJob = {
|
|
216
|
-
|
|
200
|
+
channelId,
|
|
217
201
|
segment,
|
|
218
202
|
syncState: Amity.ReadReceiptSyncState.CREATED,
|
|
219
203
|
retryCount: 0,
|
|
@@ -225,11 +209,9 @@ export class MessageReadReceiptSyncEngine {
|
|
|
225
209
|
}
|
|
226
210
|
}
|
|
227
211
|
|
|
228
|
-
private getSyncJob(
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
const targetJob = syncJobs.find(job => job.subChannelId === subChannelId);
|
|
232
|
-
|
|
212
|
+
private getSyncJob(channelId: string): Amity.ReadReceiptSyncJob | null {
|
|
213
|
+
const { jobQueue } = this;
|
|
214
|
+
const targetJob = jobQueue.find(job => job.channelId === channelId);
|
|
233
215
|
return targetJob || null;
|
|
234
216
|
}
|
|
235
217
|
|
|
@@ -242,13 +224,6 @@ export class MessageReadReceiptSyncEngine {
|
|
|
242
224
|
this.jobQueue.push(syncJob);
|
|
243
225
|
}
|
|
244
226
|
}
|
|
245
|
-
|
|
246
|
-
private removeJobFromQueue(item: Amity.ReadReceiptSyncJob) {
|
|
247
|
-
const index = this.jobQueue.indexOf(item);
|
|
248
|
-
if (index > -1) {
|
|
249
|
-
this.jobQueue.splice(index, 1);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
227
|
}
|
|
253
228
|
|
|
254
229
|
let instance: MessageReadReceiptSyncEngine | null = null;
|
|
@@ -30,6 +30,14 @@ export const setClientToken = async (params: Parameters<typeof getToken>[0]) =>
|
|
|
30
30
|
isUserDeleted: false,
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
client.upload.defaults.headers.common.Authorization = `Bearer ${accessToken}`;
|
|
34
|
+
|
|
35
|
+
client.upload.defaults.metadata = {
|
|
36
|
+
tokenExpiry: expiresAt,
|
|
37
|
+
isGlobalBanned: false,
|
|
38
|
+
isUserDeleted: false,
|
|
39
|
+
};
|
|
40
|
+
|
|
33
41
|
// manually setup the token for ws transport
|
|
34
42
|
if (client.ws) client.ws.io.opts.query = { token: accessToken };
|
|
35
43
|
|
|
@@ -26,6 +26,8 @@ const idResolvers: Resolvers = {
|
|
|
26
26
|
channelUnreadInfo: ({ channelId }) => channelId,
|
|
27
27
|
subChannelUnreadInfo: ({ subChannelId }) => subChannelId,
|
|
28
28
|
|
|
29
|
+
channelUnread: ({ channelId }) => channelId,
|
|
30
|
+
|
|
29
31
|
channelMarker: ({ entityId, userId }) => `${entityId}#${userId}`,
|
|
30
32
|
subChannelMarker: ({ entityId, feedId, userId }) => `${entityId}#${feedId}#${userId}`,
|
|
31
33
|
messageMarker: ({ feedId, contentId, creatorId }) => `${feedId}#${contentId}#${creatorId}`,
|
|
@@ -59,9 +61,6 @@ const idResolvers: Resolvers = {
|
|
|
59
61
|
|
|
60
62
|
pin: ({ placement, referenceId }) => `${placement}#${referenceId}`,
|
|
61
63
|
pinTarget: ({ targetId }) => targetId,
|
|
62
|
-
|
|
63
|
-
notificationTrayItem: ({ _id }) => _id,
|
|
64
|
-
notificationTraySeen: ({ userId }) => userId,
|
|
65
64
|
};
|
|
66
65
|
|
|
67
66
|
/**
|
package/src/core/model/index.ts
CHANGED
|
@@ -42,7 +42,7 @@ export const uploadFile = async <T extends Amity.FileType = any>(
|
|
|
42
42
|
? (formData as any).getHeaders()
|
|
43
43
|
: { 'content-type': 'multipart/form-data' };
|
|
44
44
|
|
|
45
|
-
const { data } = await client.
|
|
45
|
+
const { data } = await client.upload.post<Amity.CreateFilePayload<T>>('/api/v4/files', formData, {
|
|
46
46
|
headers,
|
|
47
47
|
onUploadProgress({ loaded, total = 100 }) {
|
|
48
48
|
onProgress && onProgress(Math.round((loaded * 100) / total));
|
|
@@ -42,7 +42,7 @@ export const uploadImage = async (
|
|
|
42
42
|
? (formData as any).getHeaders()
|
|
43
43
|
: { 'content-type': 'multipart/form-data' };
|
|
44
44
|
|
|
45
|
-
const { data } = await client.
|
|
45
|
+
const { data } = await client.upload.post<Amity.CreateFilePayload<'image'>>(
|
|
46
46
|
'/api/v4/images',
|
|
47
47
|
formData,
|
|
48
48
|
{
|
|
@@ -48,7 +48,7 @@ export const uploadVideo = async (
|
|
|
48
48
|
? (formData as any).getHeaders()
|
|
49
49
|
: { 'content-type': 'multipart/form-data' };
|
|
50
50
|
|
|
51
|
-
const { data } = await client.
|
|
51
|
+
const { data } = await client.upload.post<Amity.CreateFilePayload<'video'>>(
|
|
52
52
|
'/api/v4/videos',
|
|
53
53
|
formData,
|
|
54
54
|
{
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { createEventSubscriber } from '~/core/events';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Internal used only
|
|
6
|
+
*
|
|
7
|
+
* Fired when an {@link Amity.channelUnreadInfo} has been updated.
|
|
8
|
+
*
|
|
9
|
+
* @param callback The function to call when the event was fired
|
|
10
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
11
|
+
*
|
|
12
|
+
* @category ChannelMarker Events
|
|
13
|
+
*/
|
|
14
|
+
export const onChannelUnreadInfoUpdatedLocal = (
|
|
15
|
+
callback: Amity.Listener<Amity.Events['local.channelUnreadInfo.updated']>,
|
|
16
|
+
): Amity.Unsubscriber => {
|
|
17
|
+
const client = getActiveClient();
|
|
18
|
+
|
|
19
|
+
const filter = (payload: Amity.Events['local.channelUnreadInfo.updated']) => {
|
|
20
|
+
callback(payload);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return createEventSubscriber(
|
|
24
|
+
client,
|
|
25
|
+
'channelMarker/onChannelUnreadInfoUpdatedLocal',
|
|
26
|
+
'local.channelUnreadInfo.updated',
|
|
27
|
+
filter,
|
|
28
|
+
);
|
|
29
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
-
import { createEventSubscriber } from '~/core/events';
|
|
2
|
+
import { createEventSubscriber, fireEvent } from '~/core/events';
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
import { updateSubChannelUnreadFromMessage } from '~/marker/utils/updateSubChannelUnreadFromMessage';
|
|
5
5
|
import { reCalculateChannelUnreadInfo } from '~/marker/utils/reCalculateChannelUnreadInfo';
|
|
6
6
|
import { getActiveUser } from '~/client/api/activeUser';
|
|
7
7
|
import { markReadMessage } from '../utils/markReadMessage';
|
|
8
8
|
import { prepareMessagePayload } from '../utils';
|
|
9
|
+
import { pullFromCache, pushToCache } from '~/cache/api';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* ```js
|
|
@@ -40,6 +41,49 @@ export const onMessageCreatedMqtt = (
|
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
if (client.useLegacyUnreadCount) {
|
|
45
|
+
rawPayload.messages.forEach(message => {
|
|
46
|
+
const channelUnread = pullFromCache<Amity.ChannelUnread>([
|
|
47
|
+
'channelUnread',
|
|
48
|
+
'get',
|
|
49
|
+
message.channelId,
|
|
50
|
+
])?.data;
|
|
51
|
+
|
|
52
|
+
if (
|
|
53
|
+
!channelUnread ||
|
|
54
|
+
channelUnread.lastSegment >= message.segment ||
|
|
55
|
+
typeof channelUnread.readToSegment !== 'number' ||
|
|
56
|
+
typeof channelUnread.lastMentionedSegment !== 'number'
|
|
57
|
+
)
|
|
58
|
+
return;
|
|
59
|
+
|
|
60
|
+
const lastSegment = message.segment;
|
|
61
|
+
const isMentionedInMessage = message.mentionedUsers?.some(mention => {
|
|
62
|
+
return (
|
|
63
|
+
mention.type === 'channel' ||
|
|
64
|
+
(mention.type === 'user' &&
|
|
65
|
+
client.userId &&
|
|
66
|
+
mention.userPublicIds.includes(client.userId))
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const lastMentionedSegment = isMentionedInMessage
|
|
71
|
+
? message.segment
|
|
72
|
+
: channelUnread.lastMentionedSegment;
|
|
73
|
+
|
|
74
|
+
const updatedChannelUnread: Amity.ChannelUnread = {
|
|
75
|
+
...channelUnread,
|
|
76
|
+
lastSegment,
|
|
77
|
+
unreadCount: Math.max(lastSegment - channelUnread.readToSegment, 0),
|
|
78
|
+
lastMentionedSegment,
|
|
79
|
+
isMentioned: !(channelUnread.readToSegment >= lastMentionedSegment),
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
pushToCache(['channelUnread', 'get', message.channelId], updatedChannelUnread);
|
|
83
|
+
fireEvent('local.channelUnread.updated', updatedChannelUnread);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
43
87
|
// Update in cache
|
|
44
88
|
ingestInCache(payload);
|
|
45
89
|
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
1
2
|
import ReadReceiptSyncEngine from '~/client/utils/ReadReceiptSync/readReceiptSyncEngine';
|
|
3
|
+
import LegacyReadReceiptSyncEngine from '~/client/utils/ReadReceiptSync/legacyReadReceiptSyncEngine';
|
|
2
4
|
|
|
3
5
|
export const markReadMessage = (message: Amity.InternalMessage) => {
|
|
4
|
-
const
|
|
5
|
-
const markReadReceiptEngine = ReadReceiptSyncEngine.getInstance();
|
|
6
|
+
const client = getActiveClient();
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
if (client.useLegacyUnreadCount) {
|
|
9
|
+
const markReadReceiptEngine = ReadReceiptSyncEngine.getInstance();
|
|
10
|
+
markReadReceiptEngine.markRead(message.channelId, message.channelSegment);
|
|
11
|
+
} else {
|
|
12
|
+
const markReadReceiptEngine = LegacyReadReceiptSyncEngine.getInstance();
|
|
13
|
+
markReadReceiptEngine.markRead(message.subChannelId, message.channelSegment);
|
|
14
|
+
}
|
|
8
15
|
};
|
|
@@ -10,7 +10,6 @@ import { reactorLinkedObject } from './reactorLinkedObject';
|
|
|
10
10
|
import { channelLinkedObject } from './channelLinkedObject';
|
|
11
11
|
import { adLinkedObject } from './adLinkedObject';
|
|
12
12
|
import { pinnedPostLinkedObject } from './pinnedPostLinkedObject';
|
|
13
|
-
import { notificationTrayLinkedObject } from './notificationTrayLinkedObject';
|
|
14
13
|
|
|
15
14
|
export const LinkedObject = {
|
|
16
15
|
ad: adLinkedObject,
|
|
@@ -25,5 +24,4 @@ export const LinkedObject = {
|
|
|
25
24
|
reactor: reactorLinkedObject,
|
|
26
25
|
channel: channelLinkedObject,
|
|
27
26
|
pinnedPost: pinnedPostLinkedObject,
|
|
28
|
-
notificationTray: notificationTrayLinkedObject,
|
|
29
27
|
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
declare global {
|
|
3
|
-
namespace Amity {
|
|
4
|
-
const enum TrayItemCategoryType {
|
|
5
|
-
POST_MENTION = "mention_in_post",
|
|
6
|
-
COMMENT_MENTION = "mention_in_comment",
|
|
7
|
-
POST_REACT = "react_to_post",
|
|
8
|
-
COMMENT_REACT = "react_to_comment"
|
|
9
|
-
}
|
|
10
|
-
const enum TrayAction {
|
|
11
|
-
POST = "post",
|
|
12
|
-
POLL = "poll",
|
|
13
|
-
COMMENT = "comment",
|
|
14
|
-
REACTION = "reaction",
|
|
15
|
-
MENTION = "mention",
|
|
16
|
-
REPLY = "reply"
|
|
17
|
-
}
|
|
18
|
-
type RawNotificationTrayItem = {
|
|
19
|
-
_id: string;
|
|
20
|
-
lastSeenAt: Amity.timestamp;
|
|
21
|
-
lastOccuredAt: Amity.timestamp;
|
|
22
|
-
actors: {
|
|
23
|
-
_id: string;
|
|
24
|
-
lastActedAt: Amity.timestamp;
|
|
25
|
-
}[];
|
|
26
|
-
actorsCount: number;
|
|
27
|
-
action: TrayAction;
|
|
28
|
-
trayItemCategory?: TrayItemCategoryType;
|
|
29
|
-
targetId: string;
|
|
30
|
-
targetType: string;
|
|
31
|
-
referenceId?: string;
|
|
32
|
-
referenceType?: string;
|
|
33
|
-
actionReferenceId?: string;
|
|
34
|
-
parentId?: string;
|
|
35
|
-
data: {
|
|
36
|
-
communityName: string;
|
|
37
|
-
} | {
|
|
38
|
-
reactionName: string[];
|
|
39
|
-
};
|
|
40
|
-
text: string;
|
|
41
|
-
templatedText: string;
|
|
42
|
-
};
|
|
43
|
-
type InternalNotificationTrayItem = RawNotificationTrayItem;
|
|
44
|
-
type QueryNotificationTrayItem = {
|
|
45
|
-
token?: Amity.Token;
|
|
46
|
-
limit?: Amity.PageLimit['limit'];
|
|
47
|
-
};
|
|
48
|
-
type NotificationTrayItemLiveCollection = Amity.LiveCollectionParams<Omit<QueryNotificationTrayItem, 'limit'>>;
|
|
49
|
-
type NotificationTrayItemLiveCollectionCache = Amity.LiveCollectionCache<Amity.InternalNotificationTrayItem['_id'], Pick<QueryNotificationTrayItem, 'limit'>>;
|
|
50
|
-
type NotificationTrayItem = Amity.InternalNotificationTrayItem & {
|
|
51
|
-
markRead: () => void;
|
|
52
|
-
isSeen: boolean;
|
|
53
|
-
isRecent: boolean;
|
|
54
|
-
users: Amity.User[];
|
|
55
|
-
};
|
|
56
|
-
type RawNotificationTraySeen = {
|
|
57
|
-
lastTraySeenAt: Amity.timestamp;
|
|
58
|
-
lastTrayOccuredAt: Amity.timestamp;
|
|
59
|
-
};
|
|
60
|
-
type RawNotificationTraySeenUpdated = {
|
|
61
|
-
lastTraySeenAt: Amity.timestamp;
|
|
62
|
-
};
|
|
63
|
-
type InternalNotificationTraySeen = RawNotificationTraySeen & {
|
|
64
|
-
userId: string;
|
|
65
|
-
};
|
|
66
|
-
type NotificationTraySeen = RawNotificationTraySeen & {
|
|
67
|
-
userId: string;
|
|
68
|
-
isSeen: boolean;
|
|
69
|
-
};
|
|
70
|
-
type RawNotificationItemSeen = {
|
|
71
|
-
lastSeenAt: Amity.timestamp;
|
|
72
|
-
};
|
|
73
|
-
type QueryNotificationItemSeen = {
|
|
74
|
-
trayItems: {
|
|
75
|
-
id: string;
|
|
76
|
-
lastSeenAt: Amity.timestamp;
|
|
77
|
-
}[];
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=notification.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/notification.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"onChannelUnreadUpdatedLocal.d.ts","sourceRoot":"","sources":["../../../src/marker/events/onChannelUnreadUpdatedLocal.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,aAC5B,MAAM,QAAQ,CAAC,MAAM,MAAM,CAAC,6BAA6B,CAAC,CAAC,KACpE,MAAM,YAaR,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ```js
|
|
3
|
-
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
4
|
-
* const updated = await NotificationTrayRepository.markNotificationItemsSeen()
|
|
5
|
-
* ```
|
|
6
|
-
*
|
|
7
|
-
* Updates an {@link Amity.NotificationItemSeen}
|
|
8
|
-
*
|
|
9
|
-
* @param trayItems[] that include id and lastTraySeenAt, The ID of the {@link Amity.NotificationItemSeen} to edit
|
|
10
|
-
* @returns the updated {@link Amity.NotificationItemSeen} object
|
|
11
|
-
*
|
|
12
|
-
* @category NotificationItemSeen API
|
|
13
|
-
* @async
|
|
14
|
-
*/
|
|
15
|
-
export declare const markNotificationItemsSeen: (patch: Amity.QueryNotificationItemSeen) => Promise<void>;
|
|
16
|
-
//# sourceMappingURL=markNotificationItemsSeen.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markNotificationItemsSeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/api/markNotificationItemsSeen.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,UAAiB,MAAM,yBAAyB,kBAoCrF,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ```js
|
|
3
|
-
* import { NotificationTrayRepository } from '@amityco/ts-sdk'
|
|
4
|
-
* const updated = await NotificationTrayRepository.markNotificationTraySeen({
|
|
5
|
-
* lastSeenAt: Amity.timestamp,
|
|
6
|
-
* })
|
|
7
|
-
* ```
|
|
8
|
-
*
|
|
9
|
-
* Updates an {@link Amity.NotificationTraySeen}
|
|
10
|
-
*
|
|
11
|
-
* @param userId The ID of the {@link Amity.NotificationTraySeen} to edit
|
|
12
|
-
* @param lastSeenAt The patch data to apply
|
|
13
|
-
* @returns the updated {@link Amity.NotificationTraySeen} object
|
|
14
|
-
*
|
|
15
|
-
* @category Post API
|
|
16
|
-
* @async
|
|
17
|
-
*/
|
|
18
|
-
export declare const markNotificationTraySeen: (lastSeenAt: Amity.timestamp) => Promise<Amity.Cached<Amity.NotificationTraySeenUpdatedPayload>>;
|
|
19
|
-
//# sourceMappingURL=markNotificationTraySeen.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markNotificationTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/api/markNotificationTraySeen.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,eACvB,MAAM,SAAS,KAC1B,QAAQ,MAAM,MAAM,CAAC,MAAM,kCAAkC,CAAC,CAqChE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
|