@alfalab/bridge-to-native 0.0.9-beta-37f9ff1 → 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.
@@ -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,6 +16,11 @@ class BridgeToNative {
15
16
  // Webview, запущенное в Android окружении имеет объект `Android` в window.
16
17
  this.AndroidBridge = window.Android;
17
18
  this.environment = this.AndroidBridge ? 'android' : 'ios';
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
+ }
18
24
  const previousState = !!sessionStorage.getItem(constants_1.PREVIOUS_B2N_STATE_STORAGE_KEY);
19
25
  if (previousState) {
20
26
  this.restorePreviousState();
@@ -110,13 +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
+ window.locationReplaceStack.push(url.href);
114
+ console.log('window.locationReplaceStack edited');
115
+ console.log(window.locationReplaceStack);
113
116
  window.location.replace(url.href);
114
117
  }
115
118
  else if (iosAppId || checkAndroidAllowOpenInNewWebview()) {
119
+ window.locationReplaceStack.push(`${appId}://webFeature?type=recommendation&url=${encodeURIComponent(url.href)}`);
120
+ console.log('window.locationReplaceStack edited');
121
+ console.log(window.locationReplaceStack);
116
122
  window.location.replace(`${appId}://webFeature?type=recommendation&url=${encodeURIComponent(url.href)}`);
117
123
  }
118
124
  else {
119
125
  (_a = this.b2n.nativeNavigationAndTitle) === null || _a === void 0 ? void 0 : _a.setInitialView('');
126
+ window.locationReplaceStack.push(url.href);
127
+ console.log('window.locationReplaceStack edited');
128
+ console.log(window.locationReplaceStack);
120
129
  window.location.replace(url.href);
121
130
  }
122
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
  /**
@@ -143,12 +144,23 @@ class NativeNavigationAndTitle {
143
144
  if (this.b2n.environment === 'ios') {
144
145
  if (closeIOSWebviewBeforeCallNativeDeeplinkHandler) {
145
146
  this.b2n.closeWebview();
146
- setTimeout(() => window.location.replace(`${this.b2n.iosAppId}://${clearedDeeplinkPath}`), 0);
147
+ setTimeout(() => {
148
+ window.locationReplaceStack.push(`${this.b2n.iosAppId}://${clearedDeeplinkPath}`);
149
+ console.log('window.locationReplaceStack edited');
150
+ console.log(window.locationReplaceStack);
151
+ window.location.replace(`${this.b2n.iosAppId}://${clearedDeeplinkPath}`);
152
+ }, 0);
147
153
  return;
148
154
  }
155
+ window.locationReplaceStack.push(`${this.b2n.iosAppId}://${clearedDeeplinkPath}`);
156
+ console.log('window.locationReplaceStack edited');
157
+ console.log(window.locationReplaceStack);
149
158
  window.location.replace(`${this.b2n.iosAppId}://${clearedDeeplinkPath}`);
150
159
  }
151
160
  else {
161
+ window.locationReplaceStack.push(`alfabank://${clearedDeeplinkPath}`);
162
+ console.log('window.locationReplaceStack edited');
163
+ console.log(window.locationReplaceStack);
152
164
  window.location.replace(`alfabank://${clearedDeeplinkPath}`);
153
165
  }
154
166
  }
@@ -274,7 +286,10 @@ class NativeNavigationAndTitle {
274
286
  const pageIdStr = pageId ? `&pageId=${pageId}` : '';
275
287
  const paramsToSend = `ios:setPageSettings/${pageTitleStr + pageIdStr}`;
276
288
  if (this.lastSetPageSettingsParams !== paramsToSend) {
277
- // window.location.replace(paramsToSend);
289
+ window.locationReplaceStack.push(paramsToSend);
290
+ console.log('window.locationReplaceStack edited');
291
+ console.log(window.locationReplaceStack);
292
+ window.location.replace(paramsToSend);
278
293
  this.lastSetPageSettingsParams = paramsToSend;
279
294
  }
280
295
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "license": "UNLICENSED",
3
3
  "name": "@alfalab/bridge-to-native",
4
- "version": "0.0.9-beta-37f9ff1",
4
+ "version": "0.0.9-beta-648b4e7",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/core-ds/bridge-to-native.git"