From 8c9683948020a742ea040f9cad3560d88f333440 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 6 Aug 2024 14:24:48 +0200 Subject: [PATCH 1/2] MOBILE-4602 core: Remove problematic close when reopening IAB Opening a new IAB when one is already open doesn't create a second one, only one is present so there's no need to close the previous one. Also, calling close() caused the new IAB to close immediately because the app doesn't wait for the previous one to finish closing. --- src/core/services/utils/utils.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/services/utils/utils.ts b/src/core/services/utils/utils.ts index 0c1724eaf..9a18d59a7 100644 --- a/src/core/services/utils/utils.ts +++ b/src/core/services/utils/utils.ts @@ -1068,8 +1068,6 @@ export class CoreUtilsProvider { this.setInAppBrowserToolbarColors(options); - this.iabInstance?.close(); // Close window if there is one already open, only allow one. - this.iabInstance = InAppBrowser.create(url, '_blank', options); if (CorePlatform.isMobile()) { From 52d37c394085ba06a1f2fb343f88e5c5abba08e3 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 6 Aug 2024 14:59:21 +0200 Subject: [PATCH 2/2] MOBILE-4602 iab: Fix links with pseudo protocols and schemes in iOS --- src/core/initializers/prepare-inapp-browser.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/core/initializers/prepare-inapp-browser.ts b/src/core/initializers/prepare-inapp-browser.ts index e3c393eb7..f35e1eb2d 100644 --- a/src/core/initializers/prepare-inapp-browser.ts +++ b/src/core/initializers/prepare-inapp-browser.ts @@ -16,7 +16,6 @@ import { CoreSiteError } from '@classes/errors/siteerror'; import { CoreLoginHelper } from '@features/login/services/login-helper'; import { CoreUserAuthenticatedSupportConfig } from '@features/user/classes/support/authenticated-support-config'; import { CoreUserNullSupportConfig } from '@features/user/classes/support/null-support-config'; -import { CorePlatform } from '@services/platform'; import { CoreSites } from '@services/sites'; import { CoreCustomURLSchemes } from '@services/urlschemes'; import { CoreDomUtils } from '@services/utils/dom'; @@ -62,11 +61,6 @@ export default function(): void { return; } - if (!CorePlatform.isAndroid()) { - return; - } - - // Check if the URL has a custom URL scheme. In Android they need to be opened manually. if (!isExternalApp) { lastInAppUrl = protocol ? `${protocol}://${url}` : url; @@ -76,8 +70,8 @@ export default function(): void { // Open in browser should launch the right app if found and do nothing if not found. CoreUtils.openInBrowser(url, { showBrowserWarning: false }); - // At this point the InAppBrowser is showing a "Webpage not available" error message. - // Try to navigate to last loaded URL so this error message isn't found. + // At this point, URL schemes will stop working in IAB, and in Android the IAB is showing a "Webpage not available" error. + // Re-loading the page inside the existing IAB doesn't fix it, we need to re-load the whole IAB. if (lastInAppUrl) { CoreUtils.openInApp(lastInAppUrl); } else {