1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 01:08:27 +00:00

Receive tab: hide address if verification error

This commit is contained in:
Szymon Lesisz 2018-05-23 16:25:57 +02:00
parent 4dae5a247a
commit c1bb93bf5c
3 changed files with 21 additions and 1 deletions

View File

@ -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: {

View File

@ -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';

View File

@ -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;
}