refactor: recommended and required firmware updates (#2012)

This commit is contained in:
James Rich 2025-06-03 19:58:21 -05:00 committed by GitHub
parent 868d705b2d
commit 38982bc37b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 57 additions and 7 deletions

View file

@ -55,6 +55,8 @@ import com.geeksville.mesh.database.QuickChatActionRepository
import com.geeksville.mesh.database.entity.MyNodeEntity
import com.geeksville.mesh.database.entity.Packet
import com.geeksville.mesh.database.entity.QuickChatAction
import com.geeksville.mesh.database.entity.asDeviceVersion
import com.geeksville.mesh.repository.api.FirmwareReleaseRepository
import com.geeksville.mesh.repository.datastore.RadioConfigRepository
import com.geeksville.mesh.repository.location.LocationRepository
import com.geeksville.mesh.repository.radio.RadioInterfaceService
@ -77,6 +79,7 @@ import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.flow.mapNotNull
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
@ -183,6 +186,7 @@ class UIViewModel @Inject constructor(
private val packetRepository: PacketRepository,
private val quickChatActionRepository: QuickChatActionRepository,
private val locationRepository: LocationRepository,
firmwareReleaseRepository: FirmwareReleaseRepository,
private val preferences: SharedPreferences
) : ViewModel(), Logging {
@ -560,6 +564,8 @@ class UIViewModel @Inject constructor(
showSnackbar(R.string.channel_invalid)
}
val latestStableFirmwareRelease = firmwareReleaseRepository.stableRelease.mapNotNull { it?.asDeviceVersion() }
/**
* Called immediately after activity observes requestChannelUrl
*/