MOBILE-2568 login: Improve legacy error in desktop apps

main
Dani Palou 2018-08-30 11:21:49 +02:00
parent 3c44cee0ee
commit bb40d1652b
4 changed files with 18 additions and 3 deletions

View File

@ -33,6 +33,7 @@
"invalidvaluemax": "The maximum value is {{$a}}",
"invalidvaluemin": "The minimum value is {{$a}}",
"legacymoodleversion": "You are trying to connect to an unsupported Moodle version. Please, download the Moodle Classic app to access this Moodle site.",
"legacymoodleversiondesktop": "You are trying to connect to <b>{{$a}}</b>.<br><br>This site is running an outdated unsupported version of Moodle which will not work with this Moodle Desktop App.<br><br>If this is your site please contact your local moodle partner to get assistance to update it.<br><br>See <a href=\"https://moodle.com/contact\">our contact page</a> to submit a request for assistance.",
"localmobileunexpectedresponse": "Moodle Mobile Additional Features check returned an unexpected response, you will be authenticated using the standard Mobile service.",
"login": "Log in",
"loginbutton": "Log in",

View File

@ -956,7 +956,13 @@ export class CoreLoginHelperProvider {
buttons: buttons
});
alert.present();
alert.present().then(() => {
if (!isAndroid && !isIOS) {
// Treat all anchors so they don't override the app.
const alertMessageEl: HTMLElement = alert.pageRef().nativeElement.querySelector('.alert-message');
this.domUtils.treatAnchors(alertMessageEl);
}
});
}
/**

View File

@ -494,8 +494,16 @@ export class CoreSitesProvider {
return siteId;
});
} else if (result == this.LEGACY_APP_VERSION) {
let errorKey = 'core.login.legacymoodleversion',
params;
if (this.appProvider.isDesktop()) {
errorKey += 'desktop';
params = {$a: siteUrl};
}
return Promise.reject({
error: this.translate.instant('core.login.legacymoodleversion'),
error: this.translate.instant(errorKey, params),
errorcode: 'legacymoodleversion'
});
} else {

View File

@ -1205,7 +1205,7 @@ export class CoreDomUtilsProvider {
*
* @param {HTMLElement} container The HTMLElement that can contain anchors.
*/
protected treatAnchors(container: HTMLElement): void {
treatAnchors(container: HTMLElement): void {
const anchors = Array.from(container.querySelectorAll('a'));
anchors.forEach((anchor) => {