MOBILE-3320 core: Check WP Enabled

main
Pau Ferrer Ocaña 2021-07-06 09:54:45 +02:00
parent 1d5fbb3bd7
commit 8eedb2afac
1 changed files with 12 additions and 6 deletions

View File

@ -70,7 +70,6 @@ export class CoreSitesProvider {
protected static readonly VALID_VERSION = 1;
protected static readonly INVALID_VERSION = -1;
protected isWPApp = false;
protected logger: CoreLogger;
protected services = {};
protected sessionRestored = false;
@ -639,21 +638,28 @@ export class CoreSitesProvider {
protected validateWorkplaceVersion(info: CoreSiteInfoResponse): number {
const isWorkplace = !!info.functions && info.functions.some((func) => func.name == 'tool_program_get_user_programs');
if (typeof this.isWPApp == 'undefined') {
this.isWPApp = false; // @todo
}
const isWPEnabled = this.isWorkplaceEnabled();
if (!this.isWPApp && isWorkplace) {
if (!isWPEnabled && isWorkplace) {
return CoreSitesProvider.WORKPLACE_APP;
}
if (this.isWPApp && !isWorkplace) {
if (isWPEnabled && !isWorkplace) {
return CoreSitesProvider.MOODLE_APP;
}
return CoreSitesProvider.VALID_VERSION;
}
/**
* Check if the app is workplace enabled.
*
* @return If the app is workplace enabled.
*/
protected isWorkplaceEnabled(): boolean {
return false;
}
/**
* Returns the release number from site release info.
*