Decouple ScannedQrCodeDialog from UiViewModel (#3300)

This commit is contained in:
Phil Oliver 2025-10-03 06:12:40 -04:00 committed by GitHub
parent f854cafe6f
commit 4a8cd6fb41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 105 additions and 21 deletions

View file

@ -347,23 +347,6 @@ constructor(
}
}
fun setChannel(channel: ChannelProtos.Channel) {
try {
meshService?.setChannel(channel.toByteArray())
} catch (ex: RemoteException) {
Timber.e(ex, "Set channel error")
}
}
/** Set the radio config (also updates our saved copy in preferences). */
fun setChannels(channelSet: AppOnlyProtos.ChannelSet) = viewModelScope.launch {
getChannelList(channelSet.settingsList, channels.value.settingsList).forEach(::setChannel)
radioConfigRepository.replaceAllSettings(channelSet.settingsList)
val newConfig = config { lora = channelSet.loraConfig }
if (config.lora != newConfig.lora) setConfig(newConfig)
}
fun addQuickChatAction(action: QuickChatAction) =
viewModelScope.launch(Dispatchers.IO) { quickChatActionRepository.upsert(action) }