soundscape-community / soundscape

An iOS application/service that aids navigation through spatialized audio
https://soundscape.services
MIT License
21 stars 22 forks source link

Announce GPS accuracy #103

Open steinbro opened 1 month ago

steinbro commented 1 month ago

@jchudge suggested having the app announce GPS accuracy at startup. This shouldn't require any calculations, just reporting the system's CLLocationAccuracy. But I wanted to open up the implementation details for discussion, specifically that the GPS accuracy can and does change as the user moves around. Should it be announced periodically, or perhaps if it exceeds some threshold?

jchudge commented 1 month ago

I would suggest implementing it on opening the app and also when awakening it from 'sleeping'. The intent is to communicate the accuracy at the outset of a person's experience - knowing that they can go into settings to look it up if they need to at other times. During it's earlier incarnation, we implemented something similar that provided updates every time there was a change of about 5 metres or so...this resulted in a fairly constant barrage of notifications which were disruptive and not particularly helpful.

steinbro commented 1 month ago

Ah, I hadn't realized this information was already exposed to the user, under the Troubleshooting section. To the implementers, the relevant code is here: https://github.com/soundscape-community/soundscape/blob/main/apps/ios/GuideDogs/Code/Visual%20UI/View%20Controllers/Settings/StatusTableViewController.swift#L112

steinbro commented 1 month ago

To play a callout at startup and wake, we can locate the places where the appLaunch glyph is played, namely in these two places:

https://github.com/soundscape-community/soundscape/blob/main/apps/ios/GuideDogs/Code/App/AppContext.swift#L245

https://github.com/soundscape-community/soundscape/blob/main/apps/ios/GuideDogs/Code/Behaviors/EventProcessor.swift#L156

However, we can't simply read the accuracy value at that instant, because the GPS location hasn't been determined yet. We probably need to watch for the first LocationUpdatedEvent to trigger after resume.

steinbro commented 1 month ago

Revising my previous comment: the first accuracy reading on launch/wake generally seems to be very large (i.e. imprecise) and gradually improves with subsequent readings. I think this is what you see when launching a map application, with a circle that starts large and quickly narrows in. If we want to announce a single value that's representative of the "true" accuracy, we'll need to wait until the reading stabilizes. That would make the implementation of this a bit more involved than simply adding a callout in one or two places in the code -- we might need to add a new Behavior that tracks accuracy values and has some heuristic to judge when they've stabilized.