Merge pull request #3054 from dpalou/MOBILE-3715

Mobile 3715
main
Pau Ferrer Ocaña 2022-01-18 14:39:33 +01:00 committed by GitHub
commit 979bf1bcfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 7 deletions

View File

@ -47,7 +47,7 @@
"addon.block_myoverview.inprogress": "block_myoverview",
"addon.block_myoverview.lastaccessed": "block_myoverview",
"addon.block_myoverview.list": "block_myoverview",
"addon.block_myoverview.nocourses": "block_myoverview",
"addon.block_myoverview.nocourses": "moodle",
"addon.block_myoverview.past": "block_myoverview",
"addon.block_myoverview.pluginname": "block_myoverview",
"addon.block_myoverview.shortname": "block_myoverview",
@ -345,7 +345,7 @@
"addon.mod_assign.cutoffdate": "assign",
"addon.mod_assign.defaultteam": "assign",
"addon.mod_assign.duedate": "assign",
"addon.mod_assign.duedateno": "assign",
"addon.mod_assign.duedateno": "local_moodlemobileapp",
"addon.mod_assign.duedatereached": "assign",
"addon.mod_assign.editingstatus": "assign",
"addon.mod_assign.editsubmission": "assign",
@ -881,8 +881,8 @@
"addon.mod_quiz.requirepasswordmessage": "quizaccess_password",
"addon.mod_quiz.returnattempt": "quiz",
"addon.mod_quiz.review": "quiz",
"addon.mod_quiz.reviewofattempt": "quiz",
"addon.mod_quiz.reviewofpreview": "quiz",
"addon.mod_quiz.reviewofattempt": "local_moodlemobileapp",
"addon.mod_quiz.reviewofpreview": "local_moodlemobileapp",
"addon.mod_quiz.showall": "quiz",
"addon.mod_quiz.showeachpage": "quiz",
"addon.mod_quiz.startattempt": "quiz",
@ -1658,6 +1658,7 @@
"core.errorsync": "local_moodlemobileapp",
"core.errorsyncblocked": "local_moodlemobileapp",
"core.errorurlschemeinvalidscheme": "local_moodlemobileapp",
"core.errorurlschemeinvalidschemessologin": "local_moodlemobileapp",
"core.errorurlschemeinvalidsite": "local_moodlemobileapp",
"core.expand": "moodle",
"core.explanationdigitalminor": "moodle",

View File

@ -19,7 +19,7 @@ import { BackButtonEvent } from '@ionic/core';
import { CoreLang } from '@services/lang';
import { CoreLoginHelper } from '@features/login/services/login-helper';
import { CoreEvents } from '@singletons/events';
import { Network, NgZone, Platform, SplashScreen } from '@singletons';
import { Network, NgZone, Platform, SplashScreen, Translate } from '@singletons';
import { CoreApp, CoreAppProvider } from '@services/app';
import { CoreSites } from '@services/sites';
import { CoreNavigator } from '@services/navigator';
@ -30,6 +30,7 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreUrlUtils } from '@services/utils/url';
import { CoreConstants } from '@/core/constants';
import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins';
import { CoreDomUtils } from '@services/utils/dom';
const MOODLE_VERSION_PREFIX = 'version-';
const MOODLEAPP_VERSION_PREFIX = 'moodleapp-';
@ -111,6 +112,8 @@ export class AppComponent implements OnInit, AfterViewInit {
// URLs with a custom scheme can be prefixed with "http://" or "https://", we need to remove this.
const protocol = CoreUrlUtils.getUrlProtocol(event.url);
const url = event.url.replace(/^https?:\/\//, '');
const urlScheme = CoreUrlUtils.getUrlProtocol(url);
const isExternalApp = urlScheme && urlScheme !== 'file' && urlScheme !== 'cdvfile';
if (CoreCustomURLSchemes.isCustomURL(url)) {
// Close the browser if it's a valid SSO URL.
@ -119,10 +122,16 @@ export class AppComponent implements OnInit, AfterViewInit {
});
CoreUtils.closeInAppBrowser();
} else if (isExternalApp && url.includes('://token=')) {
// It's an SSO token for another app. Close the IAB and show an error.
CoreUtils.closeInAppBrowser();
CoreDomUtils.showErrorModal(Translate.instant('core.errorurlschemeinvalidschemessologin', {
$a: urlScheme,
}));
} else if (CoreApp.isAndroid()) {
// Check if the URL has a custom URL scheme. In Android they need to be opened manually.
const urlScheme = CoreUrlUtils.getUrlProtocol(url);
if (urlScheme && urlScheme !== 'file' && urlScheme !== 'cdvfile') {
if (isExternalApp) {
// Open in browser should launch the right app if found and do nothing if not found.
CoreUtils.openInBrowser(url, { showBrowserWarning: false });

View File

@ -113,6 +113,7 @@
"errorsync": "An error occurred while synchronising. Please try again.",
"errorsyncblocked": "This {{$a}} cannot be synchronised right now because of an ongoing process. Please try again later. If the problem persists, try restarting the app.",
"errorurlschemeinvalidscheme": "This URL is meant to be used in another app: {{$a}}.",
"errorurlschemeinvalidschemessologin": "This site is configured to be used in another app: {{$a}}.",
"errorurlschemeinvalidsite": "This site URL cannot be opened in this app.",
"expand": "Expand",
"explanationdigitalminor": "This information is required to determine if your age is over the digital age of consent. This is the age when an individual can consent to terms and conditions and their data being legally stored and processed.",