Receive tab: hide address if verification error

pull/2/merge
Szymon Lesisz 6 years ago
parent 4dae5a247a
commit c1bb93bf5c

@ -20,6 +20,8 @@ export type ReceiveAction = {
device: TrezorDevice
} | {
type: typeof RECEIVE.SHOW_ADDRESS
} | {
type: typeof RECEIVE.HIDE_ADDRESS
} | {
type: typeof RECEIVE.SHOW_UNVERIFIED_ADDRESS
}
@ -80,7 +82,10 @@ export const showAddress = (address_n: Array<number>): AsyncAction => {
type: RECEIVE.SHOW_ADDRESS
})
} else {
// TODO: handle invalid pin?
dispatch({
type: RECEIVE.HIDE_ADDRESS
})
dispatch({
type: NOTIFICATION.ADD,
payload: {

@ -5,4 +5,5 @@ export const INIT: 'receive__init' = 'receive__init';
export const DISPOSE: 'receive__dispose' = 'receive__dispose';
export const REQUEST_UNVERIFIED: 'receive__request_unverified' = 'receive__request_unverified';
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';

@ -1,9 +1,11 @@
/* @flow */
'use strict';
import { UI } from 'trezor-connect';
import * as RECEIVE from '../actions/constants/receive';
import type { Action } from '~/flowtype';
export type State = {
addressVerified: boolean;
addressUnverified: boolean;
@ -30,6 +32,9 @@ export default (state: State = initialState, action: Action): State => {
addressVerified: true,
addressUnverified: false
}
case RECEIVE.HIDE_ADDRESS :
return initialState;
case RECEIVE.SHOW_UNVERIFIED_ADDRESS :
return {
...state,
@ -37,6 +42,15 @@ export default (state: State = initialState, action: Action): State => {
addressUnverified: true
}
case UI.REQUEST_BUTTON :
if (action.payload.code === 'ButtonRequest_Address') {
return {
...state,
addressVerified: true,
}
}
return state;
default:
return state;
}

Loading…
Cancel
Save