diff --git a/src/core/login/lang/en.json b/src/core/login/lang/en.json index 624ccd9f2..8264d9196 100644 --- a/src/core/login/lang/en.json +++ b/src/core/login/lang/en.json @@ -37,6 +37,7 @@ "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.", + "legacymoodleversiondesktopdownloadold": "<br><br>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 1bc8118c1..838d217b7 100644 --- a/src/core/login/providers/helper.ts +++ b/src/core/login/providers/helper.ts @@ -928,6 +928,8 @@ export class CoreLoginHelperProvider { protected showLegacyNoticeModal(message: string): void { const isAndroid = this.platform.is('android'), isIOS = this.platform.is('ios'), + isWindows = this.appProvider.isWindows(), + isLinux = this.appProvider.isLinux(), buttons: any[] = [ { text: this.translate.instant('core.ok'), @@ -935,12 +937,22 @@ export class CoreLoginHelperProvider { } ]; - if (isAndroid || isIOS) { + if (isAndroid || isIOS || isWindows || isLinux) { buttons.push({ text: this.translate.instant('core.download'), handler: (): void => { - const link = isAndroid ? 'market://details?id=com.moodle.classic' : - 'itms-apps://itunes.apple.com/app/id1403448117'; + let link; + + if (isWindows) { + link = 'https://download.moodle.org/desktop/download.php?platform=windows&version=342'; + } else if (isLinux) { + link = 'https://download.moodle.org/desktop/download.php?platform=linux&version=342&arch=' + + (this.appProvider.is64Bits() ? '64' : '32'); + } else if (isAndroid) { + link = 'market://details?id=com.moodle.classic'; + } else { + link = 'itms-apps://itunes.apple.com/app/id1403448117'; + } this.utils.openInBrowser(link); } diff --git a/src/providers/app.ts b/src/providers/app.ts index 5ce82bf67..6fa8ad847 100644 --- a/src/providers/app.ts +++ b/src/providers/app.ts @@ -146,6 +146,17 @@ export class CoreAppProvider { return this.appCtrl.getRootNavs()[0]; } + /** + * Checks if the app is running in a 64 bits desktop environment (not browser). + * + * @return {boolean} Whether the app is running in a 64 bits desktop environment (not browser). + */ + is64Bits(): boolean { + const process = (<any> window).process; + + return this.isDesktop() && process.arch == 'x64'; + } + /** * Checks if the app is running in a desktop environment (not browser). * diff --git a/src/providers/sites.ts b/src/providers/sites.ts index 27e088ef8..29a0941f2 100644 --- a/src/providers/sites.ts +++ b/src/providers/sites.ts @@ -506,8 +506,13 @@ export class CoreSitesProvider { params = {$a: siteUrl}; } + let error = this.translate.instant(errorKey, params); + if (this.appProvider.isWindows() || this.appProvider.isLinux()) { + error += this.translate.instant('core.login.legacymoodleversiondesktopdownloadold'); + } + return Promise.reject({ - error: this.translate.instant(errorKey, params), + error: error, errorcode: 'legacymoodleversion' }); } else {