mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 09:18:09 +00:00
Receive tab: hide address if verification error
This commit is contained in:
parent
4dae5a247a
commit
c1bb93bf5c
@ -20,6 +20,8 @@ export type ReceiveAction = {
|
|||||||
device: TrezorDevice
|
device: TrezorDevice
|
||||||
} | {
|
} | {
|
||||||
type: typeof RECEIVE.SHOW_ADDRESS
|
type: typeof RECEIVE.SHOW_ADDRESS
|
||||||
|
} | {
|
||||||
|
type: typeof RECEIVE.HIDE_ADDRESS
|
||||||
} | {
|
} | {
|
||||||
type: typeof RECEIVE.SHOW_UNVERIFIED_ADDRESS
|
type: typeof RECEIVE.SHOW_UNVERIFIED_ADDRESS
|
||||||
}
|
}
|
||||||
@ -80,7 +82,10 @@ export const showAddress = (address_n: Array<number>): AsyncAction => {
|
|||||||
type: RECEIVE.SHOW_ADDRESS
|
type: RECEIVE.SHOW_ADDRESS
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// TODO: handle invalid pin?
|
dispatch({
|
||||||
|
type: RECEIVE.HIDE_ADDRESS
|
||||||
|
})
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: NOTIFICATION.ADD,
|
type: NOTIFICATION.ADD,
|
||||||
payload: {
|
payload: {
|
||||||
|
@ -5,4 +5,5 @@ export const INIT: 'receive__init' = 'receive__init';
|
|||||||
export const DISPOSE: 'receive__dispose' = 'receive__dispose';
|
export const DISPOSE: 'receive__dispose' = 'receive__dispose';
|
||||||
export const REQUEST_UNVERIFIED: 'receive__request_unverified' = 'receive__request_unverified';
|
export const REQUEST_UNVERIFIED: 'receive__request_unverified' = 'receive__request_unverified';
|
||||||
export const SHOW_ADDRESS: 'receive__show_address' = 'receive__show_address';
|
export const SHOW_ADDRESS: 'receive__show_address' = 'receive__show_address';
|
||||||
|
export const HIDE_ADDRESS: 'receive__hide_address' = 'receive__hide_address';
|
||||||
export const SHOW_UNVERIFIED_ADDRESS: 'receive__show_unverified' = 'receive__show_unverified';
|
export const SHOW_UNVERIFIED_ADDRESS: 'receive__show_unverified' = 'receive__show_unverified';
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
import { UI } from 'trezor-connect';
|
||||||
import * as RECEIVE from '../actions/constants/receive';
|
import * as RECEIVE from '../actions/constants/receive';
|
||||||
import type { Action } from '~/flowtype';
|
import type { Action } from '~/flowtype';
|
||||||
|
|
||||||
|
|
||||||
export type State = {
|
export type State = {
|
||||||
addressVerified: boolean;
|
addressVerified: boolean;
|
||||||
addressUnverified: boolean;
|
addressUnverified: boolean;
|
||||||
@ -30,6 +32,9 @@ export default (state: State = initialState, action: Action): State => {
|
|||||||
addressVerified: true,
|
addressVerified: true,
|
||||||
addressUnverified: false
|
addressUnverified: false
|
||||||
}
|
}
|
||||||
|
case RECEIVE.HIDE_ADDRESS :
|
||||||
|
return initialState;
|
||||||
|
|
||||||
case RECEIVE.SHOW_UNVERIFIED_ADDRESS :
|
case RECEIVE.SHOW_UNVERIFIED_ADDRESS :
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
@ -37,6 +42,15 @@ export default (state: State = initialState, action: Action): State => {
|
|||||||
addressUnverified: true
|
addressUnverified: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case UI.REQUEST_BUTTON :
|
||||||
|
if (action.payload.code === 'ButtonRequest_Address') {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
addressVerified: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user