Skip to content

Commit

Permalink
MOBILE-4719 core: Allow disabling features using config.json
Browse files Browse the repository at this point in the history
  • Loading branch information
dpalou committed Dec 9, 2024
1 parent 53baee7 commit 7568739
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/classes/sites/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down
17 changes: 16 additions & 1 deletion src/core/classes/sites/unauthenticated-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,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 for the site.
*
* @returns Disabled features.
*/
protected getSiteDisabledFeatures(): string | undefined {
return this.publicConfig?.tool_mobile_disabledfeatures;
}

Expand Down
1 change: 1 addition & 0 deletions src/types/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,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.
}

0 comments on commit 7568739

Please sign in to comment.