diff --git a/app/src/main/java/com/geeksville/mesh/model/RadioConfigViewModel.kt b/app/src/main/java/com/geeksville/mesh/model/RadioConfigViewModel.kt index 061577cae..53a8f104e 100644 --- a/app/src/main/java/com/geeksville/mesh/model/RadioConfigViewModel.kt +++ b/app/src/main/java/com/geeksville/mesh/model/RadioConfigViewModel.kt @@ -294,7 +294,7 @@ class RadioConfigViewModel @Inject constructor( } private val _deviceProfile = MutableStateFlow(null) - val deviceProfile get() = _deviceProfile.value + val deviceProfile: StateFlow get() = _deviceProfile fun setDeviceProfile(deviceProfile: DeviceProfile?) { _deviceProfile.value = deviceProfile @@ -314,7 +314,7 @@ class RadioConfigViewModel @Inject constructor( } fun exportProfile(uri: Uri) = viewModelScope.launch { - val profile = deviceProfile ?: return@launch + val profile = deviceProfile.value ?: return@launch writeToUri(uri, profile) _deviceProfile.value = null } diff --git a/app/src/main/java/com/geeksville/mesh/ui/DeviceSettingsFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/DeviceSettingsFragment.kt index 2297f7e54..a605a64ea 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/DeviceSettingsFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/DeviceSettingsFragment.kt @@ -234,6 +234,7 @@ fun RadioConfigNavHost( val radioConfigState by viewModel.radioConfigState.collectAsStateWithLifecycle() var location by remember(node) { mutableStateOf(node?.position) } // FIXME + val deviceProfile by viewModel.deviceProfile.collectAsStateWithLifecycle() val isWaiting = radioConfigState.responseState !is ResponseState.Empty var showEditDeviceProfileDialog by remember { mutableStateOf(false) } @@ -254,7 +255,6 @@ fun RadioConfigNavHost( } } - val deviceProfile = viewModel.deviceProfile if (showEditDeviceProfileDialog) EditDeviceProfileDialog( title = if (deviceProfile != null) "Import configuration" else "Export configuration", deviceProfile = deviceProfile ?: viewModel.currentDeviceProfile, diff --git a/app/src/main/java/com/geeksville/mesh/ui/components/config/PacketResponseStateDialog.kt b/app/src/main/java/com/geeksville/mesh/ui/components/config/PacketResponseStateDialog.kt index c644449b0..e3280592f 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/components/config/PacketResponseStateDialog.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/components/config/PacketResponseStateDialog.kt @@ -51,7 +51,7 @@ fun PacketResponseStateDialog( if (state.total == state.completed) onComplete() } if (state is ResponseState.Success) { - Text("Delivery confirmed.") + Text("Delivery confirmed") } if (state is ResponseState.Error) { Text(text = "Error\n", textAlign = TextAlign.Center)