syttunnel 0.1.5-1 → 0.1.5-6
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/core/basic/appCommon.d.ts +15 -0
- package/core/basic/appNavigator.d.ts +5 -0
- package/core/basic/appPay.d.ts +5 -2
- package/core/basic/appUser.d.ts +23 -0
- package/core/basic/bridge.d.ts +12 -10
- package/core/basic/eventsName.d.ts +1 -1
- package/core/extension/appPay.d.ts +9 -2
- package/core/extension/appUser.d.ts +0 -23
- package/core/extension/eventsName.d.ts +1 -1
- package/package.json +1 -1
- package/syttunnel.js +200 -77
|
@@ -63,6 +63,12 @@ interface ISaveImageToLocalResponse {
|
|
|
63
63
|
errCode?: string;
|
|
64
64
|
errMessage?: string;
|
|
65
65
|
}
|
|
66
|
+
export interface ISFAddressParams {
|
|
67
|
+
encryptKey: string;
|
|
68
|
+
}
|
|
69
|
+
interface IPasteStringParams {
|
|
70
|
+
content: string;
|
|
71
|
+
}
|
|
66
72
|
export declare class AppCommon {
|
|
67
73
|
openScan(params: IOpenCodeScanParams): Promise<string>;
|
|
68
74
|
shareMsgToWXAPI(params: IShareMsgToWXParams): Promise<IShareMsgToWXResponse>;
|
|
@@ -71,5 +77,14 @@ export declare class AppCommon {
|
|
|
71
77
|
onSelectContacts(): Promise<IOnSelectContactResponse>;
|
|
72
78
|
onSaveImageToLocal(params: ISaveImageToLocalParams): Promise<ISaveImageToLocalResponse>;
|
|
73
79
|
getEnvironment(): Promise<string>;
|
|
80
|
+
/**
|
|
81
|
+
* 获取顺丰地址列表
|
|
82
|
+
* @returns 返回为json string加密的字符串,需密钥解密
|
|
83
|
+
*/
|
|
84
|
+
getSFAddress(params: ISFAddressParams): Promise<string>;
|
|
85
|
+
/**
|
|
86
|
+
* 复制字符串
|
|
87
|
+
*/
|
|
88
|
+
pasteString(params: IPasteStringParams): Promise<boolean>;
|
|
74
89
|
}
|
|
75
90
|
export {};
|
package/core/basic/appPay.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ interface IPayByWeChatParams {
|
|
|
9
9
|
interface IPayByAliParams {
|
|
10
10
|
orderStr: string;
|
|
11
11
|
}
|
|
12
|
+
export interface INativePayResult {
|
|
13
|
+
result: IPayResult;
|
|
14
|
+
}
|
|
12
15
|
export interface IPayResult {
|
|
13
16
|
channelType: string;
|
|
14
17
|
status: string | number;
|
|
@@ -16,7 +19,7 @@ export interface IPayResult {
|
|
|
16
19
|
channelResult: object;
|
|
17
20
|
}
|
|
18
21
|
export declare class AppPay {
|
|
19
|
-
payByWeChat(params: IPayByWeChatParams): Promise<
|
|
20
|
-
payByAli(params: IPayByAliParams): Promise<
|
|
22
|
+
payByWeChat(params: IPayByWeChatParams): Promise<INativePayResult>;
|
|
23
|
+
payByAli(params: IPayByAliParams): Promise<INativePayResult>;
|
|
21
24
|
}
|
|
22
25
|
export {};
|
package/core/basic/appUser.d.ts
CHANGED
|
@@ -12,6 +12,17 @@ export interface IGetUserInfoParams {
|
|
|
12
12
|
needLogin?: boolean;
|
|
13
13
|
domain?: string;
|
|
14
14
|
}
|
|
15
|
+
export interface IGetUserBaseInfoParams {
|
|
16
|
+
needLogin?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface IGetUserBaseInfoResponse {
|
|
19
|
+
nickName?: string;
|
|
20
|
+
birthday?: string;
|
|
21
|
+
sex?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface IGetUserAvatarParams {
|
|
24
|
+
needLogin?: boolean;
|
|
25
|
+
}
|
|
15
26
|
export declare class AppUser {
|
|
16
27
|
/**
|
|
17
28
|
* 调用OAuth2.0 授权接口
|
|
@@ -25,4 +36,16 @@ export declare class AppUser {
|
|
|
25
36
|
* @returns
|
|
26
37
|
*/
|
|
27
38
|
getUserInfo(params: IGetUserInfoParams): Promise<string>;
|
|
39
|
+
/**
|
|
40
|
+
* 获取用户基本信息
|
|
41
|
+
* @param params
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
getUserBaseInfo(params: IGetUserBaseInfoParams): Promise<IGetUserBaseInfoResponse>;
|
|
45
|
+
/**
|
|
46
|
+
* 获取用户头像
|
|
47
|
+
* @param params
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
getUserAvatar(params: IGetUserAvatarParams): Promise<string>;
|
|
28
51
|
}
|
package/core/basic/bridge.d.ts
CHANGED
|
@@ -10,19 +10,21 @@ export interface IRequestCompletion<T> {
|
|
|
10
10
|
success?: (res: T) => void;
|
|
11
11
|
failure?: (err: IError) => void;
|
|
12
12
|
}
|
|
13
|
-
declare
|
|
14
|
-
success?: (res: any) => void;
|
|
15
|
-
failure?: (err: IError) => void;
|
|
16
|
-
uId: string;
|
|
17
|
-
constructor(uId: string, suc?: (res: any) => void, fal?: (err: IError) => void);
|
|
18
|
-
}
|
|
13
|
+
declare type SubscribeEventFunction = (params?: any, callback?: (data: any) => void) => void;
|
|
19
14
|
declare class Bridge {
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
messageHandlers: {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
subscribers: {
|
|
19
|
+
[key: string]: SubscribeEventFunction[];
|
|
20
|
+
};
|
|
21
|
+
uniqueId: number;
|
|
22
22
|
constructor();
|
|
23
|
-
|
|
24
|
-
postMessage<T>(params: IPostParams)
|
|
23
|
+
onMessage: (msg: any) => void;
|
|
24
|
+
postMessage: <T>(params: IPostParams) => Promise<T>;
|
|
25
25
|
private dealPostMessage;
|
|
26
|
+
subscribeEvent: (handlerName: string, handler: any) => void;
|
|
27
|
+
unsubscribeEvent: (handlerName: string, handler: any) => void;
|
|
26
28
|
}
|
|
27
29
|
declare const bridge: Bridge;
|
|
28
30
|
export default bridge;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 基本的调用事件
|
|
3
3
|
*/
|
|
4
4
|
import { IPostParams } from "./bridge";
|
|
5
|
-
export declare type CommonEvents = "getUserInfo" | "sytFetch" | "authorize" | "backToBefore" | "setTitle" | "setStyle" | "getNavigationFrame" | "loadUrl" | "payByWeChat" | "payByAli" | "startScanCode" | "shareMessageToWXReq" | "currentLocation" | "appVersion" | "selectContacts" | "saveImageToLocal" | "getEnvironment" | "goBack";
|
|
5
|
+
export declare type CommonEvents = "getUserInfo" | "getUserAvatar" | "getUserBaseInfo" | "sytFetch" | "authorize" | "backToBefore" | "setTitle" | "setStyle" | "getNavigationFrame" | "loadUrl" | "payByWeChat" | "payByAli" | "startScanCode" | "shareMessageToWXReq" | "currentLocation" | "appVersion" | "selectContacts" | "saveImageToLocal" | "getEnvironment" | "goBack" | "selectAddress" | "pasteString";
|
|
6
6
|
export interface IPostBasicParams extends IPostParams {
|
|
7
7
|
method: CommonEvents;
|
|
8
8
|
}
|
|
@@ -33,8 +33,11 @@ interface IWxAutoPaySignResponse {
|
|
|
33
33
|
interface IOnDigiCnyPayResultParams {
|
|
34
34
|
status: 0 | 1 | 2 | 3;
|
|
35
35
|
}
|
|
36
|
-
interface
|
|
37
|
-
|
|
36
|
+
interface IPayByWXMiniProgram {
|
|
37
|
+
payToken: string;
|
|
38
|
+
}
|
|
39
|
+
export interface IPayByWXMiniProgramResult {
|
|
40
|
+
result: boolean;
|
|
38
41
|
}
|
|
39
42
|
declare class PayParams {
|
|
40
43
|
amt: string;
|
|
@@ -56,11 +59,15 @@ interface IPayResponse {
|
|
|
56
59
|
result: IPayResult;
|
|
57
60
|
payParams?: PayParams;
|
|
58
61
|
}
|
|
62
|
+
interface IPayWaybillByPayIdParams {
|
|
63
|
+
payId: string;
|
|
64
|
+
}
|
|
59
65
|
export declare class SFAppPay extends AppPay {
|
|
60
66
|
payBySVIP(params: IPayBySVIPParams): Promise<IPayResponse>;
|
|
61
67
|
payBySDK(params: IPayBySDKParams): Promise<IPayResult>;
|
|
62
68
|
wxAutoPaySignReq(params: IWxAutoPaySignParams): Promise<IWxAutoPaySignResponse>;
|
|
63
69
|
onDigiCnyPayResult(params: IOnDigiCnyPayResultParams): void;
|
|
64
70
|
payWaybillByPayId(params: IPayWaybillByPayIdParams): void;
|
|
71
|
+
payByWXMiniProgram(params: IPayByWXMiniProgram): Promise<IPayByWXMiniProgramResult>;
|
|
65
72
|
}
|
|
66
73
|
export {};
|
|
@@ -1,26 +1,3 @@
|
|
|
1
1
|
import { AppUser } from "../basic/appUser";
|
|
2
|
-
export interface IGetUserBaseInfoParams {
|
|
3
|
-
needLogin?: boolean;
|
|
4
|
-
}
|
|
5
|
-
export interface IGetUserBaseInfoResponse {
|
|
6
|
-
nickName?: string;
|
|
7
|
-
birthday?: string;
|
|
8
|
-
sex?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface IGetUserAvatarParams {
|
|
11
|
-
needLogin?: boolean;
|
|
12
|
-
}
|
|
13
2
|
export declare class SFAppUser extends AppUser {
|
|
14
|
-
/**
|
|
15
|
-
* 获取用户基本信息
|
|
16
|
-
* @param params
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
|
-
getUserBaseInfo(params: IGetUserBaseInfoParams): Promise<IGetUserBaseInfoResponse>;
|
|
20
|
-
/**
|
|
21
|
-
* 获取用户头像
|
|
22
|
-
* @param params
|
|
23
|
-
* @returns
|
|
24
|
-
*/
|
|
25
|
-
getUserAvatar(params: IGetUserAvatarParams): Promise<string>;
|
|
26
3
|
}
|
|
@@ -3,7 +3,7 @@ import { CommonEvents } from "../basic/eventsName";
|
|
|
3
3
|
/**
|
|
4
4
|
* 顺丰内部使用的事件
|
|
5
5
|
*/
|
|
6
|
-
export declare type SFEvents = CommonEvents | "
|
|
6
|
+
export declare type SFEvents = CommonEvents | "payBySVIP" | "payBySDK" | "wxAutoPaySignReq" | "payWaybillByPayId" | "digiCnyPayResult" | "startGetIMEICode" | "getReducerData" | "getDeviceId" | "syncCookie" | "getPushAuthStatus" | "setStateToPush" | "setStateToPushNoTimeLimit" | "getLocalWebSource" | "navigate" | "setCanBack" | "payByWXMiniProgram";
|
|
7
7
|
export interface IPostSFParams extends IPostParams {
|
|
8
8
|
method: SFEvents;
|
|
9
9
|
}
|
package/package.json
CHANGED
package/syttunnel.js
CHANGED
|
@@ -358,14 +358,14 @@ var sytFetch = function (config) {
|
|
|
358
358
|
};
|
|
359
359
|
var appFunc = {
|
|
360
360
|
method: "sytFetch",
|
|
361
|
-
params:
|
|
361
|
+
params: request,
|
|
362
362
|
};
|
|
363
363
|
return new Promise(function (resolve, reject) {
|
|
364
364
|
bridge_1.default
|
|
365
365
|
.postMessage(appFunc)
|
|
366
366
|
.then(function (result) {
|
|
367
367
|
var resData = result.data;
|
|
368
|
-
if (!
|
|
368
|
+
if (!resData) {
|
|
369
369
|
reject({
|
|
370
370
|
errCode: "-1",
|
|
371
371
|
errMessage: "没有返回data数据",
|
|
@@ -402,94 +402,156 @@ exports.sytFetch = sytFetch;
|
|
|
402
402
|
|
|
403
403
|
/***/ }),
|
|
404
404
|
/* 6 */
|
|
405
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__)
|
|
405
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
406
406
|
|
|
407
407
|
|
|
408
|
+
var __assign = (this && this.__assign) || function () {
|
|
409
|
+
__assign = Object.assign || function(t) {
|
|
410
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
411
|
+
s = arguments[i];
|
|
412
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
413
|
+
t[p] = s[p];
|
|
414
|
+
}
|
|
415
|
+
return t;
|
|
416
|
+
};
|
|
417
|
+
return __assign.apply(this, arguments);
|
|
418
|
+
};
|
|
408
419
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
409
420
|
var tools_1 = __webpack_require__(7);
|
|
410
|
-
var
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}());
|
|
421
|
+
var EventType;
|
|
422
|
+
(function (EventType) {
|
|
423
|
+
EventType["CALL"] = "call";
|
|
424
|
+
EventType["REGISTER"] = "register";
|
|
425
|
+
EventType["UNREGISTER"] = "unregister";
|
|
426
|
+
EventType["CALLBACK"] = "callback";
|
|
427
|
+
})(EventType || (EventType = {}));
|
|
418
428
|
var Bridge = /** @class */ (function () {
|
|
419
429
|
function Bridge() {
|
|
430
|
+
var _this = this;
|
|
431
|
+
this.onMessage = function (msg) {
|
|
432
|
+
var message = typeof msg.data === "string"
|
|
433
|
+
? JSON.parse(msg.data || "")
|
|
434
|
+
: msg.data || {};
|
|
435
|
+
var method = message.method;
|
|
436
|
+
var value = message.value;
|
|
437
|
+
var uniqueId = message.uniqueId;
|
|
438
|
+
var errCode = message.errCode;
|
|
439
|
+
var errMessage = message.errMessage;
|
|
440
|
+
var callbackId = message.callbackId;
|
|
441
|
+
if (!method) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
if (uniqueId) {
|
|
445
|
+
// js call native callback
|
|
446
|
+
var callback_1 = _this.messageHandlers[uniqueId];
|
|
447
|
+
if (callback_1) {
|
|
448
|
+
// 成功的回调
|
|
449
|
+
if (value != null && value != undefined) {
|
|
450
|
+
callback_1(null, value);
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
var error = {
|
|
454
|
+
errCode: errCode,
|
|
455
|
+
errMessage: errMessage,
|
|
456
|
+
};
|
|
457
|
+
callback_1(error, null);
|
|
458
|
+
}
|
|
459
|
+
delete _this.messageHandlers[uniqueId];
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
// native call js
|
|
464
|
+
if (!method) {
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
var callback;
|
|
468
|
+
if (callbackId) {
|
|
469
|
+
callback = function (response) {
|
|
470
|
+
_this.dealPostMessage({
|
|
471
|
+
responseId: callbackId,
|
|
472
|
+
method: method,
|
|
473
|
+
params: {
|
|
474
|
+
result: response,
|
|
475
|
+
},
|
|
476
|
+
type: EventType.CALLBACK,
|
|
477
|
+
});
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
var subscribers = _this.subscribers[method];
|
|
481
|
+
if (subscribers && subscribers.length > 0) {
|
|
482
|
+
subscribers.forEach(function (handler) {
|
|
483
|
+
handler(value, callback);
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
this.postMessage = function (params) {
|
|
489
|
+
return new Promise(function (resolve, reject) {
|
|
490
|
+
_this.dealPostMessage(__assign({ type: EventType.CALL }, params), function (error, result) {
|
|
491
|
+
if (error) {
|
|
492
|
+
reject(error);
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
if (result !== null && result !== undefined) {
|
|
496
|
+
resolve(result);
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
reject(new Error("返回的数据错误"));
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
};
|
|
505
|
+
this.dealPostMessage = function (params, callback) {
|
|
506
|
+
if (window.ReactNativeWebView) {
|
|
507
|
+
var postParams = params;
|
|
508
|
+
if (callback) {
|
|
509
|
+
var uniqueId = "cb_" + (_this.uniqueId++).toString() + Date.now().toString();
|
|
510
|
+
_this.messageHandlers[uniqueId] = callback;
|
|
511
|
+
postParams.uniqueId = uniqueId;
|
|
512
|
+
}
|
|
513
|
+
window.ReactNativeWebView.postMessage(JSON.stringify(postParams));
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
// 注册方法
|
|
517
|
+
this.subscribeEvent = function (handlerName, handler) {
|
|
518
|
+
var subscribers = _this.subscribers[handlerName] || [];
|
|
519
|
+
subscribers.push(handler);
|
|
520
|
+
_this.subscribers[handlerName] = subscribers;
|
|
521
|
+
// 监听者数量大于1,发送注册事件,通知native
|
|
522
|
+
if (subscribers.length > 0) {
|
|
523
|
+
_this.dealPostMessage({
|
|
524
|
+
method: handlerName,
|
|
525
|
+
type: EventType.REGISTER,
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
// 移除注册方法
|
|
530
|
+
this.unsubscribeEvent = function (handlerName, handler) {
|
|
531
|
+
var subscribers = _this.subscribers[handlerName];
|
|
532
|
+
var index = subscribers.indexOf(handler);
|
|
533
|
+
if (index > -1) {
|
|
534
|
+
subscribers.splice(index, 1);
|
|
535
|
+
_this.subscribers[handlerName] = subscribers;
|
|
536
|
+
}
|
|
537
|
+
if (subscribers.length <= 0) {
|
|
538
|
+
// 监听者数量小于等于0,发送移除注册事件,通知native
|
|
539
|
+
_this.dealPostMessage({
|
|
540
|
+
method: handlerName,
|
|
541
|
+
type: EventType.UNREGISTER,
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
};
|
|
420
545
|
if (tools_1.isSfAppIOS()) {
|
|
421
546
|
window.addEventListener("message", this.onMessage);
|
|
422
547
|
}
|
|
423
548
|
else if (tools_1.isSfAppAndroid()) {
|
|
424
549
|
document.addEventListener("message", this.onMessage);
|
|
425
550
|
}
|
|
426
|
-
this.
|
|
551
|
+
this.messageHandlers = {};
|
|
552
|
+
this.subscribers = {};
|
|
553
|
+
this.uniqueId = 0;
|
|
427
554
|
}
|
|
428
|
-
Bridge.prototype.onMessage = function (msg) {
|
|
429
|
-
var message = typeof msg.data === "string"
|
|
430
|
-
? JSON.parse(msg.data || "")
|
|
431
|
-
: msg.data || {};
|
|
432
|
-
var method = message.method;
|
|
433
|
-
var value = message.value;
|
|
434
|
-
var uniqueId = message.uniqueId;
|
|
435
|
-
var errCode = message.errCode;
|
|
436
|
-
var errMessage = message.errMessage;
|
|
437
|
-
if (!method || !uniqueId) {
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
var obj = Bridge.cbArr.find(function (item) { return item.uId === uniqueId; });
|
|
441
|
-
var success = obj === null || obj === void 0 ? void 0 : obj.success;
|
|
442
|
-
var failure = obj === null || obj === void 0 ? void 0 : obj.failure;
|
|
443
|
-
if ((errCode || errMessage) && failure) {
|
|
444
|
-
var error = {
|
|
445
|
-
errCode: errCode,
|
|
446
|
-
errMessage: errMessage,
|
|
447
|
-
};
|
|
448
|
-
failure(error);
|
|
449
|
-
var delIndex_1 = Bridge.cbArr.findIndex(function (item) { return item.uId === uniqueId; });
|
|
450
|
-
if (delIndex_1 > -1) {
|
|
451
|
-
Bridge.cbArr.splice(delIndex_1, 1);
|
|
452
|
-
}
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
if (value != null && success) {
|
|
456
|
-
success(value);
|
|
457
|
-
}
|
|
458
|
-
var delIndex = Bridge.cbArr.findIndex(function (item) { return item.uId === uniqueId; });
|
|
459
|
-
if (delIndex > -1) {
|
|
460
|
-
Bridge.cbArr.splice(delIndex, 1);
|
|
461
|
-
}
|
|
462
|
-
};
|
|
463
|
-
Bridge.prototype.postMessage = function (params) {
|
|
464
|
-
return new Promise(function (resolve, reject) {
|
|
465
|
-
bridge.dealPostMessage(params, function (result) {
|
|
466
|
-
if (result !== null && result !== undefined) {
|
|
467
|
-
resolve(result);
|
|
468
|
-
}
|
|
469
|
-
else {
|
|
470
|
-
reject(new Error("返回的数据错误"));
|
|
471
|
-
}
|
|
472
|
-
}, function (err) {
|
|
473
|
-
reject(err);
|
|
474
|
-
});
|
|
475
|
-
});
|
|
476
|
-
};
|
|
477
|
-
Bridge.prototype.dealPostMessage = function (params, success, failure) {
|
|
478
|
-
if (window.ReactNativeWebView) {
|
|
479
|
-
var uniqueId = params.method + Bridge.funCallCount.toString() + Date.now().toString();
|
|
480
|
-
var funcCbObj = new FuncCallBack(uniqueId, success, failure);
|
|
481
|
-
Bridge.cbArr.push(funcCbObj);
|
|
482
|
-
Bridge.funCallCount++;
|
|
483
|
-
var postParams = {
|
|
484
|
-
method: params.method,
|
|
485
|
-
params: params.params,
|
|
486
|
-
uniqueId: uniqueId,
|
|
487
|
-
};
|
|
488
|
-
window.ReactNativeWebView.postMessage(JSON.stringify(postParams));
|
|
489
|
-
}
|
|
490
|
-
};
|
|
491
|
-
Bridge.cbArr = [];
|
|
492
|
-
Bridge.funCallCount = 0;
|
|
493
555
|
return Bridge;
|
|
494
556
|
}());
|
|
495
557
|
var bridge = new Bridge();
|
|
@@ -665,6 +727,27 @@ var AppCommon = /** @class */ (function () {
|
|
|
665
727
|
};
|
|
666
728
|
return bridge_1.default.postMessage(appFunc);
|
|
667
729
|
};
|
|
730
|
+
/**
|
|
731
|
+
* 获取顺丰地址列表
|
|
732
|
+
* @returns 返回为json string加密的字符串,需密钥解密
|
|
733
|
+
*/
|
|
734
|
+
AppCommon.prototype.getSFAddress = function (params) {
|
|
735
|
+
var appFunc = {
|
|
736
|
+
method: "selectAddress",
|
|
737
|
+
params: params,
|
|
738
|
+
};
|
|
739
|
+
return bridge_1.default.postMessage(appFunc);
|
|
740
|
+
};
|
|
741
|
+
/**
|
|
742
|
+
* 复制字符串
|
|
743
|
+
*/
|
|
744
|
+
AppCommon.prototype.pasteString = function (params) {
|
|
745
|
+
var appFunc = {
|
|
746
|
+
method: "pasteString",
|
|
747
|
+
params: params,
|
|
748
|
+
};
|
|
749
|
+
return bridge_1.default.postMessage(appFunc);
|
|
750
|
+
};
|
|
668
751
|
return AppCommon;
|
|
669
752
|
}());
|
|
670
753
|
exports.AppCommon = AppCommon;
|
|
@@ -741,6 +824,16 @@ var AppNavigator = /** @class */ (function () {
|
|
|
741
824
|
};
|
|
742
825
|
bridge_1.default.postMessage(appFunc).then().catch();
|
|
743
826
|
};
|
|
827
|
+
/**
|
|
828
|
+
* 监听返回事件
|
|
829
|
+
* @param callback
|
|
830
|
+
*/
|
|
831
|
+
AppNavigator.prototype.onBackPressedListener = function (callback) {
|
|
832
|
+
bridge_1.default.subscribeEvent("onBackPressed", function (params, responseCallback) {
|
|
833
|
+
var res = callback(params);
|
|
834
|
+
responseCallback(res);
|
|
835
|
+
});
|
|
836
|
+
};
|
|
744
837
|
return AppNavigator;
|
|
745
838
|
}());
|
|
746
839
|
exports.AppNavigator = AppNavigator;
|
|
@@ -821,6 +914,36 @@ var AppUser = /** @class */ (function () {
|
|
|
821
914
|
};
|
|
822
915
|
return bridge_1.default.postMessage(appFunc);
|
|
823
916
|
};
|
|
917
|
+
/**
|
|
918
|
+
* 获取用户基本信息
|
|
919
|
+
* @param params
|
|
920
|
+
* @returns
|
|
921
|
+
*/
|
|
922
|
+
AppUser.prototype.getUserBaseInfo = function (params) {
|
|
923
|
+
var data = {
|
|
924
|
+
needLogin: params.needLogin || true,
|
|
925
|
+
};
|
|
926
|
+
var appFunc = {
|
|
927
|
+
method: "getUserBaseInfo",
|
|
928
|
+
params: data,
|
|
929
|
+
};
|
|
930
|
+
return bridge_1.default.postMessage(appFunc);
|
|
931
|
+
};
|
|
932
|
+
/**
|
|
933
|
+
* 获取用户头像
|
|
934
|
+
* @param params
|
|
935
|
+
* @returns
|
|
936
|
+
*/
|
|
937
|
+
AppUser.prototype.getUserAvatar = function (params) {
|
|
938
|
+
var data = {
|
|
939
|
+
needLogin: params.needLogin || true,
|
|
940
|
+
};
|
|
941
|
+
var appFunc = {
|
|
942
|
+
method: "getUserAvatar",
|
|
943
|
+
params: data,
|
|
944
|
+
};
|
|
945
|
+
return bridge_1.default.postMessage(appFunc);
|
|
946
|
+
};
|
|
824
947
|
return AppUser;
|
|
825
948
|
}());
|
|
826
949
|
exports.AppUser = AppUser;
|