|
|
|
@ -5,6 +5,7 @@ import * as LogActions from '../actions/LogActions';
|
|
|
|
|
import * as STORAGE from '../actions/constants/localStorage';
|
|
|
|
|
import * as SEND from '../actions/constants/send';
|
|
|
|
|
import { OPEN, CLOSE, ADD } from '../actions/constants/log';
|
|
|
|
|
import { TRANSPORT, DEVICE } from 'trezor-connect';
|
|
|
|
|
|
|
|
|
|
import type {
|
|
|
|
|
Middleware,
|
|
|
|
@ -24,6 +25,12 @@ const exclude: Array<string> = [
|
|
|
|
|
"web3__create"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const include: Array<string> = [
|
|
|
|
|
TRANSPORT.START,
|
|
|
|
|
DEVICE.CONNECT,
|
|
|
|
|
DEVICE.DISCONNECT
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Middleware
|
|
|
|
|
*/
|
|
|
|
@ -31,9 +38,15 @@ const LogService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispatch
|
|
|
|
|
|
|
|
|
|
next(action);
|
|
|
|
|
|
|
|
|
|
if (exclude.indexOf(action.type) < 0) {
|
|
|
|
|
// if (exclude.indexOf(action.type) < 0) {
|
|
|
|
|
if (include.indexOf(action.type) >= 0) {
|
|
|
|
|
// api.dispatch(LogActions.add(action.type, JSON.stringify( action )));
|
|
|
|
|
api.dispatch(LogActions.add(action.type, action));
|
|
|
|
|
|
|
|
|
|
if (action.type === TRANSPORT.START) {
|
|
|
|
|
api.dispatch(LogActions.add('Transport', action.payload));
|
|
|
|
|
} else if (action.type === DEVICE.CONNECT) {
|
|
|
|
|
api.dispatch(LogActions.add(action.type, action));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return action;
|
|
|
|
|