crh-jssdk 0.10.33 → 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 pinurl = url.includes('?') ? url + '&timestamp=' + timestamp : url + '?timestamp=' + timestamp;
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, "&timestamp=").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
  }
@@ -306,9 +311,9 @@ exports.default = {
306
311
  });
307
312
  },
308
313
  /**
309
- * 下载pdf文件
314
+ * 在app内打开pdf文件
310
315
  */
311
- downloadPDFFile: function (url, title) {
316
+ openPDFFile: function (url, title) {
312
317
  return __awaiter(this, void 0, void 0, function () {
313
318
  var typeList, type, params;
314
319
  return __generator(this, function (_a) {
@@ -317,8 +322,8 @@ exports.default = {
317
322
  type = "PDF";
318
323
  params = {
319
324
  url: url,
320
- // filetype: type,
321
- // title: title,
325
+ filetype: type,
326
+ title: title,
322
327
  pdfFileName: title
323
328
  };
324
329
  console.log("HXDownloadFile", params);
@@ -331,6 +336,26 @@ exports.default = {
331
336
  });
332
337
  });
333
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
+ },
334
359
  /**
335
360
  * 获取Bridge实例(供其他模块使用)
336
361
  */
@@ -318,12 +318,19 @@ var BUSINESS = /** @class */ (function () {
318
318
  }
319
319
  return this.sdkObj.followOfficialAccount(appid);
320
320
  };
321
- //下载pdf文件
322
- BUSINESS.prototype.downloadPDFFile = function (url, title) {
323
- if (!this.sdkObj.downloadPDFFile) {
324
- return (0, utils_1.empty)("downloadPDFFile");
321
+ //在app内打开pdf文件
322
+ BUSINESS.prototype.openPDFFile = function (url, title) {
323
+ if (!this.sdkObj.openPDFFile) {
324
+ return (0, utils_1.empty)("openPDFFile");
325
325
  }
326
- return this.sdkObj.downloadPDFFile(url, title);
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);
327
334
  };
328
335
  return BUSINESS;
329
336
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crh-jssdk",
3
- "version": "0.10.33",
3
+ "version": "0.10.34",
4
4
  "description": "crh-jssdk",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {