Skip to content

Commit

Permalink
fix(deploy_beta): тест
Browse files Browse the repository at this point in the history
  • Loading branch information
Aliaksandr Pashkevich committed Mar 29, 2024
1 parent f680872 commit 6a15d1d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/bridge-to-native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export class BridgeToNative {
blankPagePath: string,
nativeParams?: NativeParams,
) {
// @ts-ignore
window.locationReplaceStack = [];

const previousState = !!sessionStorage.getItem(PREVIOUS_B2N_STATE_STORAGE_KEY);

if (previousState) {
Expand Down
8 changes: 8 additions & 0 deletions src/native-fallbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,22 @@ export class NativeFallbacks {

if (!forceOpenInWebview && this.b2n.canUseNativeFeature('linksInBrowser')) {
url.searchParams.append('openInBrowser', 'true');
// @ts-ignore
window.locationReplaceStack.push(url.href);

window.location.replace(url.href);
} else if (iosAppId || checkAndroidAllowOpenInNewWebview()) {
// @ts-ignore
window.locationReplaceStack.push(
`${appId}://webFeature?type=recommendation&url=${encodeURIComponent(url.href)}`,
);
window.location.replace(
`${appId}://webFeature?type=recommendation&url=${encodeURIComponent(url.href)}`,
);
} else {
this.b2n.nativeNavigationAndTitle?.setInitialView('');
// @ts-ignore
window.locationReplaceStack.push(url.href);
window.location.replace(url.href);
}
}
Expand Down
17 changes: 13 additions & 4 deletions src/native-navigation-and-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,22 @@ export class NativeNavigationAndTitle {
if (closeIOSWebviewBeforeCallNativeDeeplinkHandler) {
this.b2n.closeWebview();

setTimeout(
() => window.location.replace(`${this.b2n.iosAppId}://${clearedDeeplinkPath}`),
0,
);
setTimeout(() => {
// @ts-ignore
window.locationReplaceStack.push(
`${this.b2n.iosAppId}://${clearedDeeplinkPath}`,
);
window.location.replace(`${this.b2n.iosAppId}://${clearedDeeplinkPath}`);
}, 0);

return;
}
// @ts-ignore
window.locationReplaceStack.push(`${this.b2n.iosAppId}://${clearedDeeplinkPath}`);
window.location.replace(`${this.b2n.iosAppId}://${clearedDeeplinkPath}`);
} else {
// @ts-ignore
window.locationReplaceStack.push(`alfabank://${clearedDeeplinkPath}`);
window.location.replace(`alfabank://${clearedDeeplinkPath}`);
}
}
Expand Down Expand Up @@ -374,6 +381,8 @@ export class NativeNavigationAndTitle {
const paramsToSend = `ios:setPageSettings/${pageTitleStr + pageIdStr}`;

if (this.lastSetPageSettingsParams !== paramsToSend) {
// @ts-ignore
window.locationReplaceStack.push(paramsToSend);
window.location.replace(paramsToSend);
this.lastSetPageSettingsParams = paramsToSend;
}
Expand Down

0 comments on commit 6a15d1d

Please sign in to comment.