Skip to content

Commit

Permalink
fix: import config missing data
Browse files Browse the repository at this point in the history
  • Loading branch information
andrekir committed Oct 11, 2023
1 parent 7a01c4b commit d71a917
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class RadioConfigViewModel @Inject constructor(
}

private val _deviceProfile = MutableStateFlow<DeviceProfile?>(null)
val deviceProfile get() = _deviceProfile.value
val deviceProfile: StateFlow<DeviceProfile?> get() = _deviceProfile

fun setDeviceProfile(deviceProfile: DeviceProfile?) {
_deviceProfile.value = deviceProfile
Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fun <T> 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)
Expand Down

0 comments on commit d71a917

Please sign in to comment.