@onyx-p/imlib-web 1.5.0 → 1.5.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/index.esm.js +48 -14
- package/index.umd.js +48 -14
- package/package.json +1 -1
- package/types/types.d.ts +4 -2
package/index.esm.js
CHANGED
@@ -18486,9 +18486,9 @@ const getRemoteMessages = params => {
|
|
18486
18486
|
rows: params.count
|
18487
18487
|
};
|
18488
18488
|
if (params.newToOld) {
|
18489
|
-
reqParams.offset = Long.
|
18489
|
+
reqParams.offset = Long.fromString(params.offset);
|
18490
18490
|
} else {
|
18491
|
-
reqParams.oldOffset = Long.
|
18491
|
+
reqParams.oldOffset = Long.fromString(params.offset);
|
18492
18492
|
}
|
18493
18493
|
return webSocketServer.send(CmdIds$1.GetRemoteMessages, reqParams, {
|
18494
18494
|
encoder: GetHistoryMessageReq,
|
@@ -18996,6 +18996,14 @@ const ConversationKey2StorageKey = {
|
|
18996
18996
|
mentionedUIds: {
|
18997
18997
|
keyName: 'mu',
|
18998
18998
|
defaultVal: null
|
18999
|
+
},
|
19000
|
+
dialogTitle: {
|
19001
|
+
keyName: 'dt',
|
19002
|
+
defaultVal: null
|
19003
|
+
},
|
19004
|
+
smallAvatarUrl: {
|
19005
|
+
keyName: 'sa',
|
19006
|
+
defaultVal: null
|
18999
19007
|
}
|
19000
19008
|
};
|
19001
19009
|
class ConversationStore {
|
@@ -19313,7 +19321,9 @@ class ConversationManager {
|
|
19313
19321
|
targetId,
|
19314
19322
|
isTop,
|
19315
19323
|
notificationStatus,
|
19316
|
-
notificationLevel
|
19324
|
+
notificationLevel,
|
19325
|
+
dialogTitle,
|
19326
|
+
smallAvatarUrl
|
19317
19327
|
} = conversation;
|
19318
19328
|
this.localConversationSet.add(this.getConversationKey(conversation));
|
19319
19329
|
this.addStatus({
|
@@ -19321,7 +19331,9 @@ class ConversationManager {
|
|
19321
19331
|
targetId,
|
19322
19332
|
isTop,
|
19323
19333
|
notificationStatus,
|
19324
|
-
notificationLevel
|
19334
|
+
notificationLevel,
|
19335
|
+
dialogTitle,
|
19336
|
+
smallAvatarUrl
|
19325
19337
|
}, false);
|
19326
19338
|
}
|
19327
19339
|
addStatus(statusItem, shouldNotify = false) {
|
@@ -19330,7 +19342,9 @@ class ConversationManager {
|
|
19330
19342
|
targetId,
|
19331
19343
|
notificationStatus,
|
19332
19344
|
notificationLevel,
|
19333
|
-
isTop
|
19345
|
+
isTop,
|
19346
|
+
dialogTitle,
|
19347
|
+
smallAvatarUrl
|
19334
19348
|
} = statusItem;
|
19335
19349
|
const conOpt = {
|
19336
19350
|
conversationType,
|
@@ -19357,10 +19371,24 @@ class ConversationManager {
|
|
19357
19371
|
val: isTop
|
19358
19372
|
};
|
19359
19373
|
}
|
19374
|
+
if (isDef(dialogTitle) && storageConversation.dialogTitle !== dialogTitle) {
|
19375
|
+
updatedItems.dialogTitle = {
|
19376
|
+
time: updatedTime,
|
19377
|
+
val: dialogTitle
|
19378
|
+
};
|
19379
|
+
}
|
19380
|
+
if (isDef(smallAvatarUrl) && storageConversation.smallAvatarUrl !== smallAvatarUrl) {
|
19381
|
+
updatedItems.smallAvatarUrl = {
|
19382
|
+
time: updatedTime,
|
19383
|
+
val: smallAvatarUrl
|
19384
|
+
};
|
19385
|
+
}
|
19360
19386
|
this.store.set(conOpt, {
|
19361
19387
|
notificationStatus,
|
19362
19388
|
isTop,
|
19363
|
-
notificationLevel
|
19389
|
+
notificationLevel,
|
19390
|
+
dialogTitle,
|
19391
|
+
smallAvatarUrl
|
19364
19392
|
});
|
19365
19393
|
if (Object.keys(updatedItems).length && shouldNotify) {
|
19366
19394
|
this.setUpdatedConversation({
|
@@ -19544,7 +19572,9 @@ class ConversationManager {
|
|
19544
19572
|
unreadMentionedCount,
|
19545
19573
|
notificationLevel,
|
19546
19574
|
notificationStatus,
|
19547
|
-
isTop
|
19575
|
+
isTop,
|
19576
|
+
dialogTitle,
|
19577
|
+
smallAvatarUrl
|
19548
19578
|
}) => ({
|
19549
19579
|
conversationType,
|
19550
19580
|
targetId,
|
@@ -19552,7 +19582,9 @@ class ConversationManager {
|
|
19552
19582
|
unreadMentionedCount: unreadMentionedCount ?? 0,
|
19553
19583
|
notificationLevel,
|
19554
19584
|
notificationStatus,
|
19555
|
-
isTop
|
19585
|
+
isTop,
|
19586
|
+
dialogTitle,
|
19587
|
+
smallAvatarUrl
|
19556
19588
|
}));
|
19557
19589
|
}
|
19558
19590
|
destroyed() {
|
@@ -19600,7 +19632,9 @@ const nullConversationManager = {
|
|
19600
19632
|
return [];
|
19601
19633
|
},
|
19602
19634
|
addLocalConversation: function (conversation) {},
|
19603
|
-
loadConvsationsIfNotExist: function (list) {
|
19635
|
+
loadConvsationsIfNotExist: function (list) {
|
19636
|
+
return Promise.resolve();
|
19637
|
+
},
|
19604
19638
|
destroyed() {},
|
19605
19639
|
syncConversationStatus: function () {}
|
19606
19640
|
};
|
@@ -19705,7 +19739,7 @@ class MessageLoader {
|
|
19705
19739
|
targetId: dialogId
|
19706
19740
|
};
|
19707
19741
|
});
|
19708
|
-
ConversationManager$1.get().loadConvsationsIfNotExist(cons);
|
19742
|
+
await ConversationManager$1.get().loadConvsationsIfNotExist(cons);
|
19709
19743
|
ServerMessageParser.parse(msg, (done, outputMsgs) => {
|
19710
19744
|
const messages = [];
|
19711
19745
|
const conversations = [];
|
@@ -27148,7 +27182,9 @@ function beforeSend(conversation, message, options) {
|
|
27148
27182
|
async function send(message, sentArgs) {
|
27149
27183
|
const dialogId = getFullDialogId(sentArgs.conversation);
|
27150
27184
|
const receivedMessage = transSentAttrs2IReceivedMessage(message, sentArgs);
|
27151
|
-
message.isPersited
|
27185
|
+
if (message.isPersited) {
|
27186
|
+
await ConversationManager$1.get().loadConvsationsIfNotExist([sentArgs.conversation]);
|
27187
|
+
}
|
27152
27188
|
const secretKey = await DialogSecretKey$1.getDialogAesKey(dialogId.toString());
|
27153
27189
|
if (!secretKey) {
|
27154
27190
|
receivedMessage.sentStatus = SentStatus.FAILED;
|
@@ -27313,10 +27349,9 @@ class IMClient extends EventEmitter {
|
|
27313
27349
|
recallMsg = sendRecallMessage;
|
27314
27350
|
async getRemoteHistoryMessages(conversation, options) {
|
27315
27351
|
const dialogId = getFullDialogId(conversation);
|
27316
|
-
debugger;
|
27317
27352
|
return getRemoteMessages({
|
27318
27353
|
dialogId,
|
27319
|
-
offset: options.timestamp ?? 0,
|
27354
|
+
offset: options.timestamp ?? "0",
|
27320
27355
|
count: options.count ?? 20,
|
27321
27356
|
newToOld: options.order === 0
|
27322
27357
|
}).then(({
|
@@ -27331,7 +27366,6 @@ class IMClient extends EventEmitter {
|
|
27331
27366
|
});
|
27332
27367
|
return;
|
27333
27368
|
}
|
27334
|
-
debugger;
|
27335
27369
|
ServerMessageParser.parse({
|
27336
27370
|
[dialogId]: data.msg ?? {}
|
27337
27371
|
}, (_, outputMsgs) => {
|
package/index.umd.js
CHANGED
@@ -18492,9 +18492,9 @@
|
|
18492
18492
|
rows: params.count
|
18493
18493
|
};
|
18494
18494
|
if (params.newToOld) {
|
18495
|
-
reqParams.offset = Long.
|
18495
|
+
reqParams.offset = Long.fromString(params.offset);
|
18496
18496
|
} else {
|
18497
|
-
reqParams.oldOffset = Long.
|
18497
|
+
reqParams.oldOffset = Long.fromString(params.offset);
|
18498
18498
|
}
|
18499
18499
|
return webSocketServer.send(CmdIds$1.GetRemoteMessages, reqParams, {
|
18500
18500
|
encoder: GetHistoryMessageReq,
|
@@ -19002,6 +19002,14 @@
|
|
19002
19002
|
mentionedUIds: {
|
19003
19003
|
keyName: 'mu',
|
19004
19004
|
defaultVal: null
|
19005
|
+
},
|
19006
|
+
dialogTitle: {
|
19007
|
+
keyName: 'dt',
|
19008
|
+
defaultVal: null
|
19009
|
+
},
|
19010
|
+
smallAvatarUrl: {
|
19011
|
+
keyName: 'sa',
|
19012
|
+
defaultVal: null
|
19005
19013
|
}
|
19006
19014
|
};
|
19007
19015
|
class ConversationStore {
|
@@ -19319,7 +19327,9 @@
|
|
19319
19327
|
targetId,
|
19320
19328
|
isTop,
|
19321
19329
|
notificationStatus,
|
19322
|
-
notificationLevel
|
19330
|
+
notificationLevel,
|
19331
|
+
dialogTitle,
|
19332
|
+
smallAvatarUrl
|
19323
19333
|
} = conversation;
|
19324
19334
|
this.localConversationSet.add(this.getConversationKey(conversation));
|
19325
19335
|
this.addStatus({
|
@@ -19327,7 +19337,9 @@
|
|
19327
19337
|
targetId,
|
19328
19338
|
isTop,
|
19329
19339
|
notificationStatus,
|
19330
|
-
notificationLevel
|
19340
|
+
notificationLevel,
|
19341
|
+
dialogTitle,
|
19342
|
+
smallAvatarUrl
|
19331
19343
|
}, false);
|
19332
19344
|
}
|
19333
19345
|
addStatus(statusItem, shouldNotify = false) {
|
@@ -19336,7 +19348,9 @@
|
|
19336
19348
|
targetId,
|
19337
19349
|
notificationStatus,
|
19338
19350
|
notificationLevel,
|
19339
|
-
isTop
|
19351
|
+
isTop,
|
19352
|
+
dialogTitle,
|
19353
|
+
smallAvatarUrl
|
19340
19354
|
} = statusItem;
|
19341
19355
|
const conOpt = {
|
19342
19356
|
conversationType,
|
@@ -19363,10 +19377,24 @@
|
|
19363
19377
|
val: isTop
|
19364
19378
|
};
|
19365
19379
|
}
|
19380
|
+
if (isDef(dialogTitle) && storageConversation.dialogTitle !== dialogTitle) {
|
19381
|
+
updatedItems.dialogTitle = {
|
19382
|
+
time: updatedTime,
|
19383
|
+
val: dialogTitle
|
19384
|
+
};
|
19385
|
+
}
|
19386
|
+
if (isDef(smallAvatarUrl) && storageConversation.smallAvatarUrl !== smallAvatarUrl) {
|
19387
|
+
updatedItems.smallAvatarUrl = {
|
19388
|
+
time: updatedTime,
|
19389
|
+
val: smallAvatarUrl
|
19390
|
+
};
|
19391
|
+
}
|
19366
19392
|
this.store.set(conOpt, {
|
19367
19393
|
notificationStatus,
|
19368
19394
|
isTop,
|
19369
|
-
notificationLevel
|
19395
|
+
notificationLevel,
|
19396
|
+
dialogTitle,
|
19397
|
+
smallAvatarUrl
|
19370
19398
|
});
|
19371
19399
|
if (Object.keys(updatedItems).length && shouldNotify) {
|
19372
19400
|
this.setUpdatedConversation({
|
@@ -19550,7 +19578,9 @@
|
|
19550
19578
|
unreadMentionedCount,
|
19551
19579
|
notificationLevel,
|
19552
19580
|
notificationStatus,
|
19553
|
-
isTop
|
19581
|
+
isTop,
|
19582
|
+
dialogTitle,
|
19583
|
+
smallAvatarUrl
|
19554
19584
|
}) => ({
|
19555
19585
|
conversationType,
|
19556
19586
|
targetId,
|
@@ -19558,7 +19588,9 @@
|
|
19558
19588
|
unreadMentionedCount: unreadMentionedCount ?? 0,
|
19559
19589
|
notificationLevel,
|
19560
19590
|
notificationStatus,
|
19561
|
-
isTop
|
19591
|
+
isTop,
|
19592
|
+
dialogTitle,
|
19593
|
+
smallAvatarUrl
|
19562
19594
|
}));
|
19563
19595
|
}
|
19564
19596
|
destroyed() {
|
@@ -19606,7 +19638,9 @@
|
|
19606
19638
|
return [];
|
19607
19639
|
},
|
19608
19640
|
addLocalConversation: function (conversation) {},
|
19609
|
-
loadConvsationsIfNotExist: function (list) {
|
19641
|
+
loadConvsationsIfNotExist: function (list) {
|
19642
|
+
return Promise.resolve();
|
19643
|
+
},
|
19610
19644
|
destroyed() {},
|
19611
19645
|
syncConversationStatus: function () {}
|
19612
19646
|
};
|
@@ -19711,7 +19745,7 @@
|
|
19711
19745
|
targetId: dialogId
|
19712
19746
|
};
|
19713
19747
|
});
|
19714
|
-
ConversationManager$1.get().loadConvsationsIfNotExist(cons);
|
19748
|
+
await ConversationManager$1.get().loadConvsationsIfNotExist(cons);
|
19715
19749
|
ServerMessageParser.parse(msg, (done, outputMsgs) => {
|
19716
19750
|
const messages = [];
|
19717
19751
|
const conversations = [];
|
@@ -27154,7 +27188,9 @@
|
|
27154
27188
|
async function send(message, sentArgs) {
|
27155
27189
|
const dialogId = getFullDialogId(sentArgs.conversation);
|
27156
27190
|
const receivedMessage = transSentAttrs2IReceivedMessage(message, sentArgs);
|
27157
|
-
message.isPersited
|
27191
|
+
if (message.isPersited) {
|
27192
|
+
await ConversationManager$1.get().loadConvsationsIfNotExist([sentArgs.conversation]);
|
27193
|
+
}
|
27158
27194
|
const secretKey = await DialogSecretKey$1.getDialogAesKey(dialogId.toString());
|
27159
27195
|
if (!secretKey) {
|
27160
27196
|
receivedMessage.sentStatus = exports.SentStatus.FAILED;
|
@@ -27319,10 +27355,9 @@
|
|
27319
27355
|
recallMsg = sendRecallMessage;
|
27320
27356
|
async getRemoteHistoryMessages(conversation, options) {
|
27321
27357
|
const dialogId = getFullDialogId(conversation);
|
27322
|
-
debugger;
|
27323
27358
|
return getRemoteMessages({
|
27324
27359
|
dialogId,
|
27325
|
-
offset: options.timestamp ?? 0,
|
27360
|
+
offset: options.timestamp ?? "0",
|
27326
27361
|
count: options.count ?? 20,
|
27327
27362
|
newToOld: options.order === 0
|
27328
27363
|
}).then(({
|
@@ -27337,7 +27372,6 @@
|
|
27337
27372
|
});
|
27338
27373
|
return;
|
27339
27374
|
}
|
27340
|
-
debugger;
|
27341
27375
|
ServerMessageParser.parse({
|
27342
27376
|
[dialogId]: data.msg ?? {}
|
27343
27377
|
}, (_, outputMsgs) => {
|
package/package.json
CHANGED
package/types/types.d.ts
CHANGED
@@ -65,12 +65,14 @@ export interface IConversationState extends IBaseConversationInfo {
|
|
65
65
|
notificationLevel: NotificationLevel;
|
66
66
|
notificationStatus: NotificationStatus;
|
67
67
|
isTop: boolean;
|
68
|
+
dialogTitle: string | null | undefined;
|
69
|
+
smallAvatarUrl: string | null | undefined;
|
68
70
|
}
|
69
71
|
/**
|
70
72
|
* 会话信息
|
71
73
|
*/
|
72
74
|
export type IConversationOption = IBaseConversationInfo;
|
73
|
-
export type IUpdatedConversationItemKeys = Extract<keyof IReceivedConversation, 'isTop' | 'notificationStatus' | 'notificationLevel' | 'unreadMessageCount' | 'hasMentioned' | 'unreadMentionedCount' | 'latestMessage'>;
|
75
|
+
export type IUpdatedConversationItemKeys = Extract<keyof IReceivedConversation, 'isTop' | 'notificationStatus' | 'notificationLevel' | 'unreadMessageCount' | 'hasMentioned' | 'unreadMentionedCount' | 'dialogTitle' | 'smallAvatarUrl' | 'latestMessage'>;
|
74
76
|
export type IUpdatedConversationItem = Partial<Record<IUpdatedConversationItemKeys, {
|
75
77
|
time: string;
|
76
78
|
val: any;
|
@@ -214,7 +216,7 @@ export type GetHistoryMessageOption = {
|
|
214
216
|
/**
|
215
217
|
* 获取此时间之前的消息,0 为从当前时间拉取
|
216
218
|
*/
|
217
|
-
timestamp?:
|
219
|
+
timestamp?: string;
|
218
220
|
/**
|
219
221
|
* 获取消息的数量,范围: 1-20
|
220
222
|
*/
|