Merge pull request #2873 from crazyserver/MOBILE-3320
MOBILE-3320 core: Add WP_PROVIDER constant checks
This commit is contained in:
		
						commit
						335b2b10e7
					
				| @ -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. | ||||
|      * | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user