-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sign up + LockScreen #28
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Very clean PR, mostly nit comments. Nothing should hold this up, so I'll approve. Feel free to fix or not fix these comments.
app/components/AccountList/index.js
Outdated
onAccountChange = async newIndex => { | ||
try { | ||
this.setState({ selectedAccountIndex: newIndex }); | ||
await Engine.api.preferences.update({ selectedAddress: Object.keys(this.props.accounts)[newIndex] }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worry about the order of these operations. I understand we're updating the UI instantly for speed then calling the background update, but maybe we should revert the UI to the previous address in the catch
. That way we don't run the risk of this component's selectedAccountIndex
getting out of sync with the preference controller's selectedAddress
.
Whatever we decide, I think this should be a pattern throughout when interacting with the Engine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was a good call. I feel like we should do this everywhere
addAccount = async () => { | ||
try { | ||
await Engine.api.keyring.addNewAccount(); | ||
this.setState({ selectedAccountIndex: Object.keys(this.props.accounts).length - 1 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment re: catching & reverting when interacting with the engine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case isn't necessary because if the engine blows up it will never change the index.
app/components/AccountList/index.js
Outdated
} | ||
}; | ||
|
||
accountSettings = () => false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: can we name this so it's obvious it's a method? openAccountSettings
or something similar?
app/components/AccountList/index.js
Outdated
icon: { | ||
height: 50, | ||
width: 10, | ||
backgroundColor: colors.concrete | ||
} | ||
}); | ||
|
||
/** | ||
* View contains the list of all the available accounts | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I don't think components can have a newline between the component description and the class for documentation generation. Not 100% sure, but that's been the case in the past.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shit, I've been doing this all over the place!
app/components/App/index.js
Outdated
import Main from '../Main'; | ||
import AccountList from '../AccountList'; | ||
|
||
import Engine from '../../core/Engine'; | ||
/** | ||
* Root application component responsible for instantiating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Can we update this to be more descriptive of the conditional rendering logic and move this description to the exported class, not the Nav component?
app/core/Encryptor.js
Outdated
|
||
_decryptWithKey = (encryptedData, key) => Aes.decrypt(encryptedData.cipher, key, encryptedData.iv); | ||
|
||
encrypt = async (password, object) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we document this since it's public?
app/core/Encryptor.js
Outdated
return JSON.stringify(result); | ||
}; | ||
|
||
decrypt = async (password, encryptedString) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we document this since it's public?
app/core/Encryptor.js
Outdated
import { NativeModules } from 'react-native'; | ||
const Aes = NativeModules.Aes; | ||
|
||
export default class Encryptor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a simple description to this class?
app/core/Engine.js
Outdated
|
||
/** | ||
* Core controller responsible for composing other GABA controllers together | ||
* and exposing convenience methods for common wallet operations. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: can we move this description to right above the Engine class? Otherwise documentation may get generated incorrectly.
shim.js
Outdated
@@ -1,3 +1,5 @@ | |||
import {decode, encode} from 'base-64' | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's chat as to why this needs to be included int the repo (if it's generated at least; if it's not generated, we should format it and lint it properly.) Not a big deal, just curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you move the lines 1-15 out of the shim.js to the./ index.js you'll see you get an error: self is not defined. I think it's related to the way "import" works.
Bumps [node-notifier](https://github.com/mikaelbr/node-notifier) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/mikaelbr/node-notifier/releases) - [Changelog](https://github.com/mikaelbr/node-notifier/blob/v8.0.1/CHANGELOG.md) - [Commits](mikaelbr/node-notifier@v8.0.0...v8.0.1) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* ready to create accounts * account generation working * added login screen * avoid setstate when unmounted * clean up * more clean up * account list using real addresses * account list using real addresses * clean up * update tests * clean up * fix android builds * android and ios are working * android view looking good * UI refactor * code review stuff * update * more code review stuff
As all runtimes now support atob and btoa, the base-64 shim is not used. Originally introduced in #28 (b08e380). - https://developer.mozilla.org/en-US/docs/Web/API/atob#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/API/btoa#browser_compatibility
As all runtimes now support atob and btoa, the base-64 shim is not used. Originally introduced in #28 (b08e380). - https://developer.mozilla.org/en-US/docs/Web/API/atob#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/API/btoa#browser_compatibility
Description
This PR relates to account creation and listing.
DEMO:
Checklist
Issue