Conversation
There was a problem hiding this comment.
Pull request overview
Refactors BeaconView to present a clearer offline experience by visually disabling the map when the beacon isn’t running and guiding the user to activate the beacon via an overlay, driven by BeaconEngine.isRunning.
Changes:
- Injected
BeaconEngineintoBeaconViewvia@EnvironmentObjectand usedengine.isRunningto drive UI state. - Added an offline overlay (message + “Activate Beacon” button) and blurred/disabled map interaction while offline.
- Made the bottom control panel conditional on the beacon being active.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .blur(radius: engine.isRunning ? 0 : 8) | ||
| .allowsHitTesting(engine.isRunning) | ||
| .overlay { |
There was a problem hiding this comment.
.allowsHitTesting(engine.isRunning) is applied before .overlay, so when engine.isRunning == false it will likely disable hit-testing for the entire view tree including the overlay, making the "Activate Beacon" button untappable. Apply hit-testing disabling to the Map only (e.g., wrap in a ZStack and disable the Map layer), or explicitly re-enable hit testing on the overlay container/button when offline.
There was a problem hiding this comment.
"Actually, the hit-testing logic works as intended here because the .overlay is applied after the .allowsHitTesting modifier. In SwiftUI's 'onion' model, the overlay sits outside that restricted layer, so the 'Activate' button remains tappable while only the underlying Map is disabled. Tested and verified!"
This pull request updates the
BeaconViewto improve user experience when the beacon is offline. The main change is the addition of an overlay that informs users when the beacon is not running and provides a button to activate it. The view now also responds visually and interactively based on the beacon's running state.User experience improvements for offline state:
engine.isRunningis false, displaying a message, icon, and an "Activate Beacon" button to prompt the user to start the beacon. The map is blurred and disabled while offline.engineobject from the environment to control and reflect the beacon's running state.Other changes: