crh-jssdk 1.0.21 → 1.0.23
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.
|
@@ -153,11 +153,14 @@ exports.default = {
|
|
|
153
153
|
_c.label = 4;
|
|
154
154
|
case 4: return [2 /*return*/];
|
|
155
155
|
case 5:
|
|
156
|
+
console.log('---ios');
|
|
156
157
|
if (!utils_1.ios) return [3 /*break*/, 6];
|
|
157
158
|
window.location.href = "client://hxsecurity.frame.router/5032?url=".concat(url, "&rp_flag_push_to_stack_directly=1&isHiddenNavigationBar=1&isHiddenBottomBar=1&isNeedWtLogin=1");
|
|
158
159
|
return [2 /*return*/];
|
|
159
160
|
case 6:
|
|
160
161
|
gotoUrl = "client.html?action=ymtz^webid=9995^url=".concat(url, "^isHiddenNavigationBar=").concat(needTitle ? 1 : 0, "^isHiddenBottomBar=1^isNeedWtLogin=1");
|
|
162
|
+
console.log("gotoUrl", gotoUrl);
|
|
163
|
+
console.log('gotoUrl----11', "client.html?action=ymtz^webid=9995^url=".concat(encodeURIComponent(url), "^isHiddenNavigationBar=").concat(needTitle ? 1 : 0, "^isHiddenBottomBar=1^isNeedWtLogin=1"));
|
|
161
164
|
return [4 /*yield*/, utils_1.jyBridge.bridgeCallHandler("Promise", "gotoNextPage", {
|
|
162
165
|
url: gotoUrl,
|
|
163
166
|
})];
|
|
@@ -260,6 +260,8 @@ var Bridge = /** @class */ (function () {
|
|
|
260
260
|
this.bridge = null;
|
|
261
261
|
this.initPromise = null;
|
|
262
262
|
this.isConnecting = false; // 标记是否正在连接,避免重复添加监听器
|
|
263
|
+
// 标记bridge.init是否已调用,避免在iOS环境下重复初始化导致"init called twice"错误
|
|
264
|
+
this._bridgeInitCalled = false;
|
|
263
265
|
this.initPromise = this.init();
|
|
264
266
|
}
|
|
265
267
|
/**
|
|
@@ -270,16 +272,18 @@ var Bridge = /** @class */ (function () {
|
|
|
270
272
|
return new Promise(function (resolve) {
|
|
271
273
|
_this.connectWebViewJavascriptBridge(function (bridge) {
|
|
272
274
|
_this.bridge = bridge;
|
|
273
|
-
// 确保bridge.init
|
|
274
|
-
|
|
275
|
+
// 确保bridge.init存在且是函数,且未初始化过
|
|
276
|
+
// 在iOS环境下,App原生可能已经调用过bridge.init(),再次调用会报错"init called twice"
|
|
277
|
+
if (bridge && typeof bridge.init === 'function' && !_this._bridgeInitCalled) {
|
|
275
278
|
bridge.init(function () {
|
|
276
279
|
console.log('Bridge初始化完成');
|
|
277
280
|
resolve();
|
|
278
281
|
});
|
|
282
|
+
_this._bridgeInitCalled = true;
|
|
279
283
|
}
|
|
280
284
|
else {
|
|
281
|
-
// 如果bridge
|
|
282
|
-
console.log('Bridge
|
|
285
|
+
// 如果bridge已经初始化过或init不存在,直接resolve
|
|
286
|
+
console.log('Bridge已存在或init已调用,跳过初始化');
|
|
283
287
|
resolve();
|
|
284
288
|
}
|
|
285
289
|
});
|