From b70a1c5e369632cf2b76a28b7aaa46a9a90e644b Mon Sep 17 00:00:00 2001 From: Yann Locatelli Date: Wed, 20 Sep 2023 21:12:23 +0200 Subject: [PATCH] :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(),