diff --git a/build.sh b/build.sh index 32a3ad6a..16ce3c1d 100644 --- a/build.sh +++ b/build.sh @@ -6,9 +6,10 @@ yarn run build printf "\n-- COPYING FILES ----------------------\n" -cd build -rsync -avz --delete -e ssh . admin@dev.sldev.cz:~/experiments/www -rsync -avz --delete -e ssh ./build/* admin@dev.sldev.cz:~/mytrezor/ethereum/www +# cd build +# rsync -avz --delete -e ssh . admin@dev.sldev.cz:~/experiments/www +# rsync -avz --delete -e ssh ./build/* admin@dev.sldev.cz:~/mytrezor/ethereum/www +rsync -avz --delete -e ssh ./build/* admin@dev.sldev.cz:~/experiments/www cd ../ printf "\n-- COMPLETE ---------------------------\n" diff --git a/src/js/actions/DiscoveryActions.js b/src/js/actions/DiscoveryActions.js index 9ca9c46f..7c426e6b 100644 --- a/src/js/actions/DiscoveryActions.js +++ b/src/js/actions/DiscoveryActions.js @@ -70,8 +70,6 @@ export const start = (device: TrezorDevice, network: string, ignoreCompleted?: b return; } - - const discovery: State = getState().discovery; let discoveryProcess: ?Discovery = discovery.find(d => d.deviceState === device.state && d.network === network); diff --git a/src/js/actions/TrezorConnectActions.js b/src/js/actions/TrezorConnectActions.js index 81475174..d291ce9e 100644 --- a/src/js/actions/TrezorConnectActions.js +++ b/src/js/actions/TrezorConnectActions.js @@ -44,7 +44,7 @@ export type TrezorConnectAction = { type: typeof CONNECT.SELECT_DEVICE, payload: ?{ id: string, - instance: string + instance: ?number } } | { type: typeof CONNECT.COIN_CHANGED, @@ -127,9 +127,9 @@ export const init = (): AsyncAction => { try { await TrezorConnect.init({ transportReconnect: true, - connectSrc: 'https://localhost:8088/', + // connectSrc: 'https://localhost:8088/', // connectSrc: 'https://connect.trezor.io/tpm/', - // connectSrc: 'https://sisyfos.trezor.io/', + connectSrc: 'https://sisyfos.trezor.io/', debug: false, popup: false, webusb: true @@ -256,7 +256,7 @@ export const onSelectDevice = (device: TrezorDevice | Device): ThunkAction => { } // check if current location is not set to this device //dispatch( push(`/device/${ device.features.device_id }/network/etc/address/0`) ); - + if (urlParams.deviceInstance !== instance || urlParams.device !== deviceId) { dispatch( push(url) ); } @@ -485,7 +485,7 @@ export const forget = (device: TrezorDevice): Action => { }; } -export const duplicateDevice = (device: any): AsyncAction => { +export const duplicateDevice = (device: TrezorDevice): AsyncAction => { return async (dispatch: Dispatch, getState: GetState): Promise => { dispatch({ type: CONNECT.TRY_TO_DUPLICATE, diff --git a/src/js/components/modal/RememberDevice.js b/src/js/components/modal/RememberDevice.js index 7ae24b5e..7c4b8b76 100644 --- a/src/js/components/modal/RememberDevice.js +++ b/src/js/components/modal/RememberDevice.js @@ -61,7 +61,7 @@ export default class RememberDevice extends Component { } } - render(): any { + render() { if (!this.props.modal.opened) return null; const { device, instances } = this.props.modal; const { onForgetDevice, onRememberDevice } = this.props.modalActions; @@ -69,8 +69,8 @@ export default class RememberDevice extends Component { let label = device.label; let devicePlural = false; if (instances && instances.length > 0) { - label = instances.map(i => { - return ({i.instanceLabel}); + label = instances.map((instance, index) => { + return ({instance.instanceLabel}); }) devicePlural = instances.length > 1; } @@ -85,7 +85,8 @@ export default class RememberDevice extends Component { } } -export const ForgetDevice = (props: any): any => { +export const ForgetDevice = (props: Props) => { + if (!props.modal.opened) return null; const { device } = props.modal; const { onForgetSingleDevice, onCancel } = props.modalActions; return ( @@ -98,7 +99,8 @@ export const ForgetDevice = (props: any): any => { ); } -export const DisconnectDevice = (props: any): any => { +export const DisconnectDevice = (props: Props) => { + if (!props.modal.opened) return null; const { device } = props.modal; const { onForgetSingleDevice, onCancel } = props.modalActions; return ( diff --git a/src/js/components/wallet/aside/DeviceSelection.js b/src/js/components/wallet/aside/DeviceSelection.js index 90b0f4df..55cff006 100644 --- a/src/js/components/wallet/aside/DeviceSelection.js +++ b/src/js/components/wallet/aside/DeviceSelection.js @@ -159,8 +159,7 @@ export class DeviceDropdown extends Component { let elem: any = (event.target : any); let block: boolean = false; while (elem.parentElement) { - // if (elem.className.indexOf('aside-button') >= 0) { - if (elem.tagName.toLowerCase() === 'aside' || (elem.className && elem.className.indexOf('modal-container') >= 0)) { + if (elem.tagName.toLowerCase() === 'aside' || (elem.className && elem.className.indexOf && elem.className.indexOf('modal-container') >= 0)) { block = true; break; } diff --git a/src/js/reducers/WalletReducer.js b/src/js/reducers/WalletReducer.js index 52a20822..1cf8278c 100644 --- a/src/js/reducers/WalletReducer.js +++ b/src/js/reducers/WalletReducer.js @@ -1,6 +1,7 @@ /* @flow */ 'use strict'; +import * as MODAL from '../actions/constants/modal'; import * as WEB3 from '../actions/constants/web3'; import * as WALLET from '../actions/constants/wallet'; @@ -42,6 +43,12 @@ export default function wallet(state: State = initialState, action: Action): Sta dropdownOpened: action.opened } + case MODAL.CLOSE : + return { + ...state, + dropdownOpened: false + } + default: return state; } diff --git a/src/js/services/RouterService.js b/src/js/services/RouterService.js index 522fc111..6c7e4837 100644 --- a/src/js/services/RouterService.js +++ b/src/js/services/RouterService.js @@ -53,7 +53,7 @@ const validation = (api: MiddlewareAPI, params: RouterLocationState): boolean => let device: ?TrezorDevice; if (params.hasOwnProperty('deviceInstance')) { - device = devices.find(d => d.features && d.features.device_id === params.device && d.instance === params.deviceInstance ); + device = devices.find(d => d.features && d.features.device_id === params.device && d.instance === parseInt(params.deviceInstance ) ); } else { device = devices.find(d => d.path === params.device || (d.features && d.features.device_id === params.device)); } @@ -136,7 +136,7 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa type: CONNECT.SELECT_DEVICE, payload: { id: requestedParams.device, - instance: requestedParams.deviceInstance + instance: requestedParams.deviceInstance ? parseInt(requestedParams.deviceInstance) : undefined } }); }