fix multiple startInterface() calls

This commit is contained in:
andrekir 2022-06-27 22:28:51 -03:00
parent 613334d87e
commit 7905bc6f70
2 changed files with 2 additions and 10 deletions

View file

@ -937,14 +937,6 @@ class MainActivity : BaseActivity(), Logging,
model.meshService = null
}
override fun onBackPressed() { // FIXME Override back button to avoid closing
if (supportFragmentManager.backStackEntryCount == 0) {
moveTaskToBack(false)
} else {
super.onBackPressed()
}
}
override fun onStop() {
unregisterMeshReceiver() // No point in receiving updates while the GUI is gone, we'll get them when the user launches the activity
unbindMeshService()

View file

@ -40,7 +40,7 @@ class RadioInterfaceService @Inject constructor(
private val processLifecycle: Lifecycle,
private val usbRepository: UsbRepository,
@RadioRepositoryQualifier private val prefs: SharedPreferences
): Logging {
) : Logging {
private val _connectionState = MutableStateFlow(RadioServiceConnectionState())
val connectionState = _connectionState.asStateFlow()
@ -73,7 +73,7 @@ class RadioInterfaceService @Inject constructor(
processLifecycle.coroutineScope.launch {
bluetoothRepository.state.collect { state ->
if (state.enabled) {
startInterface()
// startInterface() FIXME no longer safe to call here, crashing SafeBluetooth.asyncConnect
} else if (radioIf is BluetoothInterface) {
stopInterface()
}