From dbd465e31004392fbf2cef625850f1733e2b504e Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 1 Mar 2022 09:43:30 +0100 Subject: [PATCH] MOBILE-3997 core: Don't show autologin URL in warning message --- .../bigbluebuttonbn/components/index/index.ts | 4 +++- src/core/classes/site.ts | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/addons/mod/bigbluebuttonbn/components/index/index.ts b/src/addons/mod/bigbluebuttonbn/components/index/index.ts index 69383338a..d8b639b95 100644 --- a/src/addons/mod/bigbluebuttonbn/components/index/index.ts +++ b/src/addons/mod/bigbluebuttonbn/components/index/index.ts @@ -172,7 +172,9 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo try { const joinUrl = await AddonModBBB.getJoinUrl(this.module.id, this.groupId); - CoreUtils.openInBrowser(joinUrl); + CoreUtils.openInBrowser(joinUrl, { + showBrowserWarning: false, + }); this.updateMeetingInfo(); } catch (error) { diff --git a/src/core/classes/site.ts b/src/core/classes/site.ts index 776cc58ac..eaefeb159 100644 --- a/src/core/classes/site.ts +++ b/src/core/classes/site.ts @@ -46,6 +46,7 @@ import { asyncInstance, AsyncInstance } from '../utils/async-instance'; import { CoreDatabaseTable } from './database/database-table'; import { CoreDatabaseCachingStrategy } from './database/database-table-proxy'; import { CoreSilentError } from './errors/silenterror'; +import { CoreWindow } from '@singletons/window'; /** * QR Code type enumeration. @@ -1509,7 +1510,7 @@ export class CoreSite { alertMessage?: string, ): Promise { // Get the URL to open. - url = await this.getAutoLoginUrl(url); + const autoLoginUrl = await this.getAutoLoginUrl(url); if (alertMessage) { // Show an alert first. @@ -1526,9 +1527,20 @@ export class CoreSite { // Open the URL. if (inApp) { - return CoreUtils.openInApp(url, options); + return CoreUtils.openInApp(autoLoginUrl, options); } else { - return CoreUtils.openInBrowser(url, options); + if ((options.showBrowserWarning || options.showBrowserWarning === undefined) && autoLoginUrl !== url) { + // Don't display the autologin URL in the warning. + try { + await CoreWindow.confirmOpenBrowserIfNeeded(url); + + options.showBrowserWarning = false; + } catch (error) { + return; // Cancelled, stop. + } + } + + return CoreUtils.openInBrowser(autoLoginUrl, options); } }