From 8ceb75ffea631d2b9a56ce241a98ea932680bd9d Mon Sep 17 00:00:00 2001 From: Yann Locatelli Date: Thu, 21 Sep 2023 05:52:22 +0200 Subject: [PATCH 1/2] :bug: (LekaUpdater): Fix persistent data nextStateIsClearingFile stay at same value (true) so cannot move to another state even with a new instance --- .../Sources/Libs/UpdateProcess/Version/UpdateProcessV130.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV130.swift b/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV130.swift index 5af59edc00..bdcd3ebb25 100644 --- a/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV130.swift +++ b/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV130.swift @@ -312,6 +312,8 @@ private class StateVerifyingFile: GKState, StateEventProcessor { override func didEnter(from previousState: GKState?) { if previousState is StateSettingDestinationPath { nextStateIsClearingFile = true + } else { + nextStateIsClearingFile = false } DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: startFileVerification) From b70a1c5e369632cf2b76a28b7aaa46a9a90e644b Mon Sep 17 00:00:00 2001 From: Yann Locatelli Date: Wed, 20 Sep 2023 21:12:23 +0200 Subject: [PATCH 2/2] :bug: (LekaUpdater): Store lastValue and skip if value is equal in verification file --- .../Libs/UpdateProcess/Version/UpdateProcessV130.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV130.swift b/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV130.swift index bdcd3ebb25..1dc47e2e84 100644 --- a/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV130.swift +++ b/Apps/LekaUpdater/Sources/Libs/UpdateProcess/Version/UpdateProcessV130.swift @@ -300,6 +300,7 @@ private class StateVerifyingFile: GKState, StateEventProcessor { private var cancellables: Set = [] private var isFileValid = false + private var lastValue = "0000000000000000000000000000000000000000000000000000000000000000" private var nextStateIsClearingFile = false @@ -351,9 +352,10 @@ private class StateVerifyingFile: GKState, StateEventProcessor { .sink { value in guard let value = value else { return } - if value == "0000000000000000000000000000000000000000000000000000000000000000" { + if value == self.lastValue { return } + self.lastValue = value self.isFileValid = value == globalFirmwareManager.sha256 self.process(event: .fileVerificationReceived) @@ -526,6 +528,7 @@ class UpdateProcessV130: UpdateProcessProtocol { private var stateMachine: GKStateMachine? private var stateSendingFile = StateSendingFile() + private var stateVerifyingFile = StateVerifyingFile() private var cancellables: Set = [] @@ -543,7 +546,7 @@ class UpdateProcessV130: UpdateProcessProtocol { StateSettingDestinationPath(), StateClearingFile(), stateSendingFile, - StateVerifyingFile(), + stateVerifyingFile, StateApplyingUpdate(), StateWaitingForRobotToReboot(),