From 5286adf081cb75ea17251edd498266be7fe7189a Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Wed, 9 Sep 2020 08:16:42 +0200 Subject: [PATCH] feat(core): boolean to disable systemAppearanceChanged (theme) (#8827) --- packages/core/application/application-common.ts | 7 ++++++- packages/core/application/index.d.ts | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/core/application/application-common.ts b/packages/core/application/application-common.ts index 2a083eb32..d27dee9c5 100644 --- a/packages/core/application/application-common.ts +++ b/packages/core/application/application-common.ts @@ -148,9 +148,14 @@ export function orientationChanged(rootView: View, newOrientation: 'portrait' | applyCssClass(rootModalView, ORIENTATION_CSS_CLASSES, newOrientationCssClass); }); } +export let autoSystemAppearanceChanged = true; + +export function setAutoSystemAppearanceChanged(value: boolean) { + autoSystemAppearanceChanged = value; +} export function systemAppearanceChanged(rootView: View, newSystemAppearance: 'dark' | 'light'): void { - if (!rootView) { + if (!rootView || !autoSystemAppearanceChanged) { return; } diff --git a/packages/core/application/index.d.ts b/packages/core/application/index.d.ts index 9b14fe31c..9d0106c3a 100644 --- a/packages/core/application/index.d.ts +++ b/packages/core/application/index.d.ts @@ -54,6 +54,16 @@ export const orientationChangedEvent: string; */ export const systemAppearanceChangedEvent: string; +/** + * Boolean to enable/disable systemAppearanceChanged + */ +export let autoSystemAppearanceChanged = true; + +/** + * enable/disable systemAppearanceChanged + */ +export function setAutoSystemAppearanceChanged (value: boolean); + /** * Updates root view classes including those of modals * @param rootView the root view