MOBILE-2786 desktop: Allow downloading old version in Win and Linux

main
Dani Palou 2018-12-11 16:25:27 +01:00
parent 26abfeb2a7
commit 01b24e3e80
4 changed files with 33 additions and 4 deletions

View File

@ -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",

View File

@ -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);
}

View File

@ -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).
*

View File

@ -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 {