Repository navigation
fix(ui): apply in-app Appearance theme to Auth and Sync screens - #382
TimeToBuildBob wants to merge 1 commit into
Conversation
Sync Settings and API Authentication used AppTheme.FollowNight with the process default of MODE_NIGHT_FOLLOW_SYSTEM, so they followed the device even when the dashboard Appearance setting was Light or Dark (ActivityWatch#300). Persist localStorage.theme from the WebView hook and set each screen's local night mode from that setting before super.onCreate. System/auto still follows the device. Git-Session-Id: 2a5ce4f1-0de9-5694-86eb-830365dae7c9
[Medium impact] The change affects the appearance of two native settings screens. The PR appears safe to merge, with a non-blocking gap in tests for the screens' actual colors. Findings
SummaryMakes API Authentication and Sync Settings follow the dashboard's saved Appearance choice.
No blocking defect was found. The new tests should also check the screens' actual colors against an opposite device setting. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A["WebView Appearance choice"] --> B["Android.reportThemeSetting"]
B --> C["AWPreferences"]
C --> D["applyPersistedWebUiNightMode"]
D --> E["AuthSettingsActivity"]
D --> F["SyncSettingsActivity"]
Reviews (1) · Last reviewed commit: "fix(ui): apply in-app Appearance theme t..." · Reviewed by Greptile |
| assert(source.contains("applyPersistedWebUiNightMode()")) { activity } | ||
| assert( | ||
| source.indexOf("applyPersistedWebUiNightMode()") < source.indexOf("super.onCreate"), | ||
| ) { "$activity must apply the in-app theme before super.onCreate" } |
There was a problem hiding this comment.
The new tests check mode constants, callback delivery, and source text, but never check whether a saved Appearance choice changes either screen's actual colors. A broken preference-to-screen connection could leave these tests passing.
Add an activity test that saves dark against a light device setting, then tests the reverse. Check resources.configuration and the screen background before and after recreation.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
🤖 AI code reviewAdds persistence of the web UI Appearance setting in AWPreferences and reports that setting through Android.reportThemeSetting. AuthSettingsActivity and SyncSettingsActivity now apply a local AppCompat night mode before super.onCreate. Updates theme documentation and adds assertions for normalization, night-mode mapping, activity initialization order, and bridge callbacks. Safe to merge — no P0/P1 findingsConfidence 5/5 ✅ No findings. The diff looks correct to me on this pass. Files changed (9) — the diff as I read it
Reviewed Maintainer commands
|
Problem
On master, Sync Settings and API Authentication follow the device night mode. The dashboard Appearance setting (Light / Dark / System) lives in WebView
localStorageand never reached those native screens.Reporter confirmation on #300: flash is gone on the 2026-10-26 master artifact, but those two screens still ignore the in-app theme.
Change
light/dark/autosetting viaAndroid.reportThemeSetting.AWPreferences.AuthSettingsActivityandSyncSettingsActivitycallapplyPersistedWebUiNightMode()beforesuper.onCreate, mapping:MODE_NIGHT_YESMODE_NIGHT_NOMODE_NIGHT_FOLLOW_SYSTEMsetDefaultNightMode(that recreates MainActivity / WebView).Onboarding stays light-only.
Testing
WebUiThemeTest: setting → AppCompat night-mode mapping; hook containsreportThemeSetting.NativeScreenThemeTest: both screens still useAppTheme.FollowNightand apply the persisted mode beforesuper.onCreate.WebUIFragmentTest: bridge delivers the stored setting independently of exports../gradlew :mobile:testStandardDebugUnitTest --tests net.activitywatch.android.WebUiThemeTest --tests net.activitywatch.android.NativeScreenThemeTest --tests net.activitywatch.android.fragments.WebUIFragmentTest→ 44 tests, 0 failures.This is not a physical-device or published-release check. Issue #300 stays open until the screens are verified with an explicit Light/Dark override against the opposite device mode.
Refs #300