openclaw-openagent 1.0.0 → 1.0.2
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/index.d.ts +25 -0
- package/dist/index.js +105 -0
- package/dist/src/app/channel-tools.d.ts +28 -0
- package/dist/src/app/channel-tools.js +251 -0
- package/dist/src/app/discovery-tools.d.ts +35 -0
- package/dist/src/app/discovery-tools.js +243 -0
- package/dist/src/app/download-file-tool.d.ts +10 -0
- package/dist/src/app/download-file-tool.js +104 -0
- package/dist/src/app/hooks.d.ts +14 -0
- package/dist/src/app/hooks.js +118 -0
- package/dist/src/app/index.d.ts +13 -0
- package/dist/src/app/index.js +44 -0
- package/dist/src/app/messaging-tools.d.ts +11 -0
- package/dist/src/app/messaging-tools.js +79 -0
- package/dist/src/app/ops-tools.d.ts +21 -0
- package/dist/src/app/ops-tools.js +158 -0
- package/dist/src/app/remote-agent-tool.d.ts +27 -0
- package/dist/src/app/remote-agent-tool.js +461 -0
- package/dist/src/app/types.d.ts +61 -0
- package/dist/src/app/types.js +11 -0
- package/dist/src/app/upload-file-tool.d.ts +16 -0
- package/dist/src/app/upload-file-tool.js +353 -0
- package/dist/src/app/verbose-preflight.d.ts +2 -0
- package/dist/src/app/verbose-preflight.js +145 -0
- package/dist/src/auth/config.d.ts +79 -0
- package/dist/src/auth/config.js +133 -0
- package/dist/src/auth/credential-manager.d.ts +65 -0
- package/dist/src/auth/credential-manager.js +122 -0
- package/dist/src/auth/index.d.ts +6 -0
- package/dist/src/auth/index.js +6 -0
- package/dist/src/auth/verify.d.ts +42 -0
- package/dist/src/auth/verify.js +60 -0
- package/dist/src/channel.d.ts +269 -0
- package/dist/src/channel.js +488 -0
- package/dist/src/compat.d.ts +37 -0
- package/dist/src/compat.js +70 -0
- package/dist/src/config/config-schema.d.ts +56 -0
- package/dist/src/config/config-schema.js +34 -0
- package/dist/src/messaging/aggregator.d.ts +25 -0
- package/dist/src/messaging/aggregator.js +90 -0
- package/dist/src/messaging/collector.d.ts +27 -0
- package/dist/src/messaging/collector.js +76 -0
- package/dist/src/messaging/executor.d.ts +14 -0
- package/dist/src/messaging/executor.js +59 -0
- package/dist/src/messaging/inbound.d.ts +97 -0
- package/dist/src/messaging/inbound.js +63 -0
- package/dist/src/messaging/index.d.ts +10 -0
- package/dist/src/messaging/index.js +9 -0
- package/dist/src/messaging/mention-protocol.d.ts +42 -0
- package/dist/src/messaging/mention-protocol.js +74 -0
- package/dist/src/messaging/process-c2c-request.d.ts +55 -0
- package/dist/src/messaging/process-c2c-request.js +445 -0
- package/dist/src/messaging/process-message.d.ts +62 -0
- package/dist/src/messaging/process-message.js +282 -0
- package/dist/src/messaging/scheduler.d.ts +17 -0
- package/dist/src/messaging/scheduler.js +47 -0
- package/dist/src/messaging/types.d.ts +34 -0
- package/dist/src/messaging/types.js +4 -0
- package/dist/src/plugin-ui/assets/openagent-override.js +9267 -0
- package/dist/src/plugin-ui/index.d.ts +13 -0
- package/dist/src/plugin-ui/index.js +16 -0
- package/dist/src/plugin-ui/ui-extension-loader/backup.d.ts +23 -0
- package/dist/src/plugin-ui/ui-extension-loader/backup.js +82 -0
- package/dist/src/plugin-ui/ui-extension-loader/index.d.ts +28 -0
- package/dist/src/plugin-ui/ui-extension-loader/index.js +240 -0
- package/dist/src/plugin-ui/ui-extension-loader/locator.d.ts +35 -0
- package/dist/src/plugin-ui/ui-extension-loader/locator.js +129 -0
- package/dist/src/plugin-ui/ui-extension-loader/manifest.d.ts +26 -0
- package/dist/src/plugin-ui/ui-extension-loader/manifest.js +45 -0
- package/dist/src/plugin-ui/ui-extension-loader/registry-regex.d.ts +9 -0
- package/dist/src/plugin-ui/ui-extension-loader/registry-regex.js +701 -0
- package/dist/src/plugin-ui/ui-extension-loader/removed-extensions.d.ts +8 -0
- package/dist/src/plugin-ui/ui-extension-loader/removed-extensions.js +58 -0
- package/dist/src/plugin-ui/ui-extension-loader/types.d.ts +55 -0
- package/dist/src/plugin-ui/ui-extension-loader/types.js +23 -0
- package/dist/src/proxy/auth-proxy.d.ts +20 -0
- package/dist/src/proxy/auth-proxy.js +337 -0
- package/dist/src/runtime/account.d.ts +156 -0
- package/dist/src/runtime/account.js +491 -0
- package/dist/src/runtime/index.d.ts +5 -0
- package/dist/src/runtime/index.js +6 -0
- package/dist/src/runtime/plugin-runtime.d.ts +40 -0
- package/dist/src/runtime/plugin-runtime.js +72 -0
- package/dist/src/runtime/registry.d.ts +41 -0
- package/dist/src/runtime/registry.js +60 -0
- package/dist/src/sdk/CLASS_MAP.md +143 -0
- package/dist/src/sdk/index.d.ts +126 -0
- package/dist/src/sdk/index.js +23990 -0
- package/dist/src/sdk/modules/cloud-search-module.js +1117 -0
- package/dist/src/sdk/modules/follow-module.js +1069 -0
- package/dist/src/sdk/modules/group-module.js +7397 -0
- package/dist/src/sdk/modules/relationship-module.js +2269 -0
- package/dist/src/sdk/modules/signaling-module.js +1468 -0
- package/dist/src/sdk/modules/tim-upload-plugin.js +730 -0
- package/dist/src/sdk/node-env/http-request.js +90 -0
- package/dist/src/sdk/node-env/index.js +57 -0
- package/dist/src/sdk/node-env/storage.js +114 -0
- package/dist/src/sdk/package.json +10 -0
- package/dist/src/sdk/sdk/CLASS_MAP.md +143 -0
- package/dist/src/sdk/sdk/index.d.ts +126 -0
- package/dist/src/sdk/sdk/index.js +23990 -0
- package/dist/src/sdk/sdk/modules/cloud-search-module.js +1117 -0
- package/dist/src/sdk/sdk/modules/follow-module.js +1069 -0
- package/dist/src/sdk/sdk/modules/group-module.js +7397 -0
- package/dist/src/sdk/sdk/modules/relationship-module.js +2269 -0
- package/dist/src/sdk/sdk/modules/signaling-module.js +1468 -0
- package/dist/src/sdk/sdk/modules/tim-upload-plugin.js +730 -0
- package/dist/src/sdk/sdk/node-env/http-request.js +90 -0
- package/dist/src/sdk/sdk/node-env/index.js +57 -0
- package/dist/src/sdk/sdk/node-env/storage.js +114 -0
- package/dist/src/sdk/sdk/package.json +10 -0
- package/dist/src/sdk/sdk/tsconfig.json +16 -0
- package/dist/src/sdk/tsconfig.json +16 -0
- package/dist/src/state/pending-invocation-store.d.ts +26 -0
- package/dist/src/state/pending-invocation-store.js +39 -0
- package/dist/src/state/store.d.ts +165 -0
- package/dist/src/state/store.js +535 -0
- package/dist/src/tim/c2c.d.ts +83 -0
- package/dist/src/tim/c2c.js +318 -0
- package/dist/src/tim/channels.d.ts +95 -0
- package/dist/src/tim/channels.js +279 -0
- package/dist/src/tim/client.d.ts +54 -0
- package/dist/src/tim/client.js +268 -0
- package/dist/src/tim/index.d.ts +6 -0
- package/dist/src/tim/index.js +6 -0
- package/dist/src/tim/messages.d.ts +50 -0
- package/dist/src/tim/messages.js +104 -0
- package/dist/src/tim/sdk-logger-init.d.ts +13 -0
- package/dist/src/tim/sdk-logger-init.js +46 -0
- package/dist/src/tools.d.ts +9 -0
- package/dist/src/tools.js +8 -0
- package/dist/src/transport/factory.d.ts +63 -0
- package/dist/src/transport/factory.js +54 -0
- package/dist/src/transport/oasn/index.d.ts +12 -0
- package/dist/src/transport/oasn/index.js +9 -0
- package/dist/src/transport/oasn/oasn-agent-card.d.ts +38 -0
- package/dist/src/transport/oasn/oasn-agent-card.js +102 -0
- package/dist/src/transport/oasn/oasn-discovery.d.ts +33 -0
- package/dist/src/transport/oasn/oasn-discovery.js +97 -0
- package/dist/src/transport/oasn/oasn-files.d.ts +64 -0
- package/dist/src/transport/oasn/oasn-files.js +174 -0
- package/dist/src/transport/oasn/oasn-http.d.ts +98 -0
- package/dist/src/transport/oasn/oasn-http.js +362 -0
- package/dist/src/transport/oasn/oasn-invocation.d.ts +154 -0
- package/dist/src/transport/oasn/oasn-invocation.js +432 -0
- package/dist/src/transport/oasn/oasn-normalize.d.ts +6 -0
- package/dist/src/transport/oasn/oasn-normalize.js +112 -0
- package/dist/src/transport/oasn/oasn-register.d.ts +19 -0
- package/dist/src/transport/oasn/oasn-register.js +24 -0
- package/dist/src/transport/oasn/oasn-transport.d.ts +114 -0
- package/dist/src/transport/oasn/oasn-transport.js +230 -0
- package/dist/src/transport/oasn/oasn-types.d.ts +331 -0
- package/dist/src/transport/oasn/oasn-types.js +44 -0
- package/dist/src/transport/tim/index.d.ts +7 -0
- package/dist/src/transport/tim/index.js +6 -0
- package/dist/src/transport/tim/tim-transport.d.ts +122 -0
- package/dist/src/transport/tim/tim-transport.js +402 -0
- package/dist/src/transport/types.d.ts +450 -0
- package/dist/src/transport/types.js +38 -0
- package/dist/src/util/http.d.ts +21 -0
- package/dist/src/util/http.js +93 -0
- package/dist/src/util/logger.d.ts +20 -0
- package/dist/src/util/logger.js +100 -0
- package/dist/src/util/url-resolver.d.ts +7 -0
- package/dist/src/util/url-resolver.js +20 -0
- package/index.ts +11 -0
- package/openclaw.plugin.json +9 -0
- package/package.json +7 -4
- package/src/app/download-file-tool.ts +133 -0
- package/src/app/hooks.ts +89 -5
- package/src/app/index.ts +6 -0
- package/src/app/remote-agent-tool.ts +46 -0
- package/src/app/types.ts +1 -0
- package/src/app/upload-file-tool.ts +411 -0
- package/src/plugin-ui/assets/openagent-override.js +1 -63
- package/src/plugin-ui/modules/agent-book/panel/agent-book.js +0 -61
- package/src/plugin-ui/modules/agent-book/panel/agent-data.js +0 -1
- package/src/plugin-ui/ui-extension-loader/registry-regex.ts +30 -13
- package/src/runtime/account.ts +0 -23
- package/src/transport/oasn/oasn-files.ts +5 -5
- package/src/transport/oasn/oasn-invocation.ts +44 -2
- package/src/transport/oasn/oasn-normalize.ts +0 -26
- package/src/transport/oasn/oasn-register.ts +8 -81
- package/src/transport/oasn/oasn-transport.ts +9 -32
- package/src/transport/oasn/oasn-types.ts +53 -6
- package/src/transport/types.ts +33 -36
- package/src/util/url-resolver.ts +17 -0
|
@@ -0,0 +1,2269 @@
|
|
|
1
|
+
let e = {
|
|
2
|
+
A2KEY_AND_TINYID_UPDATED: "_inner1",
|
|
3
|
+
CLOUD_CONFIG: "_inner2",
|
|
4
|
+
PROFILE_UPDATED: "_inner3",
|
|
5
|
+
CONV_SYNC_COMPLETED: "_inner4",
|
|
6
|
+
C2C_UNREAD_HANDLE_COMPLETED: "_inner5",
|
|
7
|
+
},
|
|
8
|
+
t,
|
|
9
|
+
s,
|
|
10
|
+
i =
|
|
11
|
+
((t =
|
|
12
|
+
"undefined" != typeof console
|
|
13
|
+
? console
|
|
14
|
+
: "undefined" != typeof global && global.console
|
|
15
|
+
? global.console
|
|
16
|
+
: "undefined" != typeof window && window.console
|
|
17
|
+
? window.console
|
|
18
|
+
: {}),
|
|
19
|
+
function () {}),
|
|
20
|
+
n = [
|
|
21
|
+
"assert",
|
|
22
|
+
"clear",
|
|
23
|
+
"count",
|
|
24
|
+
"debug",
|
|
25
|
+
"dir",
|
|
26
|
+
"dirxml",
|
|
27
|
+
"error",
|
|
28
|
+
"group",
|
|
29
|
+
"groupCollapsed",
|
|
30
|
+
"groupEnd",
|
|
31
|
+
"info",
|
|
32
|
+
"log",
|
|
33
|
+
"profile",
|
|
34
|
+
"profileEnd",
|
|
35
|
+
"table",
|
|
36
|
+
"time",
|
|
37
|
+
"timeEnd",
|
|
38
|
+
"timeStamp",
|
|
39
|
+
"trace",
|
|
40
|
+
"warn",
|
|
41
|
+
],
|
|
42
|
+
r = n.length;
|
|
43
|
+
for (; r--; ) ((s = n[r]), console[s] || (t[s] = i));
|
|
44
|
+
var o = t;
|
|
45
|
+
class a {
|
|
46
|
+
constructor(e = 0, t = 0) {
|
|
47
|
+
((this.high = e), (this.low = t));
|
|
48
|
+
}
|
|
49
|
+
equal(e) {
|
|
50
|
+
return null !== e && this.low === e.low && this.high === e.high;
|
|
51
|
+
}
|
|
52
|
+
toString() {
|
|
53
|
+
var e = Number(this.high).toString(16);
|
|
54
|
+
let t = Number(this.low).toString(16);
|
|
55
|
+
if (t.length < 8) {
|
|
56
|
+
let e = 8 - t.length;
|
|
57
|
+
for (; e; ) ((t = "0" + t), e--);
|
|
58
|
+
}
|
|
59
|
+
return e + t;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
let d = {
|
|
63
|
+
TEST: {
|
|
64
|
+
CHINA: { DEFAULT: "wss://wss-dev.tim.qq.com" },
|
|
65
|
+
OVERSEA: { DEFAULT: "wss://wss-dev.tim.qq.com" },
|
|
66
|
+
SINGAPORE: { DEFAULT: "wss://wsssgp-dev.im.qcloud.com" },
|
|
67
|
+
KOREA: { DEFAULT: "wss://wsskr-dev.im.qcloud.com" },
|
|
68
|
+
GERMANY: { DEFAULT: "wss://wssger-dev.im.qcloud.com" },
|
|
69
|
+
IND: { DEFAULT: "wss://wssind-dev.im.qcloud.com" },
|
|
70
|
+
JPN: { DEFAULT: "wss://wssjpn-dev.im.qcloud.com" },
|
|
71
|
+
USA: { DEFAULT: "wss://wssusa-dev.im.qcloud.com" },
|
|
72
|
+
INDONESIA: { DEFAULT: "wss://wssidn-dev.im.qcloud.com" },
|
|
73
|
+
},
|
|
74
|
+
PRODUCTION: {
|
|
75
|
+
CHINA: {
|
|
76
|
+
DEFAULT0: "wss://*w4c.my-imcloud.com",
|
|
77
|
+
DEFAULT: "wss://wss.im.qcloud.com",
|
|
78
|
+
IPV6: "wss://wssv6.im.qcloud.com",
|
|
79
|
+
BACKUP: "wss://wss.tim.qq.com",
|
|
80
|
+
BACKUP_WEB: "wss://*w4c.my-cpaas.com",
|
|
81
|
+
BACKUP_CN: "wss://wss.im.tencent.cn",
|
|
82
|
+
STAT: "https://events.im.qcloud.com",
|
|
83
|
+
ANYCAST: "wss://162.14.13.203",
|
|
84
|
+
},
|
|
85
|
+
OVERSEA: {
|
|
86
|
+
DEFAULT0: "wss://*w4c.my-imcloud.com",
|
|
87
|
+
DEFAULT: "wss://wss.im.qcloud.com",
|
|
88
|
+
IPV6: "wss://wssv6.im.qcloud.com",
|
|
89
|
+
BACKUP: "wss://wss.my-imcloud.com",
|
|
90
|
+
BACKUP_WEB: "wss://*w4c.my-cpaas.com",
|
|
91
|
+
BACKUP_CN: "wss://wss.im.tencent.cn",
|
|
92
|
+
STAT: "https://api.my-imcloud.com",
|
|
93
|
+
},
|
|
94
|
+
SINGAPORE: {
|
|
95
|
+
DEFAULT0: "wss://*w4s.my-imcloud.com",
|
|
96
|
+
DEFAULT: "wss://wsssgp.im.qcloud.com",
|
|
97
|
+
IPV6: "wss://wsssgpv6.im.qcloud.com",
|
|
98
|
+
BACKUP: "wss://wsssgp.my-imcloud.com",
|
|
99
|
+
BACKUP_WEB: "wss://*w4s.my-cpaas.com",
|
|
100
|
+
STAT: "https://apisgp.my-imcloud.com",
|
|
101
|
+
ANYCAST: "wss://162.14.19.159",
|
|
102
|
+
},
|
|
103
|
+
KOREA: {
|
|
104
|
+
DEFAULT0: "wss://*w4k.my-imcloud.com",
|
|
105
|
+
DEFAULT: "wss://wsskr.im.qcloud.com",
|
|
106
|
+
IPV6: "wss://wsskrv6.im.qcloud.com",
|
|
107
|
+
BACKUP: "wss://wsskr.my-imcloud.com",
|
|
108
|
+
BACKUP_WEB: "wss://*w4k.my-cpaas.com",
|
|
109
|
+
STAT: "https://apikr.my-imcloud.com",
|
|
110
|
+
ANYCAST: "wss://162.14.13.104",
|
|
111
|
+
},
|
|
112
|
+
GERMANY: {
|
|
113
|
+
DEFAULT0: "wss://*w4g.my-imcloud.com",
|
|
114
|
+
DEFAULT: "wss://wssger.im.qcloud.com",
|
|
115
|
+
IPV6: "wss://wssgerv6.im.qcloud.com",
|
|
116
|
+
BACKUP: "wss://wssger.my-imcloud.com",
|
|
117
|
+
BACKUP_WEB: "wss://*w4g.my-cpaas.com",
|
|
118
|
+
STAT: "https://apiger.my-imcloud.com",
|
|
119
|
+
ANYCAST: "wss://162.14.3.17",
|
|
120
|
+
},
|
|
121
|
+
IND: {
|
|
122
|
+
DEFAULT0: "wss://*w4i.my-imcloud.com",
|
|
123
|
+
DEFAULT: "wss://wssind.my-imcloud.com",
|
|
124
|
+
IPV6: "wss://wssindv6.im.qcloud.com",
|
|
125
|
+
BACKUP: "wss://wssind.im.qcloud.com",
|
|
126
|
+
BACKUP_WEB: "wss://*w4i.my-cpaas.com",
|
|
127
|
+
STAT: "https://apiind.my-imcloud.com",
|
|
128
|
+
ANYCAST: "wss://162.14.19.46",
|
|
129
|
+
},
|
|
130
|
+
JPN: {
|
|
131
|
+
DEFAULT0: "wss://*w4j.my-imcloud.com",
|
|
132
|
+
DEFAULT: "wss://wssjpn.im.qcloud.com",
|
|
133
|
+
IPV6: "wss://wssjpnv6.im.qcloud.com",
|
|
134
|
+
BACKUP: "wss://wssjpn.my-imcloud.com",
|
|
135
|
+
BACKUP_WEB: "wss://*w4j.my-cpaas.com",
|
|
136
|
+
STAT: "https://apijpn.my-imcloud.com",
|
|
137
|
+
ANYCAST: "wss://162.14.13.254",
|
|
138
|
+
},
|
|
139
|
+
USA: {
|
|
140
|
+
DEFAULT0: "wss://*w4u.my-imcloud.com",
|
|
141
|
+
DEFAULT: "wss://wssusa.im.qcloud.com",
|
|
142
|
+
IPV6: "wss://wssusav6.im.qcloud.com",
|
|
143
|
+
BACKUP: "wss://wssusa.my-imcloud.com",
|
|
144
|
+
BACKUP_WEB: "wss://*w4u.my-cpaas.com",
|
|
145
|
+
STAT: "https://apiusa.my-imcloud.com",
|
|
146
|
+
ANYCAST: "wss://162.14.10.42",
|
|
147
|
+
},
|
|
148
|
+
INDONESIA: {
|
|
149
|
+
DEFAULT0: "wss://*w4y.my-imcloud.com",
|
|
150
|
+
DEFAULT: "wss://wssidn.im.qcloud.com",
|
|
151
|
+
IPV6: "wss://wssidnv6.im.qcloud.com",
|
|
152
|
+
BACKUP: "wss://wssidn.my-imcloud.com",
|
|
153
|
+
BACKUP_WEB: "wss://*w4y.my-cpaas.com",
|
|
154
|
+
STAT: "https://apiidn.my-imcloud.com",
|
|
155
|
+
ANYCAST: "wss://43.129.34.169",
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
u = {
|
|
160
|
+
ANDROID: 2,
|
|
161
|
+
IOS: 3,
|
|
162
|
+
MAC: 4,
|
|
163
|
+
WEB: 7,
|
|
164
|
+
WX_MP: 8,
|
|
165
|
+
QQ_MP: 9,
|
|
166
|
+
TT_MP: 10,
|
|
167
|
+
BAIDU_MP: 11,
|
|
168
|
+
ALI_MP: 12,
|
|
169
|
+
IPAD: 13,
|
|
170
|
+
UNI_NATIVE_APP: 15,
|
|
171
|
+
DONUT_NATIVE_APP: 19,
|
|
172
|
+
NS_NATIVE_APP: 20,
|
|
173
|
+
RN_NATIVE_APP: 21,
|
|
174
|
+
},
|
|
175
|
+
c = "CHINA",
|
|
176
|
+
l = {
|
|
177
|
+
HOST: {
|
|
178
|
+
CURRENT: {
|
|
179
|
+
DEFAULT: "wss://wss.im.qcloud.com",
|
|
180
|
+
STAT: "https://events.im.qcloud.com",
|
|
181
|
+
},
|
|
182
|
+
setCurrent(e = c) {
|
|
183
|
+
this.CURRENT = d.PRODUCTION[e];
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
NAME: {
|
|
187
|
+
OPEN_IM: "openim",
|
|
188
|
+
OPEN_IM_MSG_EXT: "openim_msg_ext_http_svc",
|
|
189
|
+
GRP: "group_open_http_svc",
|
|
190
|
+
GRP_AV: "group_open_avchatroom_http_svc",
|
|
191
|
+
GRP_COMMUNITY: "million_group_open_http_svc",
|
|
192
|
+
GRP_ATTR: "group_open_attr_http_svc",
|
|
193
|
+
FD: "sns",
|
|
194
|
+
PROFILE: "profile",
|
|
195
|
+
RECENT_CONTACT: "recentcontact",
|
|
196
|
+
PIC: "openpic",
|
|
197
|
+
BIG_GRP_NO_AUTH: "group_open_http_noauth_svc",
|
|
198
|
+
BIG_GRP_POLLING: "group_open_long_polling_http_svc",
|
|
199
|
+
BIG_GRP_POLLING_NO_AUTH: "group_open_long_polling_http_noauth_svc",
|
|
200
|
+
IM_OPEN_STAT: "imopenstat",
|
|
201
|
+
WEB_IM: "webim",
|
|
202
|
+
IM_COS_SIGN: "im_cos_sign_svr",
|
|
203
|
+
CUSTOM_UPLOAD: "im_cos_msg",
|
|
204
|
+
HEARTBEAT: "heartbeat",
|
|
205
|
+
IM_OPEN_PUSH: "im_open_push",
|
|
206
|
+
IM_OPEN_STATUS: "im_open_status",
|
|
207
|
+
IM_LONG_MSG: "im_long_msg",
|
|
208
|
+
IM_CONFIG_MANAGER: "im_sdk_config_mgr",
|
|
209
|
+
STAT_SERVICE: "StatSvc",
|
|
210
|
+
OVERLOAD_PUSH: "OverLoadPush",
|
|
211
|
+
IM_MSG_AUDIT_MGR: "im_msg_audit_mgr",
|
|
212
|
+
TUIROOM_SVR: "tui_room_svr",
|
|
213
|
+
IM_OPEN_TRANSLATE: "im_open_translate",
|
|
214
|
+
IM_OPEN_SPEECH: "im_open_speech",
|
|
215
|
+
MSG_SEARCH: "message_search",
|
|
216
|
+
GRP_SEARCH: "group_search",
|
|
217
|
+
GRP_MEMBER_SEARCH: "group_member_search",
|
|
218
|
+
USER_SEARCH: "user_search",
|
|
219
|
+
FOLLOW: "follow",
|
|
220
|
+
OFFLINE_PUSH_REPORT: "offline_push_report",
|
|
221
|
+
IM_MSG_LOGIC: "im_msg_db_logic",
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
p =
|
|
225
|
+
(new a(0, Math.pow(2, 1)).toString(),
|
|
226
|
+
new a(0, Math.pow(2, 2)).toString(),
|
|
227
|
+
new a(0, Math.pow(2, 3)).toString(),
|
|
228
|
+
new a(0, Math.pow(2, 4)).toString(),
|
|
229
|
+
new a(0, Math.pow(2, 6)).toString(),
|
|
230
|
+
new a(0, Math.pow(2, 7)).toString(),
|
|
231
|
+
new a(0, Math.pow(2, 9)).toString(),
|
|
232
|
+
new a(0, Math.pow(2, 10)).toString(),
|
|
233
|
+
new a(0, Math.pow(2, 11)).toString(),
|
|
234
|
+
new a(0, Math.pow(2, 13)).toString(),
|
|
235
|
+
new a(0, Math.pow(2, 15)).toString(),
|
|
236
|
+
new a(Math.pow(2, 6)).toString(),
|
|
237
|
+
new a(Math.pow(2, 7)).toString(),
|
|
238
|
+
new a(Math.pow(2, 8)).toString(),
|
|
239
|
+
new a(Math.pow(2, 9)).toString(),
|
|
240
|
+
new a(Math.pow(2, 10)).toString(),
|
|
241
|
+
new a(Math.pow(2, 16)).toString(),
|
|
242
|
+
new a(Math.pow(2, 20)).toString(),
|
|
243
|
+
"sns"),
|
|
244
|
+
h =
|
|
245
|
+
(l.HOST.setCurrent(c),
|
|
246
|
+
"undefined" != typeof wx &&
|
|
247
|
+
"function" == typeof wx.getSystemInfoSync &&
|
|
248
|
+
("mac" === wx.getSystemInfoSync().platform ||
|
|
249
|
+
"windows" === wx.getSystemInfoSync().platform) &&
|
|
250
|
+
void 0 === wx.getSystemInfoSync().uniPlatform),
|
|
251
|
+
m =
|
|
252
|
+
("undefined" != typeof wx &&
|
|
253
|
+
"function" == typeof wx.getSystemInfoSync &&
|
|
254
|
+
Boolean(wx.getSystemInfoSync().fontSizeSetting)) ||
|
|
255
|
+
h,
|
|
256
|
+
_ =
|
|
257
|
+
(m && wx.createGamePortal,
|
|
258
|
+
"undefined" != typeof qq &&
|
|
259
|
+
"function" == typeof qq.getSystemInfoSync &&
|
|
260
|
+
Boolean(qq.getSystemInfoSync().fontSizeSetting)),
|
|
261
|
+
f =
|
|
262
|
+
"undefined" != typeof tt &&
|
|
263
|
+
"function" == typeof tt.getSystemInfoSync &&
|
|
264
|
+
Boolean(tt.getSystemInfoSync().fontSizeSetting),
|
|
265
|
+
g =
|
|
266
|
+
"undefined" != typeof swan &&
|
|
267
|
+
"function" == typeof swan.getSystemInfoSync &&
|
|
268
|
+
Boolean(swan.getSystemInfoSync().fontSizeSetting),
|
|
269
|
+
w =
|
|
270
|
+
"undefined" != typeof my &&
|
|
271
|
+
"function" == typeof my.getSystemInfoSync &&
|
|
272
|
+
Boolean(my.getSystemInfoSync().fontSizeSetting),
|
|
273
|
+
y = "undefined" != typeof jd && "function" == typeof jd.getSystemInfoSync,
|
|
274
|
+
A =
|
|
275
|
+
"undefined" != typeof uni &&
|
|
276
|
+
"undefined" == typeof window &&
|
|
277
|
+
"function" == typeof uni.requireNativePlugin,
|
|
278
|
+
I = m && "object" == typeof wx.miniapp,
|
|
279
|
+
T = (f && tt.enterChat, m || _ || f || g || w || A || y),
|
|
280
|
+
D =
|
|
281
|
+
"undefined" == typeof window &&
|
|
282
|
+
!T &&
|
|
283
|
+
"undefined" != typeof global &&
|
|
284
|
+
void 0 !== global.NativeScriptGlobals,
|
|
285
|
+
M =
|
|
286
|
+
"undefined" != typeof global &&
|
|
287
|
+
(void 0 !== global.nativeModuleProxy || void 0 !== global.ReactNative),
|
|
288
|
+
L = "undefined" != typeof uni ? !T : "undefined" != typeof window && !T && !M,
|
|
289
|
+
S =
|
|
290
|
+
(_ ? qq : f ? tt : g ? swan : w ? my : m ? wx : A ? uni : y && jd,
|
|
291
|
+
(L && window && window.navigator && window.navigator.userAgent) || ""),
|
|
292
|
+
F = /(micromessenger|webbrowser)/i.test(S),
|
|
293
|
+
E = (function () {
|
|
294
|
+
let e = "WEB";
|
|
295
|
+
return (
|
|
296
|
+
F
|
|
297
|
+
? (e = "WEB")
|
|
298
|
+
: _
|
|
299
|
+
? (e = "QQ_MP")
|
|
300
|
+
: f
|
|
301
|
+
? (e = "TT_MP")
|
|
302
|
+
: g
|
|
303
|
+
? (e = "BAIDU_MP")
|
|
304
|
+
: w
|
|
305
|
+
? (e = "ALI_MP")
|
|
306
|
+
: m
|
|
307
|
+
? (e = I ? "DONUT_NATIVE_APP" : "WX_MP")
|
|
308
|
+
: A
|
|
309
|
+
? (e = "UNI_NATIVE_APP")
|
|
310
|
+
: D
|
|
311
|
+
? (e = "NS_NATIVE_APP")
|
|
312
|
+
: M && (e = "RN_NATIVE_APP"),
|
|
313
|
+
u[e]
|
|
314
|
+
);
|
|
315
|
+
})(),
|
|
316
|
+
v =
|
|
317
|
+
(!(function () {
|
|
318
|
+
var e = S.match(/OS (\d+)_/i);
|
|
319
|
+
e && e[1] && e[1];
|
|
320
|
+
})(),
|
|
321
|
+
(function () {
|
|
322
|
+
var e,
|
|
323
|
+
t,
|
|
324
|
+
s = S.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
|
|
325
|
+
s &&
|
|
326
|
+
((e = s[1] && parseFloat(s[1])), (t = s[2] && parseFloat(s[2])), e) &&
|
|
327
|
+
t &&
|
|
328
|
+
parseFloat(s[1] + "." + s[2]);
|
|
329
|
+
})(),
|
|
330
|
+
/MSIE/.test(S) || (-1 < S.indexOf("Trident") && -1 < S.indexOf("rv:11.0"))),
|
|
331
|
+
P =
|
|
332
|
+
(!(function () {
|
|
333
|
+
var e = /MSIE\s(\d+)\.\d/.exec(S),
|
|
334
|
+
e = e && parseFloat(e[1]);
|
|
335
|
+
!e && /Trident\/7.0/i.test(S) && /rv:11.0/.test(S);
|
|
336
|
+
})(),
|
|
337
|
+
"C2C"),
|
|
338
|
+
k = "AllowType_Type_AllowAny",
|
|
339
|
+
U = "AdminForbid_Type_None",
|
|
340
|
+
b = "Add_Type_Single",
|
|
341
|
+
C = "Add_Type_Both",
|
|
342
|
+
N = "Delete_Type_Single",
|
|
343
|
+
G = "Delete_Type_Both",
|
|
344
|
+
O = "Pendency_Type_Both",
|
|
345
|
+
$ = "Pendency_Type_ComeIn",
|
|
346
|
+
R = "Pendency_Type_SendOut",
|
|
347
|
+
q = "Response_Action_Agree",
|
|
348
|
+
x = "Response_Action_AgreeAndAdd",
|
|
349
|
+
H = "CheckResult_Type_Both",
|
|
350
|
+
B = "CheckResult_Type_Single",
|
|
351
|
+
W = function () {
|
|
352
|
+
return new Date().getTime() + 0;
|
|
353
|
+
},
|
|
354
|
+
K = "Tag_Profile_IM_Nick",
|
|
355
|
+
j = "Tag_Profile_IM_Gender",
|
|
356
|
+
V = "Tag_Profile_IM_BirthDay",
|
|
357
|
+
Y = "Tag_Profile_IM_Location",
|
|
358
|
+
J = "Tag_Profile_IM_SelfSignature",
|
|
359
|
+
z = "Tag_Profile_IM_AllowType",
|
|
360
|
+
Q = "Tag_Profile_IM_Language",
|
|
361
|
+
X = "Tag_Profile_IM_Image",
|
|
362
|
+
Z = "Tag_Profile_IM_MsgSettings",
|
|
363
|
+
ee = "Tag_Profile_IM_AdminForbidType",
|
|
364
|
+
te = "Tag_Profile_IM_Level",
|
|
365
|
+
se = "Tag_Profile_IM_Role",
|
|
366
|
+
ie = {
|
|
367
|
+
GROUP: "Tag_SNS_IM_Group",
|
|
368
|
+
REMARK: "Tag_SNS_IM_Remark",
|
|
369
|
+
ADDSOURCE: "Tag_SNS_IM_AddSource",
|
|
370
|
+
ADDWORDING: "Tag_SNS_IM_Wording",
|
|
371
|
+
ADDTIME: "Tag_SNS_IM_AddTime",
|
|
372
|
+
},
|
|
373
|
+
ne = "Gender_Type_",
|
|
374
|
+
re = { UNKNOWN: ne + "Unknown", FEMALE: ne + "Female", MALE: ne + "Male" },
|
|
375
|
+
oe = { NONE: "AdminForbid_Type_None", SEND_OUT: "AdminForbid_Type_SendOut" },
|
|
376
|
+
ae = {
|
|
377
|
+
NEED_CONFIRM: "AllowType_Type_NeedConfirm",
|
|
378
|
+
ALLOW_ANY: "AllowType_Type_AllowAny",
|
|
379
|
+
DENY_ANY: "AllowType_Type_DenyAny",
|
|
380
|
+
},
|
|
381
|
+
de = Object.prototype.hasOwnProperty;
|
|
382
|
+
function ue(e) {
|
|
383
|
+
if (null == e) return !0;
|
|
384
|
+
if ("boolean" == typeof e) return !1;
|
|
385
|
+
if ("number" == typeof e) return 0 === e;
|
|
386
|
+
if ("string" == typeof e) return 0 === e.length;
|
|
387
|
+
if ("function" == typeof e) return 0 === e.length;
|
|
388
|
+
if (Array.isArray(e)) return 0 === e.length;
|
|
389
|
+
if (e instanceof Error) return "" === e.message;
|
|
390
|
+
if (_e(e)) {
|
|
391
|
+
for (var t in e) if (de.call(e, t)) return !1;
|
|
392
|
+
return !0;
|
|
393
|
+
}
|
|
394
|
+
return !!(ce(e) || le(e) || pe(e)) && 0 === e.size;
|
|
395
|
+
}
|
|
396
|
+
let ce = function (e) {
|
|
397
|
+
return "map" === ye(e);
|
|
398
|
+
},
|
|
399
|
+
le = function (e) {
|
|
400
|
+
return "set" === ye(e);
|
|
401
|
+
},
|
|
402
|
+
pe = function (e) {
|
|
403
|
+
return "file" === ye(e);
|
|
404
|
+
},
|
|
405
|
+
he = function (e) {
|
|
406
|
+
return (
|
|
407
|
+
null !== e &&
|
|
408
|
+
(("number" == typeof e && !isNaN(+e)) ||
|
|
409
|
+
("object" == typeof e && e.constructor === Number))
|
|
410
|
+
);
|
|
411
|
+
},
|
|
412
|
+
me = function (e) {
|
|
413
|
+
return "string" == typeof e;
|
|
414
|
+
},
|
|
415
|
+
_e = function (e) {
|
|
416
|
+
if ("object" != typeof e || null === e) return !1;
|
|
417
|
+
e = Object.getPrototypeOf(e);
|
|
418
|
+
if (null === e) return !0;
|
|
419
|
+
let t = e;
|
|
420
|
+
for (; null !== Object.getPrototypeOf(t); ) t = Object.getPrototypeOf(t);
|
|
421
|
+
return e === t;
|
|
422
|
+
},
|
|
423
|
+
fe = function (e) {
|
|
424
|
+
return "function" == typeof Array.isArray
|
|
425
|
+
? Array.isArray(e)
|
|
426
|
+
: "array" === ye(e);
|
|
427
|
+
},
|
|
428
|
+
ge = function (e) {
|
|
429
|
+
return void 0 === e;
|
|
430
|
+
},
|
|
431
|
+
we = function (e) {
|
|
432
|
+
return e instanceof Error;
|
|
433
|
+
},
|
|
434
|
+
ye = function (e) {
|
|
435
|
+
return Object.prototype.toString
|
|
436
|
+
.call(e)
|
|
437
|
+
.match(/^\[object (.*)\]$/)[1]
|
|
438
|
+
.toLowerCase();
|
|
439
|
+
},
|
|
440
|
+
Ae =
|
|
441
|
+
(Date.now ||
|
|
442
|
+
(Date.now = function () {
|
|
443
|
+
return new Date().getTime();
|
|
444
|
+
}),
|
|
445
|
+
function (e) {
|
|
446
|
+
if (0 === e.length) return 0;
|
|
447
|
+
let t = 0,
|
|
448
|
+
s = 0,
|
|
449
|
+
i;
|
|
450
|
+
for (
|
|
451
|
+
var r =
|
|
452
|
+
"undefined" != typeof document && void 0 !== document.characterSet
|
|
453
|
+
? document.characterSet
|
|
454
|
+
: "UTF-8";
|
|
455
|
+
void 0 !== e[t];
|
|
456
|
+
)
|
|
457
|
+
((i = e[t++].charCodeAt[t] <= 255 ? 1 : !1 === r ? 3 : 2), (s += i));
|
|
458
|
+
return s;
|
|
459
|
+
}),
|
|
460
|
+
Ie = function (e, t) {
|
|
461
|
+
for (var s in e) if (e[s] === t) return !0;
|
|
462
|
+
return !1;
|
|
463
|
+
};
|
|
464
|
+
function Te() {
|
|
465
|
+
return !v && !T;
|
|
466
|
+
}
|
|
467
|
+
let De = 0;
|
|
468
|
+
function Me() {
|
|
469
|
+
return Te() ? "%c Chat %c" : "Chat";
|
|
470
|
+
}
|
|
471
|
+
function Le() {
|
|
472
|
+
(e = new Date()).setTime(W());
|
|
473
|
+
var e;
|
|
474
|
+
return (
|
|
475
|
+
e.toLocaleTimeString("en-US", { hour12: !1 }) +
|
|
476
|
+
"." +
|
|
477
|
+
(function (e) {
|
|
478
|
+
let t;
|
|
479
|
+
switch (e.toString().length) {
|
|
480
|
+
case 1:
|
|
481
|
+
t = "00" + e;
|
|
482
|
+
break;
|
|
483
|
+
case 2:
|
|
484
|
+
t = "0" + e;
|
|
485
|
+
break;
|
|
486
|
+
default:
|
|
487
|
+
t = e;
|
|
488
|
+
}
|
|
489
|
+
return t;
|
|
490
|
+
})(e.getMilliseconds())
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
let Se = {
|
|
494
|
+
arguments2String(s) {
|
|
495
|
+
let i = "";
|
|
496
|
+
if (1 === s.length) i = s[0];
|
|
497
|
+
else
|
|
498
|
+
for (let e = 0, t = s.length; e < t; e++) {
|
|
499
|
+
if (((r = s[e]), fe(r) || (null !== r && "object" == typeof r)))
|
|
500
|
+
try {
|
|
501
|
+
i += we(s[e])
|
|
502
|
+
? JSON.stringify(s[e], ["message", "code"])
|
|
503
|
+
: JSON.stringify(s[e]);
|
|
504
|
+
} catch (e) {
|
|
505
|
+
i += e ? e.message : "";
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
else i += s[e];
|
|
509
|
+
i += " ";
|
|
510
|
+
}
|
|
511
|
+
var r;
|
|
512
|
+
return i;
|
|
513
|
+
},
|
|
514
|
+
_exec(e, t) {
|
|
515
|
+
Te()
|
|
516
|
+
? o[e](
|
|
517
|
+
Me(),
|
|
518
|
+
"background:#0abf5b; padding:1px; border-radius:3px; color: #fff",
|
|
519
|
+
"background:transparent",
|
|
520
|
+
Le(),
|
|
521
|
+
t,
|
|
522
|
+
)
|
|
523
|
+
: o[e](`${Me()} ${Le()} ` + t);
|
|
524
|
+
},
|
|
525
|
+
d: function () {
|
|
526
|
+
var e;
|
|
527
|
+
De <= -1 &&
|
|
528
|
+
((e = this.arguments2String(arguments)), this._exec("debug", e));
|
|
529
|
+
},
|
|
530
|
+
l: function () {
|
|
531
|
+
var e;
|
|
532
|
+
De <= 0 && ((e = this.arguments2String(arguments)), this._exec("log", e));
|
|
533
|
+
},
|
|
534
|
+
log: function () {
|
|
535
|
+
var e;
|
|
536
|
+
De <= 0 && ((e = this.arguments2String(arguments)), this._exec("log", e));
|
|
537
|
+
},
|
|
538
|
+
i: function () {
|
|
539
|
+
var e;
|
|
540
|
+
De <= 1 && ((e = this.arguments2String(arguments)), this._exec("info", e));
|
|
541
|
+
},
|
|
542
|
+
w: function () {
|
|
543
|
+
var e;
|
|
544
|
+
De <= 2 && ((e = this.arguments2String(arguments)), this._exec("warn", e));
|
|
545
|
+
},
|
|
546
|
+
e: function () {
|
|
547
|
+
var e;
|
|
548
|
+
De <= 3 && ((e = this.arguments2String(arguments)), this._exec("error", e));
|
|
549
|
+
},
|
|
550
|
+
setLevel: function (e) {
|
|
551
|
+
(e < 4 && this._exec("log", "set level from " + De + " to " + e), (De = e));
|
|
552
|
+
},
|
|
553
|
+
getLevel: function () {
|
|
554
|
+
return De;
|
|
555
|
+
},
|
|
556
|
+
};
|
|
557
|
+
class Fe {
|
|
558
|
+
constructor(e) {
|
|
559
|
+
ue(e) ||
|
|
560
|
+
((this.userID = e.userID || ""),
|
|
561
|
+
(this.nick = e.nick || ""),
|
|
562
|
+
(this.avatar = e.avatar || ""),
|
|
563
|
+
(this.time = e.time || 0),
|
|
564
|
+
(this.source = e.source || ""),
|
|
565
|
+
(this.wording = e.wording || ""),
|
|
566
|
+
(this.type = e.type || ""));
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
let Ee = function (e) {
|
|
570
|
+
return { code: 0, data: e || {} };
|
|
571
|
+
};
|
|
572
|
+
class ve extends Error {
|
|
573
|
+
constructor(e) {
|
|
574
|
+
super();
|
|
575
|
+
var { code: e, message: t, data: s } = e;
|
|
576
|
+
((this.code = e),
|
|
577
|
+
t
|
|
578
|
+
? (this.message = t)
|
|
579
|
+
: this._getErrMsg && (this.message = this._getErrMsg(this.code)),
|
|
580
|
+
(this.data = s || {}));
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
let Pe = 2700,
|
|
584
|
+
ke = 2710,
|
|
585
|
+
Ue = 2711,
|
|
586
|
+
be = 2716,
|
|
587
|
+
Ce = 2805,
|
|
588
|
+
Ne = 2903,
|
|
589
|
+
Ge = 3122,
|
|
590
|
+
Oe = 3123,
|
|
591
|
+
$e = "onFriendListUpdated",
|
|
592
|
+
Re = "onFriendGroupListUpdated",
|
|
593
|
+
qe = "onFriendApplicationListUpdated",
|
|
594
|
+
xe = "error",
|
|
595
|
+
He = null,
|
|
596
|
+
Be = function (e) {
|
|
597
|
+
return Promise.resolve(Ee(e));
|
|
598
|
+
},
|
|
599
|
+
We = function (e, t = !1) {
|
|
600
|
+
if (e instanceof ve)
|
|
601
|
+
return (t && null !== He && He.emit(xe, e), Promise.reject(e));
|
|
602
|
+
if (e instanceof Error) {
|
|
603
|
+
let e = new ve({ code: Ne });
|
|
604
|
+
return (t && null !== He && He.emit(xe, e), Promise.reject(e));
|
|
605
|
+
}
|
|
606
|
+
return ge(e) || ge(e.code)
|
|
607
|
+
? Promise.reject(new ve({ code: Ne }))
|
|
608
|
+
: ((e = new ve(e)),
|
|
609
|
+
t && null !== He && He.emit(xe, e),
|
|
610
|
+
Promise.reject(e));
|
|
611
|
+
},
|
|
612
|
+
Ke = "friend_get",
|
|
613
|
+
je = "friend_get_specified",
|
|
614
|
+
Ve = "friend_check",
|
|
615
|
+
Ye = "friend_delete",
|
|
616
|
+
Je = "friend_add",
|
|
617
|
+
ze = "friend_update",
|
|
618
|
+
Qe = "friend_response",
|
|
619
|
+
Xe = "pendency_get",
|
|
620
|
+
Ze = "pendency_delete",
|
|
621
|
+
et = "pendency_report",
|
|
622
|
+
st = "group_get",
|
|
623
|
+
it = "group_add",
|
|
624
|
+
nt = "group_delete",
|
|
625
|
+
rt = "group_update",
|
|
626
|
+
ot = { info: 4, warning: 5, error: 6 },
|
|
627
|
+
at = {
|
|
628
|
+
wifi: 1,
|
|
629
|
+
"2g": 2,
|
|
630
|
+
"3g": 3,
|
|
631
|
+
"4g": 4,
|
|
632
|
+
"5g": 5,
|
|
633
|
+
unknown: 6,
|
|
634
|
+
none: 7,
|
|
635
|
+
online: 8,
|
|
636
|
+
},
|
|
637
|
+
dt = {
|
|
638
|
+
login: 4,
|
|
639
|
+
plugin_search: 16,
|
|
640
|
+
plugin_translate: 16,
|
|
641
|
+
plugin_voice_to_text: 16,
|
|
642
|
+
plugin_cs: 16,
|
|
643
|
+
plugin_push: 16,
|
|
644
|
+
plugin_bot: 16,
|
|
645
|
+
plugin_emoji_reaction: 16,
|
|
646
|
+
tui_key_features: 16,
|
|
647
|
+
};
|
|
648
|
+
class ut {
|
|
649
|
+
constructor(e) {
|
|
650
|
+
((this._n = "SSOLogData"),
|
|
651
|
+
(this.eventType = dt[e] || 0),
|
|
652
|
+
(this.timestamp = 0),
|
|
653
|
+
(this.networkType = 8),
|
|
654
|
+
(this.code = 0),
|
|
655
|
+
(this.message = ""),
|
|
656
|
+
(this.moreMessage = ""),
|
|
657
|
+
(this.extension = e),
|
|
658
|
+
(this.costTime = 0),
|
|
659
|
+
(this.duplicate = !1),
|
|
660
|
+
(this.level = 4),
|
|
661
|
+
(this.uiPlatform = void 0),
|
|
662
|
+
(this._sentFlag = !1),
|
|
663
|
+
(this._startts = W()));
|
|
664
|
+
}
|
|
665
|
+
static bindEventStatModule(e) {
|
|
666
|
+
ut.prototype._eventStatModule = e;
|
|
667
|
+
}
|
|
668
|
+
static bindNetMonitorModule(e) {
|
|
669
|
+
ut.prototype._netMonitorModule = e;
|
|
670
|
+
}
|
|
671
|
+
updateTimeStamp() {
|
|
672
|
+
this.timestamp = W();
|
|
673
|
+
}
|
|
674
|
+
start(e) {
|
|
675
|
+
return ((this._startts = e), this);
|
|
676
|
+
}
|
|
677
|
+
end(e = !1) {
|
|
678
|
+
if (!this._sentFlag) {
|
|
679
|
+
if (this._netMonitorModule) {
|
|
680
|
+
let e = this._netMonitorModule.getNetworkType();
|
|
681
|
+
this.setNetworkType(e);
|
|
682
|
+
}
|
|
683
|
+
var t = W();
|
|
684
|
+
(0 === this.costTime && (this.costTime = t - this._startts),
|
|
685
|
+
this.setMoreMessage(`startts:${this._startts} endts:` + t),
|
|
686
|
+
e
|
|
687
|
+
? ((this._sentFlag = !0),
|
|
688
|
+
this._eventStatModule && this._eventStatModule.pushIn(this))
|
|
689
|
+
: setTimeout(() => {
|
|
690
|
+
((this._sentFlag = !0),
|
|
691
|
+
this._eventStatModule && this._eventStatModule.pushIn(this));
|
|
692
|
+
}, 0));
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
setError(t) {
|
|
696
|
+
if (t instanceof Error) {
|
|
697
|
+
if (!this._sentFlag) {
|
|
698
|
+
let e = !0;
|
|
699
|
+
if (
|
|
700
|
+
(e = this._netMonitorModule ? this._netMonitorModule.isOnline() : e)
|
|
701
|
+
)
|
|
702
|
+
(t.code && this.setCode(t.code),
|
|
703
|
+
t.message && this.setMoreMessage(t.message));
|
|
704
|
+
else {
|
|
705
|
+
let e = Ce;
|
|
706
|
+
this.setCode(e);
|
|
707
|
+
}
|
|
708
|
+
this.setLevel("error");
|
|
709
|
+
}
|
|
710
|
+
} else
|
|
711
|
+
Se.w(this._n + ".setError value not instanceof Error, please check!");
|
|
712
|
+
return this;
|
|
713
|
+
}
|
|
714
|
+
setCode(e) {
|
|
715
|
+
return (
|
|
716
|
+
ge(e) ||
|
|
717
|
+
this._sentFlag ||
|
|
718
|
+
("ECONNABORTED" === e && (this.code = 103),
|
|
719
|
+
he(e)
|
|
720
|
+
? (this.code = e)
|
|
721
|
+
: Se.w(
|
|
722
|
+
this._n + ".setCode value not a number, please check!",
|
|
723
|
+
e,
|
|
724
|
+
typeof e,
|
|
725
|
+
)),
|
|
726
|
+
this
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
setMessage(e) {
|
|
730
|
+
return (
|
|
731
|
+
ge(e) ||
|
|
732
|
+
this._sentFlag ||
|
|
733
|
+
(he(e) && (this.message = e.toString()), me(e) && (this.message = e)),
|
|
734
|
+
this
|
|
735
|
+
);
|
|
736
|
+
}
|
|
737
|
+
setCostTime(e) {
|
|
738
|
+
return ((this.costTime = e), this);
|
|
739
|
+
}
|
|
740
|
+
setLevel(e) {
|
|
741
|
+
return (ge(e) || this._sentFlag || (this.level = ot[e]), this);
|
|
742
|
+
}
|
|
743
|
+
setMoreMessage(e) {
|
|
744
|
+
return (
|
|
745
|
+
ue(this.moreMessage)
|
|
746
|
+
? (this.moreMessage = "" + e)
|
|
747
|
+
: (this.moreMessage += " " + e),
|
|
748
|
+
this
|
|
749
|
+
);
|
|
750
|
+
}
|
|
751
|
+
setNetworkType(e) {
|
|
752
|
+
return (
|
|
753
|
+
ge(e)
|
|
754
|
+
? Se.w(this._n + ".setNetworkType value is undefined, please check!")
|
|
755
|
+
: ((e = at[e.toLowerCase()]), ge(e) || (this.networkType = e)),
|
|
756
|
+
this
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
getStartTs() {
|
|
760
|
+
return this._startts;
|
|
761
|
+
}
|
|
762
|
+
setUIPlatform(e) {
|
|
763
|
+
return ((this.uiPlatform = e), this);
|
|
764
|
+
}
|
|
765
|
+
setExtension(e) {
|
|
766
|
+
return ((this.extension = e), this);
|
|
767
|
+
}
|
|
768
|
+
setEventType(e) {
|
|
769
|
+
return ((this.eventType = e), this);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
class ct {
|
|
773
|
+
constructor(e) {
|
|
774
|
+
((this._snsM = e),
|
|
775
|
+
(this._n = "FriendApplicationHandler"),
|
|
776
|
+
(this._startTime = 0),
|
|
777
|
+
(this._maxLimited = 100),
|
|
778
|
+
(this._currentSeq = 0),
|
|
779
|
+
(this._map = new Map()),
|
|
780
|
+
(this._unreadCount = 0));
|
|
781
|
+
}
|
|
782
|
+
updateCacheOnReconnected() {
|
|
783
|
+
((this._startTime = 0), (this._currentSeq = 0), this.getApplicationList());
|
|
784
|
+
}
|
|
785
|
+
getLocalApplicationList() {
|
|
786
|
+
return {
|
|
787
|
+
friendApplicationList: [...this._map.values()],
|
|
788
|
+
unreadCount: this._unreadCount,
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
_onApplicationListUpdated() {
|
|
792
|
+
this._snsM.emitOEvt(qe, {
|
|
793
|
+
friendApplicationList: [...this._map.values()],
|
|
794
|
+
unreadCount: this._unreadCount,
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
onApplicationRead() {
|
|
798
|
+
((this._unreadCount = 0), this._onApplicationListUpdated());
|
|
799
|
+
}
|
|
800
|
+
onApplicationAdded(e, t) {
|
|
801
|
+
if (!ue(e)) {
|
|
802
|
+
let s,
|
|
803
|
+
i = ((s = t === this._snsM.getMyUserID() ? R : $), !1);
|
|
804
|
+
(e.forEach((e) => {
|
|
805
|
+
var t = e.userID + "_" + s;
|
|
806
|
+
(s !== $ || this._map.has(t) || (this._unreadCount += 1),
|
|
807
|
+
this._map.set(t, new Fe({ ...e, type: s })),
|
|
808
|
+
(i = !0));
|
|
809
|
+
}),
|
|
810
|
+
i && this._onApplicationListUpdated());
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
onApplicationDeleted(e) {
|
|
814
|
+
ue(e) ||
|
|
815
|
+
((this._startTime = 0),
|
|
816
|
+
(this._currentSeq = 0),
|
|
817
|
+
this.getApplicationList());
|
|
818
|
+
}
|
|
819
|
+
getApplicationList() {
|
|
820
|
+
let r = this._n + ".getApplicationList",
|
|
821
|
+
n = new ut("getApplicationList");
|
|
822
|
+
return this._snsM
|
|
823
|
+
.req({
|
|
824
|
+
P: Xe,
|
|
825
|
+
data: {
|
|
826
|
+
applicationType: O,
|
|
827
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
828
|
+
maxLimited: this._maxLimited,
|
|
829
|
+
startTime: this._startTime,
|
|
830
|
+
lastSequence: this._currentSeq,
|
|
831
|
+
},
|
|
832
|
+
})
|
|
833
|
+
.then((e) => {
|
|
834
|
+
var {
|
|
835
|
+
resultList: e,
|
|
836
|
+
unreadCount: t,
|
|
837
|
+
startTime: s,
|
|
838
|
+
currentSequence: i,
|
|
839
|
+
} = e.data,
|
|
840
|
+
t =
|
|
841
|
+
((this._startTime = s),
|
|
842
|
+
(this._currentSeq = i),
|
|
843
|
+
(this._unreadCount = t),
|
|
844
|
+
`applicationCount:${fe(e) ? e.length : 0} unreadCount:${t} startTime:${s} currentSequence:` +
|
|
845
|
+
i);
|
|
846
|
+
(n.setMessage(t).end(),
|
|
847
|
+
Se.i(r + " ok. " + t),
|
|
848
|
+
this._map.clear(),
|
|
849
|
+
fe(e) &&
|
|
850
|
+
e.forEach((e) => {
|
|
851
|
+
var { userID: t, type: s } = e,
|
|
852
|
+
e = new Fe(e);
|
|
853
|
+
this._map.set(t + "_" + s, e);
|
|
854
|
+
}),
|
|
855
|
+
this._onApplicationListUpdated());
|
|
856
|
+
})
|
|
857
|
+
.catch(
|
|
858
|
+
(e) => (n.setError(e).end(), Se.w(r + " failed. error:", e), We(e)),
|
|
859
|
+
);
|
|
860
|
+
}
|
|
861
|
+
deleteApplication(e) {
|
|
862
|
+
let r = this._n + ".deleteApplication",
|
|
863
|
+
{ userID: n, type: t } = e,
|
|
864
|
+
o = t;
|
|
865
|
+
if (((o && (o === R || o === $)) || (o = $), !this._map.has(n + "_" + o)))
|
|
866
|
+
return We({ code: be });
|
|
867
|
+
let a = new ut("deleteApplication");
|
|
868
|
+
return (
|
|
869
|
+
a.setMessage(`userID:${n} type:` + o),
|
|
870
|
+
this._snsM
|
|
871
|
+
.req({
|
|
872
|
+
P: Ze,
|
|
873
|
+
data: {
|
|
874
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
875
|
+
userIDList: [n],
|
|
876
|
+
type: o,
|
|
877
|
+
},
|
|
878
|
+
})
|
|
879
|
+
.then((e) => {
|
|
880
|
+
var e = e.data["resultList"],
|
|
881
|
+
{ to: t, resultCode: s, resultInfo: i } = e[0];
|
|
882
|
+
return (
|
|
883
|
+
a.setMoreMessage("resultList:" + JSON.stringify(e)).end(),
|
|
884
|
+
Se.i(r + ` ok. userID:${n} type:` + o),
|
|
885
|
+
0 === s ? Ee() : We({ userID: t, code: s, message: i })
|
|
886
|
+
);
|
|
887
|
+
})
|
|
888
|
+
.catch(
|
|
889
|
+
(e) => (a.setError(e).end(), Se.w(r + " failed. error:", e), We(e)),
|
|
890
|
+
)
|
|
891
|
+
);
|
|
892
|
+
}
|
|
893
|
+
acceptApplication(e) {
|
|
894
|
+
let s = this._n + ".acceptApplication",
|
|
895
|
+
{ userID: i, remark: t, tag: r, type: n } = e,
|
|
896
|
+
o = n,
|
|
897
|
+
a = ((o && (o === q || o === x)) || (o = x), new ut("acceptApplication"));
|
|
898
|
+
return (
|
|
899
|
+
a.setMessage(`userID:${i} type:` + o),
|
|
900
|
+
this._snsM
|
|
901
|
+
.req({
|
|
902
|
+
P: Qe,
|
|
903
|
+
data: {
|
|
904
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
905
|
+
responseFriendItem: [{ userID: i, remark: t, tag: r, action: o }],
|
|
906
|
+
},
|
|
907
|
+
})
|
|
908
|
+
.then((e) => {
|
|
909
|
+
a.end();
|
|
910
|
+
var e = e.data["resultList"],
|
|
911
|
+
{ resultCode: e, resultInfo: t } = e[0];
|
|
912
|
+
if (0 !== e) return We({ code: e, message: t });
|
|
913
|
+
Se.i(s + ` ok. userID:${i} type:` + o);
|
|
914
|
+
})
|
|
915
|
+
.catch(
|
|
916
|
+
(e) => (a.setError(e).end(), Se.w(s + " failed. error:", e), We(e)),
|
|
917
|
+
)
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
refuseApplication(e) {
|
|
921
|
+
let s = this._n + ".refuseApplication",
|
|
922
|
+
i = e["userID"],
|
|
923
|
+
r = new ut("refuseApplication");
|
|
924
|
+
return (
|
|
925
|
+
r.setMessage("userID:" + i),
|
|
926
|
+
this._snsM
|
|
927
|
+
.req({
|
|
928
|
+
P: Qe,
|
|
929
|
+
data: {
|
|
930
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
931
|
+
responseFriendItem: [
|
|
932
|
+
{ userID: i, action: "Response_Action_Reject" },
|
|
933
|
+
],
|
|
934
|
+
},
|
|
935
|
+
})
|
|
936
|
+
.then((e) => {
|
|
937
|
+
r.end();
|
|
938
|
+
var e = e.data["resultList"],
|
|
939
|
+
{ resultCode: e, resultInfo: t } = e[0];
|
|
940
|
+
if (0 !== e) return We({ code: e, message: t });
|
|
941
|
+
Se.i(s + " ok. userID:" + i);
|
|
942
|
+
})
|
|
943
|
+
.catch(
|
|
944
|
+
(e) => (r.setError(e).end(), Se.w(s + " failed. error:", e), We(e)),
|
|
945
|
+
)
|
|
946
|
+
);
|
|
947
|
+
}
|
|
948
|
+
setApplicationRead() {
|
|
949
|
+
let t = this._n + ".setApplicationRead",
|
|
950
|
+
s = new ut("setApplicationRead"),
|
|
951
|
+
e;
|
|
952
|
+
return this._snsM
|
|
953
|
+
.req({
|
|
954
|
+
P: et,
|
|
955
|
+
data: {
|
|
956
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
957
|
+
latestTimeStamp:
|
|
958
|
+
((e = W() / 1e3),
|
|
959
|
+
Math.round(Number(e) * Math.pow(10, 0)) / Math.pow(10, 0)),
|
|
960
|
+
},
|
|
961
|
+
})
|
|
962
|
+
.then((e) => {
|
|
963
|
+
(s.end(), Se.i(t + " ok"), (this._unreadCount = 0));
|
|
964
|
+
})
|
|
965
|
+
.catch(
|
|
966
|
+
(e) => (s.setError(e).end(), Se.w(t + " failed. error:", e), We(e)),
|
|
967
|
+
);
|
|
968
|
+
}
|
|
969
|
+
reset() {
|
|
970
|
+
((this._maxLimited = 100),
|
|
971
|
+
(this._startTime = 0),
|
|
972
|
+
(this._currentSeq = 0),
|
|
973
|
+
(this._unreadCount = 0),
|
|
974
|
+
this._map.clear());
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
class lt {
|
|
978
|
+
constructor(e) {
|
|
979
|
+
ue(e) ||
|
|
980
|
+
((this.userID = e.userID || ""),
|
|
981
|
+
(this.nick = e.nick || ""),
|
|
982
|
+
(this.gender = e.gender || ""),
|
|
983
|
+
(this.birthday = e.birthday || 0),
|
|
984
|
+
(this.location = e.location || ""),
|
|
985
|
+
(this.selfSignature = e.selfSignature || ""),
|
|
986
|
+
(this.allowType = e.allowType || k),
|
|
987
|
+
(this.language = e.language || 0),
|
|
988
|
+
(this.avatar = e.avatar || ""),
|
|
989
|
+
(this.messageSettings = e.messageSettings || 0),
|
|
990
|
+
(this.adminForbidType = e.adminForbidType || U),
|
|
991
|
+
(this.level = e.level || 0),
|
|
992
|
+
(this.role = e.role || 0),
|
|
993
|
+
(this.lastUpdatedTime = e.lastUpdatedTime || 0),
|
|
994
|
+
(this.profileCustomField = []),
|
|
995
|
+
ue(e.profileCustomField)) ||
|
|
996
|
+
e.profileCustomField.forEach((e) => {
|
|
997
|
+
this.profileCustomField.push({ key: e.key, value: e.value });
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
validate(s) {
|
|
1001
|
+
let e = !0,
|
|
1002
|
+
t = "";
|
|
1003
|
+
if (ue(s)) return { valid: !1, tips: "empty options" };
|
|
1004
|
+
if (s.profileCustomField) {
|
|
1005
|
+
let t = s.profileCustomField.length;
|
|
1006
|
+
var i = null;
|
|
1007
|
+
for (let e = 0; e < t; e++) {
|
|
1008
|
+
if (
|
|
1009
|
+
((i = s.profileCustomField[e]),
|
|
1010
|
+
!me(i.key) || -1 === i.key.indexOf("Tag_Profile_Custom"))
|
|
1011
|
+
)
|
|
1012
|
+
return {
|
|
1013
|
+
valid: !1,
|
|
1014
|
+
tips: "The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom",
|
|
1015
|
+
};
|
|
1016
|
+
if (!me(i.value))
|
|
1017
|
+
return {
|
|
1018
|
+
valid: !1,
|
|
1019
|
+
tips: "The type of values of the custom profile key-value pairs (which is profileCustomField) must be String",
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
for (var r in s)
|
|
1024
|
+
if (Object.prototype.hasOwnProperty.call(s, r)) {
|
|
1025
|
+
if ("profileCustomField" === r) continue;
|
|
1026
|
+
if (ue(s[r]) && !me(s[r]) && !he(s[r])) {
|
|
1027
|
+
((t = "key:" + r + ", invalid value:" + s[r]), (e = !1));
|
|
1028
|
+
continue;
|
|
1029
|
+
}
|
|
1030
|
+
switch (r) {
|
|
1031
|
+
case "nick":
|
|
1032
|
+
(me(s[r]) || ((t = "nick must be a string"), (e = !1)),
|
|
1033
|
+
500 < Ae(s[r]) &&
|
|
1034
|
+
((t = `nick name limited: must less than or equal to 500 bytes, current size: ${Ae(s[r])} bytes`),
|
|
1035
|
+
(e = !1)));
|
|
1036
|
+
break;
|
|
1037
|
+
case "gender":
|
|
1038
|
+
Ie(re, s.gender) ||
|
|
1039
|
+
((t = "key:gender, invalid value:" + s.gender), (e = !1));
|
|
1040
|
+
break;
|
|
1041
|
+
case "birthday":
|
|
1042
|
+
he(s.birthday) || ((t = "birthday must be a number"), (e = !1));
|
|
1043
|
+
break;
|
|
1044
|
+
case "location":
|
|
1045
|
+
me(s.location) || ((t = "location must be a string"), (e = !1));
|
|
1046
|
+
break;
|
|
1047
|
+
case "selfSignature":
|
|
1048
|
+
me(s.selfSignature) ||
|
|
1049
|
+
((t = "selfSignature must be a string"), (e = !1));
|
|
1050
|
+
break;
|
|
1051
|
+
case "allowType":
|
|
1052
|
+
Ie(ae, s.allowType) ||
|
|
1053
|
+
((t = "key:allowType, invalid value:" + s.allowType), (e = !1));
|
|
1054
|
+
break;
|
|
1055
|
+
case "language":
|
|
1056
|
+
he(s.language) || ((t = "language must be a number"), (e = !1));
|
|
1057
|
+
break;
|
|
1058
|
+
case "avatar":
|
|
1059
|
+
me(s.avatar) || ((t = "avatar must be a string"), (e = !1));
|
|
1060
|
+
break;
|
|
1061
|
+
case "messageSettings":
|
|
1062
|
+
0 !== s.messageSettings &&
|
|
1063
|
+
1 !== s.messageSettings &&
|
|
1064
|
+
((t = "messageSettings must be 0 or 1"), (e = !1));
|
|
1065
|
+
break;
|
|
1066
|
+
case "adminForbidType":
|
|
1067
|
+
Ie(oe, s.adminForbidType) ||
|
|
1068
|
+
((t = "key:adminForbidType, invalid value:" + s.adminForbidType),
|
|
1069
|
+
(e = !1));
|
|
1070
|
+
break;
|
|
1071
|
+
case "level":
|
|
1072
|
+
he(s.level) || ((t = "level must be a number"), (e = !1));
|
|
1073
|
+
break;
|
|
1074
|
+
case "role":
|
|
1075
|
+
he(s.role) || ((t = "role must be a number"), (e = !1));
|
|
1076
|
+
break;
|
|
1077
|
+
default:
|
|
1078
|
+
((t = "unknown key:" + r + " " + s[r]), (e = !1));
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
return { valid: e, tips: t };
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
class pt {
|
|
1085
|
+
constructor(e, s) {
|
|
1086
|
+
((this.userID = e),
|
|
1087
|
+
(this.remark = ""),
|
|
1088
|
+
(this.groupList = []),
|
|
1089
|
+
(this.source = ""),
|
|
1090
|
+
(this.addTime = 0),
|
|
1091
|
+
(this.friendCustomField = []),
|
|
1092
|
+
(this.timestamp = 0));
|
|
1093
|
+
var i = {},
|
|
1094
|
+
r = [];
|
|
1095
|
+
if (((i.userID = e), !ue(s))) {
|
|
1096
|
+
var n,
|
|
1097
|
+
o = "";
|
|
1098
|
+
for (let e = 0, t = s.length; e < t; e++)
|
|
1099
|
+
if (
|
|
1100
|
+
((o = s[e].tag), (n = s[e].value), -1 < o.indexOf("Tag_SNS_Custom"))
|
|
1101
|
+
)
|
|
1102
|
+
this.friendCustomField.push({ key: o, value: n });
|
|
1103
|
+
else if (-1 < o.indexOf("Tag_Profile_Custom"))
|
|
1104
|
+
r.push({ key: o, value: n });
|
|
1105
|
+
else
|
|
1106
|
+
switch (o) {
|
|
1107
|
+
case K:
|
|
1108
|
+
i.nick = n;
|
|
1109
|
+
break;
|
|
1110
|
+
case j:
|
|
1111
|
+
i.gender = n;
|
|
1112
|
+
break;
|
|
1113
|
+
case V:
|
|
1114
|
+
i.birthday = n;
|
|
1115
|
+
break;
|
|
1116
|
+
case Y:
|
|
1117
|
+
i.location = n;
|
|
1118
|
+
break;
|
|
1119
|
+
case J:
|
|
1120
|
+
i.selfSignature = n;
|
|
1121
|
+
break;
|
|
1122
|
+
case z:
|
|
1123
|
+
i.allowType = n;
|
|
1124
|
+
break;
|
|
1125
|
+
case Q:
|
|
1126
|
+
i.language = n;
|
|
1127
|
+
break;
|
|
1128
|
+
case X:
|
|
1129
|
+
i.avatar = n;
|
|
1130
|
+
break;
|
|
1131
|
+
case Z:
|
|
1132
|
+
i.messageSettings = n;
|
|
1133
|
+
break;
|
|
1134
|
+
case ee:
|
|
1135
|
+
i.adminForbidType = n;
|
|
1136
|
+
break;
|
|
1137
|
+
case te:
|
|
1138
|
+
i.level = n;
|
|
1139
|
+
break;
|
|
1140
|
+
case se:
|
|
1141
|
+
i.role = n;
|
|
1142
|
+
break;
|
|
1143
|
+
case ie.REMARK:
|
|
1144
|
+
this.remark = n;
|
|
1145
|
+
break;
|
|
1146
|
+
case ie.ADDTIME:
|
|
1147
|
+
this.addTime = n;
|
|
1148
|
+
break;
|
|
1149
|
+
case ie.GROUP:
|
|
1150
|
+
this.groupList = JSON.parse(JSON.stringify(n));
|
|
1151
|
+
break;
|
|
1152
|
+
case ie.ADDSOURCE:
|
|
1153
|
+
this.source = n;
|
|
1154
|
+
break;
|
|
1155
|
+
case ie.ADDWORDING:
|
|
1156
|
+
break;
|
|
1157
|
+
default:
|
|
1158
|
+
Se.l("snsProfileItem unknown tag->", s[e].tag);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
this.profile = new lt({ ...i, profileCustomField: r });
|
|
1162
|
+
}
|
|
1163
|
+
validate(s) {
|
|
1164
|
+
let e = !0,
|
|
1165
|
+
t = "";
|
|
1166
|
+
if (ue(s)) return { valid: !1, tips: "empty options" };
|
|
1167
|
+
if (s.profileCustomField) {
|
|
1168
|
+
let t = s.profileCustomField.length;
|
|
1169
|
+
var i = null;
|
|
1170
|
+
for (let e = 0; e < t; e++) {
|
|
1171
|
+
if (
|
|
1172
|
+
((i = s.profileCustomField[e]),
|
|
1173
|
+
!me(i.key) || -1 === i.key.indexOf("Tag_Profile_Custom"))
|
|
1174
|
+
)
|
|
1175
|
+
return {
|
|
1176
|
+
valid: !1,
|
|
1177
|
+
tips: "The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom",
|
|
1178
|
+
};
|
|
1179
|
+
if (!me(i.value))
|
|
1180
|
+
return {
|
|
1181
|
+
valid: !1,
|
|
1182
|
+
tips: "The type of values of the custom profile key-value pairs (which is profileCustomField) must be String",
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
for (var r in s)
|
|
1187
|
+
if (Object.prototype.hasOwnProperty.call(s, r)) {
|
|
1188
|
+
if ("profileCustomField" === r) continue;
|
|
1189
|
+
if (ue(s[r]) && !me(s[r]) && !he(s[r])) {
|
|
1190
|
+
((t = "key:" + r + ", invalid value:" + s[r]), (e = !1));
|
|
1191
|
+
continue;
|
|
1192
|
+
}
|
|
1193
|
+
switch (r) {
|
|
1194
|
+
case "nick":
|
|
1195
|
+
(me(s[r]) || ((t = "nick must be a string"), (e = !1)),
|
|
1196
|
+
500 < Ae(s[r]) &&
|
|
1197
|
+
((t = `nick name limited: must less than or equal to 500 bytes, current size: ${Ae(s[r])} bytes`),
|
|
1198
|
+
(e = !1)));
|
|
1199
|
+
break;
|
|
1200
|
+
case "gender":
|
|
1201
|
+
Ie(re, s.gender) ||
|
|
1202
|
+
((t = "key:gender, invalid value:" + s.gender), (e = !1));
|
|
1203
|
+
break;
|
|
1204
|
+
case "birthday":
|
|
1205
|
+
he(s.birthday) || ((t = "birthday must be a number"), (e = !1));
|
|
1206
|
+
break;
|
|
1207
|
+
case "location":
|
|
1208
|
+
me(s.location) || ((t = "location must be a string"), (e = !1));
|
|
1209
|
+
break;
|
|
1210
|
+
case "selfSignature":
|
|
1211
|
+
me(s.selfSignature) ||
|
|
1212
|
+
((t = "selfSignature must be a string"), (e = !1));
|
|
1213
|
+
break;
|
|
1214
|
+
case "allowType":
|
|
1215
|
+
Ie(ae, s.allowType) ||
|
|
1216
|
+
((t = "key:allowType, invalid value:" + s.allowType), (e = !1));
|
|
1217
|
+
break;
|
|
1218
|
+
case "language":
|
|
1219
|
+
he(s.language) || ((t = "language must be a number"), (e = !1));
|
|
1220
|
+
break;
|
|
1221
|
+
case "avatar":
|
|
1222
|
+
me(s.avatar) || ((t = "avatar must be a string"), (e = !1));
|
|
1223
|
+
break;
|
|
1224
|
+
case "messageSettings":
|
|
1225
|
+
0 !== s.messageSettings &&
|
|
1226
|
+
1 !== s.messageSettings &&
|
|
1227
|
+
((t = "messageSettings must be 0 or 1"), (e = !1));
|
|
1228
|
+
break;
|
|
1229
|
+
case "adminForbidType":
|
|
1230
|
+
Ie(oe, s.adminForbidType) ||
|
|
1231
|
+
((t = "key:adminForbidType, invalid value:" + s.adminForbidType),
|
|
1232
|
+
(e = !1));
|
|
1233
|
+
break;
|
|
1234
|
+
case "level":
|
|
1235
|
+
he(s.level) || ((t = "level must be a number"), (e = !1));
|
|
1236
|
+
break;
|
|
1237
|
+
case "role":
|
|
1238
|
+
he(s.role) || ((t = "role must be a number"), (e = !1));
|
|
1239
|
+
break;
|
|
1240
|
+
default:
|
|
1241
|
+
((t = "unknown key:" + r + " " + s[r]), (e = !1));
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
return { valid: e, tips: t };
|
|
1245
|
+
}
|
|
1246
|
+
update(s) {
|
|
1247
|
+
let i = "",
|
|
1248
|
+
r,
|
|
1249
|
+
n = [];
|
|
1250
|
+
this.friendCustomField.forEach((e) => {
|
|
1251
|
+
n.push(e.key);
|
|
1252
|
+
});
|
|
1253
|
+
for (let e = 0, t = s.length; e < t; e++)
|
|
1254
|
+
if (((i = s[e].tag), (r = s[e].value), -1 < i.indexOf("Tag_SNS_Custom")))
|
|
1255
|
+
-1 < n.indexOf(i)
|
|
1256
|
+
? this.friendCustomField.forEach((e) => {
|
|
1257
|
+
e.key === i && (e.value = r);
|
|
1258
|
+
})
|
|
1259
|
+
: this.friendCustomField.push({ key: i, value: r });
|
|
1260
|
+
else if (-1 < i.indexOf("Tag_Profile_Custom")) {
|
|
1261
|
+
let t = !1;
|
|
1262
|
+
(this.profile.profileCustomField.forEach((e) => {
|
|
1263
|
+
e.key === i && ((e.value = r), (t = !0));
|
|
1264
|
+
}),
|
|
1265
|
+
t || this.profile.profileCustomField.push({ key: i, value: r }));
|
|
1266
|
+
} else
|
|
1267
|
+
switch (i) {
|
|
1268
|
+
case K:
|
|
1269
|
+
this.profile.nick = r;
|
|
1270
|
+
break;
|
|
1271
|
+
case j:
|
|
1272
|
+
this.profile.gender = r;
|
|
1273
|
+
break;
|
|
1274
|
+
case V:
|
|
1275
|
+
this.profile.birthday = r;
|
|
1276
|
+
break;
|
|
1277
|
+
case Y:
|
|
1278
|
+
this.profile.location = r;
|
|
1279
|
+
break;
|
|
1280
|
+
case J:
|
|
1281
|
+
this.profile.selfSignature = r;
|
|
1282
|
+
break;
|
|
1283
|
+
case z:
|
|
1284
|
+
this.profile.allowType = r;
|
|
1285
|
+
break;
|
|
1286
|
+
case Q:
|
|
1287
|
+
this.profile.language = r;
|
|
1288
|
+
break;
|
|
1289
|
+
case X:
|
|
1290
|
+
this.profile.avatar = r;
|
|
1291
|
+
break;
|
|
1292
|
+
case Z:
|
|
1293
|
+
this.profile.messageSettings = r;
|
|
1294
|
+
break;
|
|
1295
|
+
case ee:
|
|
1296
|
+
this.profile.adminForbidType = r;
|
|
1297
|
+
break;
|
|
1298
|
+
case te:
|
|
1299
|
+
this.profile.level = r;
|
|
1300
|
+
break;
|
|
1301
|
+
case se:
|
|
1302
|
+
this.profile.role = r;
|
|
1303
|
+
break;
|
|
1304
|
+
case ie.REMARK:
|
|
1305
|
+
this.remark = r;
|
|
1306
|
+
break;
|
|
1307
|
+
case ie.ADDTIME:
|
|
1308
|
+
this.addTime = r;
|
|
1309
|
+
break;
|
|
1310
|
+
case ie.GROUP:
|
|
1311
|
+
this.groupList = JSON.parse(JSON.stringify(r));
|
|
1312
|
+
break;
|
|
1313
|
+
case ie.ADDSOURCE:
|
|
1314
|
+
this.source = r;
|
|
1315
|
+
break;
|
|
1316
|
+
case ie.ADDWORDING:
|
|
1317
|
+
break;
|
|
1318
|
+
default:
|
|
1319
|
+
Se.d("snsProfileItem unkown tag->", s[e].tag);
|
|
1320
|
+
}
|
|
1321
|
+
((this.timestamp = Date.now()), (n.length = 0));
|
|
1322
|
+
}
|
|
1323
|
+
updateProfile(e) {
|
|
1324
|
+
((this.profile = JSON.parse(JSON.stringify(e))),
|
|
1325
|
+
(this.timestamp = Date.now()));
|
|
1326
|
+
}
|
|
1327
|
+
addToGroupList(e) {
|
|
1328
|
+
-1 === this.groupList.indexOf(e) &&
|
|
1329
|
+
(this.groupList.push(e), (this.count = this.groupList.length));
|
|
1330
|
+
}
|
|
1331
|
+
removeFromGroupList(e) {
|
|
1332
|
+
e = this.groupList.indexOf(e);
|
|
1333
|
+
-1 < e &&
|
|
1334
|
+
(this.groupList.splice(e, 1), (this.count = this.groupList.length));
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
let ht = 4,
|
|
1338
|
+
mt = 11,
|
|
1339
|
+
_t = 12,
|
|
1340
|
+
ft = 20,
|
|
1341
|
+
gt = 23,
|
|
1342
|
+
wt = 27,
|
|
1343
|
+
yt = 29;
|
|
1344
|
+
class At {
|
|
1345
|
+
constructor(e) {
|
|
1346
|
+
((this._snsM = e),
|
|
1347
|
+
(this._n = "FriendHandler"),
|
|
1348
|
+
(this._map = new Map()),
|
|
1349
|
+
(this._startIdx = 0),
|
|
1350
|
+
(this._standardSeq = 0),
|
|
1351
|
+
(this._customSeq = 0),
|
|
1352
|
+
(this._expirationTime = 18e4));
|
|
1353
|
+
}
|
|
1354
|
+
updateCacheOnReconnected() {
|
|
1355
|
+
((this._startIdx = 0),
|
|
1356
|
+
(this._standardSeq = 0),
|
|
1357
|
+
(this._customSeq = 0),
|
|
1358
|
+
this.pagingGetFriendList());
|
|
1359
|
+
}
|
|
1360
|
+
getLocalFriendList() {
|
|
1361
|
+
return [...this._map.values()];
|
|
1362
|
+
}
|
|
1363
|
+
getFriendRemark(e) {
|
|
1364
|
+
return this._map.has(e) ? this._map.get(e).remark : "";
|
|
1365
|
+
}
|
|
1366
|
+
onFriendProfileModified(e) {
|
|
1367
|
+
e = e.dataList;
|
|
1368
|
+
if (!ue(e)) {
|
|
1369
|
+
let i = this._snsM.get(mt);
|
|
1370
|
+
(e.forEach((e) => {
|
|
1371
|
+
var { userID: t, profileList: s } = e;
|
|
1372
|
+
if (this.isMyFriend(t)) {
|
|
1373
|
+
Se.l(
|
|
1374
|
+
this._n +
|
|
1375
|
+
`.onFriendProfileModified. friend account:${t}, profileList:` +
|
|
1376
|
+
JSON.stringify(s),
|
|
1377
|
+
);
|
|
1378
|
+
let e = this._map.get(t);
|
|
1379
|
+
(e.update(s),
|
|
1380
|
+
i.modifyMessageSentByPeer({
|
|
1381
|
+
conversationID: "" + P + t,
|
|
1382
|
+
latestNick: e.profile.nick,
|
|
1383
|
+
latestAvatar: e.profile.avatar,
|
|
1384
|
+
}));
|
|
1385
|
+
}
|
|
1386
|
+
}),
|
|
1387
|
+
this._onFriendListUpdated());
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
onFriendAdded(t) {
|
|
1391
|
+
0 !== t.length &&
|
|
1392
|
+
(Se.l(this._n + ".onFriendAdded userIDList:" + t),
|
|
1393
|
+
t.forEach((e) => {
|
|
1394
|
+
this._map.set(e, new pt(e));
|
|
1395
|
+
}),
|
|
1396
|
+
this.getFriendProfile({ userIDList: t }).then((e) => {
|
|
1397
|
+
(t.forEach((e) => {
|
|
1398
|
+
var t = this._map.get(e);
|
|
1399
|
+
0 < t.groupList.length &&
|
|
1400
|
+
this._snsM.updateWhenFriendAdded({
|
|
1401
|
+
nameList: t.groupList,
|
|
1402
|
+
userID: e,
|
|
1403
|
+
});
|
|
1404
|
+
}),
|
|
1405
|
+
this._onFriendListUpdated());
|
|
1406
|
+
}));
|
|
1407
|
+
}
|
|
1408
|
+
onFriendDeleted(e) {
|
|
1409
|
+
0 !== e.length &&
|
|
1410
|
+
(Se.l(this._n + ".onFriendDeleted userIDList:" + e),
|
|
1411
|
+
e.forEach((e) => {
|
|
1412
|
+
var t = this._map.get(e);
|
|
1413
|
+
(0 < t.groupList.length &&
|
|
1414
|
+
this._snsM.updateWhenFriendDeleted({
|
|
1415
|
+
nameList: t.groupList,
|
|
1416
|
+
userID: e,
|
|
1417
|
+
}),
|
|
1418
|
+
this._map.delete(e));
|
|
1419
|
+
}),
|
|
1420
|
+
this._onFriendListUpdated());
|
|
1421
|
+
}
|
|
1422
|
+
_onFriendListUpdated() {
|
|
1423
|
+
(this._snsM.emitOEvt($e), this._snsM.get(mt).checkAndPatchRemark());
|
|
1424
|
+
}
|
|
1425
|
+
getFriendProfile(e) {
|
|
1426
|
+
let t = this._n + ".getFriendProfile",
|
|
1427
|
+
s = e["userIDList"],
|
|
1428
|
+
r = [],
|
|
1429
|
+
n = [],
|
|
1430
|
+
i = [];
|
|
1431
|
+
if (
|
|
1432
|
+
(s.forEach((e) => {
|
|
1433
|
+
var t;
|
|
1434
|
+
this._map.has(e)
|
|
1435
|
+
? ((t = this._map.get(e)),
|
|
1436
|
+
Date.now() - t.timestamp < this._expirationTime
|
|
1437
|
+
? n.push(t)
|
|
1438
|
+
: i.push(e))
|
|
1439
|
+
: r.push({ userID: e, code: Pe, message: this._snsM.getErrMsg(Pe) });
|
|
1440
|
+
}),
|
|
1441
|
+
0 === i.length)
|
|
1442
|
+
)
|
|
1443
|
+
return (
|
|
1444
|
+
Se.i(t + " newUserIDList is empty"),
|
|
1445
|
+
Be({ friendList: n, failureUserIDList: r })
|
|
1446
|
+
);
|
|
1447
|
+
let o = new ut("getFriendProfile");
|
|
1448
|
+
return (
|
|
1449
|
+
o.setMessage("userIDList:" + i),
|
|
1450
|
+
Se.i(t + " userIDList:" + i),
|
|
1451
|
+
this._snsM
|
|
1452
|
+
.req({
|
|
1453
|
+
P: je,
|
|
1454
|
+
data: { fromAccount: this._snsM.getMyUserID(), userIDList: i },
|
|
1455
|
+
})
|
|
1456
|
+
.then((e) => {
|
|
1457
|
+
(o.end(), Se.i(t + " ok"));
|
|
1458
|
+
e = e.data.resultList;
|
|
1459
|
+
return (
|
|
1460
|
+
e.forEach((t) => {
|
|
1461
|
+
var { to: t, resultCode: e, resultInfo: s, tagValueList: i } = t;
|
|
1462
|
+
if (ge(e) || 0 === e) {
|
|
1463
|
+
let e;
|
|
1464
|
+
(this._map.has(t)
|
|
1465
|
+
? (e = this._map.get(t)).update(i)
|
|
1466
|
+
: ((e = new pt(t, i)), this._map.set(t, e)),
|
|
1467
|
+
n.push(e));
|
|
1468
|
+
} else r.push({ userID: t, code: e, message: s });
|
|
1469
|
+
}),
|
|
1470
|
+
Ee({ friendList: n, failureUserIDList: r })
|
|
1471
|
+
);
|
|
1472
|
+
})
|
|
1473
|
+
.catch(
|
|
1474
|
+
(e) => (o.setError(e).end(), Se.w(t + " failed. error:", e), We(e)),
|
|
1475
|
+
)
|
|
1476
|
+
);
|
|
1477
|
+
}
|
|
1478
|
+
isMyFriend(e) {
|
|
1479
|
+
return this._map.has(e);
|
|
1480
|
+
}
|
|
1481
|
+
pagingGetFriendList() {
|
|
1482
|
+
let o = this._n + ".getFriendList",
|
|
1483
|
+
a = new ut("getFriendList"),
|
|
1484
|
+
d = Date.now();
|
|
1485
|
+
this._snsM
|
|
1486
|
+
.req({
|
|
1487
|
+
P: Ke,
|
|
1488
|
+
data: {
|
|
1489
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
1490
|
+
startIndex: this._startIdx,
|
|
1491
|
+
standardSequence: this._standardSeq,
|
|
1492
|
+
customSequence: this._customSeq,
|
|
1493
|
+
},
|
|
1494
|
+
})
|
|
1495
|
+
.then((e) => {
|
|
1496
|
+
var {
|
|
1497
|
+
friendCount: e,
|
|
1498
|
+
resultList: t,
|
|
1499
|
+
nextStartIndex: s,
|
|
1500
|
+
standardSequence: i,
|
|
1501
|
+
customSequence: r,
|
|
1502
|
+
completeFlag: n,
|
|
1503
|
+
} = e.data,
|
|
1504
|
+
s =
|
|
1505
|
+
`friendCount:${e} nextStartIndex:${(this._startIdx = s)} standardSequence:${(this._standardSeq = i)} customSequence:${(this._customSeq = r)} completeFlag:${n} cost:` +
|
|
1506
|
+
((e = d), Date.now() - e) +
|
|
1507
|
+
" ms";
|
|
1508
|
+
(a.setMessage(s).end(),
|
|
1509
|
+
Se.i(o + " ok.", s),
|
|
1510
|
+
ue(t) ||
|
|
1511
|
+
t.forEach((e) => {
|
|
1512
|
+
var { to: e, tagValueList: t } = e;
|
|
1513
|
+
this._map.set(e, new pt(e, t));
|
|
1514
|
+
}),
|
|
1515
|
+
0 === n
|
|
1516
|
+
? this.pagingGetFriendList()
|
|
1517
|
+
: (this._snsM.emitOEvt($e), this._pagingGetFriendProfile()));
|
|
1518
|
+
})
|
|
1519
|
+
.catch(
|
|
1520
|
+
(e) => (a.setError(e).end(), Se.w(o + " failed. error:", e), We(e)),
|
|
1521
|
+
);
|
|
1522
|
+
}
|
|
1523
|
+
_pagingGetFriendProfile() {
|
|
1524
|
+
var t = [...this._map.keys()],
|
|
1525
|
+
s = this._snsM.get(ht),
|
|
1526
|
+
e = t.length,
|
|
1527
|
+
i = e <= 100 ? 1 : Math.ceil(e / 100);
|
|
1528
|
+
Se.l(this._n + `._pagingGetFriendProfile friendCount:${e} pageCount:` + i);
|
|
1529
|
+
for (let e = 0; e < i; e++)
|
|
1530
|
+
s.getUserProfile({ userIDList: t.slice(100 * e, 100 * (e + 1)) }).then(
|
|
1531
|
+
(e) => {
|
|
1532
|
+
(e.data.forEach((e) => {
|
|
1533
|
+
var t = this._map.get(e.userID);
|
|
1534
|
+
t && t.updateProfile(e);
|
|
1535
|
+
}),
|
|
1536
|
+
this._onFriendListUpdated());
|
|
1537
|
+
},
|
|
1538
|
+
);
|
|
1539
|
+
}
|
|
1540
|
+
addFriend(e) {
|
|
1541
|
+
let i = this._n + ".addFriend";
|
|
1542
|
+
if (e.wording && !1 === this._snsM.filterProfanity("wording", e))
|
|
1543
|
+
return We({ code: Oe });
|
|
1544
|
+
var { to: e, source: t, type: s, wording: r, remark: n, groupName: o } = e;
|
|
1545
|
+
let a = s,
|
|
1546
|
+
d = ((a && (a === b || a === C)) || (a = C), new ut("addFriend"));
|
|
1547
|
+
return (
|
|
1548
|
+
d.setMessage(`to:${e} source:${t} type:` + a),
|
|
1549
|
+
this._snsM
|
|
1550
|
+
.req({
|
|
1551
|
+
P: Je,
|
|
1552
|
+
data: {
|
|
1553
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
1554
|
+
addFriendItem: [
|
|
1555
|
+
{ to: e, source: t, wording: r, remark: n, groupName: o },
|
|
1556
|
+
],
|
|
1557
|
+
type: a,
|
|
1558
|
+
},
|
|
1559
|
+
})
|
|
1560
|
+
.then((e) => {
|
|
1561
|
+
var e = e.data["resultList"],
|
|
1562
|
+
{
|
|
1563
|
+
to: e,
|
|
1564
|
+
resultCode: t,
|
|
1565
|
+
resultInfo: s,
|
|
1566
|
+
} = (d.setMoreMessage("resultList:" + JSON.stringify(e)).end(),
|
|
1567
|
+
e[0]);
|
|
1568
|
+
return (
|
|
1569
|
+
Se.i(i + ` ok. to:${e} type:${a} code:` + t),
|
|
1570
|
+
ge(t) || 0 === t
|
|
1571
|
+
? Ee({ userID: e, code: 0 })
|
|
1572
|
+
: 30539 === t
|
|
1573
|
+
? Ee({ userID: e, code: t, message: this._snsM.getErrMsg(t) })
|
|
1574
|
+
: We({
|
|
1575
|
+
userID: e,
|
|
1576
|
+
code: t,
|
|
1577
|
+
message: this._snsM.getErrMsg(t) || s,
|
|
1578
|
+
})
|
|
1579
|
+
);
|
|
1580
|
+
})
|
|
1581
|
+
.catch(
|
|
1582
|
+
(e) => (d.setError(e).end(), Se.w(i + " failed. error:", e), We(e)),
|
|
1583
|
+
)
|
|
1584
|
+
);
|
|
1585
|
+
}
|
|
1586
|
+
deleteFriend(e) {
|
|
1587
|
+
let t = this._n + ".deleteFriend",
|
|
1588
|
+
{ userIDList: s, type: i } = e,
|
|
1589
|
+
r =
|
|
1590
|
+
(1e3 < s.length &&
|
|
1591
|
+
(Se.w(t + " " + "the length of userIDList cannot exceed 1000"),
|
|
1592
|
+
(s.length = 1e3)),
|
|
1593
|
+
[]),
|
|
1594
|
+
n = [],
|
|
1595
|
+
o = [];
|
|
1596
|
+
if (
|
|
1597
|
+
(s.forEach((e) => {
|
|
1598
|
+
this._map.has(e)
|
|
1599
|
+
? o.push(e)
|
|
1600
|
+
: r.push({ userID: e, code: Pe, message: this._snsM.getErrMsg(Pe) });
|
|
1601
|
+
}),
|
|
1602
|
+
0 === o.length)
|
|
1603
|
+
)
|
|
1604
|
+
return Be({ successUserIDList: n, failureUserIDList: r });
|
|
1605
|
+
let a = i,
|
|
1606
|
+
d = ((a && (a === N || a === G)) || (a = G), new ut("deleteFriend"));
|
|
1607
|
+
return (
|
|
1608
|
+
d.setMessage(`userIDList:${o} type:` + a),
|
|
1609
|
+
this._snsM
|
|
1610
|
+
.req({
|
|
1611
|
+
P: Ye,
|
|
1612
|
+
data: {
|
|
1613
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
1614
|
+
userIDList: o,
|
|
1615
|
+
type: a,
|
|
1616
|
+
},
|
|
1617
|
+
})
|
|
1618
|
+
.then((e) => {
|
|
1619
|
+
(d.end(), Se.i(t + " ok"));
|
|
1620
|
+
e = e.data.resultList;
|
|
1621
|
+
return (
|
|
1622
|
+
ue(e) ||
|
|
1623
|
+
e.forEach((e) => {
|
|
1624
|
+
var { to: e, resultCode: t, resultInfo: s } = e;
|
|
1625
|
+
ge(t) || 0 === t
|
|
1626
|
+
? n.push({ userID: e })
|
|
1627
|
+
: r.push({ userID: e, code: t, message: s });
|
|
1628
|
+
}),
|
|
1629
|
+
Ee({ successUserIDList: n, failureUserIDList: r })
|
|
1630
|
+
);
|
|
1631
|
+
})
|
|
1632
|
+
.catch((e) => (d.setError(e).end(), Se.w(t + " error:", e), We(e)))
|
|
1633
|
+
);
|
|
1634
|
+
}
|
|
1635
|
+
updateFriend(e) {
|
|
1636
|
+
let { userID: t, remark: i, friendCustomField: n } = e;
|
|
1637
|
+
if (!this._map.has(t)) return We({ code: Pe });
|
|
1638
|
+
let o = this._n + ".updateFriend",
|
|
1639
|
+
a = new ut("updateFriend"),
|
|
1640
|
+
s = (a.setMessage(`userID:${t} remark:${i} friendCustomField:` + n), []);
|
|
1641
|
+
return (
|
|
1642
|
+
ge(i) || s.push({ tag: ie.REMARK, value: i }),
|
|
1643
|
+
fe(n) &&
|
|
1644
|
+
0 < n.length &&
|
|
1645
|
+
n.forEach((e) => {
|
|
1646
|
+
s.push({ tag: e.key, value: e.value });
|
|
1647
|
+
}),
|
|
1648
|
+
this._snsM
|
|
1649
|
+
.req({
|
|
1650
|
+
P: ze,
|
|
1651
|
+
data: {
|
|
1652
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
1653
|
+
updateItem: [{ to: t, snsItem: s }],
|
|
1654
|
+
},
|
|
1655
|
+
})
|
|
1656
|
+
.then((e) => {
|
|
1657
|
+
(a.end(), Se.i(o + " ok"));
|
|
1658
|
+
var e = e.data["resultList"],
|
|
1659
|
+
{ to: t, resultCode: e, resultInfo: s } = e[0];
|
|
1660
|
+
if (ge(e) || 0 === e) {
|
|
1661
|
+
let e = this._map.get(t);
|
|
1662
|
+
if (e) {
|
|
1663
|
+
ge(i) || (e.remark = i);
|
|
1664
|
+
if (fe(n) && 0 < n.length) {
|
|
1665
|
+
var r = e.friendCustomField;
|
|
1666
|
+
t = n;
|
|
1667
|
+
if (fe(r) && fe(t)) {
|
|
1668
|
+
let i = !1;
|
|
1669
|
+
t.forEach(({ key: t, value: e }) => {
|
|
1670
|
+
var s = r.find((e) => e.key === t);
|
|
1671
|
+
s
|
|
1672
|
+
? s.value !== e && ((s.value = e), (i = !0))
|
|
1673
|
+
: (r.push({ key: t, value: e }), (i = !0));
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
this._onFriendListUpdated();
|
|
1678
|
+
}
|
|
1679
|
+
return Ee(e);
|
|
1680
|
+
}
|
|
1681
|
+
return We({ code: e, message: s });
|
|
1682
|
+
})
|
|
1683
|
+
.catch(
|
|
1684
|
+
(e) => (a.setError(e).end(), Se.w(o + " failed. error:", e), We(e)),
|
|
1685
|
+
)
|
|
1686
|
+
);
|
|
1687
|
+
}
|
|
1688
|
+
checkFriend(e) {
|
|
1689
|
+
let s = this._n + ".checkFriend",
|
|
1690
|
+
{ userIDList: i, type: t } = e,
|
|
1691
|
+
o = t,
|
|
1692
|
+
a = ((o && (o === B || o === H)) || (o = H), new ut("checkFriend"));
|
|
1693
|
+
return (
|
|
1694
|
+
a.setMessage(`userIDList:${i} type:` + o),
|
|
1695
|
+
this._snsM
|
|
1696
|
+
.req({
|
|
1697
|
+
P: Ve,
|
|
1698
|
+
data: {
|
|
1699
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
1700
|
+
userIDList: i,
|
|
1701
|
+
type: o,
|
|
1702
|
+
},
|
|
1703
|
+
})
|
|
1704
|
+
.then((e) => {
|
|
1705
|
+
(a.end(), Se.i(s + ` ok. userIDList:${i} type:` + o));
|
|
1706
|
+
let r = [],
|
|
1707
|
+
n = [],
|
|
1708
|
+
t = e.data["resultList"];
|
|
1709
|
+
return (
|
|
1710
|
+
fe(t) &&
|
|
1711
|
+
t.forEach((e) => {
|
|
1712
|
+
var { to: e, relation: t, resultCode: s, resultInfo: i } = e;
|
|
1713
|
+
ge(s) || 0 === s
|
|
1714
|
+
? r.push({ userID: e, code: 0, relation: t })
|
|
1715
|
+
: n.push({ userID: e, code: s, message: i });
|
|
1716
|
+
}),
|
|
1717
|
+
Ee({ successUserIDList: r, failureUserIDList: n })
|
|
1718
|
+
);
|
|
1719
|
+
})
|
|
1720
|
+
.catch(
|
|
1721
|
+
(e) => (a.setError(e).end(), Se.w(s + " failed. error:", e), We(e)),
|
|
1722
|
+
)
|
|
1723
|
+
);
|
|
1724
|
+
}
|
|
1725
|
+
onAddedToFriendGroup(e) {
|
|
1726
|
+
let { name: t, userIDList: s } = e;
|
|
1727
|
+
(Se.l(`${this._n}.onAddedToFriendGroup groupName:${t} userIDList:` + s),
|
|
1728
|
+
t &&
|
|
1729
|
+
!ue(s) &&
|
|
1730
|
+
s.forEach((e) => {
|
|
1731
|
+
this._map.has(e) && this._map.get(e).addToGroupList(t);
|
|
1732
|
+
}));
|
|
1733
|
+
}
|
|
1734
|
+
onRemovedFromFriendGroup(e) {
|
|
1735
|
+
let { name: t, userIDList: s } = e;
|
|
1736
|
+
(Se.l(`${this._n}.onRemovedFromFriendGroup groupName:${t} userIDList:` + s),
|
|
1737
|
+
t &&
|
|
1738
|
+
!ue(s) &&
|
|
1739
|
+
s.forEach((e) => {
|
|
1740
|
+
this._map.has(e) && this._map.get(e).removeFromGroupList(t);
|
|
1741
|
+
}));
|
|
1742
|
+
}
|
|
1743
|
+
reset() {
|
|
1744
|
+
(this._map.clear(),
|
|
1745
|
+
(this._startIdx = 0),
|
|
1746
|
+
(this._standardSeq = 0),
|
|
1747
|
+
(this._customSeq = 0));
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
class It {
|
|
1751
|
+
constructor(e) {
|
|
1752
|
+
ue(e) ||
|
|
1753
|
+
((this.name = e.name || ""),
|
|
1754
|
+
(this.userIDList = e.userIDList || []),
|
|
1755
|
+
(this.count = this.userIDList.length || 0));
|
|
1756
|
+
}
|
|
1757
|
+
addToUserIDList(e) {
|
|
1758
|
+
-1 === this.userIDList.indexOf(e) &&
|
|
1759
|
+
(this.userIDList.push(e), (this.count = this.userIDList.length));
|
|
1760
|
+
}
|
|
1761
|
+
removeFromUserIDList(e) {
|
|
1762
|
+
e = this.userIDList.indexOf(e);
|
|
1763
|
+
-1 < e &&
|
|
1764
|
+
(this.userIDList.splice(e, 1), (this.count = this.userIDList.length));
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
class Tt {
|
|
1768
|
+
constructor(e) {
|
|
1769
|
+
((this._snsM = e),
|
|
1770
|
+
(this._n = "FriendGroupHandler"),
|
|
1771
|
+
(this._map = new Map()));
|
|
1772
|
+
}
|
|
1773
|
+
updateCacheOnReconnected() {
|
|
1774
|
+
this.getGroupList();
|
|
1775
|
+
}
|
|
1776
|
+
getLocalGroupList() {
|
|
1777
|
+
return [...this._map.values()];
|
|
1778
|
+
}
|
|
1779
|
+
_onGroupListUpdated() {
|
|
1780
|
+
var e = [...this._map.values()];
|
|
1781
|
+
this._snsM.emitOEvt(Re, e);
|
|
1782
|
+
}
|
|
1783
|
+
getGroupList() {
|
|
1784
|
+
let t = this._n + ".getGroupList",
|
|
1785
|
+
s = new ut("getGroupList");
|
|
1786
|
+
return this._snsM
|
|
1787
|
+
.req({ P: st, data: { fromAccount: this._snsM.getMyUserID() } })
|
|
1788
|
+
.then((e) => {
|
|
1789
|
+
s.end();
|
|
1790
|
+
e = e.data.resultList;
|
|
1791
|
+
ue(e)
|
|
1792
|
+
? Se.i(t + " ok. count:0")
|
|
1793
|
+
: (Se.i(t + " ok. count:" + e.length),
|
|
1794
|
+
this._map.clear(),
|
|
1795
|
+
e.forEach((e) => {
|
|
1796
|
+
var t = new It(e);
|
|
1797
|
+
this._map.set(e.name, t);
|
|
1798
|
+
}),
|
|
1799
|
+
this._onGroupListUpdated());
|
|
1800
|
+
})
|
|
1801
|
+
.catch((e) => (s.setError(e).end(), Se.w(t + " error:", e), We(e)));
|
|
1802
|
+
}
|
|
1803
|
+
createGroup(e) {
|
|
1804
|
+
let s = this._n + ".createGroup",
|
|
1805
|
+
{ name: i, userIDList: t } = e;
|
|
1806
|
+
if (this._map.has(i)) return We({ code: ke });
|
|
1807
|
+
let o = `name:${i} userIDList:` + t,
|
|
1808
|
+
a = new ut("createGroup");
|
|
1809
|
+
return (
|
|
1810
|
+
a.setMessage(o),
|
|
1811
|
+
this._snsM
|
|
1812
|
+
.req({
|
|
1813
|
+
P: it,
|
|
1814
|
+
data: {
|
|
1815
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
1816
|
+
groupName: [i],
|
|
1817
|
+
userIDList: fe(t) ? t : void 0,
|
|
1818
|
+
},
|
|
1819
|
+
})
|
|
1820
|
+
.then((e) => {
|
|
1821
|
+
(a.end(), Se.l(s + " ok. " + o));
|
|
1822
|
+
let t = e.data["resultList"],
|
|
1823
|
+
r = [],
|
|
1824
|
+
n = [];
|
|
1825
|
+
t &&
|
|
1826
|
+
t.forEach((t) => {
|
|
1827
|
+
let { to: e, resultCode: s, resultInfo: i } = t;
|
|
1828
|
+
if (ge(s) || 0 === s) r.push(e);
|
|
1829
|
+
else {
|
|
1830
|
+
let e = { userID: t.to, code: s, message: i };
|
|
1831
|
+
n.push(e);
|
|
1832
|
+
}
|
|
1833
|
+
});
|
|
1834
|
+
e = new It({ name: i, userIDList: r });
|
|
1835
|
+
return (
|
|
1836
|
+
this._map.set(i, e),
|
|
1837
|
+
this._snsM.onAddedToFriendGroup({ name: i, userIDList: r }),
|
|
1838
|
+
this._onGroupListUpdated(),
|
|
1839
|
+
Ee({ friendGroup: e, failureUserIDList: n })
|
|
1840
|
+
);
|
|
1841
|
+
})
|
|
1842
|
+
.catch(
|
|
1843
|
+
(e) => (a.setError(e).end(), Se.w(s + " failed. error:", e), We(e)),
|
|
1844
|
+
)
|
|
1845
|
+
);
|
|
1846
|
+
}
|
|
1847
|
+
deleteGroup(e) {
|
|
1848
|
+
let s = this._n + ".deleteGroup",
|
|
1849
|
+
i = e["name"];
|
|
1850
|
+
if (!this._map.has(i)) return this._onGroupNotExist();
|
|
1851
|
+
let r = "name:" + i,
|
|
1852
|
+
n = new ut("deleteGroup");
|
|
1853
|
+
return (
|
|
1854
|
+
n.setMessage(r),
|
|
1855
|
+
this._snsM
|
|
1856
|
+
.req({
|
|
1857
|
+
P: nt,
|
|
1858
|
+
data: { fromAccount: this._snsM.getMyUserID(), nameList: [i] },
|
|
1859
|
+
})
|
|
1860
|
+
.then((e) => {
|
|
1861
|
+
(n.end(), Se.l(s + " ok. " + r));
|
|
1862
|
+
var t = this._map.get(i);
|
|
1863
|
+
return (
|
|
1864
|
+
t &&
|
|
1865
|
+
(this._snsM.onRemovedFromFriendGroup({
|
|
1866
|
+
name: i,
|
|
1867
|
+
userIDList: t.userIDList,
|
|
1868
|
+
}),
|
|
1869
|
+
this._map.delete(i),
|
|
1870
|
+
(t.userIDList.length = 0)),
|
|
1871
|
+
this._onGroupListUpdated(),
|
|
1872
|
+
Ee(t)
|
|
1873
|
+
);
|
|
1874
|
+
})
|
|
1875
|
+
.catch(
|
|
1876
|
+
(e) => (n.setError(e).end(), Se.w(s + " failed. error:", e), We(e)),
|
|
1877
|
+
)
|
|
1878
|
+
);
|
|
1879
|
+
}
|
|
1880
|
+
renameGroup(e) {
|
|
1881
|
+
let t = this._n + ".renameGroup",
|
|
1882
|
+
{ oldName: s, newName: i } = e;
|
|
1883
|
+
if (!this._map.has(s)) return this._onGroupNotExist();
|
|
1884
|
+
let r = `oldName:${s} newName:` + i,
|
|
1885
|
+
n = new ut("renameGroup");
|
|
1886
|
+
return (
|
|
1887
|
+
n.setMessage(r),
|
|
1888
|
+
this._snsM
|
|
1889
|
+
.req({
|
|
1890
|
+
P: rt,
|
|
1891
|
+
data: {
|
|
1892
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
1893
|
+
oldName: s,
|
|
1894
|
+
newName: i,
|
|
1895
|
+
},
|
|
1896
|
+
})
|
|
1897
|
+
.then(() => {
|
|
1898
|
+
var e;
|
|
1899
|
+
return (
|
|
1900
|
+
n.end(),
|
|
1901
|
+
Se.l(t + " ok. " + r),
|
|
1902
|
+
this._map.has(s)
|
|
1903
|
+
? (((e = this._map.get(s)).name = i),
|
|
1904
|
+
this._map.delete(s),
|
|
1905
|
+
this._map.set(i, e),
|
|
1906
|
+
this._snsM.onRemovedFromFriendGroup({
|
|
1907
|
+
name: s,
|
|
1908
|
+
userIDList: e.userIDList,
|
|
1909
|
+
}),
|
|
1910
|
+
this._snsM.onAddedToFriendGroup({
|
|
1911
|
+
name: i,
|
|
1912
|
+
userIDList: e.userIDList,
|
|
1913
|
+
}),
|
|
1914
|
+
this._onGroupListUpdated(),
|
|
1915
|
+
Ee(e))
|
|
1916
|
+
: Ee()
|
|
1917
|
+
);
|
|
1918
|
+
})
|
|
1919
|
+
.catch(
|
|
1920
|
+
(e) => (n.setError(e).end(), Se.w(t + " failed. error:", e), We(e)),
|
|
1921
|
+
)
|
|
1922
|
+
);
|
|
1923
|
+
}
|
|
1924
|
+
addToGroup(e) {
|
|
1925
|
+
let t = this._n + ".addToGroup",
|
|
1926
|
+
{ name: s, userIDList: i } = e;
|
|
1927
|
+
if (!this._map.has(s)) return this._onGroupNotExist();
|
|
1928
|
+
let r = `name:${s} userIDList:` + i,
|
|
1929
|
+
n = new ut("addToGroup");
|
|
1930
|
+
return (
|
|
1931
|
+
n.setMessage(r),
|
|
1932
|
+
this._snsM
|
|
1933
|
+
.req({
|
|
1934
|
+
P: rt,
|
|
1935
|
+
data: {
|
|
1936
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
1937
|
+
oldName: s,
|
|
1938
|
+
updateGroupItem: i
|
|
1939
|
+
.filter((e) => this._snsM.isMyFriend(e))
|
|
1940
|
+
.map((e) => ({ to: e, updateType: "Update_Type_Add" })),
|
|
1941
|
+
},
|
|
1942
|
+
})
|
|
1943
|
+
.then(
|
|
1944
|
+
(e) => (n.end(), Se.l(t + " ok. " + r), this._onGroupUpdated(s, e)),
|
|
1945
|
+
)
|
|
1946
|
+
.catch(
|
|
1947
|
+
(e) => (n.setError(e).end(), Se.w(t + " failed. error:", e), We(e)),
|
|
1948
|
+
)
|
|
1949
|
+
);
|
|
1950
|
+
}
|
|
1951
|
+
removeFromGroup(e) {
|
|
1952
|
+
let t = this._n + ".removeFromGroup",
|
|
1953
|
+
{ name: s, userIDList: i } = e;
|
|
1954
|
+
if (!this._map.has(s)) return this._onGroupNotExist();
|
|
1955
|
+
let r = `name:${s} userIDList:` + i,
|
|
1956
|
+
n = new ut("removeFromGroup");
|
|
1957
|
+
return (
|
|
1958
|
+
n.setMessage(r),
|
|
1959
|
+
this._snsM
|
|
1960
|
+
.req({
|
|
1961
|
+
P: rt,
|
|
1962
|
+
data: {
|
|
1963
|
+
fromAccount: this._snsM.getMyUserID(),
|
|
1964
|
+
oldName: s,
|
|
1965
|
+
updateGroupItem: i
|
|
1966
|
+
.filter((e) => this._snsM.isMyFriend(e))
|
|
1967
|
+
.map((e) => ({ to: e, updateType: "Update_Type_Delete" })),
|
|
1968
|
+
},
|
|
1969
|
+
})
|
|
1970
|
+
.then(
|
|
1971
|
+
(e) => (n.end(), Se.l(t + " ok. " + r), this._onGroupUpdated(s, e)),
|
|
1972
|
+
)
|
|
1973
|
+
.catch(
|
|
1974
|
+
(e) => (n.setError(e).end(), Se.w(t + " failed. error:", e), We(e)),
|
|
1975
|
+
)
|
|
1976
|
+
);
|
|
1977
|
+
}
|
|
1978
|
+
_onGroupUpdated(e, t) {
|
|
1979
|
+
let s = t.data["resultList"],
|
|
1980
|
+
n = this._map.get(e),
|
|
1981
|
+
o = [],
|
|
1982
|
+
a = [],
|
|
1983
|
+
d = [],
|
|
1984
|
+
u = !1;
|
|
1985
|
+
return (
|
|
1986
|
+
fe(s) &&
|
|
1987
|
+
s.forEach((e) => {
|
|
1988
|
+
var { to: t, resultCode: s, resultInfo: i, type: r } = e;
|
|
1989
|
+
0 === s
|
|
1990
|
+
? "Update_Type_Add" === r
|
|
1991
|
+
? n && (n.addToUserIDList(t), a.push(t), (u = !0))
|
|
1992
|
+
: "Update_Type_Delete" === r &&
|
|
1993
|
+
n &&
|
|
1994
|
+
(n.removeFromUserIDList(t), d.push(t), (u = !0))
|
|
1995
|
+
: o.push({ to: e.to, code: s, message: i });
|
|
1996
|
+
}),
|
|
1997
|
+
Se.l(this._n + `._onGroupUpdated name:${e} userIDList:` + n.userIDList),
|
|
1998
|
+
0 < a.length &&
|
|
1999
|
+
this._snsM.onAddedToFriendGroup({ name: e, userIDList: a }),
|
|
2000
|
+
0 < d.length &&
|
|
2001
|
+
this._snsM.onRemovedFromFriendGroup({ name: e, userIDList: d }),
|
|
2002
|
+
u && this._onGroupListUpdated(),
|
|
2003
|
+
Ee({ friendGroup: n, failureUserIDList: o })
|
|
2004
|
+
);
|
|
2005
|
+
}
|
|
2006
|
+
updateWhenFriendAdded(e) {
|
|
2007
|
+
let { nameList: s, userID: i } = e;
|
|
2008
|
+
if (
|
|
2009
|
+
(Se.l(`${this._n}.updateWhenFriendAdded userID:${i} nameList:` + s),
|
|
2010
|
+
!ue(s))
|
|
2011
|
+
) {
|
|
2012
|
+
let t = !1;
|
|
2013
|
+
(s.forEach((e) => {
|
|
2014
|
+
this._map.has(e) && (this._map.get(e).addToUserIDList(i), (t = !0));
|
|
2015
|
+
}),
|
|
2016
|
+
t && this._onGroupListUpdated());
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
updateWhenFriendDeleted(e) {
|
|
2020
|
+
let { nameList: s, userID: i } = e;
|
|
2021
|
+
if (
|
|
2022
|
+
(Se.l(`${this._n}.updateWhenFriendDeleted userID:${i} nameList:` + s),
|
|
2023
|
+
!ue(s))
|
|
2024
|
+
) {
|
|
2025
|
+
let t = !1;
|
|
2026
|
+
(s.forEach((e) => {
|
|
2027
|
+
this._map.has(e) &&
|
|
2028
|
+
(this._map.get(e).removeFromUserIDList(i), (t = !0));
|
|
2029
|
+
}),
|
|
2030
|
+
t && this._onGroupListUpdated());
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
_onGroupNotExist(e) {
|
|
2034
|
+
return We({ code: Ue });
|
|
2035
|
+
}
|
|
2036
|
+
reset() {
|
|
2037
|
+
this._map.clear();
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
class Dt extends class {
|
|
2041
|
+
constructor(e) {
|
|
2042
|
+
((this._m = e), (this._n = ""));
|
|
2043
|
+
}
|
|
2044
|
+
isLoggedIn() {
|
|
2045
|
+
return this._m.get(_t).isLoggedIn();
|
|
2046
|
+
}
|
|
2047
|
+
isOversea() {
|
|
2048
|
+
return this._m.get(_t).isOversea();
|
|
2049
|
+
}
|
|
2050
|
+
isPrivateNetWork() {
|
|
2051
|
+
var e = this._m.get(_t);
|
|
2052
|
+
return e.isPrivateNetWork() && !e.getFileDownloadProxy();
|
|
2053
|
+
}
|
|
2054
|
+
getFileDownloadProxy() {
|
|
2055
|
+
return this._m.get(_t).getFileDownloadProxy();
|
|
2056
|
+
}
|
|
2057
|
+
getDownloadFileAuthKey() {
|
|
2058
|
+
return this._m.get(_t).getDownloadFileAuthKey();
|
|
2059
|
+
}
|
|
2060
|
+
getMyUserID() {
|
|
2061
|
+
return this._m.get(_t).getUserID();
|
|
2062
|
+
}
|
|
2063
|
+
getMyTinyID() {
|
|
2064
|
+
return this._m.get(_t).getTinyID();
|
|
2065
|
+
}
|
|
2066
|
+
getSDKAppID() {
|
|
2067
|
+
return this._m.get(_t).getSDKAppID();
|
|
2068
|
+
}
|
|
2069
|
+
isIntl() {
|
|
2070
|
+
return this._m.get(_t).isIntl();
|
|
2071
|
+
}
|
|
2072
|
+
isUsingChatCore() {
|
|
2073
|
+
return this._m.get(_t).isUsingChatCore();
|
|
2074
|
+
}
|
|
2075
|
+
isDevMode() {
|
|
2076
|
+
return this._m.get(_t).isDevMode();
|
|
2077
|
+
}
|
|
2078
|
+
get(e) {
|
|
2079
|
+
return this._m.get(e);
|
|
2080
|
+
}
|
|
2081
|
+
getPlatform() {
|
|
2082
|
+
return E;
|
|
2083
|
+
}
|
|
2084
|
+
getCloudConfig(e) {
|
|
2085
|
+
return this._m.get(gt).getCloudConfig(e);
|
|
2086
|
+
}
|
|
2087
|
+
emitOEvt(e, t) {
|
|
2088
|
+
this._m.getOEmitInst().emit(e, t);
|
|
2089
|
+
}
|
|
2090
|
+
emitIEvt(e, t) {
|
|
2091
|
+
this._m.getIEmitInst().emit(e, t);
|
|
2092
|
+
}
|
|
2093
|
+
getIEmitInst() {
|
|
2094
|
+
return this._m.getIEmitInst();
|
|
2095
|
+
}
|
|
2096
|
+
req(e) {
|
|
2097
|
+
return this._m.get(ft).req(e);
|
|
2098
|
+
}
|
|
2099
|
+
canIUse(e) {
|
|
2100
|
+
return this._m.get(wt).canIUse(e);
|
|
2101
|
+
}
|
|
2102
|
+
getErrMsg(e, t, s) {
|
|
2103
|
+
return this._m.getErrMsg(e, t, s);
|
|
2104
|
+
}
|
|
2105
|
+
warn(e, t, s) {
|
|
2106
|
+
e = this.getErrMsg(e, t, s);
|
|
2107
|
+
e && Se.w(e);
|
|
2108
|
+
}
|
|
2109
|
+
noUse(e) {
|
|
2110
|
+
var t = Ge;
|
|
2111
|
+
return We({ code: t, message: this.getErrMsg(t, e) });
|
|
2112
|
+
}
|
|
2113
|
+
} {
|
|
2114
|
+
constructor(t) {
|
|
2115
|
+
(super(t),
|
|
2116
|
+
(this._n = "SnsModule"),
|
|
2117
|
+
(this._friendHandler = new At(this)),
|
|
2118
|
+
(this._friendApplicationHandler = new ct(this)),
|
|
2119
|
+
(this._friendGroupHandler = new Tt(this)),
|
|
2120
|
+
this.getIEmitInst().on(
|
|
2121
|
+
e.A2KEY_AND_TINYID_UPDATED,
|
|
2122
|
+
this.onContextUpdated,
|
|
2123
|
+
this,
|
|
2124
|
+
));
|
|
2125
|
+
}
|
|
2126
|
+
onContextUpdated(e) {
|
|
2127
|
+
(this._friendHandler.pagingGetFriendList(),
|
|
2128
|
+
this._friendGroupHandler.getGroupList(),
|
|
2129
|
+
this._friendApplicationHandler.getApplicationList());
|
|
2130
|
+
}
|
|
2131
|
+
onRelationChainModified(e) {
|
|
2132
|
+
e = e.dataList;
|
|
2133
|
+
if (!ue(e)) {
|
|
2134
|
+
let t = [],
|
|
2135
|
+
s = [],
|
|
2136
|
+
i = [],
|
|
2137
|
+
r = [],
|
|
2138
|
+
n = !1,
|
|
2139
|
+
o = "";
|
|
2140
|
+
(e.forEach((e) => {
|
|
2141
|
+
if (
|
|
2142
|
+
((3 !== e.pushType && 4 !== e.pushType) || !e.from || (o = e.from),
|
|
2143
|
+
e.friendAddAccount &&
|
|
2144
|
+
(t.push(...e.friendAddAccount), r.push(...e.friendAddAccount)),
|
|
2145
|
+
e.friendDelAccount && s.push(...e.friendDelAccount),
|
|
2146
|
+
e.friendApplicationAdded && i.push(...e.friendApplicationAdded),
|
|
2147
|
+
e.friendApplicationDeletedUserIDList &&
|
|
2148
|
+
r.push(...e.friendApplicationDeletedUserIDList),
|
|
2149
|
+
e.reportTime && 7 === e.pushType && (n = !0),
|
|
2150
|
+
e.friendUpInfo)
|
|
2151
|
+
) {
|
|
2152
|
+
let t = { dataList: [] };
|
|
2153
|
+
(e.friendUpInfo.forEach((e) => {
|
|
2154
|
+
t.dataList.push({
|
|
2155
|
+
userID: e.friendAccount,
|
|
2156
|
+
profileList: [...e.sns],
|
|
2157
|
+
});
|
|
2158
|
+
}),
|
|
2159
|
+
this.onFriendProfileModified(t));
|
|
2160
|
+
}
|
|
2161
|
+
}),
|
|
2162
|
+
n && this._friendApplicationHandler.onApplicationRead(),
|
|
2163
|
+
this._friendApplicationHandler.onApplicationAdded(i, o),
|
|
2164
|
+
this._friendApplicationHandler.onApplicationDeleted(r),
|
|
2165
|
+
this._friendHandler.onFriendAdded(t),
|
|
2166
|
+
this._friendHandler.onFriendDeleted(s));
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
isMyFriend(e) {
|
|
2170
|
+
return this._friendHandler.isMyFriend(e);
|
|
2171
|
+
}
|
|
2172
|
+
filterProfanity(e, t) {
|
|
2173
|
+
var s,
|
|
2174
|
+
i = this.get(yt);
|
|
2175
|
+
return (
|
|
2176
|
+
!i ||
|
|
2177
|
+
(({ isAllowedToSend: i, modifiedText: s } = i.filterText(t[e], p)),
|
|
2178
|
+
!0 === i && ((t[e] = s), !0))
|
|
2179
|
+
);
|
|
2180
|
+
}
|
|
2181
|
+
onFriendProfileModified(e) {
|
|
2182
|
+
this._friendHandler.onFriendProfileModified(e);
|
|
2183
|
+
}
|
|
2184
|
+
getLocalFriendList(e = !0) {
|
|
2185
|
+
var t = this._friendHandler.getLocalFriendList();
|
|
2186
|
+
return e ? Be(t) : t;
|
|
2187
|
+
}
|
|
2188
|
+
getFriendRemark(e) {
|
|
2189
|
+
return this._friendHandler.getFriendRemark(e);
|
|
2190
|
+
}
|
|
2191
|
+
getFriendList() {
|
|
2192
|
+
return this._friendHandler.pagingGetFriendList();
|
|
2193
|
+
}
|
|
2194
|
+
addFriend(e) {
|
|
2195
|
+
return this._friendHandler.addFriend(e);
|
|
2196
|
+
}
|
|
2197
|
+
deleteFriend(e) {
|
|
2198
|
+
return this._friendHandler.deleteFriend(e);
|
|
2199
|
+
}
|
|
2200
|
+
checkFriend(e) {
|
|
2201
|
+
return this._friendHandler.checkFriend(e);
|
|
2202
|
+
}
|
|
2203
|
+
getFriendProfile(e) {
|
|
2204
|
+
return this._friendHandler.getFriendProfile(e);
|
|
2205
|
+
}
|
|
2206
|
+
updateFriend(e) {
|
|
2207
|
+
return this._friendHandler.updateFriend(e);
|
|
2208
|
+
}
|
|
2209
|
+
onAddedToFriendGroup(e) {
|
|
2210
|
+
this._friendHandler.onAddedToFriendGroup(e);
|
|
2211
|
+
}
|
|
2212
|
+
onRemovedFromFriendGroup(e) {
|
|
2213
|
+
this._friendHandler.onRemovedFromFriendGroup(e);
|
|
2214
|
+
}
|
|
2215
|
+
getLocalFriendApplicationList() {
|
|
2216
|
+
var e = this._friendApplicationHandler.getLocalApplicationList();
|
|
2217
|
+
return Be(e);
|
|
2218
|
+
}
|
|
2219
|
+
deleteFriendApplication(e) {
|
|
2220
|
+
return this._friendApplicationHandler.deleteApplication(e);
|
|
2221
|
+
}
|
|
2222
|
+
refuseFriendApplication(e) {
|
|
2223
|
+
return this._friendApplicationHandler.refuseApplication(e);
|
|
2224
|
+
}
|
|
2225
|
+
acceptFriendApplication(e) {
|
|
2226
|
+
return this._friendApplicationHandler.acceptApplication(e);
|
|
2227
|
+
}
|
|
2228
|
+
setFriendApplicationRead(e) {
|
|
2229
|
+
return this._friendApplicationHandler.setApplicationRead(e);
|
|
2230
|
+
}
|
|
2231
|
+
getLocalFriendGroupList() {
|
|
2232
|
+
var e = this._friendGroupHandler.getLocalGroupList();
|
|
2233
|
+
return Be(e);
|
|
2234
|
+
}
|
|
2235
|
+
createFriendGroup(e) {
|
|
2236
|
+
return this._friendGroupHandler.createGroup(e);
|
|
2237
|
+
}
|
|
2238
|
+
deleteFriendGroup(e) {
|
|
2239
|
+
return this._friendGroupHandler.deleteGroup(e);
|
|
2240
|
+
}
|
|
2241
|
+
addToFriendGroup(e) {
|
|
2242
|
+
return this._friendGroupHandler.addToGroup(e);
|
|
2243
|
+
}
|
|
2244
|
+
removeFromFriendGroup(e) {
|
|
2245
|
+
return this._friendGroupHandler.removeFromGroup(e);
|
|
2246
|
+
}
|
|
2247
|
+
renameFriendGroup(e) {
|
|
2248
|
+
return this._friendGroupHandler.renameGroup(e);
|
|
2249
|
+
}
|
|
2250
|
+
updateWhenFriendAdded(e) {
|
|
2251
|
+
this._friendGroupHandler.updateWhenFriendAdded(e);
|
|
2252
|
+
}
|
|
2253
|
+
updateWhenFriendDeleted(e) {
|
|
2254
|
+
this._friendGroupHandler.updateWhenFriendDeleted(e);
|
|
2255
|
+
}
|
|
2256
|
+
updateCacheOnReconnected() {
|
|
2257
|
+
(Se.l(this._n + ".updateCacheOnReconnected"),
|
|
2258
|
+
this._friendHandler.updateCacheOnReconnected(),
|
|
2259
|
+
this._friendGroupHandler.updateCacheOnReconnected(),
|
|
2260
|
+
this._friendApplicationHandler.updateCacheOnReconnected());
|
|
2261
|
+
}
|
|
2262
|
+
reset() {
|
|
2263
|
+
(Se.l(this._n + ".reset"),
|
|
2264
|
+
this._friendHandler.reset(),
|
|
2265
|
+
this._friendGroupHandler.reset(),
|
|
2266
|
+
this._friendApplicationHandler.reset());
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
export { Dt as default };
|