mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-15 01:35:38 +00:00
d947050f31
Three duplicated patterns surfaced by the audit, each consolidated into a single named helper. 1. ThemeOverrides.toColors and toAppColors had the same five-source priority chain (per-chat → per-user → own → preset → base) inlined for nine non-bubble fields. Move it into resolveColor so each call site states the data, not the resolution rule. (Bubble fields keep their wallpaper-aware logic — different rule, separate concern.) 2. The chat's effective theme — chatInfo.uiThemes.preferredMode resolved through ThemeManager.currentColors — was computed inline in ChatView (for SimpleXThemeOverride) and again in App.ActiveChatThemeProvider (for the chatlist column / Android modal stack). Pull both into a shared rememberActiveChatTheme. Both call sites also adopt the wider remember key (whole theme, not just base) that the toolbar fix already needed; behavior is unchanged when the chat has no override. 3. The toolbar code-output copy in Appearance reimplemented oklch conversion inline (Color → Oklab → atan2 → degrees) instead of calling the existing Color.toOklch() extension. Replace with the extension, which also adds a small near-zero-chroma guard the inline version was missing. Pure refactor — no user-visible behavior change. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>