Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Commit

Permalink
Mobile: Fix SeedVault export name (#1312)
Browse files Browse the repository at this point in the history
  • Loading branch information
cvarley100 committed Apr 15, 2019
1 parent 30aaebf commit 3241e28
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/mobile/src/ui/components/SeedVaultExportComponent.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import isEmpty from 'lodash/isEmpty';
import values from 'lodash/values';
import isEqual from 'lodash/isEqual';
import React, { Component } from 'react';
Expand Down Expand Up @@ -168,8 +169,12 @@ class SeedVaultExportComponent extends Component {
await getAndroidFileSystemPermissions();
}
const { t, selectedAccountName } = this.props;

const path = SeedVaultExportComponent.getPath(removeNonAlphaNumeric(selectedAccountName, 'SeedVault').trim());
const path = SeedVaultExportComponent.getPath(
removeNonAlphaNumeric(
isEmpty(global.onboardingSeed) ? selectedAccountName : '',
SEED_VAULT_DEFAULT_TITLE,
).trim(),
);

this.setState({ path });

Expand Down Expand Up @@ -261,7 +266,10 @@ class SeedVaultExportComponent extends Component {
// If it's undefined, use the fallback title
serialise({
seed: tritsToChars(this.state.seed),
title: removeNonAlphaNumeric(selectedAccountName, SEED_VAULT_DEFAULT_TITLE),
title: removeNonAlphaNumeric(
isEmpty(global.onboardingSeed) ? selectedAccountName : '',
SEED_VAULT_DEFAULT_TITLE,
),
}) +
'~' +
UInt8ToString(this.state.password),
Expand Down
1 change: 1 addition & 0 deletions src/mobile/src/ui/views/onboarding/NewSeedSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class NewSeedSetup extends Component {
}

onBackPress() {
delete global.onboardingSeed;
navigator.pop(this.props.componentId);
}

Expand Down
1 change: 1 addition & 0 deletions src/mobile/src/ui/views/onboarding/SetAccountName.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export class SetAccountName extends Component {
if (onboardingComplete) {
const seedStore = await new SeedStore.keychain(global.passwordHash);
seedStore.addAccount(accountName, global.onboardingSeed);
delete global.onboardingSeed;
navigator.setStackRoot('loading');
} else {
navigator.push('setPassword');
Expand Down

0 comments on commit 3241e28

Please sign in to comment.