@easemob-community/uikit-sdk-websdk5 1.6.0 → 1.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.
- package/dist/adapter/group-adapter.d.ts.map +1 -1
- package/dist/adapter/group-adapter.test.d.ts +2 -0
- package/dist/adapter/group-adapter.test.d.ts.map +1 -0
- package/dist/domain/__tests__/group-info-fields.test.d.ts +2 -0
- package/dist/domain/__tests__/group-info-fields.test.d.ts.map +1 -0
- package/dist/domain/group-domain.d.ts.map +1 -1
- package/dist/easemob-uikit-sdk-websdk5.js +290 -288
- package/dist/easemob-uikit-sdk-websdk5.umd.cjs +1 -1
- package/dist/event/__tests__/group-info-fields.test.d.ts +2 -0
- package/dist/event/__tests__/group-info-fields.test.d.ts.map +1 -0
- package/dist/event/group-events.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ChatClient as it, isSDKError as Ve, ChatManager as
|
|
2
|
-
import { log as
|
|
1
|
+
import { ChatClient as it, isSDKError as Ve, ChatManager as qe, ChatRoomManager as at, UserInfoManager as We, ContactManager as ct, GroupManager as ut, PresenceManager as dt, PushManager as lt } from "easemob-websdk";
|
|
2
|
+
import { log as Ce, customEventPreviewMap as gt, mergeMessagePreviewLabels as Je, MESSAGE_TYPE as b, resolveMultiBodyPreview as $e, isTextBody as ft, isImageBody as mt, MESSAGE_EXT_KEY as Qe, isVoiceBody as ze, isVideoBody as pt, isFileBody as ht, isLocationBody as vt, isCustomBody as It, isCmdBody as Mt, isCombineBody as Ye, CONVERSATION_TYPE as I, normalizeUserId as E, MESSAGE_STATUS as O, isMultiBody as yt, createLogger as T, toMessageRecord as we, formatConversationPreview as Xe, GROUP_MEMBER_ROLE as k, PRESENCE_STATUS as X, isKickErrorCode as bt, resolveLastMessageText as Ct, isStreamActive as wt, toConversationRecord as _e, NOTICE_EVENT_TYPE as A, SDK_CONTRACT_VERSION as St, normalizeLoginUserId as At } from "@easemob-community/uikit-sdk-contract";
|
|
3
3
|
import { normalizeUserId as rs } from "@easemob-community/uikit-sdk-contract";
|
|
4
|
-
import { markRaw as
|
|
4
|
+
import { markRaw as Ne, computed as me, reactive as Gt } from "vue";
|
|
5
5
|
let ce = null;
|
|
6
6
|
function qn(s) {
|
|
7
7
|
ce = s;
|
|
@@ -9,25 +9,25 @@ function qn(s) {
|
|
|
9
9
|
function Et(s) {
|
|
10
10
|
ce == null || ce(s);
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const Ze = "uikit-sdk-log-capture", Tt = /^%c\[Chat\]\[(DEBUG|WARN|ERROR)\]\[[^\]]*\]/, et = {
|
|
13
13
|
DEBUG: "debug",
|
|
14
14
|
WARN: "warn",
|
|
15
15
|
ERROR: "error"
|
|
16
16
|
};
|
|
17
|
-
let Q = !1, K = null,
|
|
17
|
+
let Q = !1, K = null, V = null, ue = null, Se = !1, H = null, de = null;
|
|
18
18
|
function Rt(s) {
|
|
19
19
|
de = s;
|
|
20
20
|
}
|
|
21
21
|
function ee(s, e, t) {
|
|
22
22
|
Q && Et({
|
|
23
|
-
level:
|
|
23
|
+
level: et[s],
|
|
24
24
|
source: "sdk",
|
|
25
25
|
message: typeof e == "string" ? e : String(e),
|
|
26
26
|
args: t
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
function pe(s, e, t) {
|
|
30
|
-
const n =
|
|
30
|
+
const n = V ?? console.log, o = (/* @__PURE__ */ new Date()).toISOString().slice(11, 23);
|
|
31
31
|
n.call(
|
|
32
32
|
console,
|
|
33
33
|
`%c[Chat][${s}][${o}]`,
|
|
@@ -37,7 +37,7 @@ function pe(s, e, t) {
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
function Ut() {
|
|
40
|
-
|
|
40
|
+
V || (V = console.log, console.log = (...s) => {
|
|
41
41
|
try {
|
|
42
42
|
const e = s[0];
|
|
43
43
|
if (typeof e == "string") {
|
|
@@ -46,11 +46,11 @@ function Ut() {
|
|
|
46
46
|
}
|
|
47
47
|
} catch {
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
V.apply(console, s);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
function Lt() {
|
|
53
|
-
|
|
53
|
+
V && (console.log = V, V = null);
|
|
54
54
|
}
|
|
55
55
|
async function Wn() {
|
|
56
56
|
var s;
|
|
@@ -60,10 +60,10 @@ async function Wn() {
|
|
|
60
60
|
const e = await import("easemob-websdk");
|
|
61
61
|
typeof e.setLogLevel == "function" && (e.setLogLevel("DEBUG"), Se = !0);
|
|
62
62
|
const t = e.LogEventName ? (s = e.ChatClient) == null ? void 0 : s.instance : null;
|
|
63
|
-
t && typeof t.addEventHandler == "function" ? (t.addEventHandler(
|
|
63
|
+
t && typeof t.addEventHandler == "function" ? (t.addEventHandler(Ze, {
|
|
64
64
|
onLog: (n) => {
|
|
65
65
|
const o = n;
|
|
66
|
-
o && typeof o.level == "string" && o.level in
|
|
66
|
+
o && typeof o.level == "string" && o.level in et && ee(o.level, o.message, [...o.args ?? []]);
|
|
67
67
|
}
|
|
68
68
|
}), H = t, K = "onlog") : typeof e.setLogger == "function" ? (ue = typeof e.getLogger == "function" ? e.getLogger() : null, e.setLogger({
|
|
69
69
|
debug: (n, ...o) => {
|
|
@@ -86,7 +86,7 @@ async function Jn() {
|
|
|
86
86
|
if (Q) {
|
|
87
87
|
Q = !1;
|
|
88
88
|
try {
|
|
89
|
-
K === "console" && Lt(), K === "onlog" && ((s = H == null ? void 0 : H.removeEventHandler) == null || s.call(H,
|
|
89
|
+
K === "console" && Lt(), K === "onlog" && ((s = H == null ? void 0 : H.removeEventHandler) == null || s.call(H, Ze));
|
|
90
90
|
const e = await import("easemob-websdk");
|
|
91
91
|
K === "inject" && typeof e.setLogger == "function" && ue && e.setLogger(ue), Se && !(de != null && de()) && typeof e.setLogLevel == "function" && e.setLogLevel("WARN");
|
|
92
92
|
} catch {
|
|
@@ -99,9 +99,9 @@ let Re = !1;
|
|
|
99
99
|
function $n() {
|
|
100
100
|
return Re;
|
|
101
101
|
}
|
|
102
|
-
let
|
|
102
|
+
let tt = null;
|
|
103
103
|
function Dt(s) {
|
|
104
|
-
const e =
|
|
104
|
+
const e = tt;
|
|
105
105
|
if (!e)
|
|
106
106
|
return s;
|
|
107
107
|
if (s.appKey !== e.appKey || s.appId !== e.appId)
|
|
@@ -111,7 +111,7 @@ function Dt(s) {
|
|
|
111
111
|
const { managers: t, ...n } = s, o = [];
|
|
112
112
|
for (const a of Object.keys(n))
|
|
113
113
|
JSON.stringify(n[a]) !== JSON.stringify(e[a]) && o.push(a);
|
|
114
|
-
return o.length > 0 &&
|
|
114
|
+
return o.length > 0 && Ce(
|
|
115
115
|
"[UIKit] SDK 已初始化,本次 init 配置以首次初始化为准(忽略字段:%s)。",
|
|
116
116
|
o.join(", ")
|
|
117
117
|
), { ...e, managers: t };
|
|
@@ -130,20 +130,20 @@ class _t {
|
|
|
130
130
|
enableUserInfoSync: a.enableUserInfoSync ?? !0,
|
|
131
131
|
managers: a.managers
|
|
132
132
|
});
|
|
133
|
-
this._deleteConversationOnGroupDestroyed = r.deleteConversationOnGroupDestroyed ?? !0, this._client = it.init(r),
|
|
133
|
+
this._deleteConversationOnGroupDestroyed = r.deleteConversationOnGroupDestroyed ?? !0, this._client = it.init(r), tt = r, t && (Re = !0, import("easemob-websdk").then(({ setLogLevel: c }) => {
|
|
134
134
|
c("DEBUG");
|
|
135
|
-
})), o ?
|
|
135
|
+
})), o ? Ce(
|
|
136
136
|
"%c[Easemob] SDK version: %s, %s version: %s, Adapter version: %s",
|
|
137
137
|
"color: green; font-weight: bold;",
|
|
138
138
|
"5.2.0",
|
|
139
139
|
n,
|
|
140
140
|
o,
|
|
141
|
-
"1.6.
|
|
142
|
-
) :
|
|
141
|
+
"1.6.1"
|
|
142
|
+
) : Ce(
|
|
143
143
|
"%c[Easemob] SDK version: %s, Adapter version: %s",
|
|
144
144
|
"color: green; font-weight: bold;",
|
|
145
145
|
"5.2.0",
|
|
146
|
-
"1.6.
|
|
146
|
+
"1.6.1"
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
get chatManager() {
|
|
@@ -247,18 +247,18 @@ function Ot(s) {
|
|
|
247
247
|
},
|
|
248
248
|
addContact(r) {
|
|
249
249
|
var c, u;
|
|
250
|
-
const i = e.findIndex((
|
|
250
|
+
const i = e.findIndex((f) => f.userId === r.userId);
|
|
251
251
|
i >= 0 ? e[i] = { ...e[i], ...r } : e.push(r), o(), (u = (c = s()) == null ? void 0 : c.onContactUpdated) == null || u.call(c, r);
|
|
252
252
|
},
|
|
253
253
|
removeContact(r) {
|
|
254
254
|
var c, u;
|
|
255
|
-
const i = e.find((
|
|
256
|
-
e = e.filter((
|
|
255
|
+
const i = e.find((f) => f.userId === r);
|
|
256
|
+
e = e.filter((f) => f.userId !== r), i && (o(), (u = (c = s()) == null ? void 0 : c.onContactUpdated) == null || u.call(c, i));
|
|
257
257
|
},
|
|
258
258
|
updateRemark(r, i) {
|
|
259
|
-
var u,
|
|
260
|
-
const c = e.findIndex((
|
|
261
|
-
c < 0 || (e[c] = { ...e[c], remark: i, name: i || e[c].name }, o(), (
|
|
259
|
+
var u, f;
|
|
260
|
+
const c = e.findIndex((m) => m.userId === r);
|
|
261
|
+
c < 0 || (e[c] = { ...e[c], remark: i, name: i || e[c].name }, o(), (f = (u = s()) == null ? void 0 : u.onContactUpdated) == null || f.call(u, e[c]));
|
|
262
262
|
},
|
|
263
263
|
setBlocklist(r) {
|
|
264
264
|
},
|
|
@@ -317,7 +317,7 @@ function xt(s) {
|
|
|
317
317
|
},
|
|
318
318
|
update(a, r) {
|
|
319
319
|
var c, u;
|
|
320
|
-
const i = e.findIndex((
|
|
320
|
+
const i = e.findIndex((f) => f.id === a);
|
|
321
321
|
i < 0 || (e[i] = { ...e[i], ...r }, o(), (u = (c = s()) == null ? void 0 : c.onConversationUpdated) == null || u.call(c, { id: a, conversation: r }));
|
|
322
322
|
},
|
|
323
323
|
setConversationList(a) {
|
|
@@ -351,8 +351,8 @@ function xt(s) {
|
|
|
351
351
|
}
|
|
352
352
|
function Pt(s) {
|
|
353
353
|
let e = [];
|
|
354
|
-
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set(),
|
|
355
|
-
function
|
|
354
|
+
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set(), f = !1;
|
|
355
|
+
function m() {
|
|
356
356
|
var g, d;
|
|
357
357
|
(d = (g = s()) == null ? void 0 : g.onGroupChange) == null || d.call(g, e);
|
|
358
358
|
}
|
|
@@ -361,25 +361,25 @@ function Pt(s) {
|
|
|
361
361
|
return e;
|
|
362
362
|
},
|
|
363
363
|
get loaded() {
|
|
364
|
-
return
|
|
364
|
+
return f;
|
|
365
365
|
},
|
|
366
366
|
setList(g) {
|
|
367
|
-
e = g,
|
|
367
|
+
e = g, m();
|
|
368
368
|
},
|
|
369
369
|
addGroup(g) {
|
|
370
370
|
var l, p;
|
|
371
371
|
const d = e.findIndex((h) => h.groupId === g.groupId);
|
|
372
|
-
d >= 0 ? e[d] = { ...e[d], ...g } : e.push(g),
|
|
372
|
+
d >= 0 ? e[d] = { ...e[d], ...g } : e.push(g), m(), (p = (l = s()) == null ? void 0 : l.onGroupUpdated) == null || p.call(l, g);
|
|
373
373
|
},
|
|
374
374
|
removeGroup(g) {
|
|
375
375
|
var l, p;
|
|
376
376
|
const d = e.find((h) => h.groupId === g);
|
|
377
|
-
e = e.filter((h) => h.groupId !== g), d && (
|
|
377
|
+
e = e.filter((h) => h.groupId !== g), d && (m(), (p = (l = s()) == null ? void 0 : l.onGroupUpdated) == null || p.call(l, d));
|
|
378
378
|
},
|
|
379
379
|
updateGroup(g, d) {
|
|
380
380
|
var p, h;
|
|
381
381
|
const l = e.findIndex((v) => v.groupId === g);
|
|
382
|
-
l < 0 || (e[l] = { ...e[l], ...d },
|
|
382
|
+
l < 0 || (e[l] = { ...e[l], ...d }, m(), (h = (p = s()) == null ? void 0 : p.onGroupUpdated) == null || h.call(p, e[l]));
|
|
383
383
|
},
|
|
384
384
|
setGroupMembers(g, d) {
|
|
385
385
|
var l, p;
|
|
@@ -387,9 +387,9 @@ function Pt(s) {
|
|
|
387
387
|
},
|
|
388
388
|
appendGroupMembers(g, d) {
|
|
389
389
|
var v, S;
|
|
390
|
-
const l = t.get(g) ?? [], p = new Map(l.map((
|
|
391
|
-
for (const
|
|
392
|
-
p.set(
|
|
390
|
+
const l = t.get(g) ?? [], p = new Map(l.map((C) => [C.userId, C]));
|
|
391
|
+
for (const C of d)
|
|
392
|
+
p.set(C.userId, C);
|
|
393
393
|
const h = Array.from(p.values());
|
|
394
394
|
t.set(g, h), (S = (v = s()) == null ? void 0 : v.onGroupMembersChanged) == null || S.call(v, { groupId: g, members: h });
|
|
395
395
|
},
|
|
@@ -400,7 +400,7 @@ function Pt(s) {
|
|
|
400
400
|
},
|
|
401
401
|
updateGroupMemberRole(g, d, l) {
|
|
402
402
|
var v, S;
|
|
403
|
-
const p = t.get(g) ?? [], h = p.findIndex((
|
|
403
|
+
const p = t.get(g) ?? [], h = p.findIndex((C) => C.userId === d);
|
|
404
404
|
h < 0 || (p[h] = { ...p[h], role: l }, t.set(g, p), (S = (v = s()) == null ? void 0 : v.onGroupMembersChanged) == null || S.call(v, { groupId: g, members: p }));
|
|
405
405
|
},
|
|
406
406
|
setGroupAnnouncement(g, d) {
|
|
@@ -498,17 +498,17 @@ function Bt(s) {
|
|
|
498
498
|
}
|
|
499
499
|
function a(i) {
|
|
500
500
|
for (const [c, u] of e) {
|
|
501
|
-
const
|
|
502
|
-
if (
|
|
503
|
-
return { list: u, index:
|
|
501
|
+
const f = u.findIndex((m) => m.msgServerId === i || m.msgLocalId === i);
|
|
502
|
+
if (f >= 0)
|
|
503
|
+
return { list: u, index: f, conversationId: c };
|
|
504
504
|
}
|
|
505
505
|
return null;
|
|
506
506
|
}
|
|
507
507
|
function r(i) {
|
|
508
|
-
const c = i, u = e.get(c.conversationId) ?? [],
|
|
509
|
-
(
|
|
508
|
+
const c = i, u = e.get(c.conversationId) ?? [], f = u.findIndex(
|
|
509
|
+
(m) => m.msgServerId && m.msgServerId === c.msgServerId
|
|
510
510
|
);
|
|
511
|
-
|
|
511
|
+
f >= 0 ? u[f] = c : u.push(c), u.sort((m, g) => (m.timestamp ?? 0) - (g.timestamp ?? 0)), e.set(c.conversationId, u);
|
|
512
512
|
}
|
|
513
513
|
return {
|
|
514
514
|
getMessages: o,
|
|
@@ -520,69 +520,69 @@ function Bt(s) {
|
|
|
520
520
|
t.set(i, c);
|
|
521
521
|
},
|
|
522
522
|
replaceWithSent(i, c) {
|
|
523
|
-
var u,
|
|
524
|
-
t.delete(i), r(c), (
|
|
523
|
+
var u, f;
|
|
524
|
+
t.delete(i), r(c), (f = (u = s()) == null ? void 0 : u.onMessage) == null || f.call(u, c);
|
|
525
525
|
},
|
|
526
526
|
updateUploadProgress(i, c) {
|
|
527
527
|
const u = t.get(i);
|
|
528
528
|
if (!u)
|
|
529
529
|
return;
|
|
530
|
-
const
|
|
531
|
-
if (
|
|
532
|
-
const
|
|
533
|
-
|
|
530
|
+
const f = a(u.msgLocalId || u.msgServerId || "");
|
|
531
|
+
if (f) {
|
|
532
|
+
const m = { ...f.list[f.index], progress: c };
|
|
533
|
+
f.list[f.index] = m;
|
|
534
534
|
}
|
|
535
535
|
},
|
|
536
536
|
markFailed(i, c) {
|
|
537
537
|
const u = t.get(i);
|
|
538
538
|
t.delete(i);
|
|
539
|
-
const
|
|
540
|
-
if (!
|
|
539
|
+
const f = (u == null ? void 0 : u.msgLocalId) || (u == null ? void 0 : u.msgServerId);
|
|
540
|
+
if (!f)
|
|
541
541
|
return;
|
|
542
|
-
const
|
|
543
|
-
if (
|
|
544
|
-
const g = { ...
|
|
545
|
-
|
|
542
|
+
const m = a(f);
|
|
543
|
+
if (m) {
|
|
544
|
+
const g = { ...m.list[m.index], status: "failed", failReason: c };
|
|
545
|
+
m.list[m.index] = g;
|
|
546
546
|
}
|
|
547
547
|
},
|
|
548
548
|
prependMessages(i, c) {
|
|
549
|
-
const u = e.get(i) ?? [],
|
|
549
|
+
const u = e.get(i) ?? [], f = /* @__PURE__ */ new Map();
|
|
550
550
|
for (const g of c) {
|
|
551
551
|
const d = g;
|
|
552
|
-
d.msgServerId &&
|
|
552
|
+
d.msgServerId && f.set(d.msgServerId, d);
|
|
553
553
|
}
|
|
554
554
|
for (const g of u)
|
|
555
|
-
g.msgServerId && !
|
|
556
|
-
const
|
|
555
|
+
g.msgServerId && !f.has(g.msgServerId) && f.set(g.msgServerId, g);
|
|
556
|
+
const m = Array.from(f.values()).sort(
|
|
557
557
|
(g, d) => (g.timestamp ?? 0) - (d.timestamp ?? 0)
|
|
558
558
|
);
|
|
559
|
-
e.set(i,
|
|
559
|
+
e.set(i, m);
|
|
560
560
|
},
|
|
561
561
|
updateStatusByServerId(i, c) {
|
|
562
|
-
var
|
|
562
|
+
var f, m;
|
|
563
563
|
const u = a(i);
|
|
564
|
-
u && (u.list[u.index] = { ...u.list[u.index], status: c }, (
|
|
564
|
+
u && (u.list[u.index] = { ...u.list[u.index], status: c }, (m = (f = s()) == null ? void 0 : f.onMessageStatusChanged) == null || m.call(f, { messageId: i, status: c }));
|
|
565
565
|
},
|
|
566
566
|
recallMessage(i, c) {
|
|
567
|
-
var
|
|
567
|
+
var m, g;
|
|
568
568
|
const u = a(i);
|
|
569
569
|
if (!u)
|
|
570
570
|
return;
|
|
571
|
-
const
|
|
572
|
-
|
|
571
|
+
const f = u.list[u.index];
|
|
572
|
+
f.recalled = !0, f.recalledBy = c, (g = (m = s()) == null ? void 0 : m.onMessagesRecalled) == null || g.call(m, {
|
|
573
573
|
messageId: i,
|
|
574
574
|
conversationId: u.conversationId,
|
|
575
|
-
conversationType:
|
|
575
|
+
conversationType: f.conversationType,
|
|
576
576
|
operatorId: c
|
|
577
577
|
});
|
|
578
578
|
},
|
|
579
579
|
updateMessage(i, c) {
|
|
580
|
-
var
|
|
580
|
+
var m, g;
|
|
581
581
|
const u = a(i);
|
|
582
582
|
if (!u)
|
|
583
583
|
return;
|
|
584
|
-
const
|
|
585
|
-
u.list[u.index] =
|
|
584
|
+
const f = c;
|
|
585
|
+
u.list[u.index] = f, f.modified && ((g = (m = s()) == null ? void 0 : m.onMessageUpdated) == null || g.call(m, f));
|
|
586
586
|
},
|
|
587
587
|
setPinnedMessages(i, c) {
|
|
588
588
|
},
|
|
@@ -590,8 +590,8 @@ function Bt(s) {
|
|
|
590
590
|
const u = a(i);
|
|
591
591
|
if (!u)
|
|
592
592
|
return;
|
|
593
|
-
const
|
|
594
|
-
|
|
593
|
+
const f = u.list[u.index];
|
|
594
|
+
f.translation = c, f.showTranslation = !0;
|
|
595
595
|
},
|
|
596
596
|
setTranslating(i, c) {
|
|
597
597
|
const u = a(i);
|
|
@@ -601,8 +601,8 @@ function Bt(s) {
|
|
|
601
601
|
const u = a(i);
|
|
602
602
|
if (!u)
|
|
603
603
|
return;
|
|
604
|
-
const
|
|
605
|
-
|
|
604
|
+
const f = u.list[u.index];
|
|
605
|
+
f.voiceText = c, f.showVoiceText = !0;
|
|
606
606
|
},
|
|
607
607
|
setVoiceTranscribing(i, c) {
|
|
608
608
|
const u = a(i);
|
|
@@ -616,35 +616,35 @@ function Bt(s) {
|
|
|
616
616
|
const u = a(i);
|
|
617
617
|
if (!u)
|
|
618
618
|
return;
|
|
619
|
-
const
|
|
620
|
-
u.list[u.index] =
|
|
619
|
+
const f = u.list[u.index], m = { ...f, ...c };
|
|
620
|
+
u.list[u.index] = m, (c.modified || c.modifiedInfo) && ((d = (g = s()) == null ? void 0 : g.onMessageUpdated) == null || d.call(g, m)), c.status && c.status !== f.status && ((p = (l = s()) == null ? void 0 : l.onMessageStatusChanged) == null || p.call(l, {
|
|
621
621
|
messageId: i,
|
|
622
622
|
status: c.status
|
|
623
623
|
}));
|
|
624
624
|
},
|
|
625
625
|
replaceMessageById(i, c) {
|
|
626
|
-
var
|
|
626
|
+
var m, g;
|
|
627
627
|
const u = a(i);
|
|
628
628
|
if (!u)
|
|
629
629
|
return;
|
|
630
|
-
const
|
|
631
|
-
u.list[u.index] =
|
|
630
|
+
const f = c;
|
|
631
|
+
u.list[u.index] = f, (g = (m = s()) == null ? void 0 : m.onMessageUpdated) == null || g.call(m, f);
|
|
632
632
|
},
|
|
633
633
|
addAtMeMessage(i, c) {
|
|
634
|
-
var u,
|
|
635
|
-
(
|
|
634
|
+
var u, f;
|
|
635
|
+
(f = (u = s()) == null ? void 0 : u.onAtMe) == null || f.call(u, { conversationId: i, messageId: c });
|
|
636
636
|
},
|
|
637
637
|
updateMessageStatus(i, c) {
|
|
638
|
-
var
|
|
638
|
+
var f, m;
|
|
639
639
|
const u = a(i);
|
|
640
|
-
u && (u.list[u.index] = { ...u.list[u.index], status: c }, (
|
|
640
|
+
u && (u.list[u.index] = { ...u.list[u.index], status: c }, (m = (f = s()) == null ? void 0 : f.onMessageStatusChanged) == null || m.call(f, { messageId: i, status: c }));
|
|
641
641
|
},
|
|
642
642
|
setMessagePinned(i, c) {
|
|
643
643
|
const u = a(i);
|
|
644
644
|
if (!u)
|
|
645
645
|
return;
|
|
646
|
-
const
|
|
647
|
-
|
|
646
|
+
const f = u.list[u.index];
|
|
647
|
+
f.pinned = !0, f.pinTime = c.pinTime, f.pinOperatorId = c.operatorId;
|
|
648
648
|
},
|
|
649
649
|
setMessageUnpinned(i) {
|
|
650
650
|
const c = a(i);
|
|
@@ -654,7 +654,7 @@ function Bt(s) {
|
|
|
654
654
|
u.pinned = !1;
|
|
655
655
|
},
|
|
656
656
|
deleteMessages(i) {
|
|
657
|
-
var
|
|
657
|
+
var f, m;
|
|
658
658
|
const c = new Set(i), u = /* @__PURE__ */ new Map();
|
|
659
659
|
for (const [g, d] of e) {
|
|
660
660
|
const l = [];
|
|
@@ -669,7 +669,7 @@ function Bt(s) {
|
|
|
669
669
|
e.set(g, l);
|
|
670
670
|
}
|
|
671
671
|
for (const [g, d] of u)
|
|
672
|
-
(
|
|
672
|
+
(m = (f = s()) == null ? void 0 : f.onMessagesDeleted) == null || m.call(f, { messageIds: d, conversationId: g });
|
|
673
673
|
},
|
|
674
674
|
setSyncingMessages(i) {
|
|
675
675
|
var c, u;
|
|
@@ -718,15 +718,15 @@ function Ht(s) {
|
|
|
718
718
|
i();
|
|
719
719
|
},
|
|
720
720
|
areAttributesFetched(c, u) {
|
|
721
|
-
const
|
|
722
|
-
return
|
|
721
|
+
const f = r.get(c);
|
|
722
|
+
return f ? u.every((m) => f.has(m)) : !1;
|
|
723
723
|
},
|
|
724
724
|
markFetchedAttributes(c, u) {
|
|
725
|
-
for (const
|
|
726
|
-
const
|
|
725
|
+
for (const f of c) {
|
|
726
|
+
const m = r.get(f) ?? /* @__PURE__ */ new Set();
|
|
727
727
|
for (const g of u)
|
|
728
|
-
|
|
729
|
-
r.set(
|
|
728
|
+
m.add(g);
|
|
729
|
+
r.set(f, m);
|
|
730
730
|
}
|
|
731
731
|
},
|
|
732
732
|
markLoading(c) {
|
|
@@ -784,7 +784,7 @@ function Kt(s, e) {
|
|
|
784
784
|
userInfo: Ht(e)
|
|
785
785
|
};
|
|
786
786
|
}
|
|
787
|
-
function
|
|
787
|
+
function jt() {
|
|
788
788
|
return {
|
|
789
789
|
enableContact: !0,
|
|
790
790
|
enableBlocklist: !0,
|
|
@@ -803,7 +803,7 @@ function Vt() {
|
|
|
803
803
|
filterBlockedContacts: !0
|
|
804
804
|
};
|
|
805
805
|
}
|
|
806
|
-
function
|
|
806
|
+
function Vt(s) {
|
|
807
807
|
if (s != null && s.fetchUserInfos)
|
|
808
808
|
return { fetchUserInfos: s.fetchUserInfos };
|
|
809
809
|
}
|
|
@@ -922,7 +922,7 @@ function $t(s) {
|
|
|
922
922
|
// 契约的 needReadReceipt 未透传:domain sendLocation 无此参数(SDK 不支持位置消息回执)
|
|
923
923
|
sendLocation: (n, o, a, r, i, c) => e.sendLocation(n, o, a, r, i, c),
|
|
924
924
|
sendCustom: (n, o, a, r, i) => {
|
|
925
|
-
const c = r ? Object.fromEntries(Object.entries(r).map(([u,
|
|
925
|
+
const c = r ? Object.fromEntries(Object.entries(r).map(([u, f]) => [u, String(f)])) : void 0;
|
|
926
926
|
return e.sendCustom(n, o, a, c, i);
|
|
927
927
|
},
|
|
928
928
|
sendCmd: (n, o, a, r) => e.sendCmd(n, o, a, r),
|
|
@@ -989,7 +989,7 @@ const Yt = T("UIKit:MessageAdapter"), Ue = {
|
|
|
989
989
|
customFallback: "[自定义]",
|
|
990
990
|
unknown: ""
|
|
991
991
|
};
|
|
992
|
-
function
|
|
992
|
+
function ke(s) {
|
|
993
993
|
if (s.event && typeof s.event == "string")
|
|
994
994
|
return s.event;
|
|
995
995
|
const e = s.params;
|
|
@@ -1012,15 +1012,15 @@ function P(s, e) {
|
|
|
1012
1012
|
localId: s.msgLocalId,
|
|
1013
1013
|
status: t && s.isPeerRead === !0 ? O.READ : s.sendStatus ?? O.SENT
|
|
1014
1014
|
};
|
|
1015
|
-
return
|
|
1015
|
+
return Ye(n.body) && n.body.messageList ? n.body = {
|
|
1016
1016
|
...n.body,
|
|
1017
|
-
messageList:
|
|
1018
|
-
} : yt(n.body) && (n.body =
|
|
1017
|
+
messageList: Ne([...n.body.messageList])
|
|
1018
|
+
} : yt(n.body) && (n.body = Ne([...n.body])), n;
|
|
1019
1019
|
}
|
|
1020
1020
|
function Qn(s, e) {
|
|
1021
1021
|
return s.map((t) => P(t, e));
|
|
1022
1022
|
}
|
|
1023
|
-
function
|
|
1023
|
+
function Oe(s) {
|
|
1024
1024
|
return {
|
|
1025
1025
|
...s,
|
|
1026
1026
|
isSelf: !1,
|
|
@@ -1028,7 +1028,7 @@ function ke(s) {
|
|
|
1028
1028
|
status: s.sendStatus ?? O.SENT
|
|
1029
1029
|
};
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1031
|
+
function xe(s, e) {
|
|
1032
1032
|
const t = s.from || "";
|
|
1033
1033
|
return {
|
|
1034
1034
|
...s,
|
|
@@ -1053,27 +1053,27 @@ function zn(s, e, t) {
|
|
|
1053
1053
|
var r;
|
|
1054
1054
|
if (!s)
|
|
1055
1055
|
return "";
|
|
1056
|
-
const n = t == null ? void 0 : t(
|
|
1056
|
+
const n = t == null ? void 0 : t(Oe(s));
|
|
1057
1057
|
if (n !== void 0)
|
|
1058
1058
|
return n;
|
|
1059
|
-
const o =
|
|
1060
|
-
return s.type === b.MULTI_BODY ?
|
|
1059
|
+
const o = Je({ ...Ue, ...e }), { body: a } = s;
|
|
1060
|
+
return s.type === b.MULTI_BODY ? $e(Oe(s), o) : ft(a) ? a.content || "" : mt(a) ? ((r = s.ext) == null ? void 0 : r[Qe.IS_STICKER]) === !0 ? o.sticker : o.image : ze(a) ? o.voice : pt(a) ? o.video : ht(a) ? a.filename || o.file : vt(a) ? o.location : It(a) ? o.custom[a.event || ""] || o.customFallback : Mt(a) ? "[命令]" : Ye(a) ? a.summary || o.combine : "";
|
|
1061
1061
|
}
|
|
1062
1062
|
function Xt(s, e, t, n) {
|
|
1063
1063
|
var i;
|
|
1064
1064
|
if (!s)
|
|
1065
1065
|
return "";
|
|
1066
|
-
const o = t == null ? void 0 : t(
|
|
1066
|
+
const o = t == null ? void 0 : t(xe(s, n));
|
|
1067
1067
|
if (o !== void 0)
|
|
1068
1068
|
return o;
|
|
1069
|
-
const a =
|
|
1069
|
+
const a = Je({ ...Ue, ...e }), r = Array.isArray(s.body) ? {} : s.body || {};
|
|
1070
1070
|
switch (s.type) {
|
|
1071
1071
|
case b.MULTI_BODY:
|
|
1072
|
-
return
|
|
1072
|
+
return $e(xe(s, n), a);
|
|
1073
1073
|
case b.TEXT:
|
|
1074
1074
|
return r.content || r.summary || "";
|
|
1075
1075
|
case b.IMAGE:
|
|
1076
|
-
return ((i = s.ext) == null ? void 0 : i[
|
|
1076
|
+
return ((i = s.ext) == null ? void 0 : i[Qe.IS_STICKER]) === !0 ? a.sticker : a.image;
|
|
1077
1077
|
case b.VOICE:
|
|
1078
1078
|
return a.voice;
|
|
1079
1079
|
case b.VIDEO:
|
|
@@ -1083,7 +1083,7 @@ function Xt(s, e, t, n) {
|
|
|
1083
1083
|
case b.LOCATION:
|
|
1084
1084
|
return a.location;
|
|
1085
1085
|
case b.CUSTOM: {
|
|
1086
|
-
const c =
|
|
1086
|
+
const c = ke(r);
|
|
1087
1087
|
return a.custom[c] || a.customFallback;
|
|
1088
1088
|
}
|
|
1089
1089
|
case b.CMD:
|
|
@@ -1091,7 +1091,7 @@ function Xt(s, e, t, n) {
|
|
|
1091
1091
|
case b.COMBINE:
|
|
1092
1092
|
return r.summary || a.combine;
|
|
1093
1093
|
default: {
|
|
1094
|
-
const c =
|
|
1094
|
+
const c = ke(r);
|
|
1095
1095
|
return c ? a.custom[c] || a.customFallback : r.content || r.summary || r.msg || "";
|
|
1096
1096
|
}
|
|
1097
1097
|
}
|
|
@@ -1231,12 +1231,12 @@ function rn(s) {
|
|
|
1231
1231
|
}), n.addEventListener("error", () => a(void 0)), setTimeout(() => a(void 0), 5e3);
|
|
1232
1232
|
});
|
|
1233
1233
|
}
|
|
1234
|
-
const
|
|
1234
|
+
const j = /* @__PURE__ */ new Set(), on = 5e3;
|
|
1235
1235
|
function an(s) {
|
|
1236
1236
|
for (const e of s)
|
|
1237
|
-
if (
|
|
1238
|
-
const t =
|
|
1239
|
-
t !== void 0 &&
|
|
1237
|
+
if (j.add(e), j.size > on) {
|
|
1238
|
+
const t = j.values().next().value;
|
|
1239
|
+
t !== void 0 && j.delete(t);
|
|
1240
1240
|
}
|
|
1241
1241
|
}
|
|
1242
1242
|
function se(s) {
|
|
@@ -1435,9 +1435,9 @@ class dn {
|
|
|
1435
1435
|
const r = performance.now();
|
|
1436
1436
|
try {
|
|
1437
1437
|
const c = await this.client.chatManager.sendMessage(e, {
|
|
1438
|
-
onFileUploadProgress: (
|
|
1438
|
+
onFileUploadProgress: (m) => {
|
|
1439
1439
|
o += 1;
|
|
1440
|
-
const g =
|
|
1440
|
+
const g = m.percent ?? 0, d = performance.now();
|
|
1441
1441
|
g < 100 && d - a < sn || (a = d, this.store.updateUploadProgress(t, g));
|
|
1442
1442
|
}
|
|
1443
1443
|
});
|
|
@@ -1447,8 +1447,8 @@ class dn {
|
|
|
1447
1447
|
});
|
|
1448
1448
|
const u = P(c, this.currentUserId);
|
|
1449
1449
|
this.store.replaceWithSent(t, u);
|
|
1450
|
-
const
|
|
1451
|
-
return
|
|
1450
|
+
const f = (i = this.options.persistence) == null ? void 0 : i.saveMessage;
|
|
1451
|
+
return f && se(() => f(we(c))), c;
|
|
1452
1452
|
} catch (c) {
|
|
1453
1453
|
n && he.warn("sendMessage failed", {
|
|
1454
1454
|
elapsedMs: Math.round(performance.now() - r),
|
|
@@ -1461,8 +1461,8 @@ class dn {
|
|
|
1461
1461
|
}
|
|
1462
1462
|
// ===== 历史消息 =====
|
|
1463
1463
|
async fetchHistory(e, t, n, o = 20) {
|
|
1464
|
-
var
|
|
1465
|
-
const a = (
|
|
1464
|
+
var f, m;
|
|
1465
|
+
const a = (f = this.options.messageRepository) == null ? void 0 : f.loadMessages;
|
|
1466
1466
|
if (a) {
|
|
1467
1467
|
const g = await a(e, t, n, o), d = g.list.filter((l) => l.type !== b.CMD).map((l) => cn(l, this.currentUserId));
|
|
1468
1468
|
return this.store.prependMessages(e, d), t === I.GROUPCHAT && this.fillGroupReadCounts(d, e), {
|
|
@@ -1490,8 +1490,8 @@ class dn {
|
|
|
1490
1490
|
});
|
|
1491
1491
|
const i = r.items.filter((g) => g.type !== b.CMD), c = i.map((g) => P(g, this.currentUserId));
|
|
1492
1492
|
this.store.prependMessages(e, c);
|
|
1493
|
-
const u = (
|
|
1494
|
-
return u && i.length > 0 && se(() => u(i.map((g) =>
|
|
1493
|
+
const u = (m = this.options.persistence) == null ? void 0 : m.saveMessages;
|
|
1494
|
+
return u && i.length > 0 && se(() => u(i.map((g) => we(g)))), t === I.GROUPCHAT && this.fillGroupReadCounts(c, e), {
|
|
1495
1495
|
list: c,
|
|
1496
1496
|
cursor: r.cursor,
|
|
1497
1497
|
hasMore: r.hasMore
|
|
@@ -1583,16 +1583,16 @@ class dn {
|
|
|
1583
1583
|
* 失败仅 warn 不阻塞进入会话(先标记后发送,失败回滚以便下次重试)。
|
|
1584
1584
|
*/
|
|
1585
1585
|
async sendPendingReadReceipts(e, t) {
|
|
1586
|
-
const o = this.store.getMessages(e).filter((a) => !a.isSelf && !
|
|
1586
|
+
const o = this.store.getMessages(e).filter((a) => !a.isSelf && !j.has(a.msgServerId)).map((a) => a.msgServerId).filter((a) => !!a);
|
|
1587
1587
|
if (o.length !== 0) {
|
|
1588
1588
|
N.info("[MessageDomain.sendPendingReadReceipts] 补发已读回执", { conversationId: e, conversationType: t, pendingCount: o.length, messageIds: o.slice(0, 5) });
|
|
1589
1589
|
for (const a of o)
|
|
1590
|
-
|
|
1590
|
+
j.add(a);
|
|
1591
1591
|
try {
|
|
1592
1592
|
await this.markMessagesRead(e, t, o);
|
|
1593
1593
|
} catch (a) {
|
|
1594
1594
|
for (const r of o)
|
|
1595
|
-
|
|
1595
|
+
j.delete(r);
|
|
1596
1596
|
N.warn("[MessageDomain.sendPendingReadReceipts] failed:", e, U(a));
|
|
1597
1597
|
}
|
|
1598
1598
|
}
|
|
@@ -1626,7 +1626,7 @@ class dn {
|
|
|
1626
1626
|
}
|
|
1627
1627
|
/** 语音消息转文字 */
|
|
1628
1628
|
async transcribeVoiceMessage(e, t) {
|
|
1629
|
-
if (!
|
|
1629
|
+
if (!ze(e.body))
|
|
1630
1630
|
throw N.warn("[MessageDomain.transcribeVoiceMessage] not a voice message:", e), new Error("not a voice message");
|
|
1631
1631
|
const n = {
|
|
1632
1632
|
...e.body,
|
|
@@ -1703,11 +1703,11 @@ class dn {
|
|
|
1703
1703
|
}
|
|
1704
1704
|
}
|
|
1705
1705
|
function ln(s, e) {
|
|
1706
|
-
var u,
|
|
1706
|
+
var u, f, m, g, d, l;
|
|
1707
1707
|
const t = Xt(s.lastMessage, void 0, e == null ? void 0 : e.lastMessageTextResolver, {
|
|
1708
1708
|
conversationId: s.conversationId,
|
|
1709
1709
|
conversationType: s.conversationType
|
|
1710
|
-
}), n = E(((u = s.lastMessage) == null ? void 0 : u.from) || ""), o = E(((
|
|
1710
|
+
}), n = E(((u = s.lastMessage) == null ? void 0 : u.from) || ""), o = E(((m = (f = s.lastMessage) == null ? void 0 : f.sender) == null ? void 0 : m.userId) || ""), a = o || n, r = a ? (g = e == null ? void 0 : e.resolveSenderName) == null ? void 0 : g.call(e, a) : void 0, i = ((l = (d = s.lastMessage) == null ? void 0 : d.sender) == null ? void 0 : l.nickname) || r || o || n || "", c = Xe(s.conversationType, i, t);
|
|
1711
1711
|
return {
|
|
1712
1712
|
id: s.conversationId,
|
|
1713
1713
|
name: s.conversationName || s.conversationId,
|
|
@@ -1732,7 +1732,7 @@ const Ae = T("Conversation");
|
|
|
1732
1732
|
function gn(s) {
|
|
1733
1733
|
return [...s].sort((e, t) => e.isPinned !== t.isPinned ? e.isPinned ? -1 : 1 : e.isPinned ? (t.pinnedTime ?? 0) - (e.pinnedTime ?? 0) : (t.lastMessageTime ?? 0) - (e.lastMessageTime ?? 0));
|
|
1734
1734
|
}
|
|
1735
|
-
function
|
|
1735
|
+
function fn(s, e) {
|
|
1736
1736
|
var o;
|
|
1737
1737
|
const t = {}, n = [];
|
|
1738
1738
|
for (const a of s) {
|
|
@@ -1744,7 +1744,7 @@ function mn(s, e) {
|
|
|
1744
1744
|
}
|
|
1745
1745
|
n.length > 0 && Ae.info(`raw snippets (${e})`, { typeCount: t, suspects: n });
|
|
1746
1746
|
}
|
|
1747
|
-
const
|
|
1747
|
+
const mn = 1e3;
|
|
1748
1748
|
class pn {
|
|
1749
1749
|
constructor(e, t, n = {}) {
|
|
1750
1750
|
this.client = e, this.store = t, this.hooks = n, this.channelAckSentAt = /* @__PURE__ */ new Map();
|
|
@@ -1761,7 +1761,7 @@ class pn {
|
|
|
1761
1761
|
/** 从本地缓存读取会话列表 */
|
|
1762
1762
|
syncLocal() {
|
|
1763
1763
|
const e = this.client.chatManager.getConversationList();
|
|
1764
|
-
Ae.info("getConversationList raw (syncLocal)", e),
|
|
1764
|
+
Ae.info("getConversationList raw (syncLocal)", e), fn(e, "syncLocal");
|
|
1765
1765
|
const t = te(e, {
|
|
1766
1766
|
resolveSenderName: this.hooks.resolveSenderName,
|
|
1767
1767
|
lastMessageTextResolver: this.hooks.lastMessageTextResolver
|
|
@@ -1799,11 +1799,11 @@ class pn {
|
|
|
1799
1799
|
} while (a);
|
|
1800
1800
|
const r = this.store.conversationList ?? [], i = new Map(r.map((u) => [u.id, u])), c = /* @__PURE__ */ new Map();
|
|
1801
1801
|
for (const u of o) {
|
|
1802
|
-
const
|
|
1803
|
-
c.set(u.id,
|
|
1802
|
+
const f = i.get(u.id);
|
|
1803
|
+
c.set(u.id, f ? {
|
|
1804
1804
|
...u,
|
|
1805
|
-
name: (!u.name || u.name === u.id) &&
|
|
1806
|
-
avatar: u.avatar ||
|
|
1805
|
+
name: (!u.name || u.name === u.id) && f.name && f.name !== f.id ? f.name : u.name,
|
|
1806
|
+
avatar: u.avatar || f.avatar
|
|
1807
1807
|
} : u);
|
|
1808
1808
|
}
|
|
1809
1809
|
this.store.setList(gn(Array.from(c.values())));
|
|
@@ -1897,7 +1897,7 @@ class pn {
|
|
|
1897
1897
|
if (n !== void 0 && n <= 0)
|
|
1898
1898
|
return;
|
|
1899
1899
|
const o = Date.now(), a = this.channelAckSentAt.get(e) || 0;
|
|
1900
|
-
o - a <
|
|
1900
|
+
o - a < mn || (this.channelAckSentAt.set(e, o), await this.markRead(e, t));
|
|
1901
1901
|
}
|
|
1902
1902
|
/** 加载更多会话:SDK5 当前无分页游标,直接返回本地列表 */
|
|
1903
1903
|
async loadMore(e) {
|
|
@@ -2019,7 +2019,7 @@ class In {
|
|
|
2019
2019
|
await this.client.contactManager.removeUserFromBlocklist({ userIds: e });
|
|
2020
2020
|
}
|
|
2021
2021
|
}
|
|
2022
|
-
function
|
|
2022
|
+
function Le(s) {
|
|
2023
2023
|
const e = {
|
|
2024
2024
|
groupId: s.groupId,
|
|
2025
2025
|
groupName: s.name,
|
|
@@ -2031,10 +2031,10 @@ function tt(s) {
|
|
|
2031
2031
|
disabled: s.disabled,
|
|
2032
2032
|
maxUsers: s.maxMembers
|
|
2033
2033
|
};
|
|
2034
|
-
return s.role && (e.role = s.role), "avatarUrl" in s && (e.avatar = s.avatarUrl), "muteAllMembers" in s && (e.mute = s.muteAllMembers), "ownerId" in s && (e.owner = s.ownerId), "owner" in s && s.owner && (e.owner = s.owner.userId), "createdAt" in s && (e.created = s.createdAt), "messageBlocked" in s && (e.shieldgroup = s.messageBlocked), e;
|
|
2034
|
+
return s.role && (e.role = s.role), "avatarUrl" in s && (e.avatar = s.avatarUrl), "muteAllMembers" in s && (e.mute = s.muteAllMembers), "ownerId" in s && (e.owner = s.ownerId), "owner" in s && s.owner && (e.owner = s.owner.userId), "createdAt" in s && (e.created = s.createdAt), "messageBlocked" in s && (e.shieldgroup = s.messageBlocked), "ext" in s && (e.ext = s.ext), "inviteNeedConfirm" in s && (e.inviteNeedConfirm = s.inviteNeedConfirm), "joinedAt" in s && (e.joinedAt = s.joinedAt), e;
|
|
2035
2035
|
}
|
|
2036
|
-
function
|
|
2037
|
-
return s.map((e) =>
|
|
2036
|
+
function fe(s) {
|
|
2037
|
+
return s.map((e) => Le(e));
|
|
2038
2038
|
}
|
|
2039
2039
|
function Mn(s) {
|
|
2040
2040
|
const e = s.user, t = {
|
|
@@ -2055,7 +2055,7 @@ class yn {
|
|
|
2055
2055
|
}
|
|
2056
2056
|
/** 获取已加入群组本地列表 */
|
|
2057
2057
|
syncLocal() {
|
|
2058
|
-
const e = this.client.groupManager.getJoinedGroupList(), t =
|
|
2058
|
+
const e = this.client.groupManager.getJoinedGroupList(), t = fe(e);
|
|
2059
2059
|
return this.store.setList(t), t;
|
|
2060
2060
|
}
|
|
2061
2061
|
/**
|
|
@@ -2082,7 +2082,7 @@ class yn {
|
|
|
2082
2082
|
if (t)
|
|
2083
2083
|
return t;
|
|
2084
2084
|
const n = (async () => {
|
|
2085
|
-
const o = await this.client.groupManager.getGroupInfo({ groupId: e }), a =
|
|
2085
|
+
const o = await this.client.groupManager.getGroupInfo({ groupId: e }), a = Le(o);
|
|
2086
2086
|
return this.store.updateGroup(e, a), a;
|
|
2087
2087
|
})();
|
|
2088
2088
|
Ie.set(e, n);
|
|
@@ -2094,7 +2094,7 @@ class yn {
|
|
|
2094
2094
|
}
|
|
2095
2095
|
/** 批量获取群详情 */
|
|
2096
2096
|
async fetchGroupInfoList(e) {
|
|
2097
|
-
const t = await this.client.groupManager.getGroupInfoList({ groupIds: e }), n =
|
|
2097
|
+
const t = await this.client.groupManager.getGroupInfoList({ groupIds: e }), n = fe(t);
|
|
2098
2098
|
return n.forEach((o) => this.store.updateGroup(o.groupId, o)), n;
|
|
2099
2099
|
}
|
|
2100
2100
|
/** 创建群组(注入 createGroup 时整体委托业务接管:不调 SDK、不写本地缓存,权威数据由业务源负责) */
|
|
@@ -2122,7 +2122,8 @@ class yn {
|
|
|
2122
2122
|
maxUsers: e.maxMembers,
|
|
2123
2123
|
public: e.public ?? !1,
|
|
2124
2124
|
allowInvites: e.allowInvites ?? !1,
|
|
2125
|
-
approval: e.joinApprovalRequired ?? !1
|
|
2125
|
+
approval: e.joinApprovalRequired ?? !1,
|
|
2126
|
+
inviteNeedConfirm: e.inviteNeedConfirm ?? !1
|
|
2126
2127
|
});
|
|
2127
2128
|
try {
|
|
2128
2129
|
await this.fetchGroupInfo(n.groupId);
|
|
@@ -2169,11 +2170,11 @@ class yn {
|
|
|
2169
2170
|
const n = (async () => {
|
|
2170
2171
|
var c, u;
|
|
2171
2172
|
const r = await this.client.groupManager.getGroup(e).getAdmins(), i = Z(
|
|
2172
|
-
(r || []).map((
|
|
2173
|
+
(r || []).map((f) => ({ user: f, role: k.ADMIN }))
|
|
2173
2174
|
);
|
|
2174
2175
|
this.store.appendGroupMembers(e, i);
|
|
2175
|
-
for (const
|
|
2176
|
-
this.store.updateGroupMemberRole(e,
|
|
2176
|
+
for (const f of i)
|
|
2177
|
+
this.store.updateGroupMemberRole(e, f.userId, k.ADMIN);
|
|
2177
2178
|
(u = (c = this.store).markGroupAdminSynced) == null || u.call(c, e);
|
|
2178
2179
|
})();
|
|
2179
2180
|
Me.set(e, n);
|
|
@@ -2231,13 +2232,13 @@ class yn {
|
|
|
2231
2232
|
async updateGroupInfo(e, t) {
|
|
2232
2233
|
await this.client.groupManager.getGroup(e).updateInfo(t);
|
|
2233
2234
|
const n = {};
|
|
2234
|
-
t.name !== void 0 && (n.groupName = t.name), t.description !== void 0 && (n.description = t.description), t.avatar !== void 0 && (n.avatar = t.avatar), this.store.updateGroup(e, n);
|
|
2235
|
+
t.name !== void 0 && (n.groupName = t.name), t.description !== void 0 && (n.description = t.description), t.avatar !== void 0 && (n.avatar = t.avatar), t.ext !== void 0 && (n.ext = t.ext), this.store.updateGroup(e, n);
|
|
2235
2236
|
}
|
|
2236
2237
|
/** 更新群配置(公开/审批/邀请/最大人数等) */
|
|
2237
2238
|
async updateGroupConfigs(e, t) {
|
|
2238
2239
|
await this.client.groupManager.getGroup(e).updateConfigs(t);
|
|
2239
2240
|
const n = {};
|
|
2240
|
-
t.public !== void 0 && (n.public = t.public), t.joinApprovalRequired !== void 0 && (n.approval = t.joinApprovalRequired), t.allowInvites !== void 0 && (n.allowInvites = t.allowInvites), t.maxMembers !== void 0 && (n.maxUsers = t.maxMembers), this.store.updateGroup(e, n);
|
|
2241
|
+
t.public !== void 0 && (n.public = t.public), t.joinApprovalRequired !== void 0 && (n.approval = t.joinApprovalRequired), t.allowInvites !== void 0 && (n.allowInvites = t.allowInvites), t.inviteNeedConfirm !== void 0 && (n.inviteNeedConfirm = t.inviteNeedConfirm), t.maxMembers !== void 0 && (n.maxUsers = t.maxMembers), this.store.updateGroup(e, n);
|
|
2241
2242
|
}
|
|
2242
2243
|
/** 开启全员禁言 */
|
|
2243
2244
|
async muteAllGroupMembers(e) {
|
|
@@ -2356,7 +2357,7 @@ function nt(s, e) {
|
|
|
2356
2357
|
const t = e.toLowerCase(), n = X.ONLINE.toLowerCase(), o = X.AWAY.toLowerCase(), a = X.BUSY.toLowerCase(), r = X.DO_NOT_DISTURB.toLowerCase(), i = X.OFFLINE.toLowerCase();
|
|
2357
2358
|
return t === n ? "online" : t === o ? "away" : t === a ? "busy" : t === r ? "doNotDisturb" : t === i ? "offline" : "custom";
|
|
2358
2359
|
}
|
|
2359
|
-
function
|
|
2360
|
+
function Pe(s) {
|
|
2360
2361
|
const e = s.publisher || "";
|
|
2361
2362
|
if (!e)
|
|
2362
2363
|
return null;
|
|
@@ -2385,7 +2386,7 @@ class bn {
|
|
|
2385
2386
|
expiry: t
|
|
2386
2387
|
});
|
|
2387
2388
|
this.store.setSubscribed(e);
|
|
2388
|
-
const a = o.map(
|
|
2389
|
+
const a = o.map(Pe).filter((i) => i !== null);
|
|
2389
2390
|
return this.store.updateBatch(a), a;
|
|
2390
2391
|
}
|
|
2391
2392
|
/** 取消订阅 */
|
|
@@ -2408,7 +2409,7 @@ class bn {
|
|
|
2408
2409
|
}
|
|
2409
2410
|
if (!this.client.isConnected)
|
|
2410
2411
|
return [];
|
|
2411
|
-
const o = (await this.client.presenceManager.getPresenceStatus({ userIds: e })).map(
|
|
2412
|
+
const o = (await this.client.presenceManager.getPresenceStatus({ userIds: e })).map(Pe).filter((r) => r !== null);
|
|
2412
2413
|
return this.store.updateBatch(o), o;
|
|
2413
2414
|
}
|
|
2414
2415
|
/** 发布自定义在线状态 */
|
|
@@ -2416,7 +2417,7 @@ class bn {
|
|
|
2416
2417
|
this.client.isConnected && await this.client.presenceManager.publishPresence({ customStatus: e });
|
|
2417
2418
|
}
|
|
2418
2419
|
}
|
|
2419
|
-
const F = T("UIKit:UserInfoDomain"),
|
|
2420
|
+
const F = T("UIKit:UserInfoDomain"), Be = [
|
|
2420
2421
|
"nickname",
|
|
2421
2422
|
"avatarUrl",
|
|
2422
2423
|
"mail",
|
|
@@ -2426,7 +2427,7 @@ const F = T("UIKit:UserInfoDomain"), Pe = [
|
|
|
2426
2427
|
"birth",
|
|
2427
2428
|
"ext"
|
|
2428
2429
|
];
|
|
2429
|
-
class
|
|
2430
|
+
class Cn {
|
|
2430
2431
|
constructor(e, t, n = {}, o) {
|
|
2431
2432
|
this.client = e, this.store = t, this.userInfoRepository = n, this.onSubscriptionPermissionError = o, this.handlerId = "uikit-user-info", this.subscribeQueue = [], this.subscribeFlushPromise = null, this.fetchQueue = [], this.fetchFlushPromise = null, this.hasLoggedPermissionError = !1;
|
|
2432
2433
|
}
|
|
@@ -2444,7 +2445,7 @@ class wn {
|
|
|
2444
2445
|
* @param userIds 目标用户 ID 列表
|
|
2445
2446
|
* @param attributes 需要查询的属性,默认全量 8 个属性
|
|
2446
2447
|
*/
|
|
2447
|
-
async fetchUserInfos(e, t =
|
|
2448
|
+
async fetchUserInfos(e, t = Be) {
|
|
2448
2449
|
if (!this.client.isConnected)
|
|
2449
2450
|
return [];
|
|
2450
2451
|
const n = Array.from(new Set(e.filter(Boolean)));
|
|
@@ -2550,7 +2551,7 @@ class wn {
|
|
|
2550
2551
|
/**
|
|
2551
2552
|
* 获取当前登录用户自己的资料(默认全量属性,保证签名等登录后回显)。
|
|
2552
2553
|
*/
|
|
2553
|
-
async fetchOwnInfo(e =
|
|
2554
|
+
async fetchOwnInfo(e = Be) {
|
|
2554
2555
|
const t = this.client.currentUserId;
|
|
2555
2556
|
if (!t)
|
|
2556
2557
|
return;
|
|
@@ -2634,7 +2635,7 @@ class wn {
|
|
|
2634
2635
|
}
|
|
2635
2636
|
}
|
|
2636
2637
|
const _ = T("UIKit:ConnEvents");
|
|
2637
|
-
function
|
|
2638
|
+
function wn(s, e = {}) {
|
|
2638
2639
|
return {
|
|
2639
2640
|
onConnecting: () => {
|
|
2640
2641
|
_.info("onConnecting"), s.client.setConnecting(!0);
|
|
@@ -2690,9 +2691,9 @@ function An() {
|
|
|
2690
2691
|
st.info("sync status reset(事件反注册/登出)");
|
|
2691
2692
|
}
|
|
2692
2693
|
function es() {
|
|
2693
|
-
const s =
|
|
2694
|
+
const s = me(() => ({ ...z })), e = me(
|
|
2694
2695
|
() => Object.values(z).some((n) => n.status === "syncing")
|
|
2695
|
-
), t =
|
|
2696
|
+
), t = me(
|
|
2696
2697
|
() => Object.values(z).every((n) => n.status === "success" || n.status === "failed")
|
|
2697
2698
|
);
|
|
2698
2699
|
return { status: s, isSyncing: e, allFinished: t };
|
|
@@ -2767,12 +2768,12 @@ function Rn(s, e) {
|
|
|
2767
2768
|
const c = typeof document > "u" || document.visibilityState === "hidden";
|
|
2768
2769
|
if (o.value.triggerMode === "background" && !c)
|
|
2769
2770
|
return;
|
|
2770
|
-
const u = P(e, s.client.currentUser),
|
|
2771
|
+
const u = P(e, s.client.currentUser), f = ot(s, u), m = u.conversationType === I.GROUPCHAT, g = {
|
|
2771
2772
|
// 群聊标题为群名(正文含 "发送者: 内容" 前缀),单聊标题为发送者名
|
|
2772
|
-
title:
|
|
2773
|
-
body:
|
|
2773
|
+
title: m && (i == null ? void 0 : i.name) || f,
|
|
2774
|
+
body: Ct(u, void 0, f, void 0, Ue),
|
|
2774
2775
|
// 群聊用群头像,单聊用发送者头像
|
|
2775
|
-
avatar:
|
|
2776
|
+
avatar: m ? i == null ? void 0 : i.avatar : (d = s.userInfo.getUserInfo(e.from)) == null ? void 0 : d.avatarUrl,
|
|
2776
2777
|
timestamp: u.timestamp || Date.now(),
|
|
2777
2778
|
conversationId: e.conversationId,
|
|
2778
2779
|
conversationType: u.conversationType
|
|
@@ -2781,21 +2782,21 @@ function Rn(s, e) {
|
|
|
2781
2782
|
l ? n(g, "browser") : o.value.inAppEnabled && (a(g), n(g, "in-app"));
|
|
2782
2783
|
}) : o.value.inAppEnabled && (a(g), n(g, "in-app"));
|
|
2783
2784
|
}
|
|
2784
|
-
function
|
|
2785
|
+
function Fe(s, e, t) {
|
|
2785
2786
|
const { t: n, useNotification: o, emitNotificationDelivered: a, resolveNoticeUserName: r } = B(), { state: i, notify: c, notifyBrowser: u } = o();
|
|
2786
2787
|
if (!i.value.enabled)
|
|
2787
2788
|
return;
|
|
2788
|
-
const
|
|
2789
|
-
title: r(
|
|
2789
|
+
const f = s.userInfo.getUserInfo(e), m = {
|
|
2790
|
+
title: r(f) || e,
|
|
2790
2791
|
body: n(t === "declined" ? "contact.inviteDeclinedByPeer" : "chat.notice.contactDeleted"),
|
|
2791
|
-
avatar:
|
|
2792
|
+
avatar: f == null ? void 0 : f.avatarUrl,
|
|
2792
2793
|
timestamp: Date.now(),
|
|
2793
2794
|
conversationId: e,
|
|
2794
2795
|
conversationType: I.SINGLECHAT
|
|
2795
2796
|
};
|
|
2796
|
-
(typeof document > "u" || document.visibilityState === "hidden") && i.value.browserEnabled ? u(
|
|
2797
|
-
d ? a(
|
|
2798
|
-
}) : i.value.inAppEnabled && (c(
|
|
2797
|
+
(typeof document > "u" || document.visibilityState === "hidden") && i.value.browserEnabled ? u(m).then((d) => {
|
|
2798
|
+
d ? a(m, "browser") : i.value.inAppEnabled && (c(m), a(m, "in-app"));
|
|
2799
|
+
}) : i.value.inAppEnabled && (c(m), a(m, "in-app"));
|
|
2799
2800
|
}
|
|
2800
2801
|
const M = T("UIKit:ChatEvents"), le = /* @__PURE__ */ new Set(), Te = /* @__PURE__ */ new Set(), $ = /* @__PURE__ */ new Map();
|
|
2801
2802
|
let ge = !1;
|
|
@@ -2811,18 +2812,18 @@ function Ln(s, e, t, n) {
|
|
|
2811
2812
|
const r = Array.from($.entries());
|
|
2812
2813
|
$.clear();
|
|
2813
2814
|
for (const [i, c] of r) {
|
|
2814
|
-
const [u,
|
|
2815
|
-
for (let
|
|
2816
|
-
const g = c.slice(
|
|
2817
|
-
M.info("[queueMessageReadReceipt] 批量发送已读回执", { conversationType: u, conversationId:
|
|
2815
|
+
const [u, f] = i.split(":");
|
|
2816
|
+
for (let m = 0; m < c.length; m += 50) {
|
|
2817
|
+
const g = c.slice(m, m + 50);
|
|
2818
|
+
M.info("[queueMessageReadReceipt] 批量发送已读回执", { conversationType: u, conversationId: f, batchSize: g.length, messageIds: g });
|
|
2818
2819
|
try {
|
|
2819
2820
|
await s.chatManager.sendMessageReadReceipts({
|
|
2820
|
-
conversationId:
|
|
2821
|
+
conversationId: f,
|
|
2821
2822
|
conversationType: u,
|
|
2822
2823
|
messageIds: g
|
|
2823
|
-
}), an(g), M.info("[queueMessageReadReceipt] 已读回执发送成功", { conversationType: u, conversationId:
|
|
2824
|
+
}), an(g), M.info("[queueMessageReadReceipt] 已读回执发送成功", { conversationType: u, conversationId: f, messageIds: g });
|
|
2824
2825
|
} catch (d) {
|
|
2825
|
-
M.warn("[queueMessageReadReceipt] sendMessageReadReceipts failed:", { conversationType: u, conversationId:
|
|
2826
|
+
M.warn("[queueMessageReadReceipt] sendMessageReadReceipts failed:", { conversationType: u, conversationId: f, messageIds: g, err: d });
|
|
2826
2827
|
}
|
|
2827
2828
|
}
|
|
2828
2829
|
}
|
|
@@ -2867,7 +2868,7 @@ async function oe(s, e) {
|
|
|
2867
2868
|
for (const o of n)
|
|
2868
2869
|
le.add(o), Te.add(o);
|
|
2869
2870
|
try {
|
|
2870
|
-
const o = await e.groupManager.getGroupInfoList({ groupIds: n }), a =
|
|
2871
|
+
const o = await e.groupManager.getGroupInfoList({ groupIds: n }), a = fe(o);
|
|
2871
2872
|
for (const r of a)
|
|
2872
2873
|
s.group.updateGroup(r.groupId, r), r.groupName && r.groupName !== r.groupId && s.conversation.updateConversation(r.groupId, { name: r.groupName });
|
|
2873
2874
|
} catch (o) {
|
|
@@ -2879,28 +2880,28 @@ async function oe(s, e) {
|
|
|
2879
2880
|
}
|
|
2880
2881
|
function _n(s, e, t, n) {
|
|
2881
2882
|
const o = s.message.getMessages(e), a = o.findIndex(
|
|
2882
|
-
(
|
|
2883
|
+
(m) => m.msgServerId === n || m.msgLocalId === n
|
|
2883
2884
|
);
|
|
2884
2885
|
if (a === -1 || a !== o.length - 1)
|
|
2885
2886
|
return;
|
|
2886
|
-
const r = o[a], i = s.conversation.conversationList.find((
|
|
2887
|
+
const r = o[a], i = s.conversation.conversationList.find((m) => m.id === e);
|
|
2887
2888
|
if (!i || i.lastMessageTime && r.timestamp < i.lastMessageTime - 1e3)
|
|
2888
2889
|
return;
|
|
2889
|
-
const u = t === I.GROUPCHAT ? ot(s, r) : void 0, { t:
|
|
2890
|
+
const u = t === I.GROUPCHAT ? ot(s, r) : void 0, { t: f } = B();
|
|
2890
2891
|
s.conversation.updateConversation(e, {
|
|
2891
|
-
lastMessageText:
|
|
2892
|
+
lastMessageText: Xe(
|
|
2892
2893
|
t,
|
|
2893
2894
|
u,
|
|
2894
|
-
|
|
2895
|
+
f("message.recalledPreview")
|
|
2895
2896
|
)
|
|
2896
2897
|
});
|
|
2897
2898
|
}
|
|
2898
2899
|
function x(s) {
|
|
2899
2900
|
Promise.resolve().then(s).catch((e) => M.warn("persistence 钩子执行失败(已忽略):", e));
|
|
2900
2901
|
}
|
|
2901
|
-
function
|
|
2902
|
+
function He(s, e) {
|
|
2902
2903
|
const t = s.conversation.conversationList, n = new Set(e.map((r) => r.id)), o = e.map((r) => {
|
|
2903
|
-
const i = t.find((
|
|
2904
|
+
const i = t.find((f) => f.id === r.id);
|
|
2904
2905
|
if (!i)
|
|
2905
2906
|
return r;
|
|
2906
2907
|
const c = (!r.name || r.name === r.id) && i.name && i.name !== i.id, u = !r.avatar && i.avatar;
|
|
@@ -2926,8 +2927,8 @@ function Nn(s, e, t, n, o) {
|
|
|
2926
2927
|
updateMessageStatus: i,
|
|
2927
2928
|
markMessageRecalled: c,
|
|
2928
2929
|
updateMessageContent: u,
|
|
2929
|
-
deleteMessages:
|
|
2930
|
-
} = (n == null ? void 0 : n.message) ?? {},
|
|
2930
|
+
deleteMessages: f
|
|
2931
|
+
} = (n == null ? void 0 : n.message) ?? {}, m = (g = n == null ? void 0 : n.conversation) == null ? void 0 : g.saveConversations;
|
|
2931
2932
|
return {
|
|
2932
2933
|
onSyncDataStart: (d) => {
|
|
2933
2934
|
M.info("onSyncDataStart", { dataType: d.dataType }), be(d.dataType, { status: "syncing" }), d.dataType === "conversation" && e.conversation.setSyncingConversations(!0);
|
|
@@ -2959,8 +2960,8 @@ function Nn(s, e, t, n, o) {
|
|
|
2959
2960
|
{
|
|
2960
2961
|
const l = s.chatManager.getConversationList().filter((v) => v.conversationType !== "chatRoom");
|
|
2961
2962
|
M.info("getConversationList raw (onSyncDataFinished)", l);
|
|
2962
|
-
const p = te(l, { resolveSenderName: a, lastMessageTextResolver: o }), h =
|
|
2963
|
-
e.conversation.setConversationList(h), M.info("conversation 同步回填", { count: h.length }),
|
|
2963
|
+
const p = te(l, { resolveSenderName: a, lastMessageTextResolver: o }), h = He(e, p);
|
|
2964
|
+
e.conversation.setConversationList(h), M.info("conversation 同步回填", { count: h.length }), m && x(() => m(h.map(_e)));
|
|
2964
2965
|
}
|
|
2965
2966
|
e.conversation.setConversationsLoaded(!0), oe(e, s), Dn(e, s);
|
|
2966
2967
|
break;
|
|
@@ -2975,7 +2976,7 @@ function Nn(s, e, t, n, o) {
|
|
|
2975
2976
|
case "group":
|
|
2976
2977
|
if (!e.group.loaded || e.group.groupList.length === 0) {
|
|
2977
2978
|
const l = s.groupManager.getJoinedGroupList();
|
|
2978
|
-
e.group.setGroupList(
|
|
2979
|
+
e.group.setGroupList(fe(l)), M.info("group 同步回填", { count: l.length });
|
|
2979
2980
|
} else
|
|
2980
2981
|
M.info("group 同步回填跳过(列表已由业务方填充)", { count: e.group.groupList.length });
|
|
2981
2982
|
oe(e, s);
|
|
@@ -2983,18 +2984,18 @@ function Nn(s, e, t, n, o) {
|
|
|
2983
2984
|
}
|
|
2984
2985
|
},
|
|
2985
2986
|
onConversationListUpdate: (d) => {
|
|
2986
|
-
var
|
|
2987
|
+
var C;
|
|
2987
2988
|
const l = d.items.filter((y) => y.conversationType !== "chatRoom");
|
|
2988
2989
|
M.info("onConversationListUpdate", { count: l.length, reset: d.patch.reset, removed: d.patch.removed.length }), M.info("getConversationList raw (onConversationListUpdate)", l);
|
|
2989
2990
|
{
|
|
2990
2991
|
const y = {}, G = [];
|
|
2991
2992
|
for (const q of l) {
|
|
2992
|
-
const R = String(((
|
|
2993
|
+
const R = String(((C = q.lastMessage) == null ? void 0 : C.type) ?? "(null)");
|
|
2993
2994
|
y[R] = (y[R] ?? 0) + 1, (R === b.COMBINE || R === "unknown") && G.push({ conversationId: q.conversationId, lastMessage: q.lastMessage });
|
|
2994
2995
|
}
|
|
2995
2996
|
G.length > 0 && M.info("raw snippets (onConversationListUpdate)", { typeCount: y, suspects: G });
|
|
2996
2997
|
}
|
|
2997
|
-
const p = te(l, { resolveSenderName: a, lastMessageTextResolver: o }), h =
|
|
2998
|
+
const p = te(l, { resolveSenderName: a, lastMessageTextResolver: o }), h = He(e, p), v = new Set(d.patch.removed.map((y) => y.conversationId)), S = v.size > 0 ? h.filter((y) => !v.has(y.id)) : h;
|
|
2998
2999
|
if (d.patch.reset || d.patch.removed.length > 0)
|
|
2999
3000
|
e.conversation.setConversationList(S);
|
|
3000
3001
|
else
|
|
@@ -3002,10 +3003,10 @@ function Nn(s, e, t, n, o) {
|
|
|
3002
3003
|
const G = e.conversation.conversationList.find((q) => q.id === y.id);
|
|
3003
3004
|
G ? G !== y && e.conversation.updateConversation(y.id, y) : e.conversation.addConversation(y);
|
|
3004
3005
|
}
|
|
3005
|
-
|
|
3006
|
+
m && x(() => m(S.map(_e))), oe(e, s);
|
|
3006
3007
|
},
|
|
3007
3008
|
onMessage: (d) => {
|
|
3008
|
-
var S,
|
|
3009
|
+
var S, C, y;
|
|
3009
3010
|
if (d.conversationType === "chatRoom")
|
|
3010
3011
|
return;
|
|
3011
3012
|
if (d.type === b.CMD) {
|
|
@@ -3020,7 +3021,7 @@ function Nn(s, e, t, n, o) {
|
|
|
3020
3021
|
}
|
|
3021
3022
|
M.info("onMessage", { conversationId: d.conversationId, from: d.from, type: d.type });
|
|
3022
3023
|
const l = P(d, e.client.currentUser), p = e.message.getMessages(d.conversationId).find((G) => G.msgServerId === d.msgServerId);
|
|
3023
|
-
p != null && p.stream &&
|
|
3024
|
+
p != null && p.stream && wt(p.stream.status) ? e.message.replaceMessageById(d.msgServerId, l) : e.message.addMessage(l), l.type === b.VOICE && !l.isSelf && ((C = (S = e.message).markVoiceUnplayed) == null || C.call(S, l.msgServerId || l.msgLocalId)), r && x(() => r(we(d)));
|
|
3024
3025
|
const h = e.conversation.currentConversationId, v = typeof document > "u" || document.visibilityState === "visible";
|
|
3025
3026
|
if (h && d.conversationId === h && E(d.from) !== E(e.client.currentUser) && v && (s.chatManager.clearConversationUnreadMessageCount({
|
|
3026
3027
|
conversationId: d.conversationId,
|
|
@@ -3165,17 +3166,17 @@ function Nn(s, e, t, n, o) {
|
|
|
3165
3166
|
const { operation: l, conversationId: p, messageIds: h, beforeTimestamp: v } = d;
|
|
3166
3167
|
if (!(!p || l !== "MESSAGE_REMOVED")) {
|
|
3167
3168
|
if (h && h.length > 0)
|
|
3168
|
-
e.message.deleteMessages([...h]),
|
|
3169
|
+
e.message.deleteMessages([...h]), f && x(() => f([...h]));
|
|
3169
3170
|
else if (v) {
|
|
3170
|
-
const
|
|
3171
|
-
|
|
3171
|
+
const C = e.message.getMessages(p).filter((y) => y.timestamp && y.timestamp < v).map((y) => y.msgServerId || y.msgLocalId).filter((y) => !!y);
|
|
3172
|
+
C.length > 0 && (e.message.deleteMessages(C), f && x(() => f(C)));
|
|
3172
3173
|
}
|
|
3173
3174
|
}
|
|
3174
3175
|
}
|
|
3175
3176
|
};
|
|
3176
3177
|
}
|
|
3177
3178
|
const J = T("UIKit:ContactEvents");
|
|
3178
|
-
function
|
|
3179
|
+
function Ke(s, e = "pending") {
|
|
3179
3180
|
const t = s.userInfo, n = s.from;
|
|
3180
3181
|
return {
|
|
3181
3182
|
id: n,
|
|
@@ -3195,7 +3196,7 @@ function kn(s) {
|
|
|
3195
3196
|
onContactInvited: (n) => {
|
|
3196
3197
|
J.info("onContactInvited", { from: n.from });
|
|
3197
3198
|
const o = n.from, a = o ? s.contact.getContact(o) : void 0;
|
|
3198
|
-
s.contact.addInvite(
|
|
3199
|
+
s.contact.addInvite(Ke(n, a ? "accepted" : "pending"));
|
|
3199
3200
|
},
|
|
3200
3201
|
onContactAgreed: (n) => {
|
|
3201
3202
|
J.info("onContactAgreed", { from: n.from });
|
|
@@ -3207,7 +3208,7 @@ function kn(s) {
|
|
|
3207
3208
|
onContactRefuse: (n) => {
|
|
3208
3209
|
J.info("onContactRefuse", { from: n.from });
|
|
3209
3210
|
const o = n.from;
|
|
3210
|
-
o && (s.contact.getInvite(o) ? s.contact.updateInviteStatus(o, "declined") : s.contact.addInvite({ ...
|
|
3211
|
+
o && (s.contact.getInvite(o) ? s.contact.updateInviteStatus(o, "declined") : s.contact.addInvite({ ...Ke(n, "declined"), outgoing: !0, unread: !0 }), Fe(s, o, "declined"));
|
|
3211
3212
|
},
|
|
3212
3213
|
onContactDeleted: (n) => {
|
|
3213
3214
|
J.info("onContactDeleted", { from: n.from });
|
|
@@ -3216,7 +3217,7 @@ function kn(s) {
|
|
|
3216
3217
|
eventType: A.CONTACT_DELETED,
|
|
3217
3218
|
params: {},
|
|
3218
3219
|
defaultText: e("chat.notice.contactDeleted")
|
|
3219
|
-
}),
|
|
3220
|
+
}), Fe(s, o, "deleted"));
|
|
3220
3221
|
},
|
|
3221
3222
|
onContactAdded: (n) => {
|
|
3222
3223
|
J.info("onContactAdded", { from: n.from });
|
|
@@ -3239,8 +3240,8 @@ function kn(s) {
|
|
|
3239
3240
|
}
|
|
3240
3241
|
};
|
|
3241
3242
|
}
|
|
3242
|
-
const
|
|
3243
|
-
function
|
|
3243
|
+
const w = T("UIKit:GroupEvents");
|
|
3244
|
+
function je(s, e = "pending") {
|
|
3244
3245
|
const t = s.groupId, n = "inviter" in s ? s.inviter : void 0, o = "groupName" in s ? s.groupName : void 0;
|
|
3245
3246
|
return {
|
|
3246
3247
|
id: t,
|
|
@@ -3281,24 +3282,24 @@ function On(s) {
|
|
|
3281
3282
|
}
|
|
3282
3283
|
return {
|
|
3283
3284
|
onInvitationReceived: (r) => {
|
|
3284
|
-
|
|
3285
|
-
const i =
|
|
3285
|
+
w.info("onInvitationReceived raw payload", r);
|
|
3286
|
+
const i = je(r, a(r.groupId) ? "accepted" : "pending");
|
|
3286
3287
|
s.contact.addInvite(i);
|
|
3287
3288
|
},
|
|
3288
3289
|
onInvitationAccepted: (r) => {
|
|
3289
|
-
|
|
3290
|
+
w.info("onInvitationAccepted raw payload", r), s.contact.updateInviteStatus(r.groupId, "accepted");
|
|
3290
3291
|
},
|
|
3291
3292
|
onInvitationDeclined: (r) => {
|
|
3292
|
-
|
|
3293
|
+
w.info("onInvitationDeclined raw payload", r), s.contact.updateInviteStatus(r.groupId, "declined");
|
|
3293
3294
|
},
|
|
3294
3295
|
onAutoAcceptInvitationFromGroup: (r) => {
|
|
3295
|
-
|
|
3296
|
+
w.info("onAutoAcceptInvitationFromGroup raw payload", r), s.contact.addInvite(je(r, "accepted"));
|
|
3296
3297
|
},
|
|
3297
3298
|
onMembersJoined: (r) => {
|
|
3298
|
-
|
|
3299
|
+
w.info("onMembersJoined raw payload", r);
|
|
3299
3300
|
const i = r.members || [], c = s.client.currentUser;
|
|
3300
|
-
i.some((
|
|
3301
|
-
const
|
|
3301
|
+
i.some((m) => m.userId === c) && (s.contact.getInvite(r.groupId) && s.contact.updateInviteStatus(r.groupId, "accepted"), s.group.getGroupById(r.groupId) || s.group.addGroup({ groupId: r.groupId, groupName: r.groupName })), s.group.incrementMemberCount(r.groupId, i.length);
|
|
3302
|
+
const f = ie(
|
|
3302
3303
|
i,
|
|
3303
3304
|
c || "",
|
|
3304
3305
|
"chat.notice.memberJoined",
|
|
@@ -3307,12 +3308,12 @@ function On(s) {
|
|
|
3307
3308
|
t(s, r.groupId, I.GROUPCHAT, {
|
|
3308
3309
|
eventType: A.MEMBER_JOINED,
|
|
3309
3310
|
params: ae(i, c || ""),
|
|
3310
|
-
defaultText:
|
|
3311
|
+
defaultText: f
|
|
3311
3312
|
});
|
|
3312
3313
|
},
|
|
3313
3314
|
onMembersExited: (r) => {
|
|
3314
3315
|
const i = r.members || [];
|
|
3315
|
-
|
|
3316
|
+
w.info("onMembersExited raw payload", r), s.group.decrementMemberCount(r.groupId, i.length);
|
|
3316
3317
|
const c = ie(
|
|
3317
3318
|
i,
|
|
3318
3319
|
s.client.currentUser || "",
|
|
@@ -3326,24 +3327,25 @@ function On(s) {
|
|
|
3326
3327
|
});
|
|
3327
3328
|
},
|
|
3328
3329
|
onGroupInfoChanged: (r) => {
|
|
3329
|
-
|
|
3330
|
-
const i = r.groupInfo ?? r, c = i.name ?? i.groupName, u = s.group.getGroupById(r.groupId)
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
}),
|
|
3330
|
+
w.info("onGroupInfoChanged raw payload", r);
|
|
3331
|
+
const i = r.groupInfo ?? r, c = i.name ?? i.groupName, u = s.group.getGroupById(r.groupId), f = Le({
|
|
3332
|
+
...i,
|
|
3333
|
+
groupId: r.groupId,
|
|
3334
|
+
name: c,
|
|
3335
|
+
avatarUrl: i.avatarUrl ?? i.avatar
|
|
3336
|
+
}), g = !!r.groupInfo ? f : Object.fromEntries(Object.entries(f).filter(([, d]) => d !== void 0));
|
|
3337
|
+
s.group.updateGroup(r.groupId, g), c && (u != null && u.groupName) && c !== u.groupName && (t(s, r.groupId, I.GROUPCHAT, {
|
|
3336
3338
|
eventType: A.GROUP_NAME_CHANGED,
|
|
3337
3339
|
params: { name: c },
|
|
3338
3340
|
defaultText: e("chat.notice.groupNameChanged").replace("{name}", c)
|
|
3339
3341
|
}), s.conversation.updateConversation(r.groupId, { name: c }));
|
|
3340
3342
|
},
|
|
3341
3343
|
onOwnerChanged: (r) => {
|
|
3342
|
-
var l, p, h, v, S,
|
|
3343
|
-
|
|
3344
|
-
const i = (l = s.group.getGroupById(r.groupId)) == null ? void 0 : l.owner, c = (h = (p = s.group).getPendingOwnerTransfer) == null ? void 0 : h.call(p, r.groupId), u = c || ((v = r.newOwner) == null ? void 0 : v.userId) || "",
|
|
3345
|
-
|
|
3346
|
-
const g = u ===
|
|
3344
|
+
var l, p, h, v, S, C;
|
|
3345
|
+
w.info("onOwnerChanged raw payload", r);
|
|
3346
|
+
const i = (l = s.group.getGroupById(r.groupId)) == null ? void 0 : l.owner, c = (h = (p = s.group).getPendingOwnerTransfer) == null ? void 0 : h.call(p, r.groupId), u = c || ((v = r.newOwner) == null ? void 0 : v.userId) || "", f = { owner: u }, m = s.client.currentUser || "";
|
|
3347
|
+
m && (m === u ? f.role = k.OWNER : m === i && (f.role = k.MEMBER)), s.group.updateGroup(r.groupId, f), u && s.group.updateGroupMemberRole(r.groupId, u, k.OWNER), i && i !== u && s.group.updateGroupMemberRole(r.groupId, i, k.MEMBER), c && ((C = (S = s.group).clearPendingOwnerTransfer) == null || C.call(S, r.groupId));
|
|
3348
|
+
const g = u === m ? e("chat.notice.you") : o(r.newOwner), d = e("chat.notice.ownerChanged").replace("{name}", g);
|
|
3347
3349
|
t(s, r.groupId, I.GROUPCHAT, {
|
|
3348
3350
|
eventType: A.OWNER_CHANGED,
|
|
3349
3351
|
params: { name: g, ownerId: u },
|
|
@@ -3351,31 +3353,31 @@ function On(s) {
|
|
|
3351
3353
|
});
|
|
3352
3354
|
},
|
|
3353
3355
|
onAdminAdded: (r) => {
|
|
3354
|
-
var
|
|
3355
|
-
|
|
3356
|
-
const i = (
|
|
3356
|
+
var m;
|
|
3357
|
+
w.info("onAdminAdded raw payload", r);
|
|
3358
|
+
const i = (m = r.administrator) == null ? void 0 : m.userId;
|
|
3357
3359
|
i && s.group.updateGroupMemberRole(r.groupId, i, k.ADMIN);
|
|
3358
|
-
const c = s.client.currentUser || "", u = i === c ? e("chat.notice.you") : o(r.administrator),
|
|
3360
|
+
const c = s.client.currentUser || "", u = i === c ? e("chat.notice.you") : o(r.administrator), f = e("chat.notice.adminAdded").replace("{name}", u);
|
|
3359
3361
|
t(s, r.groupId, I.GROUPCHAT, {
|
|
3360
3362
|
eventType: A.ADMIN_ADDED,
|
|
3361
3363
|
params: { name: u, userId: i || "" },
|
|
3362
|
-
defaultText:
|
|
3364
|
+
defaultText: f
|
|
3363
3365
|
});
|
|
3364
3366
|
},
|
|
3365
3367
|
onAdminRemoved: (r) => {
|
|
3366
|
-
var
|
|
3367
|
-
|
|
3368
|
-
const i = (
|
|
3368
|
+
var m;
|
|
3369
|
+
w.info("onAdminRemoved raw payload", r);
|
|
3370
|
+
const i = (m = r.administrator) == null ? void 0 : m.userId;
|
|
3369
3371
|
i && s.group.updateGroupMemberRole(r.groupId, i, k.MEMBER);
|
|
3370
|
-
const c = s.client.currentUser || "", u = i === c ? e("chat.notice.you") : o(r.administrator),
|
|
3372
|
+
const c = s.client.currentUser || "", u = i === c ? e("chat.notice.you") : o(r.administrator), f = e("chat.notice.adminRemoved").replace("{name}", u);
|
|
3371
3373
|
t(s, r.groupId, I.GROUPCHAT, {
|
|
3372
3374
|
eventType: A.ADMIN_REMOVED,
|
|
3373
3375
|
params: { name: u, userId: i || "" },
|
|
3374
|
-
defaultText:
|
|
3376
|
+
defaultText: f
|
|
3375
3377
|
});
|
|
3376
3378
|
},
|
|
3377
3379
|
onUserRemoved: (r) => {
|
|
3378
|
-
|
|
3380
|
+
w.info("onUserRemoved raw payload", r);
|
|
3379
3381
|
const i = e("chat.notice.you");
|
|
3380
3382
|
s.group.removeGroup(r.groupId), s.conversation.deleteConversation(r.groupId), s.message.clearConversationMessages(r.groupId);
|
|
3381
3383
|
const c = e("chat.notice.userRemoved").replace("{name}", i);
|
|
@@ -3387,27 +3389,27 @@ function On(s) {
|
|
|
3387
3389
|
},
|
|
3388
3390
|
onGroupDestroyed: (r) => {
|
|
3389
3391
|
var i;
|
|
3390
|
-
|
|
3392
|
+
w.info("onGroupDestroyed raw payload", r), s.group.removeGroup(r.groupId), (((i = s.client.client) == null ? void 0 : i.deleteConversationOnGroupDestroyed) ?? !0) && (s.conversation.deleteConversation(r.groupId), s.message.clearConversationMessages(r.groupId)), t(s, r.groupId, I.GROUPCHAT, {
|
|
3391
3393
|
eventType: A.GROUP_DESTROYED,
|
|
3392
3394
|
params: {},
|
|
3393
3395
|
defaultText: e("chat.notice.groupDestroyed")
|
|
3394
3396
|
});
|
|
3395
3397
|
},
|
|
3396
3398
|
onAnnouncementChanged: (r) => {
|
|
3397
|
-
|
|
3399
|
+
w.info("onAnnouncementChanged raw payload", r), s.group.updateGroup(r.groupId, { announcement: r.announcement }), s.group.setGroupAnnouncement(r.groupId, r.announcement), t(s, r.groupId, I.GROUPCHAT, {
|
|
3398
3400
|
eventType: A.ANNOUNCEMENT_CHANGED,
|
|
3399
3401
|
params: { announcement: r.announcement || "" },
|
|
3400
3402
|
defaultText: n(r.announcement)
|
|
3401
3403
|
});
|
|
3402
3404
|
},
|
|
3403
3405
|
onMuteListAdded: (r) => {
|
|
3404
|
-
|
|
3405
|
-
const i = (r.mutes || []).map((
|
|
3406
|
-
userId:
|
|
3406
|
+
w.info("onMuteListAdded raw payload", r);
|
|
3407
|
+
const i = (r.mutes || []).map((f) => ({
|
|
3408
|
+
userId: f.userId,
|
|
3407
3409
|
muteExpire: r.muteExpire
|
|
3408
3410
|
}));
|
|
3409
3411
|
s.group.addGroupMuteMembers(r.groupId, i);
|
|
3410
|
-
const c = (r.mutes || []).map((
|
|
3412
|
+
const c = (r.mutes || []).map((f) => f.nickname || f.userId || ""), u = c.map((f) => e("group.mutelist.muteNotice").replace("{name}", f)).join("、");
|
|
3411
3413
|
t(s, r.groupId, I.GROUPCHAT, {
|
|
3412
3414
|
eventType: A.MUTE_ADDED,
|
|
3413
3415
|
params: { names: c.join("、"), count: c.length },
|
|
@@ -3415,10 +3417,10 @@ function On(s) {
|
|
|
3415
3417
|
});
|
|
3416
3418
|
},
|
|
3417
3419
|
onMuteListRemoved: (r) => {
|
|
3418
|
-
|
|
3419
|
-
const i = (r.mutes || []).map((
|
|
3420
|
+
w.info("onMuteListRemoved raw payload", r);
|
|
3421
|
+
const i = (r.mutes || []).map((f) => f.userId);
|
|
3420
3422
|
s.group.removeGroupMuteMembers(r.groupId, i);
|
|
3421
|
-
const c = (r.mutes || []).map((
|
|
3423
|
+
const c = (r.mutes || []).map((f) => f.nickname || f.userId || ""), u = c.map((f) => e("group.mutelist.unmuteNotice").replace("{name}", f)).join("、");
|
|
3422
3424
|
t(s, r.groupId, I.GROUPCHAT, {
|
|
3423
3425
|
eventType: A.MUTE_REMOVED,
|
|
3424
3426
|
params: { names: c.join("、"), count: c.length },
|
|
@@ -3426,7 +3428,7 @@ function On(s) {
|
|
|
3426
3428
|
});
|
|
3427
3429
|
},
|
|
3428
3430
|
onAllMemberMuteStateChanged: (r) => {
|
|
3429
|
-
|
|
3431
|
+
w.info("onAllMemberMuteStateChanged raw payload", r), s.group.updateGroup(r.groupId, { mute: r.isMuted });
|
|
3430
3432
|
const i = e(r.isMuted ? "group.mutelist.muteAllNotice" : "group.mutelist.unmuteAllNotice");
|
|
3431
3433
|
t(s, r.groupId, I.GROUPCHAT, {
|
|
3432
3434
|
eventType: A.ALL_MEMBER_MUTE_CHANGED,
|
|
@@ -3435,7 +3437,7 @@ function On(s) {
|
|
|
3435
3437
|
});
|
|
3436
3438
|
},
|
|
3437
3439
|
onAllowListAdded: (r) => {
|
|
3438
|
-
|
|
3440
|
+
w.info("onAllowListAdded raw payload", r);
|
|
3439
3441
|
const i = (r.allowlist || []).map((u) => u.userId);
|
|
3440
3442
|
s.group.addGroupAllowlistMembers(r.groupId, i);
|
|
3441
3443
|
const c = ie(
|
|
@@ -3451,7 +3453,7 @@ function On(s) {
|
|
|
3451
3453
|
});
|
|
3452
3454
|
},
|
|
3453
3455
|
onAllowListRemoved: (r) => {
|
|
3454
|
-
|
|
3456
|
+
w.info("onAllowListRemoved raw payload", r);
|
|
3455
3457
|
const i = (r.allowlist || []).map((u) => u.userId);
|
|
3456
3458
|
s.group.removeGroupAllowlistMembers(r.groupId, i);
|
|
3457
3459
|
const c = ie(
|
|
@@ -3467,14 +3469,14 @@ function On(s) {
|
|
|
3467
3469
|
});
|
|
3468
3470
|
},
|
|
3469
3471
|
onGroupDisabledChanged: (r) => {
|
|
3470
|
-
|
|
3472
|
+
w.info("onGroupDisabledChanged raw payload", r), s.group.updateGroup(r.groupId, { disabled: r.disabled }), t(s, r.groupId, I.GROUPCHAT, {
|
|
3471
3473
|
eventType: A.GROUP_DISABLED_CHANGED,
|
|
3472
3474
|
params: { disabled: r.disabled },
|
|
3473
3475
|
defaultText: e(r.disabled ? "chat.notice.groupDisabled" : "chat.notice.groupEnabled")
|
|
3474
3476
|
});
|
|
3475
3477
|
},
|
|
3476
3478
|
onSharedFileAdded: (r) => {
|
|
3477
|
-
if (
|
|
3479
|
+
if (w.info("onSharedFileAdded raw payload", r), r.sharedFile) {
|
|
3478
3480
|
s.group.addGroupSharedFile(r.groupId, r.sharedFile);
|
|
3479
3481
|
const i = r.sharedFile.fileOwner, c = (i == null ? void 0 : i.userId) === s.client.currentUser ? e("chat.notice.you") : o(i), u = e("chat.notice.sharedFileAdded").replace("{name}", c || (i == null ? void 0 : i.userId) || "").replace("{fileName}", r.sharedFile.fileName);
|
|
3480
3482
|
t(s, r.groupId, I.GROUPCHAT, {
|
|
@@ -3485,11 +3487,11 @@ function On(s) {
|
|
|
3485
3487
|
}
|
|
3486
3488
|
},
|
|
3487
3489
|
onSharedFileDeleted: (r) => {
|
|
3488
|
-
|
|
3490
|
+
w.info("onSharedFileDeleted raw payload", r), s.group.removeGroupSharedFile(r.groupId, r.fileId);
|
|
3489
3491
|
},
|
|
3490
3492
|
onRequestToJoinReceived: (r) => {
|
|
3491
3493
|
var c;
|
|
3492
|
-
|
|
3494
|
+
w.info("onRequestToJoinReceived raw payload", r);
|
|
3493
3495
|
const i = s.group.getGroupJoinRequests(r.groupId);
|
|
3494
3496
|
s.group.setGroupJoinRequests(r.groupId, [
|
|
3495
3497
|
...i,
|
|
@@ -3506,16 +3508,16 @@ function On(s) {
|
|
|
3506
3508
|
]);
|
|
3507
3509
|
},
|
|
3508
3510
|
onRequestToJoinAccepted: (r) => {
|
|
3509
|
-
|
|
3511
|
+
w.info("onRequestToJoinAccepted raw payload", r);
|
|
3510
3512
|
const i = s.client.currentUser, c = s.group.getGroupJoinRequests(r.groupId).filter((u) => {
|
|
3511
|
-
var
|
|
3512
|
-
return !(u.status === "pending" && (u.applicantId === i || ((
|
|
3513
|
+
var f;
|
|
3514
|
+
return !(u.status === "pending" && (u.applicantId === i || ((f = u.applicant) == null ? void 0 : f.userId) === i));
|
|
3513
3515
|
});
|
|
3514
3516
|
s.group.setGroupJoinRequests(r.groupId, c);
|
|
3515
3517
|
},
|
|
3516
3518
|
onRequestToJoinDeclined: (r) => {
|
|
3517
3519
|
var i;
|
|
3518
|
-
|
|
3520
|
+
w.info("onRequestToJoinDeclined raw payload", r), s.group.updateGroupJoinRequest(
|
|
3519
3521
|
r.groupId,
|
|
3520
3522
|
((i = r.applicant) == null ? void 0 : i.userId) || "",
|
|
3521
3523
|
"declined"
|
|
@@ -3543,22 +3545,22 @@ function Pn(s) {
|
|
|
3543
3545
|
};
|
|
3544
3546
|
}
|
|
3545
3547
|
function Bn(s, e, t = {}, n, o, a) {
|
|
3546
|
-
const r =
|
|
3547
|
-
return s.addEventHandler("uikit-conn", r), s.chatManager.addEventHandler("uikit-chat", i), s.contactManager.addEventHandler("uikit-contact", c), s.groupManager.addEventHandler("uikit-group", u), s.presenceManager.addEventHandler("uikit-presence",
|
|
3548
|
+
const r = wn(e, t), i = Nn(s, e, n, o, a), c = kn(e), u = On(e), f = Pn(e);
|
|
3549
|
+
return s.addEventHandler("uikit-conn", r), s.chatManager.addEventHandler("uikit-chat", i), s.contactManager.addEventHandler("uikit-contact", c), s.groupManager.addEventHandler("uikit-group", u), s.presenceManager.addEventHandler("uikit-presence", f), () => {
|
|
3548
3550
|
s.removeEventHandler("uikit-conn"), s.chatManager.removeEventHandler("uikit-chat"), s.contactManager.removeEventHandler("uikit-contact"), s.groupManager.removeEventHandler("uikit-group"), s.presenceManager.removeEventHandler("uikit-presence"), Un(), An();
|
|
3549
3551
|
};
|
|
3550
3552
|
}
|
|
3551
3553
|
const D = T("UIKit:Websdk5Adapter"), Fn = [
|
|
3552
|
-
|
|
3554
|
+
qe,
|
|
3553
3555
|
ct,
|
|
3554
3556
|
ut,
|
|
3555
3557
|
dt,
|
|
3556
3558
|
lt,
|
|
3557
|
-
|
|
3559
|
+
We
|
|
3558
3560
|
], Hn = [
|
|
3559
|
-
|
|
3561
|
+
qe,
|
|
3560
3562
|
at,
|
|
3561
|
-
|
|
3563
|
+
We
|
|
3562
3564
|
];
|
|
3563
3565
|
class ts {
|
|
3564
3566
|
constructor(e) {
|
|
@@ -3601,28 +3603,28 @@ class ts {
|
|
|
3601
3603
|
onUserInfoSubscriptionPermissionError: i,
|
|
3602
3604
|
registerImEvents: c,
|
|
3603
3605
|
managerPreset: u,
|
|
3604
|
-
repositories:
|
|
3605
|
-
persistence:
|
|
3606
|
+
repositories: f,
|
|
3607
|
+
persistence: m,
|
|
3606
3608
|
lastMessageTextResolver: g,
|
|
3607
3609
|
...d
|
|
3608
|
-
} = t, l = e.repositories ??
|
|
3610
|
+
} = t, l = e.repositories ?? f, p = e.persistence ?? m;
|
|
3609
3611
|
this._persistence = p, this._lastMessageTextResolver = g, this._loginTimeoutMs = e.loginTimeoutMs;
|
|
3610
3612
|
const { appKey: h, appId: v, ...S } = d;
|
|
3611
|
-
let
|
|
3613
|
+
let C;
|
|
3612
3614
|
if (e.appKey)
|
|
3613
|
-
|
|
3615
|
+
C = { appKey: e.appKey };
|
|
3614
3616
|
else if (e.appId)
|
|
3615
|
-
|
|
3617
|
+
C = { appId: e.appId };
|
|
3616
3618
|
else if (this.injectedClient)
|
|
3617
|
-
|
|
3619
|
+
C = { appKey: "" };
|
|
3618
3620
|
else
|
|
3619
3621
|
throw new Error("[Websdk5Adapter] 缺少应用身份:SdkConfig.appKey 与 SdkConfig.appId 必须提供其一");
|
|
3620
3622
|
this._client = this.injectedClient ?? Nt({
|
|
3621
3623
|
debug: e.debug,
|
|
3622
3624
|
managers: d.managers ?? (u === "chatroom" ? Hn : Fn),
|
|
3623
3625
|
...S,
|
|
3624
|
-
...
|
|
3625
|
-
}), r && rt(r), this._features = n ??
|
|
3626
|
+
...C
|
|
3627
|
+
}), r && rt(r), this._features = n ?? jt(), this._registerImEvents = c !== !1;
|
|
3626
3628
|
const y = a ? Object.keys(a) : [];
|
|
3627
3629
|
if (D.info("[Websdk5Adapter] init 开始", {
|
|
3628
3630
|
mode: this.injectedClient ? "injected-client" : "builtin",
|
|
@@ -3644,8 +3646,8 @@ class ts {
|
|
|
3644
3646
|
}),
|
|
3645
3647
|
conversation: new pn(this._client, R.conversation, {
|
|
3646
3648
|
sendPendingReadReceipts: (W, L) => {
|
|
3647
|
-
var Y,
|
|
3648
|
-
((Y = this._features) == null ? void 0 : Y.enableReadReceipt) !== !1 && ((
|
|
3649
|
+
var Y, De;
|
|
3650
|
+
((Y = this._features) == null ? void 0 : Y.enableReadReceipt) !== !1 && ((De = this._domains) == null || De.message.sendPendingReadReceipts(W, L));
|
|
3649
3651
|
},
|
|
3650
3652
|
resolveSenderName: (W) => {
|
|
3651
3653
|
var Y;
|
|
@@ -3665,15 +3667,15 @@ class ts {
|
|
|
3665
3667
|
presence: new bn(this._client, R.presence, {
|
|
3666
3668
|
presenceRepository: l == null ? void 0 : l.presence
|
|
3667
3669
|
})
|
|
3668
|
-
}, this._userInfoDomain = new
|
|
3670
|
+
}, this._userInfoDomain = new Cn(
|
|
3669
3671
|
this._client,
|
|
3670
3672
|
R.userInfo,
|
|
3671
|
-
(l == null ? void 0 : l.userInfo) ??
|
|
3673
|
+
(l == null ? void 0 : l.userInfo) ?? Vt(o) ?? {},
|
|
3672
3674
|
i ?? (() => D.warn("[Websdk5Adapter] 用户资料订阅无权限,已自动熔断"))
|
|
3673
3675
|
), this._userInfoDomain.listen(), this._setupEventHandlers(), D.info("[Websdk5Adapter] init 完成");
|
|
3674
3676
|
}
|
|
3675
3677
|
async login(e, t) {
|
|
3676
|
-
var o, a, r, i, c, u,
|
|
3678
|
+
var o, a, r, i, c, u, f;
|
|
3677
3679
|
if (!this._client)
|
|
3678
3680
|
throw new Error("[Websdk5Adapter] 尚未初始化,请先调用 init()");
|
|
3679
3681
|
this._eventsRegistered || (D.debug("[Websdk5Adapter] 登出后重新登录,恢复事件处理器与用户资料监听"), (o = this._userInfoDomain) == null || o.listen(), this._setupEventHandlers());
|
|
@@ -3684,8 +3686,8 @@ class ts {
|
|
|
3684
3686
|
}), D.info("[Websdk5Adapter] login 开始", { user: n }), (i = (a = this._stores) == null ? void 0 : (r = a.client).setCurrentUser) == null || i.call(r, n);
|
|
3685
3687
|
try {
|
|
3686
3688
|
await this._client.login(n, t, this._loginTimeoutMs);
|
|
3687
|
-
} catch (
|
|
3688
|
-
throw (
|
|
3689
|
+
} catch (m) {
|
|
3690
|
+
throw (f = (c = this._stores) == null ? void 0 : (u = c.client).setCurrentUser) == null || f.call(u, ""), D.error("[Websdk5Adapter] login 失败:", U(m)), m;
|
|
3689
3691
|
}
|
|
3690
3692
|
D.info("[Websdk5Adapter] login 成功", { user: n });
|
|
3691
3693
|
}
|
|
@@ -3775,20 +3777,20 @@ class ts {
|
|
|
3775
3777
|
}
|
|
3776
3778
|
}
|
|
3777
3779
|
export {
|
|
3778
|
-
|
|
3780
|
+
Be as ALL_USER_INFO_ATTRIBUTES,
|
|
3779
3781
|
In as ContactDomain,
|
|
3780
3782
|
pn as ConversationDomain,
|
|
3781
3783
|
yn as GroupDomain,
|
|
3782
3784
|
dn as MessageDomain,
|
|
3783
3785
|
bn as PresenceDomain,
|
|
3784
3786
|
_t as UIKitClient,
|
|
3785
|
-
|
|
3787
|
+
Cn as UserInfoDomain,
|
|
3786
3788
|
Hn as WEBSDK5_CHATROOM_MANAGERS,
|
|
3787
3789
|
Fn as WEBSDK5_MANAGERS,
|
|
3788
3790
|
ts as Websdk5Adapter,
|
|
3789
3791
|
Nn as createChatHandlers,
|
|
3790
3792
|
Nt as createClient,
|
|
3791
|
-
|
|
3793
|
+
wn as createConnectionHandlers,
|
|
3792
3794
|
kn as createContactHandlers,
|
|
3793
3795
|
On as createGroupHandlers,
|
|
3794
3796
|
Pn as createPresenceHandlers,
|
|
@@ -3803,7 +3805,7 @@ export {
|
|
|
3803
3805
|
$n as isSdkDebugEnabled,
|
|
3804
3806
|
an as markReadReceiptSent,
|
|
3805
3807
|
rs as normalizeUserId,
|
|
3806
|
-
|
|
3808
|
+
Fe as notifyContactEvent,
|
|
3807
3809
|
Rn as notifyOnNewMessage,
|
|
3808
3810
|
nt as parsePresenceStatus,
|
|
3809
3811
|
Bn as registerEventHandlers,
|
|
@@ -3824,10 +3826,10 @@ export {
|
|
|
3824
3826
|
Ge as toUiContacts,
|
|
3825
3827
|
ln as toUiConversation,
|
|
3826
3828
|
te as toUiConversations,
|
|
3827
|
-
|
|
3829
|
+
Le as toUiGroup,
|
|
3828
3830
|
Mn as toUiGroupMember,
|
|
3829
3831
|
Z as toUiGroupMembers,
|
|
3830
|
-
|
|
3832
|
+
fe as toUiGroups,
|
|
3831
3833
|
P as toUiMessage,
|
|
3832
3834
|
Qn as toUiMessages,
|
|
3833
3835
|
es as useSyncStatus
|