soundscape-community / soundscape

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

"Enter Vicinity Distance" setting #102

Closed steinbro closed 2 months ago

steinbro commented 3 months ago

Adds a stepper (plus/minus buttons) under Settings > Audio Beacon to configure the distance threshold for stopping beacon audio. Default 15m, min 5m, max 50m, increments by 5m.

It's possible you need to restart Soundscape before a settings change takes effect. This might be fixable.

Would appreciate testing of the interactive setting by VoiceOver users.

Fixes #78

RDMurray commented 2 months ago

Sorry it's been so long. Just uploading a build for testing now.

RDMurray commented 2 months ago

The setting works fine for voiceover. Not really too important, but this kind of control usually appears to voiceover as a single control which is adjustable by swiping up or down.

RDMurray commented 2 months ago

As discussed on the call today, could we have a no cutoff option, so the beacon stays active until manually stopped? 5m is still quite a distance for a totally blind user. I know the GPS accuracy isn't much better than that, but it would still be useful to have the beacon to make sure you stay in the vicinity while you find the exact location.

steinbro commented 2 months ago

Adjusting the minimum down to zero is easy enough.

Regarding @jchudge's request to change the color on the increment/decrement buttons, it definitely occurred to me, but I hadn't done it because I discovered the native Stepper widget I used isn't stylable for whatever reason. I reimplemented the widget as individual buttons with white labels, but I fear this is far less accessible for VoiceOver users. @RDMurray can confirm, but I think it won't give feedback on the current value as you click the buttons. I'm inclined to go back to the low-contrast-but-VoiceOver-friendly option.

RDMurray commented 2 months ago

Thanks for working on this!

It works with voiceover, but puts increment and decrement actions in the vo actions rotor. The following makes it behave perfectly with VO. Thanks to claude.ai

(...)
            .accessibilityElement(children: .ignore)
            .accessibilityValue("\(Int(value)) \(unitsLocalization)")
            .accessibilityAdjustableAction { direction in
                switch direction {
                case .increment:
                    increment()
                case .decrement:
                    decrement()
                @unknown default:
                    break
                }
            }

I wonder if it should just be an integer setting anyway to avoid the need for truncation?

I think you are right that the setting won't take effect until you close the app. the setting should probably be referenced directly each time it is used instead of being stored in a static constant.

steinbro commented 2 months ago

Thanks for the feedback. I added the additional accessibility attributes, and replaced references to the static DestinationManager attributes with the live values from SettingsContext. This appears to have done the trick of making the setting take effect immediately, with no obvious side-effects.

Regarding the setting's data type, the value is used as a CLLocationDistance which is a Double. I expect it would also probably work if the user setting was an integer that is cast, but keeping the setting to be the same data type as the constant it was replacing felt like the cleanest update.

RDMurray commented 2 months ago

I was trying to rebase this in order to merge but there's a conflict in a Localization.strings file. Most of the strings files are UTF-16 which isn't well supported y git and it sees them as binary files. I was planning to convert them all to UTF-8 in main before merging this.

Do you think that will be ok?

RDMurray commented 2 months ago

sorry, I know it's not a good idea to rebase someone else's branch, but I'm just going to merge this now and we can fix any issues in a new pr.