Round 2 release candidate 2: round branch merged with main (updater) and Back fix #68
2 changed files with 9 additions and 1 deletions
|
|
@ -9,16 +9,22 @@ class FakeUpdateController(
|
|||
initialState: UpdateUiState = UpdateUiState.Idle,
|
||||
initialAutoCheck: Boolean = true,
|
||||
initialVersion: InstalledVersion = InstalledVersion("1.1.1", 100001),
|
||||
initialRelease: UpdateUiState.Available? = initialState as? UpdateUiState.Available,
|
||||
) : UpdateController {
|
||||
private val mutableState = MutableStateFlow(initialState)
|
||||
private val mutableAutoCheck = MutableStateFlow(initialAutoCheck)
|
||||
private val mutableVersion = MutableStateFlow(initialVersion)
|
||||
private val mutableRelease = MutableStateFlow(initialRelease)
|
||||
override val state = mutableState.asStateFlow()
|
||||
override val autoCheck = mutableAutoCheck.asStateFlow()
|
||||
override val installedVersion = mutableVersion.asStateFlow()
|
||||
override val release = mutableRelease.asStateFlow()
|
||||
val actions = mutableListOf<String>()
|
||||
|
||||
fun show(state: UpdateUiState) { mutableState.value = state }
|
||||
fun show(state: UpdateUiState) {
|
||||
if (state is UpdateUiState.Available) mutableRelease.value = state
|
||||
mutableState.value = state
|
||||
}
|
||||
fun showInstalled(version: InstalledVersion) { mutableVersion.value = version }
|
||||
override fun check(manual: Boolean) { actions += "check:$manual" }
|
||||
override fun download() { actions += "download" }
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ interface UpdateController {
|
|||
val state: StateFlow<UpdateUiState>
|
||||
val autoCheck: StateFlow<Boolean>
|
||||
val installedVersion: StateFlow<InstalledVersion>
|
||||
/** Candidate facts survive download/installer transitions and verified-file restoration. */
|
||||
val release: StateFlow<UpdateUiState.Available?>
|
||||
|
||||
fun check(manual: Boolean)
|
||||
fun download()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue