* Apply spotless by default
- Upgrades to spotless 8.2.1
- Moves spotless setup from an init.gradle.kts to build-logic
- Narrows down the scope of `target` in spotless configuration to
be more precise to workaround https://github.com/diffplug/spotless/issues/2717
- Updates all references to init.gradle.kts
Ran gradle-profiler ./gradlew build --dry-run to validate performance
impact.
Before PR:
Mean 10,527.96 ms with 289.01 ms std dev
After PR:
Mean 11,251.78 ms with 530.29 ms std dev
Regression is there, but quite minor.
Test: ./gradlew spotlessCheck
* Address comments from AI overlords
* Fix usage of rootProject
* Enable spotless for build-logic via root project
```
[Hilt] Provided Metadata instance has version 2.3.0, while maximum supported version is 2.2.0. To support newer versions, update the kotlin-metadata-jvm library.: java.lang.IllegalArgumentException: Provided Metadata instance has version 2.3.0, while maximum supported version is 2.2.0. To support newer versions, update the kotlin-metadata-jvm library.
```
Fixes#633
On Android 12 and above, the splash screen was ignoring the user’s saved theme preference and instead defaulting to the system theme. This happened because the splash screen is rendered before Application.onCreate() finishes executing. At that point, the system’s UiModeManager hadn't been updated with the user's preferred theme, so it showed the wrong one.
Changes:
- Introduced initializeNightModeFromPreferences() in UiExtensions.kt. This method forces the correct theme mode synchronously during Application.onCreate(), ensuring it’s in place before the splash screen ever appears.
- Added observeNightModePreferences() to actively listen for changes to the theme setting. This keeps UiModeManager updated in real time so future cold starts use the right theme immediately.
- On Android 12+ (API 31+), now using UiModeManager.setApplicationNightMode() to set the theme properly.
- For older versions, the implementation falls back to AppCompatDelegate.setDefaultNightMode() for compatibility.
- Added a toDarkThemeConfig() extension function to translate the DataStore proto into the theme model used by the UI.
- Included the AppCompat dependency in the app module to support these changes.
Why the Observer Matters? Without it, any theme change made by the user wouldn't notify UiModeManager right away. That would mean the next time the app is launched cold, the splash screen would still use whatever theme was cached before—not the one the user just selected. This fix prevents that.
Testing:
- Confirmed that the splash screen reflects the saved theme preference, even on a fresh app start.
- Checked all theme configurations: Light, Dark, and Follow System.
- Verified behavior on both Android 12+ and Android 11 devices to ensure backward compatibility.