@docoi/mys-sdk 1.0.1 → 1.0.3
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/api/basic.d.ts +1 -1
- package/dist/api/biz.d.ts +15 -1
- package/dist/bridge.d.ts +2 -2
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +145 -139
- package/dist/types/enums.d.ts +9 -0
- package/dist/types/params.d.ts +15 -1
- package/dist/types/results.d.ts +6 -1
- package/package.json +1 -1
package/dist/api/basic.d.ts
CHANGED
|
@@ -171,7 +171,7 @@ export declare function chooseMedia(params?: ChooseMediaParams): Promise<NativeR
|
|
|
171
171
|
* 批量串行上传 chooseMedia 返回的临时文件路径,成功后返回网络 URL。
|
|
172
172
|
*
|
|
173
173
|
* @note
|
|
174
|
-
* filePath 应为 chooseMedia 返回的临时文件路径,例如
|
|
174
|
+
* filePath 应为 chooseMedia 返回的临时文件路径,例如 mysFiles://temp/xxxx.png。
|
|
175
175
|
* cosDirPath 默认 multipleSource/common/。
|
|
176
176
|
*
|
|
177
177
|
* @app 4.3.0
|
package/dist/api/biz.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Callbacks, NativeResponse, ShareWebCardParams, ShowAdParams, BindGameRoleParams, LoginResult, GetTokenResult, GetCircleInfoResult } from '../types';
|
|
1
|
+
import { Callbacks, NativeResponse, ShareWebCardParams, ShareImageParams, ShareImageResult, ShowAdParams, BindGameRoleParams, LoginResult, GetTokenResult, GetCircleInfoResult } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* 登录授权,获取用户信息。
|
|
4
4
|
*
|
|
@@ -44,6 +44,20 @@ export declare function getCurrentCircleInfo(params?: Callbacks<GetCircleInfoRes
|
|
|
44
44
|
* })
|
|
45
45
|
*/
|
|
46
46
|
export declare function shareWebCard(params: ShareWebCardParams): Promise<NativeResponse<void>>;
|
|
47
|
+
/**
|
|
48
|
+
* 唤起客户端图片分享弹窗,分享网络图片。
|
|
49
|
+
*
|
|
50
|
+
* 弹窗提供微信好友、微信朋友圈、QQ 好友、保存图片、取消五个操作,用户点击后通过 result.action 返回所选操作。
|
|
51
|
+
*
|
|
52
|
+
* @note
|
|
53
|
+
* url 不能为空,且必须为 http(s) 网络地址。
|
|
54
|
+
* 点击取消按钮属于成功响应,result.action 为 cancel。
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* const res = await mys.shareImage({ url: 'https://example.com/poster.png' })
|
|
58
|
+
* console.log(res.result.action) // 'wechat' | 'moment' | 'qq' | 'save' | 'cancel'
|
|
59
|
+
*/
|
|
60
|
+
export declare function shareImage(params: ShareImageParams): Promise<NativeResponse<ShareImageResult>>;
|
|
47
61
|
/**
|
|
48
62
|
* 打开添加自定义表情页面。
|
|
49
63
|
*
|
package/dist/bridge.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { default as JSBridgeSdk, CallOptions, JSBridgeInterface } from '@docoi/jsbridge-sdk';
|
|
1
|
+
import { default as JSBridgeSdk, CallOptions, DebugOptions, JSBridgeInterface } from '@docoi/jsbridge-sdk';
|
|
2
2
|
import { Callbacks, NativeResponse } from './types';
|
|
3
3
|
export { JSBridgeSdk };
|
|
4
4
|
export type NativeHandler<TData = unknown, TResult = unknown> = (data: TData) => TResult | Promise<TResult>;
|
|
5
5
|
declare const bridge: JSBridgeInterface;
|
|
6
|
-
export declare const setDebug: (enabled: boolean) => JSBridgeInterface;
|
|
6
|
+
export declare const setDebug: (enabled: boolean, options?: Partial<DebugOptions>) => JSBridgeInterface;
|
|
7
7
|
export default bridge;
|
|
8
8
|
export declare function registerNativeHandler<TData = unknown, TResult = unknown>(name: string, handler: NativeHandler<TData, TResult>): JSBridgeInterface;
|
|
9
9
|
export declare function rejectParamError<T = void>(fnName: string, msg: string, options?: Callbacks<T>): Promise<never>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { default as bridge, registerNativeHandler, setDebug, JSBridgeSdk } from './bridge';
|
|
2
|
-
import {
|
|
2
|
+
import { DebugOptions, JSBridgeInterface } from '@docoi/jsbridge-sdk';
|
|
3
|
+
import { Callbacks, LoginResult, NativeResponse, GetTokenResult, GetCircleInfoResult, ShareWebCardParams, ShareImageParams, ShareImageResult, BindGameRoleParams, ShowAdParams, ShowToastParams, TriggerVibrateParams, KeyboardHeightChangeCallback, EventListenOptions, CommentPanelChangeCallback, PlayMediaParams, ChooseMediaParams, ChooseMediaResult, UploadFilesParams, UploadFilesResult, SaveImageToPhotosAlbumParams, SaveVideoToPhotosAlbumParams, StartRecordParams, SystemInfoResult, NetworkTypeResult, SetClipboardDataParams, GetClipboardDataResult, CheckPermissionParams, CheckPermissionResult, OpenPhoneSettingParams, OpenInExternalBrowserParams } from './types';
|
|
3
4
|
declare const mys: {
|
|
5
|
+
setDebug: (enabled: boolean, options?: Partial< DebugOptions>) => JSBridgeInterface;
|
|
4
6
|
registerNativeHandler: typeof registerNativeHandler;
|
|
5
7
|
login(params?: Callbacks<LoginResult>): Promise< NativeResponse<LoginResult>>;
|
|
6
8
|
getToken(params?: Callbacks<GetTokenResult>): Promise< NativeResponse<GetTokenResult>>;
|
|
7
9
|
getCurrentCircleInfo(params?: Callbacks<GetCircleInfoResult>): Promise< NativeResponse<GetCircleInfoResult>>;
|
|
8
10
|
shareWebCard(params: ShareWebCardParams): Promise< NativeResponse<void>>;
|
|
11
|
+
shareImage(params: ShareImageParams): Promise< NativeResponse<ShareImageResult>>;
|
|
9
12
|
openAddCustomEmoji(params?: Callbacks): Promise< NativeResponse<void>>;
|
|
10
13
|
toBindGameRole(params: BindGameRoleParams): Promise< NativeResponse<void>>;
|
|
11
14
|
showAd(params: ShowAdParams): Promise< NativeResponse<void>>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { default as
|
|
3
|
-
const
|
|
1
|
+
import T from "@docoi/jsbridge-sdk";
|
|
2
|
+
import { default as Ie } from "@docoi/jsbridge-sdk";
|
|
3
|
+
const v = 0, S = -1, Pe = 1001, A = 1002, be = 2002, qe = 3002, ve = 4002, Se = 9002;
|
|
4
4
|
function N(e) {
|
|
5
5
|
return {
|
|
6
|
-
code:
|
|
6
|
+
code: v,
|
|
7
7
|
msg: "ok",
|
|
8
8
|
result: e
|
|
9
9
|
};
|
|
@@ -20,16 +20,16 @@ function w(e) {
|
|
|
20
20
|
}
|
|
21
21
|
function O(e, t) {
|
|
22
22
|
return {
|
|
23
|
-
code:
|
|
23
|
+
code: S,
|
|
24
24
|
msg: `${e}:fail ${w(t)}`,
|
|
25
25
|
result: h(t) && "result" in t ? t.result : t
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
const u =
|
|
28
|
+
const u = T.init({
|
|
29
29
|
debug: !1,
|
|
30
30
|
timeout: 9e4
|
|
31
|
-
}),
|
|
32
|
-
function
|
|
31
|
+
}), H = (e, t) => u.setDebug(e, t);
|
|
32
|
+
function _(e, t) {
|
|
33
33
|
return u.register(e, async (r) => {
|
|
34
34
|
try {
|
|
35
35
|
const o = await t(r);
|
|
@@ -40,14 +40,14 @@ function H(e, t) {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
function i(e, t, r) {
|
|
43
|
-
var
|
|
43
|
+
var s, f;
|
|
44
44
|
const o = {
|
|
45
45
|
errMsg: `${e}:fail parameter error: ${t}`,
|
|
46
|
-
errCode:
|
|
46
|
+
errCode: A
|
|
47
47
|
};
|
|
48
|
-
return (
|
|
48
|
+
return (s = r == null ? void 0 : r.fail) == null || s.call(r, o), (f = r == null ? void 0 : r.complete) == null || f.call(r, o), Promise.reject(o);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function D(e) {
|
|
51
51
|
return Object.fromEntries(
|
|
52
52
|
Object.entries(e).filter(([, r]) => typeof r != "function")
|
|
53
53
|
);
|
|
@@ -58,7 +58,7 @@ function h(e) {
|
|
|
58
58
|
function M(e) {
|
|
59
59
|
return h(e) && typeof e.code == "number";
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function m(e) {
|
|
62
62
|
if (typeof e != "string") return e;
|
|
63
63
|
try {
|
|
64
64
|
return JSON.parse(e);
|
|
@@ -73,25 +73,25 @@ function q(e, t) {
|
|
|
73
73
|
raw: t
|
|
74
74
|
} : {
|
|
75
75
|
errMsg: `${e}:fail ${w(t)}`,
|
|
76
|
-
errCode:
|
|
76
|
+
errCode: S
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
function n(e, t = {}, r, o) {
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
if (M(
|
|
83
|
-
const C =
|
|
84
|
-
return
|
|
80
|
+
const s = String(e), { success: f, fail: y, complete: d } = r || {}, I = (a) => {
|
|
81
|
+
const l = m(a);
|
|
82
|
+
if (M(l) && l.code === v) {
|
|
83
|
+
const C = l;
|
|
84
|
+
return f == null || f(C), d == null || d(C), C;
|
|
85
85
|
}
|
|
86
|
-
throw q(
|
|
87
|
-
},
|
|
88
|
-
const
|
|
89
|
-
throw y == null || y(
|
|
86
|
+
throw q(s, l);
|
|
87
|
+
}, R = (a) => {
|
|
88
|
+
const l = q(s, a);
|
|
89
|
+
throw y == null || y(l), d == null || d(l), l;
|
|
90
90
|
};
|
|
91
|
-
return u.callAsync(
|
|
91
|
+
return u.callAsync(s, D(t), o).then(I).catch(R);
|
|
92
92
|
}
|
|
93
93
|
var E = /* @__PURE__ */ ((e) => (e[e.Short = 0] = "Short", e[e.Long = 1] = "Long", e))(E || {});
|
|
94
|
-
function
|
|
94
|
+
function x(e) {
|
|
95
95
|
return e.text ? n(
|
|
96
96
|
"showToast",
|
|
97
97
|
{
|
|
@@ -101,7 +101,7 @@ function m(e) {
|
|
|
101
101
|
e
|
|
102
102
|
) : i("showToast", "text is required", e);
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function V(e = {}) {
|
|
105
105
|
return n("triggerVibrate", {
|
|
106
106
|
duration: e.duration,
|
|
107
107
|
intensity: e.intensity ?? 1,
|
|
@@ -109,22 +109,22 @@ function x(e = {}) {
|
|
|
109
109
|
repeat: e.repeat ?? !1
|
|
110
110
|
}, e, { queue: "serial" });
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function j(e) {
|
|
113
113
|
return n("stopVibrate", {}, e, { queue: "serial" });
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function F(e) {
|
|
116
116
|
return n("hideKeyboard", {}, e);
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function B() {
|
|
119
119
|
return typeof window > "u" ? 1 : window.devicePixelRatio || 1;
|
|
120
120
|
}
|
|
121
121
|
const c = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
|
|
122
|
-
function
|
|
122
|
+
function $(e, t) {
|
|
123
123
|
const r = c.get(e);
|
|
124
124
|
r && u.off("keyboardHeightChange", r);
|
|
125
|
-
const o = (
|
|
126
|
-
const
|
|
127
|
-
e(
|
|
125
|
+
const o = (s) => {
|
|
126
|
+
const f = s ? s / B() : 0;
|
|
127
|
+
e(f), t != null && t.once && c.delete(e);
|
|
128
128
|
};
|
|
129
129
|
if (c.set(e, o), t != null && t.once) {
|
|
130
130
|
u.once("keyboardHeightChange", o);
|
|
@@ -132,7 +132,7 @@ function B(e, t) {
|
|
|
132
132
|
}
|
|
133
133
|
u.on("keyboardHeightChange", o);
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function k(e) {
|
|
136
136
|
if (!e) {
|
|
137
137
|
c.clear(), u.off("keyboardHeightChange");
|
|
138
138
|
return;
|
|
@@ -140,11 +140,11 @@ function $(e) {
|
|
|
140
140
|
const t = c.get(e);
|
|
141
141
|
c.delete(e), u.off("keyboardHeightChange", t || e);
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function G(e, t) {
|
|
144
144
|
const r = g.get(e);
|
|
145
145
|
r && u.off("onCommentPanelChange", r);
|
|
146
|
-
const o = (
|
|
147
|
-
e(
|
|
146
|
+
const o = (s) => {
|
|
147
|
+
e(s), t != null && t.once && g.delete(e);
|
|
148
148
|
};
|
|
149
149
|
if (g.set(e, o), t != null && t.once) {
|
|
150
150
|
u.once("onCommentPanelChange", o);
|
|
@@ -152,7 +152,7 @@ function k(e, t) {
|
|
|
152
152
|
}
|
|
153
153
|
u.on("onCommentPanelChange", o);
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function W(e) {
|
|
156
156
|
if (!e) {
|
|
157
157
|
g.clear(), u.off("onCommentPanelChange");
|
|
158
158
|
return;
|
|
@@ -160,13 +160,13 @@ function G(e) {
|
|
|
160
160
|
const t = g.get(e);
|
|
161
161
|
g.delete(e), u.off("onCommentPanelChange", t || e);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function K(e) {
|
|
164
164
|
var r;
|
|
165
165
|
if (!((r = e.urls) != null && r.length))
|
|
166
|
-
return i("
|
|
166
|
+
return i("previewMedia", "urls is required", e);
|
|
167
167
|
const t = e.current ?? 0;
|
|
168
|
-
return !Number.isInteger(t) || t < 0 || t >= e.urls.length ? i("
|
|
169
|
-
"
|
|
168
|
+
return !Number.isInteger(t) || t < 0 || t >= e.urls.length ? i("previewMedia", "current is out of range", e) : n(
|
|
169
|
+
"previewMedia",
|
|
170
170
|
{
|
|
171
171
|
type: "image",
|
|
172
172
|
urls: e.urls,
|
|
@@ -175,13 +175,13 @@ function W(e) {
|
|
|
175
175
|
e
|
|
176
176
|
);
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function z(e) {
|
|
179
179
|
var r;
|
|
180
180
|
if (!((r = e.urls) != null && r.length))
|
|
181
181
|
return i("previewVideo", "urls is required", e);
|
|
182
182
|
const t = e.current ?? 0;
|
|
183
183
|
return !Number.isInteger(t) || t < 0 || t >= e.urls.length ? i("previewVideo", "current is out of range", e) : n(
|
|
184
|
-
"
|
|
184
|
+
"previewMedia",
|
|
185
185
|
{
|
|
186
186
|
type: "video",
|
|
187
187
|
urls: e.urls,
|
|
@@ -190,7 +190,7 @@ function K(e) {
|
|
|
190
190
|
e
|
|
191
191
|
);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function J(e = {}) {
|
|
194
194
|
return e.count !== void 0 && (!Number.isInteger(e.count) || e.count <= 0) ? i("chooseMedia", "可选择照片数量范围为1-9张", e) : n(
|
|
195
195
|
"chooseMedia",
|
|
196
196
|
{
|
|
@@ -210,7 +210,7 @@ u.on("uploadFilesProgress", (e) => {
|
|
|
210
210
|
for (const t of b)
|
|
211
211
|
t(e);
|
|
212
212
|
});
|
|
213
|
-
function
|
|
213
|
+
function L(e) {
|
|
214
214
|
return !Array.isArray(e.files) || e.files.length === 0 ? i("uploadFiles", "files is required", e) : e.files.some((t) => !t) ? i("uploadFiles", "files[] is required", e) : P ? i("uploadFiles", "another uploadFiles request is in progress", e) : (P = !0, e.onProgress && b.add(e.onProgress), n(
|
|
215
215
|
"uploadFiles",
|
|
216
216
|
{
|
|
@@ -223,31 +223,31 @@ function J(e) {
|
|
|
223
223
|
P = !1, e.onProgress && b.delete(e.onProgress);
|
|
224
224
|
}));
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function U(e) {
|
|
227
227
|
return e.filePath ? n("saveMediaToPhotosAlbum", { type: "image", file: e.filePath }, e, { queue: "serial" }) : i("saveImageToPhotosAlbum", "filePath is required", e);
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function X(e) {
|
|
230
230
|
return e.filePath ? n("saveMediaToPhotosAlbum", { type: "video", file: e.filePath }, e, { queue: "serial" }) : i("saveVideoToPhotosAlbum", "filePath is required", e);
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function Y(e) {
|
|
233
233
|
return n("startRecord", e || {}, e, { queue: "serial" });
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function Q(e) {
|
|
236
236
|
return n("stopRecord", {}, e, { queue: "serial" });
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function Z(e) {
|
|
239
239
|
return n("getSystemInfo", {}, e);
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function p(e) {
|
|
242
242
|
return n("getNetworkType", {}, e);
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function ee(e) {
|
|
245
245
|
return e.data === void 0 ? i("setClipboardData", "data is required", e) : n("setClipboardData", { data: e.data }, e);
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function te(e) {
|
|
248
248
|
return n("getClipboardData", {}, e);
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function re(e) {
|
|
251
251
|
return e.permission ? n(
|
|
252
252
|
"checkPermission",
|
|
253
253
|
{
|
|
@@ -256,7 +256,7 @@ function te(e) {
|
|
|
256
256
|
e
|
|
257
257
|
) : i("checkPermission", "permission is required", e);
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function ne(e) {
|
|
260
260
|
return e.type ? n(
|
|
261
261
|
"openPhoneSetting",
|
|
262
262
|
{
|
|
@@ -266,46 +266,46 @@ function re(e) {
|
|
|
266
266
|
{ queue: "serial" }
|
|
267
267
|
) : i("openPhoneSetting", "type is required", e);
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function ie(e) {
|
|
270
270
|
return n("closeWebView", {}, e, { queue: "serial" });
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function oe(e) {
|
|
273
273
|
return e.url ? n("openInExternalBrowser", { url: e.url }, e, { queue: "serial" }) : i("openInExternalBrowser", "url is required", e);
|
|
274
274
|
}
|
|
275
|
-
const
|
|
275
|
+
const ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
276
276
|
__proto__: null,
|
|
277
|
-
checkPermission:
|
|
278
|
-
chooseMedia:
|
|
279
|
-
closeWebView:
|
|
280
|
-
getClipboardData:
|
|
281
|
-
getNetworkType:
|
|
282
|
-
getSystemInfo:
|
|
283
|
-
hideKeyboard:
|
|
284
|
-
offCommentPanelChange:
|
|
285
|
-
offKeyboardHeightChange:
|
|
286
|
-
onCommentPanelChange:
|
|
287
|
-
onKeyboardHeightChange:
|
|
288
|
-
openInExternalBrowser:
|
|
289
|
-
openPhoneSetting:
|
|
290
|
-
previewImage:
|
|
291
|
-
previewVideo:
|
|
292
|
-
saveImageToPhotosAlbum:
|
|
293
|
-
saveVideoToPhotosAlbum:
|
|
294
|
-
setClipboardData:
|
|
295
|
-
showToast:
|
|
296
|
-
startRecord:
|
|
297
|
-
stopRecord:
|
|
298
|
-
stopVibrate:
|
|
299
|
-
triggerVibrate:
|
|
300
|
-
uploadFiles:
|
|
277
|
+
checkPermission: re,
|
|
278
|
+
chooseMedia: J,
|
|
279
|
+
closeWebView: ie,
|
|
280
|
+
getClipboardData: te,
|
|
281
|
+
getNetworkType: p,
|
|
282
|
+
getSystemInfo: Z,
|
|
283
|
+
hideKeyboard: F,
|
|
284
|
+
offCommentPanelChange: W,
|
|
285
|
+
offKeyboardHeightChange: k,
|
|
286
|
+
onCommentPanelChange: G,
|
|
287
|
+
onKeyboardHeightChange: $,
|
|
288
|
+
openInExternalBrowser: oe,
|
|
289
|
+
openPhoneSetting: ne,
|
|
290
|
+
previewImage: K,
|
|
291
|
+
previewVideo: z,
|
|
292
|
+
saveImageToPhotosAlbum: U,
|
|
293
|
+
saveVideoToPhotosAlbum: X,
|
|
294
|
+
setClipboardData: ee,
|
|
295
|
+
showToast: x,
|
|
296
|
+
startRecord: Y,
|
|
297
|
+
stopRecord: Q,
|
|
298
|
+
stopVibrate: j,
|
|
299
|
+
triggerVibrate: V,
|
|
300
|
+
uploadFiles: L
|
|
301
301
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
302
|
-
function
|
|
302
|
+
function se(e) {
|
|
303
303
|
return n("login", {}, e, { queue: "serial" });
|
|
304
304
|
}
|
|
305
305
|
function fe(e) {
|
|
306
306
|
return n("getToken", {}, e);
|
|
307
307
|
}
|
|
308
|
-
function
|
|
308
|
+
function le(e) {
|
|
309
309
|
return n("getCurrentCircleInfo", {}, e);
|
|
310
310
|
}
|
|
311
311
|
function de(e) {
|
|
@@ -319,73 +319,79 @@ function de(e) {
|
|
|
319
319
|
{ queue: "serial" }
|
|
320
320
|
) : i("shareWebCard", "title is required", e);
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function ce(e) {
|
|
323
|
+
return !e.url || !/^https?:\/\//i.test(e.url) ? i("shareImage", "url must be a valid http(s) url", e) : n("shareImage", { url: e.url }, e, { queue: "serial" });
|
|
324
|
+
}
|
|
325
|
+
function ge(e) {
|
|
323
326
|
return n("openAddCustomEmoji", {}, e, { queue: "serial" });
|
|
324
327
|
}
|
|
325
|
-
function
|
|
328
|
+
function he(e) {
|
|
326
329
|
return e.gameName ? e.serverId ? n("pointsMallBindGame", e, e, { queue: "serial" }) : i("toBindGameRole", "serverId is required", e) : i("toBindGameRole", "gameName is required", e);
|
|
327
330
|
}
|
|
328
|
-
function
|
|
331
|
+
function ye(e) {
|
|
329
332
|
return e.type === void 0 ? i("showAd", "type is required", e) : n("showAdVideo", e, e, { queue: "serial" });
|
|
330
333
|
}
|
|
331
|
-
const
|
|
334
|
+
const ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
332
335
|
__proto__: null,
|
|
333
|
-
getCurrentCircleInfo:
|
|
336
|
+
getCurrentCircleInfo: le,
|
|
334
337
|
getToken: fe,
|
|
335
|
-
login:
|
|
336
|
-
openAddCustomEmoji:
|
|
338
|
+
login: se,
|
|
339
|
+
openAddCustomEmoji: ge,
|
|
340
|
+
shareImage: ce,
|
|
337
341
|
shareWebCard: de,
|
|
338
|
-
showAd:
|
|
339
|
-
toBindGameRole:
|
|
340
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
341
|
-
...
|
|
342
|
-
...
|
|
343
|
-
|
|
342
|
+
showAd: ye,
|
|
343
|
+
toBindGameRole: he
|
|
344
|
+
}, Symbol.toStringTag, { value: "Module" })), we = {
|
|
345
|
+
...ue,
|
|
346
|
+
...ae,
|
|
347
|
+
setDebug: H,
|
|
348
|
+
registerNativeHandler: _
|
|
344
349
|
};
|
|
345
350
|
export {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
351
|
+
Se as CUSTOM,
|
|
352
|
+
Ie as JSBridgeSdk,
|
|
353
|
+
Pe as METHOD_NOT_FOUND,
|
|
354
|
+
ve as NETWORK_ERROR,
|
|
355
|
+
be as NOT_LOGGED_IN,
|
|
356
|
+
A as PARAMS_ERROR,
|
|
357
|
+
qe as PERMISSION_DENIED,
|
|
358
|
+
v as SUCCESS,
|
|
359
|
+
S as SYSTEM_EXCEPTION,
|
|
355
360
|
E as ToastDuration,
|
|
356
361
|
u as bridge,
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
362
|
+
re as checkPermission,
|
|
363
|
+
J as chooseMedia,
|
|
364
|
+
ie as closeWebView,
|
|
365
|
+
we as default,
|
|
366
|
+
te as getClipboardData,
|
|
367
|
+
le as getCurrentCircleInfo,
|
|
368
|
+
p as getNetworkType,
|
|
369
|
+
Z as getSystemInfo,
|
|
365
370
|
fe as getToken,
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
371
|
+
F as hideKeyboard,
|
|
372
|
+
se as login,
|
|
373
|
+
W as offCommentPanelChange,
|
|
374
|
+
k as offKeyboardHeightChange,
|
|
375
|
+
G as onCommentPanelChange,
|
|
376
|
+
$ as onKeyboardHeightChange,
|
|
377
|
+
ge as openAddCustomEmoji,
|
|
378
|
+
oe as openInExternalBrowser,
|
|
379
|
+
ne as openPhoneSetting,
|
|
380
|
+
K as previewImage,
|
|
381
|
+
z as previewVideo,
|
|
382
|
+
_ as registerNativeHandler,
|
|
383
|
+
U as saveImageToPhotosAlbum,
|
|
384
|
+
X as saveVideoToPhotosAlbum,
|
|
385
|
+
ee as setClipboardData,
|
|
386
|
+
H as setDebug,
|
|
387
|
+
ce as shareImage,
|
|
382
388
|
de as shareWebCard,
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
389
|
+
ye as showAd,
|
|
390
|
+
x as showToast,
|
|
391
|
+
Y as startRecord,
|
|
392
|
+
Q as stopRecord,
|
|
393
|
+
j as stopVibrate,
|
|
394
|
+
he as toBindGameRole,
|
|
395
|
+
V as triggerVibrate,
|
|
396
|
+
L as uploadFiles
|
|
391
397
|
};
|
package/dist/types/enums.d.ts
CHANGED
|
@@ -38,5 +38,14 @@ export type NetworkTypeStr = "wifi" | "2g" | "3g" | "4g" | "5g" | "unknown" | "n
|
|
|
38
38
|
* - 3: QQ
|
|
39
39
|
*/
|
|
40
40
|
export type ShareChannelType = 1 | 2 | 3;
|
|
41
|
+
/**
|
|
42
|
+
* 图片分享弹窗操作
|
|
43
|
+
* - wechat: 微信好友
|
|
44
|
+
* - moment: 微信朋友圈
|
|
45
|
+
* - qq: QQ 好友
|
|
46
|
+
* - save: 保存图片
|
|
47
|
+
* - cancel: 取消
|
|
48
|
+
*/
|
|
49
|
+
export type ShareImageAction = "wechat" | "moment" | "qq" | "save" | "cancel";
|
|
41
50
|
/** 文件类型标签 */
|
|
42
51
|
export type FileTypeTag = "image" | "video";
|
package/dist/types/params.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Callbacks } from './base';
|
|
2
2
|
import { MediaFileType, SettingType, CameraDirection, ShareChannelType, PermissionType, PreviewMediaType, ToastDuration } from './enums';
|
|
3
|
-
import { ChooseMediaResult, CheckPermissionResult, UploadFilesProgress, UploadFilesResult } from './results';
|
|
3
|
+
import { ChooseMediaResult, CheckPermissionResult, ShareImageResult, UploadFilesProgress, UploadFilesResult } from './results';
|
|
4
4
|
/**
|
|
5
5
|
* 事件监听选项。
|
|
6
6
|
*
|
|
@@ -195,6 +195,20 @@ export interface ShareWebCardParams extends Callbacks {
|
|
|
195
195
|
/** 内容类型 */
|
|
196
196
|
contentType?: string;
|
|
197
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* shareImage 参数
|
|
200
|
+
*
|
|
201
|
+
* 唤起客户端图片分享弹窗
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```ts
|
|
205
|
+
* mys.shareImage({ url: 'https://example.com/poster.png' })
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
export interface ShareImageParams extends Callbacks<ShareImageResult> {
|
|
209
|
+
/** 待分享图片的网络地址,需为 http(s) URL */
|
|
210
|
+
url: string;
|
|
211
|
+
}
|
|
198
212
|
/**
|
|
199
213
|
* showAd 参数
|
|
200
214
|
*
|
package/dist/types/results.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Platform, NetworkTypeStr, PermissionStatus, PermissionType } from './enums';
|
|
1
|
+
import { Platform, NetworkTypeStr, PermissionStatus, PermissionType, ShareImageAction } from './enums';
|
|
2
2
|
/** chooseMedia 返回值 */
|
|
3
3
|
export interface ChooseMediaResult {
|
|
4
4
|
/** 本地临时媒体文件列表 */
|
|
@@ -133,6 +133,11 @@ export interface GetTokenResult {
|
|
|
133
133
|
/** 登录 Token */
|
|
134
134
|
readonly token: string;
|
|
135
135
|
}
|
|
136
|
+
/** shareImage 返回值 */
|
|
137
|
+
export interface ShareImageResult {
|
|
138
|
+
/** 用户在分享弹窗中点击的操作 */
|
|
139
|
+
readonly action: ShareImageAction;
|
|
140
|
+
}
|
|
136
141
|
/** getCurrentCircleInfo 返回值 */
|
|
137
142
|
export interface GetCircleInfoResult {
|
|
138
143
|
/** 服务器 ID */
|