From 9196371f501451dff41625faa649e3ec9ed4dd34 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 19 Sep 2019 09:34:00 +0200 Subject: [PATCH] MOBILE-3163 core: Remove Classic app warning --- src/assets/lang/en.json | 7 ++---- src/core/login/lang/en.json | 7 ++---- src/core/login/providers/helper.ts | 24 -------------------- src/lang/en.json | 2 +- src/providers/sites.ts | 35 +++++------------------------- 5 files changed, 11 insertions(+), 64 deletions(-) diff --git a/src/assets/lang/en.json b/src/assets/lang/en.json index d837ace11..af8f5aa60 100644 --- a/src/assets/lang/en.json +++ b/src/assets/lang/en.json @@ -1556,7 +1556,7 @@ "core.login.auth_email": "Email-based self-registration", "core.login.authenticating": "Authenticating", "core.login.cancel": "Cancel", - "core.login.checksiteversion": "Check that your site uses Moodle 2.4 or later.", + "core.login.checksiteversion": "Check that your site uses Moodle 3.1 or later.", "core.login.confirmdeletesite": "Are you sure you want to delete the site {{sitename}}?", "core.login.connect": "Connect!", "core.login.connecttomoodle": "Connect to Moodle", @@ -1585,15 +1585,12 @@ "core.login.invalidaccount": "Please check your login details or ask your site administrator to check the site configuration.", "core.login.invaliddate": "Invalid date", "core.login.invalidemail": "Invalid email address", - "core.login.invalidmoodleversion": "Invalid Moodle version. The minimum version required is 2.4.", + "core.login.invalidmoodleversion": "Invalid Moodle version. The minimum version required is 3.1.", "core.login.invalidsite": "The site URL is invalid.", "core.login.invalidtime": "Invalid time", "core.login.invalidurl": "Invalid URL specified", "core.login.invalidvaluemax": "The maximum value is {{$a}}", "core.login.invalidvaluemin": "The minimum value is {{$a}}", - "core.login.legacymoodleversion": "You are trying to connect to an unsupported Moodle version. Please download the Moodle Classic app to access this Moodle site.", - "core.login.legacymoodleversiondesktop": "You are trying to connect to {{$a}}.

This site is running an outdated unsupported version of Moodle which will not work with this Moodle Desktop App.

If this is your site please contact your local moodle partner to get assistance to update it.

See our contact page to submit a request for assistance.", - "core.login.legacymoodleversiondesktopdownloadold": "

Alternatively, you can still access this site using an unsupported version of the app that can be downloaded from here.", "core.login.localmobileunexpectedresponse": "Moodle Mobile Additional Features check returned an unexpected response. You will be authenticated using the standard mobile service.", "core.login.loggedoutssodescription": "You have to authenticate again. You need to log in to the site in a browser window.", "core.login.login": "Log in", diff --git a/src/core/login/lang/en.json b/src/core/login/lang/en.json index 4328c6d3e..84825ee48 100644 --- a/src/core/login/lang/en.json +++ b/src/core/login/lang/en.json @@ -2,7 +2,7 @@ "auth_email": "Email-based self-registration", "authenticating": "Authenticating", "cancel": "Cancel", - "checksiteversion": "Check that your site uses Moodle 2.4 or later.", + "checksiteversion": "Check that your site uses Moodle 3.1 or later.", "confirmdeletesite": "Are you sure you want to delete the site {{sitename}}?", "connect": "Connect!", "connecttomoodle": "Connect to Moodle", @@ -31,15 +31,12 @@ "invalidaccount": "Please check your login details or ask your site administrator to check the site configuration.", "invaliddate": "Invalid date", "invalidemail": "Invalid email address", - "invalidmoodleversion": "Invalid Moodle version. The minimum version required is 2.4.", + "invalidmoodleversion": "Invalid Moodle version. The minimum version required is 3.1.", "invalidsite": "The site URL is invalid.", "invalidtime": "Invalid time", "invalidurl": "Invalid URL specified", "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 {{$a}}.

This site is running an outdated unsupported version of Moodle which will not work with this Moodle Desktop App.

If this is your site please contact your local moodle partner to get assistance to update it.

See our contact page to submit a request for assistance.", - "legacymoodleversiondesktopdownloadold": "

Alternatively, you can still access this site using an unsupported version of the app that can be downloaded from here.", "localmobileunexpectedresponse": "Moodle Mobile Additional Features check returned an unexpected response. You will be authenticated using the standard mobile service.", "loggedoutssodescription": "You have to authenticate again. You need to log in to the site in a browser window.", "login": "Log in", diff --git a/src/core/login/providers/helper.ts b/src/core/login/providers/helper.ts index 9d46e536a..9682ba46a 100644 --- a/src/core/login/providers/helper.ts +++ b/src/core/login/providers/helper.ts @@ -1023,28 +1023,6 @@ export class CoreLoginHelperProvider { (!CoreConfigConstants.skipssoconfirmation || String(CoreConfigConstants.skipssoconfirmation) === 'false'); } - /** - * Show a modal warning the user that he should use the Classic app. - * - * @param {string} message The warning message. - */ - protected showLegacyNoticeModal(message: string): void { - let link; - - if (this.appProvider.isWindows()) { - link = 'https://download.moodle.org/desktop/download.php?platform=windows&version=342'; - } else if (this.appProvider.isLinux()) { - link = 'https://download.moodle.org/desktop/download.php?platform=linux&version=342&arch=' + - (this.appProvider.is64Bits() ? '64' : '32'); - } else if (this.platform.is('android')) { - link = 'market://details?id=com.moodle.classic'; - } else if (this.platform.is('ios')) { - link = 'itms-apps://itunes.apple.com/app/id1403448117'; - } - - this.showDownloadAppNoticeModal(message, link); - } - /** * Show a modal warning the user that he should use the Workplace app. * @@ -1225,8 +1203,6 @@ export class CoreLoginHelperProvider { this.openChangePassword(siteUrl, this.textUtils.getErrorMessageFromError(error)); } else if (error.errorcode == 'usernotconfirmed') { this.showNotConfirmedModal(siteUrl, undefined, username, password); - } else if (error.errorcode == 'legacymoodleversion') { - this.showLegacyNoticeModal(this.textUtils.getErrorMessageFromError(error)); } else if (error.errorcode == 'connecttomoodleapp') { this.showMoodleAppNoticeModal(this.textUtils.getErrorMessageFromError(error)); } else if (error.errorcode == 'connecttoworkplaceapp') { diff --git a/src/lang/en.json b/src/lang/en.json index 59183bdcf..5fd61caf7 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -12,7 +12,7 @@ "areyousure": "Are you sure?", "back": "Back", "cancel": "Cancel", - "cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle 2.4 or later.", + "cannotconnect": "Cannot connect: Verify that you have correctly typed the URL and that your site uses Moodle 3.1 or later.", "cannotdownloadfiles": "File downloading is disabled. Please contact your site administrator.", "captureaudio": "Record audio", "capturedimage": "Taken picture.", diff --git a/src/providers/sites.ts b/src/providers/sites.ts index 515d7117a..0c310c708 100644 --- a/src/providers/sites.ts +++ b/src/providers/sites.ts @@ -247,7 +247,6 @@ export class CoreSitesProvider { protected WORKPLACE_APP = 3; protected MOODLE_APP = 2; protected VALID_VERSION = 1; - protected LEGACY_APP_VERSION = 0; protected INVALID_VERSION = -1; protected isWPApp: boolean; @@ -690,25 +689,9 @@ export class CoreSitesProvider { */ protected treatInvalidAppVersion(result: number, siteUrl: string, siteId?: string): Promise { let errorCode, - errorKey, - errorExtra = '', - errorKeyParams; + errorKey; switch (result) { - case this.LEGACY_APP_VERSION: - errorKey = 'core.login.legacymoodleversion'; - errorCode = 'legacymoodleversion'; - - if (this.appProvider.isDesktop()) { - errorKey += 'desktop'; - errorKeyParams = {$a: siteUrl}; - } - - if (this.appProvider.isWindows() || this.appProvider.isLinux()) { - errorExtra = this.translate.instant('core.login.legacymoodleversiondesktopdownloadold'); - } - - break; case this.MOODLE_APP: errorKey = 'core.login.connecttomoodleapp'; errorCode = 'connecttomoodleapp'; @@ -732,7 +715,7 @@ export class CoreSitesProvider { return promise.then(() => { return Promise.reject({ - error: this.translate.instant(errorKey, errorKeyParams) + errorExtra, + error: this.translate.instant(errorKey), errorcode: errorCode, loggedout: true }); @@ -779,16 +762,14 @@ export class CoreSitesProvider { * Check for the minimum required version. * * @param {any} info Site info. - * @return {number} Either VALID_VERSION, LEGACY_APP_VERSION, WORKPLACE_APP, MOODLE_APP or INVALID_VERSION. + * @return {number} Either VALID_VERSION, WORKPLACE_APP, MOODLE_APP or INVALID_VERSION. */ protected isValidMoodleVersion(info: any): number { if (!info) { return this.INVALID_VERSION; } - const version24 = 2012120300, // Moodle 2.4 version. - release24 = '2.4', - version31 = 2016052300, + const version31 = 2016052300, release31 = '3.1'; // Try to validate by version. @@ -797,8 +778,6 @@ export class CoreSitesProvider { if (!isNaN(version)) { if (version >= version31) { return this.validateWorkplaceVersion(info); - } else if (version >= version24) { - return this.LEGACY_APP_VERSION; } } } @@ -809,9 +788,6 @@ export class CoreSitesProvider { if (release >= release31) { return this.validateWorkplaceVersion(info); } - if (release >= release24) { - return this.LEGACY_APP_VERSION; - } } // Couldn't validate it. @@ -1556,9 +1532,10 @@ export class CoreSitesProvider { * * @param {any} info The site info. * @return {boolean} Whether it's a legacy Moodle. + * @deprecated since 3.7.1 */ isLegacyMoodleByInfo(info: any): boolean { - return this.isValidMoodleVersion(info) == this.LEGACY_APP_VERSION; + return false; } /**