Skip to content

Commit

Permalink
fix: move strongholdVersion logic from create profile to finish onboa…
Browse files Browse the repository at this point in the history
…rding (#7304)
  • Loading branch information
cpl121 authored Aug 3, 2023
1 parent e7b469f commit 38c65bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
completeOnboardingProcess,
isOnboardingLedgerProfile,
onboardingProfile,
updateOnboardingProfile,
} from '@contexts/onboarding'
import { mobile } from '@core/app'
import { localize } from '@core/i18n'
import { checkOrConnectLedger } from '@core/ledger'
import { ProfileType } from '@core/profile'
import { setStrongholdPassword } from '@core/profile-manager'
import { STRONGHOLD_VERSION } from '@core/stronghold'
import { Animation, Button, Icon, Text, TextHint } from '@ui'
import { TextType } from '@ui/enums'
import { onboardingRouter } from '@views/onboarding/onboarding-router'
Expand All @@ -29,6 +32,9 @@
if ($onboardingProfile?.restoreProfileType === RestoreProfileType.Stronghold) {
await setStrongholdPassword($onboardingProfile.strongholdPassword)
}
const isLedgerProfile = $onboardingProfile?.type === ProfileType.Ledger
const strongholdVersion = isLedgerProfile ? undefined : STRONGHOLD_VERSION
updateOnboardingProfile({ ...(strongholdVersion && { strongholdVersion }) })
completeOnboardingProcess()
$onboardingRouter.next()
return Promise.resolve()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import { destroyProfileManager } from '@core/profile-manager/actions'
import { Icon as IconEnum } from '@auxiliary/icon'
import { AnimationEnum } from '@auxiliary/animation'
import { STRONGHOLD_VERSION } from '@core/stronghold'
let isBusy = {
[CreateProfileType.Mnemonic]: false,
Expand All @@ -28,10 +27,8 @@
async function onProfileTypeClick(createProfileType: CreateProfileType): Promise<void> {
isBusy = { ...isBusy, [createProfileType]: true }
const isLedgerProfile = createProfileType === CreateProfileType.Ledger
const type = isLedgerProfile ? ProfileType.Ledger : ProfileType.Software
const strongholdVersion = isLedgerProfile ? undefined : STRONGHOLD_VERSION
updateOnboardingProfile({ createProfileType, type, ...(strongholdVersion && { strongholdVersion }) })
const type = createProfileType === CreateProfileType.Ledger ? ProfileType.Ledger : ProfileType.Software
updateOnboardingProfile({ createProfileType, type })
await initialiseProfileManagerFromOnboardingProfile()
$createProfileRouter.next()
}
Expand Down

0 comments on commit 38c65bb

Please sign in to comment.