Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(app): read instance theme color without an active runtime (#3391)

Hampusb07dcc368d08
diff --git a/fluxer_app/src/app/App.tsx b/fluxer_app/src/app/App.tsx
index 65490ce2c..fcf8e0f3c 100644
--- a/fluxer_app/src/app/App.tsx
+++ b/fluxer_app/src/app/App.tsx
@@ -22,6 +22,7 @@ import {useTabKeyFocusGuard} from '@app/features/app/hooks/useTabKeyFocusGuard';
import {type LayoutVariant, LayoutVariantProvider} from '@app/features/app/state/LayoutVariantContext';
import RuntimeConfig from '@app/features/app/state/RuntimeConfig';
import RuntimeCrash from '@app/features/app/state/RuntimeCrash';
+import DeveloperOptions from '@app/features/devtools/state/DeveloperOptions';
import {showMyselfTypingHelper} from '@app/features/devtools/utils/ShowMyselfTypingHelper';
import GatewayConnection from '@app/features/gateway/transport/GatewayConnection';
import GatewaySessions from '@app/features/gateway/transport/GatewaySessionPool';
@@ -83,6 +84,14 @@ interface AppWrapperProps {
children: ReactNode;
}
+function getInstanceThemeColor(): string | null {
+ const snapshot = RuntimeConfig.getSnapshotOrNull();
+ if (snapshot === null || !(DeveloperOptions.selfHostedModeOverride || snapshot.features.self_hosted)) {
+ return null;
+ }
+ return snapshot.appPublic.branding.theme_color ?? null;
+}
+
export const AppWrapper = observer(({children}: AppWrapperProps) => {
const {i18n} = useLingui();
const reducedMotion = Accessibility.useReducedMotion;
@@ -191,9 +200,7 @@ export const AppWrapper = observer(({children}: AppWrapperProps) => {
messageGutter: Accessibility.messageGutter,
messageGroupSpacing: Accessibility.getMessageGroupSpacingValue(messageDisplayCompact),
hdrDisplayMode: Accessibility.hdrDisplayMode,
- instanceThemeColor: RuntimeConfig.isSelfHosted()
- ? (RuntimeConfig.getSnapshotOrNull()?.appPublic.branding.theme_color ?? null)
- : null,
+ instanceThemeColor: getInstanceThemeColor(),
});
useCustomThemeStyle({
enabledThemeCss: ThemeLibrary.activeThemeCss,