You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/src/main/kotlin/io/homeassistant/companion/android/onboarding/serverdiscovery/ServerDiscoveryScreen.kt
Copy file name to clipboardExpand all lines: app/src/main/kotlin/io/homeassistant/companion/android/onboarding/serverdiscovery/ServerDiscoveryViewModel.kt
+18-2Lines changed: 18 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -92,9 +92,25 @@ internal class ServerDiscoveryViewModel @VisibleForTesting constructor(
92
92
*/
93
93
val discoveryFlow =_discoveryFlow.delayFirstThrottle(DELAY_BEFORE_DISPLAY_DISCOVERY)
94
94
95
-
init {
96
-
discoverInstances()
95
+
/**
96
+
* Guards [onLocalNetworkPermissionChecked] against starting discovery more than once across
97
+
* recompositions or repeated permission-result callbacks from the screen.
98
+
*/
99
+
privatevar discoveryStarted =false
97
100
101
+
/**
102
+
* Notifies the ViewModel that the screen has finished the Android 17+ local network
103
+
* permission flow (either granted, denied, or skipped on pre-API 37 devices) and discovery
104
+
* can now begin. Subsequent calls are no-ops.
105
+
*
106
+
* Discovery is gated on this signal because NSD can't reach LAN-served Home Assistant
107
+
* instances on Android 17+ without `ACCESS_LOCAL_NETWORK`; starting earlier would risk a
108
+
* silent failure followed by a [NoServerFound] timeout that hides the real cause.
Copy file name to clipboardExpand all lines: app/src/main/kotlin/io/homeassistant/companion/android/onboarding/serverdiscovery/navigation/ServerDiscoveryNavigation.kt
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -40,13 +40,15 @@ internal fun NavGraphBuilder.serverDiscoveryScreen(
0 commit comments