mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2026-01-27 10:34:35 +01:00
Fix proximity profile
This commit is contained in:
@@ -3,15 +3,9 @@ package no.nordicsemi.android.utils
|
||||
import android.app.ActivityManager
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.livedata.observeAsState
|
||||
import androidx.navigation.NavController
|
||||
import kotlinx.coroutines.CoroutineExceptionHandler
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
import kotlinx.coroutines.launch
|
||||
import no.nordicsemi.android.navigation.ParcelableArgument
|
||||
import no.nordicsemi.android.navigation.SuccessDestinationResult
|
||||
@@ -33,20 +27,6 @@ fun SuccessDestinationResult.getDevice(): DiscoveredBluetoothDevice {
|
||||
return (argument as ParcelableArgument).value as DiscoveredBluetoothDevice
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun <T> NavController.consumeResult(value: String): T? {
|
||||
|
||||
val secondScreenResult = currentBackStackEntry
|
||||
?.savedStateHandle
|
||||
?.getLiveData<T>(value)?.observeAsState()
|
||||
|
||||
return secondScreenResult?.value?.also {
|
||||
currentBackStackEntry
|
||||
?.savedStateHandle
|
||||
?.set(value, null)
|
||||
}
|
||||
}
|
||||
|
||||
private val exceptionHandler = CoroutineExceptionHandler { _, t ->
|
||||
Log.e("COROUTINE-EXCEPTION", "Uncaught exception", t)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user