From 323ed071391fdb4f493f13cecef0e06565c05677 Mon Sep 17 00:00:00 2001 From: StephenHeaps <5314553+StephenHeaps@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:45:16 -0400 Subject: [PATCH] Fix #8291: Onboarding can get stuck if crashed before keyring saved (#8293) Add fallback for case where user completes onboarding, but keyring is not saved. Bug could lock user into onboarding without any way to dismiss Wallet or proceed. --- Sources/BraveWallet/Crypto/Stores/KeyringStore.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/BraveWallet/Crypto/Stores/KeyringStore.swift b/Sources/BraveWallet/Crypto/Stores/KeyringStore.swift index 4217f26dfee..315b650ab23 100644 --- a/Sources/BraveWallet/Crypto/Stores/KeyringStore.swift +++ b/Sources/BraveWallet/Crypto/Stores/KeyringStore.swift @@ -304,6 +304,10 @@ public class KeyringStore: ObservableObject, WalletObserverStore { self.defaultKeyring = defaultKeyring self.isDefaultKeyringLoaded = true self.isDefaultKeyringCreated = defaultKeyring.isKeyringCreated + // fallback case where user completed front-end onboarding, but has no keyring created/accounts. + if !defaultKeyring.isKeyringCreated && Preferences.Wallet.isOnboardingCompleted.value { + Preferences.Wallet.isOnboardingCompleted.reset() + } } self.allKeyrings = allKeyrings if let selectedAccountKeyring = allKeyrings.first(where: { $0.id == selectedAccount?.keyringId }) {