From b266094fba7c69dddebff708f195971d0d80abf2 Mon Sep 17 00:00:00 2001 From: Alexander Osokin Date: Mon, 20 Mar 2023 16:44:41 +0500 Subject: [PATCH] IOS-3226 Handle both codes resetting in same time --- .../Operations/ResetCode/ResetPinService.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinService.swift b/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinService.swift index da40b096d..d08e94f70 100644 --- a/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinService.swift +++ b/TangemSdk/TangemSdk/Operations/ResetCode/ResetPinService.swift @@ -45,7 +45,10 @@ public class ResetPinService: ObservableObject { } repo.accessCode = code.sha256() - currentState = currentState.next() + + if currentState == .needCode { + currentState = currentState.next() + } } public func setPasscode(_ code: String) throws { @@ -65,8 +68,12 @@ public class ResetPinService: ObservableObject { throw TangemSdkError.passcodeTooShort } } + repo.passcode = code.sha256() - currentState = currentState.next() + + if currentState == .needCode { + currentState = currentState.next() + } } public func proceed(with resetCardId: String? = nil) {