Skip to content

Commit

Permalink
fix: close dlna devices multi times.
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyroid committed Dec 13, 2023
1 parent 71fbcd0 commit 5743fcc
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class StreamViewModel @Inject constructor(

private fun openDlnaDevices() {
DLNACastManager.bindCastService(application)
binded = true
DLNACastManager.registerDeviceListener(this)
viewModelScope.launch {
delay(800.milliseconds)
Expand All @@ -107,7 +108,12 @@ class StreamViewModel @Inject constructor(
_isDevicesVisible.value = true
}

@Volatile
private var binded = false

private fun closeDlnaDevices() {
if (!binded) return
binded = false
_searching.value = false
_isDevicesVisible.value = false
_devices.value = emptyList()
Expand Down

0 comments on commit 5743fcc

Please sign in to comment.