diff --git a/Components/LaunchScreen.js b/Components/LaunchScreen.js index ee2adda..9504b41 100644 --- a/Components/LaunchScreen.js +++ b/Components/LaunchScreen.js @@ -26,10 +26,10 @@ export default class LaunchScreen extends Component { registry_addr: null, } - /*componentDidMount() { + componentDidMount() { const { navigation } = this.props; const { navigate } = navigation; - const { params } = navigation.state; + const params = navigation.state.params || {}; this.state.navigate = navigate; Keys.getAddress() .then((addr) => { @@ -53,15 +53,13 @@ export default class LaunchScreen extends Component { (params.enter_phrase === false && (!params.seed_written || !params.double_check)) ) ) { - x=1 - //navigate('Setup', params) + navigate('Setup', params) } else if (!this.state.s || !this.state.device_addr) { - //navigate('RegisterDevice', params) - x=2 + navigate('RegisterDevice', params) } }) - }*/ + } //openDevices() { this.state.navigate('Devices') } diff --git a/Components/Screens/SetupScreen.js b/Components/Screens/SetupScreen.js index dbeac62..5085764 100644 --- a/Components/Screens/SetupScreen.js +++ b/Components/Screens/SetupScreen.js @@ -41,24 +41,29 @@ export default class RegisterScreen extends Component { renderProceed() { if (!this.state.seed_written) { return ( - + ); } else { - this.props.navigation.navigate('RegisterDevice'); + this.state.seed_written = true; + this.state.double_check = true; + return; } } @@ -69,7 +74,7 @@ export default class RegisterScreen extends Component { Your secret backup phrase - + {this.state.m} @@ -179,10 +184,10 @@ export default class RegisterScreen extends Component { ) } else if (params.enter_phrase && params.phrase_matches == false) { return this.renderEnterPhrase() - } else if (!params.enter_phrase && (!params.seed_written || !params.double_check)) { + } else if (!params.enter_phrase && (!this.state.seed_written || !this.state.double_check)) { return this.renderBackupPhrase() } else { - navigate('RegisterDevice') + this.props.navigation.navigate('LaunchScreen'); } } diff --git a/Components/Util/Fs.js b/Components/Util/Fs.js index cc9b803..496e37d 100644 --- a/Components/Util/Fs.js +++ b/Components/Util/Fs.js @@ -26,6 +26,7 @@ function write(path, data, encoding) { function read(path) { return new Promise((resolve, reject) => { + console.log('bas_dir', ifs.DocumentDirectoryPath) ifs.exists(path) .then((exists) => { if (exists) { return ifs.readFile(path) } diff --git a/Components/Util/Keys.js b/Components/Util/Keys.js index 6a9807a..8504e33 100644 --- a/Components/Util/Keys.js +++ b/Components/Util/Keys.js @@ -52,7 +52,7 @@ function generateKey() { } function hash(s) { - sha3(s) + return sha3(s) } // See if a key exists. Returns the mnemonic or null diff --git a/Navigation/AppNavigation.js b/Navigation/AppNavigation.js index 553d77a..e4ec8d1 100644 --- a/Navigation/AppNavigation.js +++ b/Navigation/AppNavigation.js @@ -11,9 +11,9 @@ let init_route = 'LaunchScreen'; // Manifest of possible screens const PrimaryNav = StackNavigator({ LaunchScreen: { screen: LaunchScreen }, - // Devices: { screen: DevicesScreen }, - // Setup: { screen: SetupScreen }, - // RegisterDevice: { screen: RegisterDeviceScreen }, + Devices: { screen: DevicesScreen }, + Setup: { screen: SetupScreen }, + RegisterDevice: { screen: RegisterDeviceScreen }, }, { // Default config for all screens headerMode: 'none', diff --git a/package-lock.json b/package-lock.json index 3d8da70..4df5bfd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1875,6 +1875,11 @@ "minimalistic-crypto-utils": "1.0.1" } }, + "emitter-component": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/emitter-component/-/emitter-component-1.1.1.tgz", + "integrity": "sha1-Bl4tvtaVm/RwZ57avq95gdEAOrY=" + }, "encoding": { "version": "0.1.12", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", @@ -2008,6 +2013,11 @@ "inherits": "2.0.3" } }, + "js-sha3": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.5.tgz", + "integrity": "sha1-uvDA6MVK1ZA0R9+Wreekobynmko=" + }, "randombytes": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.3.tgz", @@ -2077,6 +2087,11 @@ "inherits": "2.0.3" } }, + "js-sha3": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.5.tgz", + "integrity": "sha1-uvDA6MVK1ZA0R9+Wreekobynmko=" + }, "number-to-bn": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.1.0.tgz", @@ -4585,9 +4600,9 @@ } }, "js-sha3": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.5.tgz", - "integrity": "sha1-uvDA6MVK1ZA0R9+Wreekobynmko=" + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.6.1.tgz", + "integrity": "sha1-W4n3enR3Z5h39YxKB1JAk0sflcA=" }, "js-tokens": { "version": "3.0.2", @@ -7116,6 +7131,14 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" }, + "stream": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stream/-/stream-0.0.2.tgz", + "integrity": "sha1-f1Nj8Ff2WSxVlfALyAon9c7B8O8=", + "requires": { + "emitter-component": "1.1.1" + } + }, "stream-browserify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-1.0.0.tgz", diff --git a/package.json b/package.json index 5275865..dd1e337 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "ethjs-signer": "^0.1.1", "events": "^1.1.1", "https-browserify": "0.0.1", + "js-sha3": "^0.6.1", "path-browserify": "0.0.0", "process": "^0.11.10", "react": "16.0.0-alpha.12", @@ -34,6 +35,7 @@ "react-navigation": "^1.0.0-beta.11", "readable-stream": "^1.0.33", "rlp": "^2.0.0", + "stream": "0.0.2", "stream-browserify": "^1.0.0", "url": "^0.10.3", "vm-browserify": "0.0.4"