diff --git a/.eslintrc b/.eslintrc
index 9f709b13..4076a433 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -5,6 +5,7 @@
"plugin:jest/recommended"
],
"globals": {
+ "LOCAL": true,
"COMMITHASH": true
},
"env": {
diff --git a/src/actions/LogActions.js b/src/actions/LogActions.js
index c841cd1e..5e1bf6a7 100644
--- a/src/actions/LogActions.js
+++ b/src/actions/LogActions.js
@@ -1,6 +1,5 @@
/* @flow */
-
import * as LOG from 'actions/constants/log';
import type {
@@ -31,7 +30,6 @@ export const toggle = (): ThunkAction => (dispatch: Dispatch, getState: GetState
}
};
-// export const add = (type: string, message: string): Action => {
export const add = (type: string, message: any): Action => ({
type: LOG.ADD,
payload: {
diff --git a/src/actions/TrezorConnectActions.js b/src/actions/TrezorConnectActions.js
index 40a3ea8c..d685f954 100644
--- a/src/actions/TrezorConnectActions.js
+++ b/src/actions/TrezorConnectActions.js
@@ -120,9 +120,7 @@ export const init = (): AsyncAction => async (dispatch: Dispatch, getState: GetS
});
});
- /* global LOCAL */
- // $FlowIssue LOCAL not declared
- window.__TREZOR_CONNECT_SRC = typeof LOCAL === 'string' ? LOCAL : 'https://sisyfos.trezor.io/connect/'; // eslint-disable-line no-underscore-dangle
+ window.__TREZOR_CONNECT_SRC = typeof window.LOCAL === 'string' ? window.LOCAL : 'https://sisyfos.trezor.io/connect/'; // eslint-disable-line no-underscore-dangle
// window.__TREZOR_CONNECT_SRC = typeof LOCAL === 'string' ? LOCAL : 'https://connect.trezor.io/5/'; // eslint-disable-line no-underscore-dangle
try {
diff --git a/src/components/Footer/index.js b/src/components/Footer/index.js
index 2b988cba..0c443223 100644
--- a/src/components/Footer/index.js
+++ b/src/components/Footer/index.js
@@ -1,3 +1,5 @@
+/* @flow */
+
import styled from 'styled-components';
import PropTypes from 'prop-types';
import React from 'react';
@@ -28,21 +30,26 @@ const Copy = styled.div`
margin-right: 20px;
`;
-const Footer = ({ toggle }) => (
+const Footer = ({ opened, toggle }) => (
- © {getYear(new Date())}
+ © {getYear(new Date())}
SatoshiLabs
Terms
- Show Log
+ { opened ? 'Hide Log' : 'Show Log' }
);
Footer.propTypes = {
+ opened: PropTypes.bool.isRequired,
toggle: PropTypes.func.isRequired,
};
+const mapStateToProps = state => ({
+ opened: state.log.opened,
+});
+
const mapDispatchToProps = dispatch => ({
toggle: bindActionCreators(LogActions.toggle, dispatch),
});
-export default connect(null, mapDispatchToProps)(Footer);
+export default connect(mapStateToProps, mapDispatchToProps)(Footer);
diff --git a/src/components/Log/index.js b/src/components/Log/index.js
index 63db62fa..c77ad073 100644
--- a/src/components/Log/index.js
+++ b/src/components/Log/index.js
@@ -6,7 +6,7 @@ import { connect } from 'react-redux';
import colors from 'config/colors';
import { H2 } from 'components/Heading';
import Icon from 'components/Icon';
-import Paragraph from 'components/Paragraph';
+import P from 'components/Paragraph';
import * as LogActions from 'actions/LogActions';
import icons from 'config/icons';
@@ -55,7 +55,7 @@ const Textarea = styled.textarea`
}
`;
-const StyledParagraph = styled(Paragraph)`
+const StyledParagraph = styled(P)`
margin: 10px 0;
`;
@@ -67,7 +67,7 @@ const Log = (props: Props): ?React$Element => {
Log
- Attention: The log contains your XPUBs. Anyone with your XPUBs can see your account history.
+ Attention: The log contains your XPUBs. Anyone with your XPUBs can see your account history.
);
diff --git a/src/flowtype/index.js b/src/flowtype/index.js
index 44bd5556..f1349134 100644
--- a/src/flowtype/index.js
+++ b/src/flowtype/index.js
@@ -174,3 +174,6 @@ export type PromiseAction = ReduxPromiseAction;
export type Store = ReduxStore;
export type GetState = () => State;
+
+declare var LOCAL: string;
+declare var COMMITHASH: string;
\ No newline at end of file
diff --git a/src/reducers/LogReducer.js b/src/reducers/LogReducer.js
index a020bcf7..ac5998e7 100644
--- a/src/reducers/LogReducer.js
+++ b/src/reducers/LogReducer.js
@@ -1,13 +1,11 @@
/* @flow */
-
import * as LOG from 'actions/constants/log';
import type { Action } from 'flowtype';
export type LogEntry = {
time: number;
type: string;
- // message: string;
message: any;
}
diff --git a/src/services/LogService.js b/src/services/LogService.js
index aa7337b4..4515aa03 100644
--- a/src/services/LogService.js
+++ b/src/services/LogService.js
@@ -1,9 +1,7 @@
/* @flow */
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 * as DISCOVERY from 'actions/constants/discovery';
import type {
Middleware,
@@ -12,17 +10,11 @@ import type {
Action,
} from 'flowtype';
-// const exclude: Array = [
-// ADD, OPEN, CLOSE,
-// STORAGE.READY,
-// SEND.TX_COMPLETE,
-// 'web3__create',
-// ];
-
-const include: Array = [
+const actions: Array = [
TRANSPORT.START,
DEVICE.CONNECT,
DEVICE.DISCONNECT,
+ DISCOVERY.START,
];
/**
@@ -31,17 +23,30 @@ const include: Array = [
const LogService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispatch) => (action: Action): Action => {
next(action);
- // if (exclude.indexOf(action.type) < 0) {
- if (include.indexOf(action.type) >= 0) {
- // api.dispatch(LogActions.add(action.type, JSON.stringify( 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));
- }
+ if (actions.indexOf(action.type) < 0) return action;
+
+ switch (action.type) {
+ case TRANSPORT.START:
+ api.dispatch(LogActions.add('Transport', { type: action.payload.type, version: action.payload.version }));
+ break;
+ case DEVICE.CONNECT:
+ api.dispatch(LogActions.add('Device connected', action.device));
+ break;
+ case DEVICE.DISCONNECT:
+ api.dispatch(LogActions.add('Device disconnected', action.device));
+ break;
+ case DISCOVERY.START:
+ api.dispatch(LogActions.add('Discovery started', action));
+ break;
+ default: break;
}
+ // 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;
};