Merge pull request #3148 from dpalou/MOBILE-3997

MOBILE-3997 core: Don't show autologin URL in warning message
main
Pau Ferrer Ocaña 2022-03-01 10:08:45 +01:00 committed by GitHub
commit 003a7d7ea2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

@ -172,7 +172,9 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
try { try {
const joinUrl = await AddonModBBB.getJoinUrl(this.module.id, this.groupId); const joinUrl = await AddonModBBB.getJoinUrl(this.module.id, this.groupId);
CoreUtils.openInBrowser(joinUrl); CoreUtils.openInBrowser(joinUrl, {
showBrowserWarning: false,
});
this.updateMeetingInfo(); this.updateMeetingInfo();
} catch (error) { } catch (error) {

View File

@ -46,6 +46,7 @@ import { asyncInstance, AsyncInstance } from '../utils/async-instance';
import { CoreDatabaseTable } from './database/database-table'; import { CoreDatabaseTable } from './database/database-table';
import { CoreDatabaseCachingStrategy } from './database/database-table-proxy'; import { CoreDatabaseCachingStrategy } from './database/database-table-proxy';
import { CoreSilentError } from './errors/silenterror'; import { CoreSilentError } from './errors/silenterror';
import { CoreWindow } from '@singletons/window';
/** /**
* QR Code type enumeration. * QR Code type enumeration.
@ -1509,7 +1510,7 @@ export class CoreSite {
alertMessage?: string, alertMessage?: string,
): Promise<InAppBrowserObject | void> { ): Promise<InAppBrowserObject | void> {
// Get the URL to open. // Get the URL to open.
url = await this.getAutoLoginUrl(url); const autoLoginUrl = await this.getAutoLoginUrl(url);
if (alertMessage) { if (alertMessage) {
// Show an alert first. // Show an alert first.
@ -1526,9 +1527,20 @@ export class CoreSite {
// Open the URL. // Open the URL.
if (inApp) { if (inApp) {
return CoreUtils.openInApp(url, options); return CoreUtils.openInApp(autoLoginUrl, options);
} else { } 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);
} }
} }