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
a1bb1c41
Commit
a1bb1c41
authored
Feb 10, 2017
by
Marek Kotewicz
Browse files
signer scene and events, fixed warnings
parent
2cc2fed8
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/actions/transactions.js
0 → 100644
View file @
a1bb1c41
import
{
NEW_SCANNED_TX
}
from
'
../constants/TransactionActions
'
export
function
newScannedTx
(
data
)
{
return
{
type
:
NEW_SCANNED_TX
,
data
:
data
,
}
}
src/components/AccountsList.js
View file @
a1bb1c41
...
...
@@ -27,6 +27,7 @@ export default class AccountsList extends Component {
style
=
{
styles
.
view
}
dataSource
=
{
this
.
state
.
dataSource
}
renderRow
=
{(
rowData
)
=>
<
AccountsListRow
text
=
{
rowData
}
/>
}
enableEmptySections
=
{
true
}
/
>
)
}
...
...
src/components/App.js
View file @
a1bb1c41
...
...
@@ -6,6 +6,7 @@ import { Actions, ActionConst, Router, Scene } from 'react-native-router-flux'
import
reducers
from
'
../reducers
'
import
TabIcon
from
'
./TabIcon
'
import
QrScanner
from
'
../containers/QrScanner
'
import
Signer
from
'
../containers/Signer
'
import
Accounts
from
'
../containers/Accounts
'
import
NewAccount
from
'
../containers/NewAccount
'
...
...
@@ -16,24 +17,13 @@ const scenes = Actions.create(
<
Scene
key
=
'
root
'
>
<
Scene
key
=
'
tabs
'
tabs
>
<
Scene
key
=
'
send
'
component
=
{
View
}
title
=
'
Send TX
'
icon
=
{
TabIcon
}
/
>
<
Scene
key
=
'
scan
'
component
=
{
QrScanner
}
title
=
'
Scan QR
'
icon
=
{
TabIcon
}
initial
/>
<
Scene
key
=
'
accounts
'
title
=
'
Accounts
'
icon
=
{
TabIcon
}
>
<
Scene
key
=
'
accountsList
'
title
=
'
Accounts
'
component
=
{
Accounts
}
rightTitle
=
"
Add
"
onRight
=
{()
=>
Actions
.
add
()}
/
>
<
Scene
key
=
'
add
'
component
=
{
NewAccount
}
title
=
'
Add Account
'
/>
<
Scene
key
=
'
mid
'
title
=
'
Scan QR
'
initial
icon
=
{
TabIcon
}
>
<
Scene
key
=
'
scan
'
component
=
{
QrScanner
}
title
=
'
Scan QR
'
/>
<
Scene
key
=
'
signer
'
component
=
{
Signer
}
title
=
'
Sign Tx
'
/>
<
/Scene
>
<
Scene
key
=
'
accounts
'
title
=
'
Accounts
'
icon
=
{
TabIcon
}
>
<
Scene
key
=
'
accountsList
'
title
=
'
Accounts
'
component
=
{
Accounts
}
rightTitle
=
"
Add
"
onRight
=
{()
=>
Actions
.
add
()}
/
>
<
Scene
key
=
'
add
'
component
=
{
NewAccount
}
title
=
'
Add Account
'
/>
<
/Scene
>
<
/Scene
>
<
/Scene
>
...
...
src/components/Scanned.js
View file @
a1bb1c41
'
use strict
'
import
React
,
{
Component
}
from
'
react
'
import
{
Text
,
View
,
StyleSheet
,
}
from
'
react-native
'
import
React
,
{
Component
,
PropTypes
}
from
'
react
'
import
{
Text
,
View
,
StyleSheet
}
from
'
react-native
'
export
default
class
Scanned
extends
Component
{
static
propTypes
=
{
transactions
:
PropTypes
.
shape
({
pendingTx
:
PropTypes
.
string
.
isRequired
,
}).
isRequired
}
render
()
{
return
(
<
View
>
<
Text
>
This
view
appears
after
we
scan
something
<
/Text
>
<
View
style
=
{
styles
.
view
}
>
<
Text
>
You
scanned
{
this
.
props
.
transactions
.
pendingTx
}
<
/Text
>
<
/View
>
)
}
}
const
styles
=
StyleSheet
.
create
({
view
:
{
flex
:
1
,
marginTop
:
60
,
marginBottom
:
50
,
},
})
src/components/Scanner.js
View file @
a1bb1c41
'
use strict
'
;
import
React
,
{
Component
,
PropTypes
}
from
'
react
'
import
{
StyleSheet
,
View
}
from
'
react-native
'
import
{
StyleSheet
,
View
}
from
'
react-native
'
import
Camera
from
'
react-native-camera
'
;
export
default
class
Scanner
extends
Component
{
...
...
src/constants/TransactionActions.js
0 → 100644
View file @
a1bb1c41
export
const
NEW_SCANNED_TX
=
'
TRANSACTION_ACTION_NEW_SCANNED_TX
'
src/containers/QrScanner.js
View file @
a1bb1c41
import
React
,
{
Component
}
from
'
react
'
import
{
Vibration
}
from
'
react-native
'
import
{
connect
}
from
'
react-redux
'
import
{
Actions
}
from
'
react-native-router-flux
'
import
Scanner
from
'
../components/Scanner
'
import
{
newScannedTx
}
from
'
../actions/transactions
'
const
onBarCodeRead
=
(
)
=>
({
})
const
readBarCode
=
(
dispatch
,
ownProps
)
=>
({
onBarCodeRead
:
()
=>
{
dispatch
(
onBarCodeRead
()
)
const
mapDispatchToProps
=
(
dispatch
,
ownProps
)
=>
({
onBarCodeRead
:
(
scanned
)
=>
{
dispatch
(
newScannedTx
(
scanned
.
data
))
Vibration
.
vibrate
()
Actions
.
signer
()
}
})
const
QrScanner
=
connect
(
readBarCode
undefined
,
mapDispatchToProps
)(
Scanner
)
export
default
QrScanner
src/containers/Signer.js
0 → 100644
View file @
a1bb1c41
import
React
from
'
react
'
import
{
connect
}
from
'
react-redux
'
import
Scanned
from
'
../components/Scanned
'
const
Signer
=
connect
(
state
=>
({
transactions
:
state
.
transactions
}))(
Scanned
)
export
default
Signer
src/reducers/accounts.js
View file @
a1bb1c41
import
{
ADD_ACCOUNT
}
from
'
../constants/AccountActions
'
const
initialAccounts
=
[{
address
:
'
0xb794f5ea0ba39494ce839613fffba74279579268
'
,
},
{
address
:
'
0xe853c56864a2ebe4576a807d26fdc4a0ada51919
'
,
},
{
address
:
'
0x53d284357ec70ce289d6d64134dfac8e511c8a3d
'
,
},
{
address
:
'
0xd56d423cdc0e437babbdff79c4fa38904ff8d128
'
}]
const
initialAccounts
=
[]
export
default
function
accounts
(
state
=
initialAccounts
,
action
)
{
switch
(
action
.
type
)
{
...
...
src/reducers/index.js
View file @
a1bb1c41
import
{
combineReducers
}
from
'
redux
'
import
accounts
from
'
./accounts
'
import
routes
from
'
./routes
'
import
transactions
from
'
./transactions
'
export
default
combineReducers
({
accounts
,
routes
,
transactions
,
})
src/reducers/transactions.js
0 → 100644
View file @
a1bb1c41
import
{
NEW_SCANNED_TX
}
from
'
../constants/TransactionActions
'
const
initialState
=
{}
export
default
function
transactions
(
state
=
initialState
,
{
type
,
data
})
{
switch
(
type
)
{
case
NEW_SCANNED_TX
:
return
Object
.
assign
({},
state
,
{
pendingTx
:
data
,
})
default
:
return
state
}
}
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