Colota - Android GPS Location tracker
fix(android): pass a theme switch made while Colota was closed on to the reopened app (#1001)
Max Dietrichae1d2dd651de
diff --git a/apps/docs/docs/development/architecture.md b/apps/docs/docs/development/architecture.mdindex 7beb7f3f..17cc563f 100644--- a/apps/docs/docs/development/architecture.md+++ b/apps/docs/docs/development/architecture.md@@ -288,7 +288,7 @@ For backups, two `internal` methods support the export/import flow without expos| Module | Purpose || --- | --- |-| `MainActivity` | The React Native activity. Refills `DisplayMetricsHolder` from itself after create and every configuration change, because React Native reads the phone's display metrics and would measure text on an external display (DeX) at the wrong density |+| `MainActivity` | The React Native activity. Refills `DisplayMetricsHolder` from itself after create and every configuration change, because React Native reads the phone's display metrics and would measure text on an external display (DeX) at the wrong density. On create it also passes the current dark or light theme to React Native, which keeps running with the tracking service after the activity is gone and would miss a theme switch made meanwhile || `LocationBootReceiver` | Auto-restarts tracking after device reboot || `AlarmScheduler` | Shared one-shot wake-up alarm used by the geofence heartbeat, the stationary heartbeat and the tracking watchdog. `setAndAllowWhileIdle` fires through Doze without `SCHEDULE_EXACT_ALARM`, at the cost of being inexact, so every interval built on it is a minimum and not a schedule. Floors the delay at 60s, and each alarm needs its own request code. Whoever handles a tick re-arms the next one || `GeofenceHeartbeatScheduler` / `GeofenceHeartbeatReceiver` | Wakes the service for the zone heartbeat while paused in a geofence. Replaced a coroutine delay, which stopped counting while the phone slept |diff --git a/apps/mobile/android/app/src/main/java/com/colota/MainActivity.kt b/apps/mobile/android/app/src/main/java/com/colota/MainActivity.ktindex 2e8c7956..8028a096 100644--- a/apps/mobile/android/app/src/main/java/com/colota/MainActivity.kt+++ b/apps/mobile/android/app/src/main/java/com/colota/MainActivity.kt@@ -13,13 +13,16 @@ import com.facebook.react.ReactActivityimport com.facebook.react.ReactActivityDelegateimport com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabledimport com.facebook.react.defaults.DefaultReactActivityDelegate+import com.facebook.react.modules.appearance.AppearanceModuleimport com.facebook.react.uimanager.DisplayMetricsHolderclass MainActivity : ReactActivity() {- // RN reads display metrics from the app context (the phone's screen); refill them from this activity's display.override fun onCreate(savedInstanceState: Bundle?) {+ // RN outlives this activity while tracking runs; give it the current theme before super.onCreate mounts the app.+ reactHost?.currentReactContext?.getNativeModule(AppearanceModule::class.java)?.onConfigurationChanged(this)super.onCreate(null)+ // RN takes display metrics from the phone's screen; use the screen this activity is on.DisplayMetricsHolder.initDisplayMetrics(this)}diff --git a/fastlane/metadata/android/en-US/changelogs/54.txt b/fastlane/metadata/android/en-US/changelogs/54.txtindex dc9ade66..06de0878 100644--- a/fastlane/metadata/android/en-US/changelogs/54.txt+++ b/fastlane/metadata/android/en-US/changelogs/54.txt@@ -1,2 +1,3 @@- Fixed text showing only its top edge on Samsung DeX and other external displays- Fixed the Bearer token label showing as asterisks in Chinese+- Fixed the theme not following the system after switching dark mode while Colota was closed and tracking kept running