Skip to content

Commit

Permalink
Fix bug, when repeated wallet initialization fails
Browse files Browse the repository at this point in the history
  • Loading branch information
i1skn committed Feb 11, 2019
1 parent 2ebb4a8 commit 07fea9c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/modules/wallet.js
Expand Up @@ -89,6 +89,7 @@ const walletInit = function(
...state,
inProgress: true,
progress: 0,
mnemonic: '',
}
case 'WALLET_INIT_SUCCESS':
return {
Expand Down
17 changes: 9 additions & 8 deletions src/screens/Initial.js
Expand Up @@ -19,7 +19,7 @@ import { ActivityIndicator } from 'react-native'
import { connect } from 'react-redux'
import styled from 'styled-components/native'

import { colors, WALLET_DATA_DIRECTORY } from 'common'
import { colors, WALLET_DATA_DIRECTORY, isWalletInitialized } from 'common'
import { type State as ReduxState, type Currency, type Error, type Navigation } from 'common/types'
import RNFS from 'react-native-fs'

Expand Down Expand Up @@ -54,13 +54,14 @@ class Initial extends Component<Props, State> {
}

componentDidMount() {
RNFS.readFile(WALLET_DATA_DIRECTORY + '/wallet.seed', 'utf8')
.then(slate => {
this.props.navigation.navigate('App')
})
.catch(error => {
this.props.navigation.navigate('Landing')
})
const { navigation } = this.props
isWalletInitialized().then(exists => {
if (exists) {
navigation.navigate('App')
} else {
navigation.navigate('Landing')
}
})
}

componentDidUpdate(prevProps) {}
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Landing.js
Expand Up @@ -96,7 +96,7 @@ class Landing extends Component<Props, State> {
}}
/>
<FlexGrow />
<Text>Version: {pkg.version} (alpha)</Text>
<Text>Version: {pkg.version} (floonet)</Text>
<Spacer />
</Wrapper>
)
Expand Down

0 comments on commit 07fea9c

Please sign in to comment.