Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
parity-signer
Commits
99a46b58
Commit
99a46b58
authored
May 04, 2019
by
Thibaut Sardan
Browse files
fix(): whitespace before function parenthesis
parent
7f268eac
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/screens/AccountBackup.js
View file @
99a46b58
...
...
@@ -30,7 +30,7 @@ export default class AccountBackup extends React.PureComponent {
static
navigationOptions
=
{
title
:
'
Account Backup
'
};
render
()
{
render
()
{
return
(
<
Subscribe
to
=
{[
AccountsStore
]}
>
{
accounts
=>
<
AccountBackupView
{...
this
.
props
}
accounts
=
{
accounts
}
/>
}
...
...
@@ -45,7 +45,7 @@ class AccountBackupView extends React.PureComponent {
this
.
handleAppStateChange
=
this
.
handleAppStateChange
.
bind
(
this
);
}
componentDidMount
()
{
componentDidMount
()
{
AppState
.
addEventListener
(
'
change
'
,
this
.
handleAppStateChange
);
}
...
...
@@ -55,7 +55,7 @@ class AccountBackupView extends React.PureComponent {
}
}
componentWillUnmount
()
{
componentWillUnmount
()
{
const
{
accounts
}
=
this
.
props
;
const
selected
=
accounts
.
getNew
().
address
&&
accounts
.
getNew
().
address
.
length
...
...
@@ -65,8 +65,7 @@ class AccountBackupView extends React.PureComponent {
AppState
.
removeEventListener
(
'
change
'
,
this
.
_handleAppStateChange
);
}
render
()
{
render
()
{
const
{
accounts
,
navigation
}
=
this
.
props
;
const
isNew
=
navigation
.
getParam
(
'
isNew
'
);
const
selected
=
isNew
?
accounts
.
getNew
()
:
accounts
.
getSelected
();
...
...
src/screens/AccountNew.js
View file @
99a46b58
...
...
@@ -35,7 +35,7 @@ export default class AccountNew extends React.Component {
title
:
'
New Account
'
,
headerBackTitle
:
'
Back
'
};
render
()
{
render
()
{
return
(
<
Subscribe
to
=
{[
AccountsStore
]}
>
{
accounts
=>
<
AccountNewView
{...
this
.
props
}
accounts
=
{
accounts
}
/>
}
...
...
@@ -45,7 +45,7 @@ export default class AccountNew extends React.Component {
}
class
AccountNewView
extends
React
.
Component
{
render
()
{
render
()
{
const
{
accounts
}
=
this
.
props
;
const
selected
=
accounts
.
getNew
();
const
chainId
=
selected
.
chainId
;
...
...
src/screens/AccountPin.js
View file @
99a46b58
...
...
@@ -27,7 +27,7 @@ import TextInput from '../components/TextInput';
import
AccountsStore
from
'
../stores/AccountsStore
'
;
export
default
class
AccountPin
extends
React
.
PureComponent
{
render
()
{
render
()
{
return
(
<
Subscribe
to
=
{[
AccountsStore
]}
>
{
accounts
=>
<
AccountPinView
{...
this
.
props
}
accounts
=
{
accounts
}
/>
}
...
...
@@ -50,7 +50,7 @@ class AccountPinView extends React.PureComponent {
pinMismatch
:
false
};
async
submit
()
{
async
submit
()
{
const
{
accounts
,
navigation
}
=
this
.
props
;
const
accountCreation
=
navigation
.
getParam
(
'
isNew
'
);
const
{
pin
}
=
this
.
state
;
...
...
@@ -96,7 +96,7 @@ class AccountPinView extends React.PureComponent {
return (<Text style={styles.hintText}>Choose a PIN code with 6 or more digits</Text>)
}
render
() {
render() {
const title =
'
ACCOUNT
PIN
'
;
return (
<View style={styles.body}>
...
...
@@ -133,7 +133,7 @@ class AccountPinView extends React.PureComponent {
}
class PinInput extends Component {
render
() {
render() {
return (
<TextInput
keyboardAppearance="dark"
...
...
src/stores/AccountsStore.js
View file @
99a46b58
...
...
@@ -53,7 +53,7 @@ export default class AccountsStore extends Container<AccountsState> {
this
.
refreshList
();
}
async
select
(
account
)
{
async
select
(
account
)
{
return
new
Promise
((
res
,
rej
)
=>
{
this
.
setState
(
state
=>
({
selected
:
accountId
(
account
)
}),
...
...
@@ -64,7 +64,7 @@ export default class AccountsStore extends Container<AccountsState> {
});
}
updateNew
(
accountUpdate
:
Object
)
{
updateNew
(
accountUpdate
:
Object
)
{
Object
.
assign
(
this
.
state
.
newAccount
,
accountUpdate
);
const
{
seed
}
=
this
.
state
.
newAccount
;
if
(
typeof
seed
===
'
string
'
)
{
...
...
@@ -78,11 +78,11 @@ export default class AccountsStore extends Container<AccountsState> {
this
.
setState
({});
}
getNew
():
Account
{
getNew
():
Account
{
return
this
.
state
.
newAccount
;
}
async
submitNew
(
pin
)
{
async
submitNew
(
pin
)
{
const
account
=
this
.
state
.
newAccount
;
await
this
.
save
(
account
,
pin
);
this
.
setState
({
...
...
@@ -91,7 +91,7 @@ export default class AccountsStore extends Container<AccountsState> {
});
}
update
(
accountUpdate
)
{
update
(
accountUpdate
)
{
let
account
=
this
.
state
.
accounts
.
get
(
accountId
(
accountUpdate
));
if
(
!
account
)
{
this
.
state
.
accounts
.
set
(
accountId
(
accountUpdate
),
accountUpdate
);
...
...
@@ -101,20 +101,20 @@ export default class AccountsStore extends Container<AccountsState> {
this
.
setState
({});
}
updateSelected
(
accountUpdate
)
{
updateSelected
(
accountUpdate
)
{
this
.
update
(
Object
.
assign
(
this
.
getSelected
(),
accountUpdate
));
}
async
refreshList
()
{
async
refreshList
()
{
loadAccounts
().
then
(
res
=>
{
const
accounts
=
new
Map
(
res
.
map
(
a
=>
[
accountId
(
a
),
a
]));
this
.
setState
({
accounts
});
});
}
async
loadAccountTxs
()
{
}
async
loadAccountTxs
()
{
}
async
save
(
account
,
pin
=
null
)
{
async
save
(
account
,
pin
=
null
)
{
try
{
if
(
pin
&&
account
.
seed
)
{
let
encryptedSeed
=
await
encryptData
(
account
.
seed
,
pin
);
...
...
@@ -128,7 +128,7 @@ export default class AccountsStore extends Container<AccountsState> {
}
}
async
deleteAccount
(
account
)
{
async
deleteAccount
(
account
)
{
account
.
archived
=
true
;
this
.
state
.
accounts
.
set
(
accountId
(
account
),
account
);
this
.
setState
({
...
...
@@ -137,11 +137,11 @@ export default class AccountsStore extends Container<AccountsState> {
await
this
.
save
(
account
);
}
async
saveSelected
(
pin
)
{
async
saveSelected
(
pin
)
{
await
this
.
save
(
this
.
getSelected
(),
pin
);
}
async
unlockAccount
(
account
,
pin
)
{
async
unlockAccount
(
account
,
pin
)
{
if
(
!
account
||
!
account
.
encryptedSeed
)
{
return
false
;
}
...
...
@@ -156,7 +156,7 @@ export default class AccountsStore extends Container<AccountsState> {
return
true
;
}
lockAccount
(
account
)
{
lockAccount
(
account
)
{
const
acc
=
this
.
state
.
accounts
.
get
(
accountId
(
account
));
if
(
acc
)
{
delete
acc
.
seed
;
...
...
@@ -164,7 +164,7 @@ export default class AccountsStore extends Container<AccountsState> {
this
.
setState
({});
}
async
checkPinForSelected
(
pin
)
{
async
checkPinForSelected
(
pin
)
{
const
account
=
this
.
getSelected
();
if
(
account
&&
account
.
encryptedSeed
)
{
return
await
decryptData
(
account
.
encryptedSeed
,
pin
);
...
...
@@ -173,21 +173,21 @@ export default class AccountsStore extends Container<AccountsState> {
}
}
getById
(
account
):
?
Account
{
getById
(
account
):
?
Account
{
return
this
.
state
.
accounts
.
get
(
accountId
(
account
))
||
empty
(
account
);
}
getByAddress
(
address
):
?
Account
{
getByAddress
(
address
):
?
Account
{
return
this
.
getAccounts
().
find
(
a
=>
a
.
address
.
toLowerCase
()
===
address
.
toLowerCase
()
);
}
getSelected
():
?
Account
{
getSelected
():
?
Account
{
return
this
.
state
.
accounts
.
get
(
this
.
state
.
selected
);
}
getAccounts
():
Array
<
Account
>
{
getAccounts
():
Array
<
Account
>
{
return
Array
.
from
(
this
.
state
.
accounts
.
values
())
.
filter
(
a
=>
!
a
.
archived
&&
a
.
chainId
)
.
sort
((
a
,
b
)
=>
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment