fix(@desktop/onboarding): keycard is not shown in settings after first launch

Fixes: #11314
This commit is contained in:
Sale Djenic 2023-07-12 18:03:26 +02:00 committed by saledjenic
parent 7849d03707
commit f55123ddf1
3 changed files with 7 additions and 6 deletions

View File

@ -18,7 +18,7 @@ proc buildKeypairAndAddToMigratedKeypairs(self: CopyingKeycardState, controller:
keycardLocked: false,
keyUid: controller.getKeyPairForProcessing().getKeyUid(),
accountsAddresses: addresses)
controller.addKeycardOrAccounts(keycardDto)
controller.addKeycardOrAccounts(keycardDto, accountsComingFromKeycard = true)
proc runStoreMetadataFlow(self: CopyingKeycardState, controller: Controller) =
let cardMetadata = controller.getMetadataForKeycardCopy()
@ -32,7 +32,7 @@ method executePrePrimaryStateCommand*(self: CopyingKeycardState, controller: Con
self.buildKeypairAndAddToMigratedKeypairs(controller)
method executePreSecondaryStateCommand*(self: CopyingKeycardState, controller: Controller) =
## Secondary action is called after each async action during migration process.
## Secondary action is called after each async action during migration process.
if self.flowType == FlowType.CreateCopyOfAKeycard:
if controller.getAddingMigratedKeypairSuccess():
self.runStoreMetadataFlow(controller)
@ -42,12 +42,12 @@ method getNextSecondaryState*(self: CopyingKeycardState, controller: Controller)
if not controller.getAddingMigratedKeypairSuccess():
return createState(StateType.CopyingKeycardFailure, self.flowType, nil)
method resolveKeycardNextState*(self: CopyingKeycardState, keycardFlowType: string, keycardEvent: KeycardEvent,
method resolveKeycardNextState*(self: CopyingKeycardState, keycardFlowType: string, keycardEvent: KeycardEvent,
controller: Controller): State =
let state = ensureReaderAndCardPresenceAndResolveNextState(self, keycardFlowType, keycardEvent, controller)
if not state.isNil:
return state
if self.flowType == FlowType.CreateCopyOfAKeycard:
if keycardFlowType == ResponseTypeValueKeycardFlowResult and
if keycardFlowType == ResponseTypeValueKeycardFlowResult and
keycardEvent.error.len == 0:
return createState(StateType.CopyingKeycardSuccess, self.flowType, nil)

View File

@ -74,7 +74,8 @@ const FlowsWeShouldNotTryAKeycardSyncFor* = @[
FlowType.SetupNewKeycardNewSeedPhrase,
FlowType.SetupNewKeycardOldSeedPhrase,
FlowType.ImportFromKeycard,
FlowType.Authentication
FlowType.Authentication,
FlowType.CreateCopyOfAKeycard
]
type

View File

@ -269,7 +269,7 @@ proc handleKeycardSyncing[T](self: Module[T]) =
if accountsToRemove.len > 0:
self.controller.removeMigratedAccountsForKeycard(kpDto.keyUid, kpDto.keycardUid, accountsToRemove)
if kpDto.accountsAddresses.len > 0:
self.controller.addKeycardOrAccounts(kpDto)
self.controller.addKeycardOrAccounts(kpDto, accountsComingFromKeycard = true)
# if all accounts are removed from the app, there is no point in storing empty accounts list to a keycard, cause in that case
# keypair which is on that keycard won't be known to the app, that means keypair was removed from the app
if activeValidPathsToStoreToAKeycard.len > 0: