feat(settings): add toggle for sync device location and harden background feeder - #478
Closed
full-bars wants to merge 2 commits into
Closed
feat(settings): add toggle for sync device location and harden background feeder#478full-bars wants to merge 2 commits into
full-bars wants to merge 2 commits into
Conversation
Contributor
Author
|
Closed: Opened upstream prematurely; moving to full-bars/android fork PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
In
SettingsScreen.kt, the "Device location sync" row lacked a toggle switch and visually mismatched the surrounding rows (Allow providing on cellular network, Kill switch, Receive connection notifications).This PR adds the switch aligned with adjacent setting toggles, implements intelligent setup routing and dynamic status feedback, and decouples the mock location SDK feeder from the UI lifecycle to ensure robust, background-safe location synchronization.
Tip
Toggling the switch ON when setup is incomplete (e.g., Developer options not enabled or mock location app not selected) automatically navigates to
Route.MockLocationGuide. Once setup is complete, the toggle directly controls location simulation without requiring navigation.Important
Test providers are never automatically removed by Android on process death or app exit. The SDK event listener has been moved to a process-scoped singleton (
MockLocationFeeder) started inMainApplication.onCreate(), ensuring test providers are disarmed and cleanly unregistered immediately when the tunnel drops, even if the user is outside the Settings UI.Logical Impact & Changes
Features & UI Alignment
SettingsScreen.kt):URSwitchto the "Device location sync" row, perfectly matching the vertical alignment, sizing, and spacing of "Kill switch" and "Cellular network".Route.MockLocationGuide.Syncing with <City>,Setup required,Waiting for provider location, or cleanup errors).MockLocationGuideScreen.kt):URSwitchin the "Ready" state banner once all three system setup prerequisites are satisfied.Syncing with <City>) or waiting state.Stability & Hardening
MockLocationFeeder.kt):ViewModelevent subscription with a dedicated@Singleton MockLocationFeederstarted inMainApplication.onCreate().DeviceLocal.addConnectChangeListenerto guarantee that when the VPN tunnel disconnects,MockLocationController.onTunnelChanged(false)is dispatched immediately to disarm providers and restore real device GPS.DeviceLocal.addConnectedProviderLocationChangeListenerto push exit provider coordinate changes across the entire app lifecycle without requiring the UI to remain open.MockLocationViewModel.kt):MockLocationViewModelinto a clean UI bridge exposing controller state and UI actions without dangling SDK subscriptions.MockLocationStatus.ORPHANEDroutes directly toMockLocationGuideScreento display recovery steps for revoked app ops.What's Changed
Full Changelog
main...full-bars:android:fix/settings-mock-location-toggle