crh-jssdk 0.10.32 → 0.10.34
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.
|
@@ -130,7 +130,12 @@ exports.default = {
|
|
|
130
130
|
*/
|
|
131
131
|
goWebview: function (url) {
|
|
132
132
|
var timestamp = new Date().getTime();
|
|
133
|
-
var
|
|
133
|
+
var safeUrl = typeof url === "string" ? url : "".concat(url || "");
|
|
134
|
+
// 低版本 iOS WebView 不支持 String.prototype.includes,这里使用 indexOf 判定
|
|
135
|
+
var pinurl = safeUrl.indexOf("?") > -1
|
|
136
|
+
? "".concat(safeUrl, "×tamp=").concat(timestamp)
|
|
137
|
+
: "".concat(safeUrl, "?timestamp=").concat(timestamp);
|
|
138
|
+
console.log('pinurl', pinurl);
|
|
134
139
|
if (utils_1.ios) {
|
|
135
140
|
location.href = "client://hxsecurity.frame.router/browser?url=".concat(encodeURIComponent(pinurl), "&rp_flag_push_to_stack_directly=true&rp_flag_back_to_last_tab=true&rp_flag_finish_when_back_to_last_tab=true&hideNavBar=1&isHiddenNavigationBar=1");
|
|
136
141
|
}
|
|
@@ -305,6 +310,52 @@ exports.default = {
|
|
|
305
310
|
});
|
|
306
311
|
});
|
|
307
312
|
},
|
|
313
|
+
/**
|
|
314
|
+
* 在app内打开pdf文件
|
|
315
|
+
*/
|
|
316
|
+
openPDFFile: function (url, title) {
|
|
317
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
318
|
+
var typeList, type, params;
|
|
319
|
+
return __generator(this, function (_a) {
|
|
320
|
+
console.log("HXDownloadFile title", title);
|
|
321
|
+
typeList = url.split(".");
|
|
322
|
+
type = "PDF";
|
|
323
|
+
params = {
|
|
324
|
+
url: url,
|
|
325
|
+
filetype: type,
|
|
326
|
+
title: title,
|
|
327
|
+
pdfFileName: title
|
|
328
|
+
};
|
|
329
|
+
console.log("HXDownloadFile", params);
|
|
330
|
+
utils_1.globalBridge.bridgeCallHandler("Promise", "HXDownloadFile", params).then(function () {
|
|
331
|
+
console.log("HXDownloadFile success");
|
|
332
|
+
}).catch(function (err) {
|
|
333
|
+
console.error("HXDownloadFile error", err);
|
|
334
|
+
});
|
|
335
|
+
return [2 /*return*/];
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
},
|
|
339
|
+
/**
|
|
340
|
+
* 在app内打开浏览器
|
|
341
|
+
* @param url 浏览器地址
|
|
342
|
+
*/
|
|
343
|
+
doOpenBrowser: function (url) {
|
|
344
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
345
|
+
return __generator(this, function (_a) {
|
|
346
|
+
console.log("要调用doOpenBrowser了", url);
|
|
347
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
348
|
+
utils_1.globalBridge.bridgeCallHandler("Promise", "doOpenBrowser", { url: url }).then(function () {
|
|
349
|
+
console.log("doOpenBrowser---resolve");
|
|
350
|
+
resolve(void 0);
|
|
351
|
+
}).catch(function (err) {
|
|
352
|
+
console.log(err, "doOpenBrowser---reject");
|
|
353
|
+
reject(err);
|
|
354
|
+
});
|
|
355
|
+
})];
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
},
|
|
308
359
|
/**
|
|
309
360
|
* 获取Bridge实例(供其他模块使用)
|
|
310
361
|
*/
|
package/dist/business/index.js
CHANGED
|
@@ -318,6 +318,20 @@ var BUSINESS = /** @class */ (function () {
|
|
|
318
318
|
}
|
|
319
319
|
return this.sdkObj.followOfficialAccount(appid);
|
|
320
320
|
};
|
|
321
|
+
//在app内打开pdf文件
|
|
322
|
+
BUSINESS.prototype.openPDFFile = function (url, title) {
|
|
323
|
+
if (!this.sdkObj.openPDFFile) {
|
|
324
|
+
return (0, utils_1.empty)("openPDFFile");
|
|
325
|
+
}
|
|
326
|
+
return this.sdkObj.openPDFFile(url, title);
|
|
327
|
+
};
|
|
328
|
+
//在app内打开浏览器
|
|
329
|
+
BUSINESS.prototype.doOpenBrowser = function (url) {
|
|
330
|
+
if (!this.sdkObj.doOpenBrowser) {
|
|
331
|
+
return (0, utils_1.empty)("doOpenBrowser");
|
|
332
|
+
}
|
|
333
|
+
return this.sdkObj.doOpenBrowser(url);
|
|
334
|
+
};
|
|
321
335
|
return BUSINESS;
|
|
322
336
|
}());
|
|
323
337
|
exports.default = BUSINESS;
|