@alfalab/bridge-to-native 0.0.9-beta-d3ad282 → 0.0.9-beta-648b4e7
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/bridge-to-native.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable no-underscore-dangle */
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.BridgeToNative = void 0;
|
|
4
|
+
/* eslint-disable no-underscore-dangle */
|
|
5
|
+
//@ts-nocheck
|
|
5
6
|
const constants_1 = require("./constants");
|
|
6
7
|
const native_fallbacks_1 = require("./native-fallbacks");
|
|
7
8
|
const native_navigation_and_title_1 = require("./native-navigation-and-title");
|
|
@@ -15,8 +16,11 @@ class BridgeToNative {
|
|
|
15
16
|
// Webview, запущенное в Android окружении имеет объект `Android` в window.
|
|
16
17
|
this.AndroidBridge = window.Android;
|
|
17
18
|
this.environment = this.AndroidBridge ? 'android' : 'ios';
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
if (!(window === null || window === void 0 ? void 0 : window.locationReplaceStack)) {
|
|
20
|
+
window.locationReplaceStack = [];
|
|
21
|
+
console.log('window.locationReplaceStack created:');
|
|
22
|
+
console.log(window.locationReplaceStack);
|
|
23
|
+
}
|
|
20
24
|
const previousState = !!sessionStorage.getItem(constants_1.PREVIOUS_B2N_STATE_STORAGE_KEY);
|
|
21
25
|
if (previousState) {
|
|
22
26
|
this.restorePreviousState();
|
package/native-fallbacks.js
CHANGED
|
@@ -110,19 +110,22 @@ class NativeFallbacks {
|
|
|
110
110
|
const appId = (0, utils_1.getAppId)(environment, iosAppId);
|
|
111
111
|
if (!forceOpenInWebview && this.b2n.canUseNativeFeature('linksInBrowser')) {
|
|
112
112
|
url.searchParams.append('openInBrowser', 'true');
|
|
113
|
-
// @ts-ignore
|
|
114
113
|
window.locationReplaceStack.push(url.href);
|
|
114
|
+
console.log('window.locationReplaceStack edited');
|
|
115
|
+
console.log(window.locationReplaceStack);
|
|
115
116
|
window.location.replace(url.href);
|
|
116
117
|
}
|
|
117
118
|
else if (iosAppId || checkAndroidAllowOpenInNewWebview()) {
|
|
118
|
-
// @ts-ignore
|
|
119
119
|
window.locationReplaceStack.push(`${appId}://webFeature?type=recommendation&url=${encodeURIComponent(url.href)}`);
|
|
120
|
+
console.log('window.locationReplaceStack edited');
|
|
121
|
+
console.log(window.locationReplaceStack);
|
|
120
122
|
window.location.replace(`${appId}://webFeature?type=recommendation&url=${encodeURIComponent(url.href)}`);
|
|
121
123
|
}
|
|
122
124
|
else {
|
|
123
125
|
(_a = this.b2n.nativeNavigationAndTitle) === null || _a === void 0 ? void 0 : _a.setInitialView('');
|
|
124
|
-
// @ts-ignore
|
|
125
126
|
window.locationReplaceStack.push(url.href);
|
|
127
|
+
console.log('window.locationReplaceStack edited');
|
|
128
|
+
console.log(window.locationReplaceStack);
|
|
126
129
|
window.location.replace(url.href);
|
|
127
130
|
}
|
|
128
131
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NativeNavigationAndTitle = void 0;
|
|
4
|
+
//@ts-nocheck
|
|
4
5
|
const constants_1 = require("./constants");
|
|
5
6
|
const utils_1 = require("./utils");
|
|
6
7
|
/**
|
|
@@ -144,19 +145,22 @@ class NativeNavigationAndTitle {
|
|
|
144
145
|
if (closeIOSWebviewBeforeCallNativeDeeplinkHandler) {
|
|
145
146
|
this.b2n.closeWebview();
|
|
146
147
|
setTimeout(() => {
|
|
147
|
-
// @ts-ignore
|
|
148
148
|
window.locationReplaceStack.push(`${this.b2n.iosAppId}://${clearedDeeplinkPath}`);
|
|
149
|
+
console.log('window.locationReplaceStack edited');
|
|
150
|
+
console.log(window.locationReplaceStack);
|
|
149
151
|
window.location.replace(`${this.b2n.iosAppId}://${clearedDeeplinkPath}`);
|
|
150
152
|
}, 0);
|
|
151
153
|
return;
|
|
152
154
|
}
|
|
153
|
-
// @ts-ignore
|
|
154
155
|
window.locationReplaceStack.push(`${this.b2n.iosAppId}://${clearedDeeplinkPath}`);
|
|
156
|
+
console.log('window.locationReplaceStack edited');
|
|
157
|
+
console.log(window.locationReplaceStack);
|
|
155
158
|
window.location.replace(`${this.b2n.iosAppId}://${clearedDeeplinkPath}`);
|
|
156
159
|
}
|
|
157
160
|
else {
|
|
158
|
-
// @ts-ignore
|
|
159
161
|
window.locationReplaceStack.push(`alfabank://${clearedDeeplinkPath}`);
|
|
162
|
+
console.log('window.locationReplaceStack edited');
|
|
163
|
+
console.log(window.locationReplaceStack);
|
|
160
164
|
window.location.replace(`alfabank://${clearedDeeplinkPath}`);
|
|
161
165
|
}
|
|
162
166
|
}
|
|
@@ -282,8 +286,9 @@ class NativeNavigationAndTitle {
|
|
|
282
286
|
const pageIdStr = pageId ? `&pageId=${pageId}` : '';
|
|
283
287
|
const paramsToSend = `ios:setPageSettings/${pageTitleStr + pageIdStr}`;
|
|
284
288
|
if (this.lastSetPageSettingsParams !== paramsToSend) {
|
|
285
|
-
// @ts-ignore
|
|
286
289
|
window.locationReplaceStack.push(paramsToSend);
|
|
290
|
+
console.log('window.locationReplaceStack edited');
|
|
291
|
+
console.log(window.locationReplaceStack);
|
|
287
292
|
window.location.replace(paramsToSend);
|
|
288
293
|
this.lastSetPageSettingsParams = paramsToSend;
|
|
289
294
|
}
|