Merge pull request #4255 from dpalou/MOBILE-4719

MOBILE-4719 core: Allow disabling features using config.json
main
Pau Ferrer Ocaña 2024-12-10 14:50:17 +01:00 committed by GitHub
commit beb98e9154
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 3 deletions

View File

@ -637,8 +637,8 @@ export class CoreSite extends CoreAuthenticatedSite {
/**
* @inheritdoc
*/
protected getDisabledFeatures(): string | undefined {
return this.config ? this.getStoredConfig('tool_mobile_disabledfeatures') : super.getDisabledFeatures();
protected getSiteDisabledFeatures(): string | undefined {
return this.config ? this.getStoredConfig('tool_mobile_disabledfeatures') : super.getSiteDisabledFeatures();
}
/**

View File

@ -413,7 +413,22 @@ export class CoreUnauthenticatedSite {
*
* @returns Disabled features.
*/
protected getDisabledFeatures(): string | undefined {
protected getDisabledFeatures(): string {
const siteDisabledFeatures = this.getSiteDisabledFeatures() || undefined; // If empty string, use undefined.
const appDisabledFeatures = CoreConstants.CONFIG.disabledFeatures;
return [
...(siteDisabledFeatures?.split(',') || []),
...(appDisabledFeatures?.split(',') || []),
].join(',');
}
/**
* Get disabled features string configured in the site.
*
* @returns Disabled features.
*/
protected getSiteDisabledFeatures(): string | undefined {
return this.publicConfig?.tool_mobile_disabledfeatures;
}

View File

@ -78,4 +78,5 @@ export interface EnvironmentConfig {
hideInformativeLinks?: boolean; // Whether to hide informative links.
iconsPrefixes?: Record<string, Record<string, string[]>>; // Prefixes for custom font icons (located in src/assets/fonts).
clearIABSessionWhenAutoLogin?: 'android' | 'ios' | 'all'; // Clear the session every time a new IAB is opened with auto-login.
disabledFeatures?: string; // Disabled features for the whole app, using the same format as tool_mobile_disabledfeatures.
}