Skip to content

Refactor BeaconView for improved offline UI and user interaction#6

Merged
algotyrnt merged 1 commit intomainfrom
dev
Feb 27, 2026
Merged

Refactor BeaconView for improved offline UI and user interaction#6
algotyrnt merged 1 commit intomainfrom
dev

Conversation

@algotyrnt
Copy link
Owner

This pull request updates the BeaconView to 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:

  • Added an overlay UI that appears when engine.isRunning is 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.
  • The view now uses the engine object from the environment to control and reflect the beacon's running state.

Other changes:

  • Adjusted the bottom control panel to only display when the beacon is running.
  • Closed the struct definition properly at the end of the file.

@algotyrnt algotyrnt self-assigned this Feb 27, 2026
Copilot AI review requested due to automatic review settings February 27, 2026 10:46
@algotyrnt algotyrnt added the enhancement New feature or request label Feb 27, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BeaconEngine into BeaconView via @EnvironmentObject and used engine.isRunning to 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.

Comment on lines +71 to +73
.blur(radius: engine.isRunning ? 0 : 8)
.allowsHitTesting(engine.isRunning)
.overlay {
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.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.

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"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!"

@algotyrnt algotyrnt merged commit bd1bf19 into main Feb 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants