mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: extract NsdManager methods
This commit is contained in:
parent
f29d4e2309
commit
e5a20c9665
3 changed files with 72 additions and 66 deletions
|
|
@ -154,9 +154,6 @@ class BTScanModel @Inject constructor(
|
|||
}
|
||||
|
||||
fun stopScan() {
|
||||
// Stop Network Service Discovery (for TCP)
|
||||
networkDiscovery?.cancel()
|
||||
|
||||
if (scanJob != null) {
|
||||
debug("stopping scan")
|
||||
try {
|
||||
|
|
@ -170,14 +167,9 @@ class BTScanModel @Inject constructor(
|
|||
} else _spinner.value = false
|
||||
}
|
||||
|
||||
private var networkDiscovery: Job? = null
|
||||
fun startScan(context: Context?) {
|
||||
_spinner.value = true
|
||||
|
||||
// Start Network Service Discovery (find TCP devices)
|
||||
networkDiscovery = networkRepository.networkDiscoveryFlow()
|
||||
.launchIn(viewModelScope)
|
||||
|
||||
if (context != null) startCompanionScan(context) else startClassicScan()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue