Skip to content

feat: add global toggle to turn off background scanning and connection loops - #132

Open
Falak-Parmar wants to merge 1 commit into
sameerasw:developfrom
Falak-Parmar:feature/airsync-active-toggle
Open

feat: add global toggle to turn off background scanning and connection loops#132
Falak-Parmar wants to merge 1 commit into
sameerasw:developfrom
Falak-Parmar:feature/airsync-active-toggle

Conversation

@Falak-Parmar

Copy link
Copy Markdown

Description

This pull request implements a global AirSync Active toggle feature that allows users to completely turn off the background connection and discovery services, resolving the background scanning behavior discussed in #131.

Key Changes

  1. Persistent Preference: Added an app_enabled preference key (defaulting to true) inside DataStoreManager.kt.
  2. Dashboard UI Toggle:
    • Implemented a two-state dashboard in AirSyncMainScreen.kt.
    • OFF State: Displays a clean, minimal landing layout with the monochrome AirSync logo and a large "Turn On AirSync" button.
    • ON State: Displays the active dashboard, with a clean "AirSync Active" toggle row at the very top of the list for quick access.
  3. Service Management & Safety:
    • Intercepted service starts in ServiceManager.shouldServiceRun() so that background scans/UDP/mDNS do not execute when toggled off.
    • Fixed potential Android OS crashes (ForegroundServiceDidNotStartInTimeException) in AirSyncService.onStartCommand() by ensuring startForeground() is called before stopSelf() in the early-exit guard.
    • Avoided calling startForegroundService() entirely in the service helper if the app is disabled.
  4. Connection Blockers:
    • Added guards inside WebSocketUtil.connect() and WebSocketUtil.requestAutoReconnect() to reject any incoming/outgoing manual or automatic WebSocket connection requests when the setting is toggled off.

References

@sameerasw

Copy link
Copy Markdown
Owner

Hi! There are some conflicts as the PR was from main branch. I will also point it to develop :)

@sameerasw
sameerasw changed the base branch from main to develop August 13, 2026 15:38
@sameerasw
sameerasw marked this pull request as draft August 13, 2026 16:47
@Falak-Parmar

Copy link
Copy Markdown
Author

Hi sameerasw! Thanks for updating the base branch to develop. I'll fetch the latest develop branch, resolve the conflicts locally, test it, and update the PR as soon as possible. Thanks!

@Falak-Parmar
Falak-Parmar force-pushed the feature/airsync-active-toggle branch from 6a4d9f9 to 393a846 Compare August 14, 2026 15:45
@Falak-Parmar
Falak-Parmar marked this pull request as ready for review August 14, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add a global "AirSync Active" switch to completely stop background scanning and connection loops

2 participants