refactor: improve import feedback and use begin/commit transactions

pull/1026/head
andrekir 2024-05-12 09:19:11 -03:00
rodzic 4047e8aebf
commit 37df3ce084
1 zmienionych plików z 3 dodań i 4 usunięć

Wyświetl plik

@ -322,13 +322,13 @@ class RadioConfigViewModel @Inject constructor(
fun installProfile(protobuf: DeviceProfile) = with(protobuf) {
_deviceProfile.value = null
// meshService?.beginEditSettings()
meshService?.beginEditSettings()
if (hasLongName() || hasShortName()) destNode.value?.user?.let {
val user = it.copy(
longName = if (hasLongName()) longName else it.longName,
shortName = if (hasShortName()) shortName else it.shortName
)
setOwner(user.toProto())
if (it != user) setOwner(user.toProto())
}
if (hasChannelUrl()) try {
setChannels(channelUrl)
@ -360,8 +360,7 @@ class RadioConfigViewModel @Inject constructor(
setModuleConfig(moduleConfig { detectionSensor = it.detectionSensor })
setModuleConfig(moduleConfig { paxcounter = it.paxcounter })
}
setResponseStateSuccess()
// meshService?.commitEditSettings()
meshService?.commitEditSettings()
}
fun clearPacketResponse() {