Skip to content

Commit ca35a88

Browse files
committed
fixed some cycle dependencies
1 parent c4728a2 commit ca35a88

File tree

10 files changed

+50
-46
lines changed

10 files changed

+50
-46
lines changed

src/components/Protypo/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import Data from './Data';
77
import DBFind from './DBFind';
88
import Em from './Em';
99
import Form from './Form';
10-
// import Image from './Image';
1110
import Input from './Input';
1211
import InputError from './InputError';
1312
import InputImage from './InputImage';

src/components/ui/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ export const cancelButton = {
5858
borderWidth: 1,
5959
width: '100%',
6060
marginTop: 0,
61-
}
61+
}

src/containers/MenuGridContainer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import MenuGrid from 'components/MenuGrid';
33

44
import * as application from 'modules/application';
55
import * as page from 'modules/page';
6-
import * as navigator from 'modules/navigator';
6+
import * as navigatorActions from 'modules/navigator/actions';
77
import { navTypes } from '../constants';
88

99
const mapStateToProps = (state: any, ownProps: any) => {
@@ -16,9 +16,9 @@ const mapStateToProps = (state: any, ownProps: any) => {
1616

1717
const mapDispatchToProps = dispatch => ({
1818
navigateToSubMenu: (menu: any) =>
19-
dispatch(navigator.actions.navigate(navTypes.SUB_MENU, { menu })),
19+
dispatch(navigatorActions.navigate(navTypes.SUB_MENU, { menu })),
2020
receivePageParams: (params: any) => {
21-
dispatch(navigator.actions.navigate(navTypes.PAGE));
21+
dispatch(navigatorActions.navigate(navTypes.PAGE));
2222
dispatch(application.actions.receivePageParams(params));
2323
}
2424
});

src/containers/NotificationsIconContainer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { connect, Dispatch } from 'react-redux';
22
import { getNotificationsCount } from 'modules/notifications/selectors';
33

44
import NotificationsIcon from 'components/NotificationsIcon';
5-
import * as navigator from 'modules/navigator';
5+
import * as navigatorActions from 'modules/navigator/actions';
66
import * as page from 'modules/page';
77
import * as application from 'modules/application';
88
import * as navigatorSelectors from 'modules/navigator/selectors';
@@ -19,11 +19,11 @@ const mapDispatchToProps = (dispatch: Dispatch<any>) => ({
1919
showNotificationsPage: (withReset = false) => {
2020
dispatch(page.actions.requestPage.started({ name: 'notifications'}));
2121
if (withReset) {
22-
dispatch(navigator.actions.navigateWithReset([{ routeName: navTypes.PAGE , params: {
22+
dispatch(navigatorActions.navigateWithReset([{ routeName: navTypes.PAGE , params: {
2323
withGoHomeButton: true,
2424
}}]));
2525
} else {
26-
dispatch(navigator.actions.navigate(navTypes.PAGE));
26+
dispatch(navigatorActions.navigate(navTypes.PAGE));
2727
}
2828
},
2929
});

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ AppRegistry.registerComponent('Apla', () =>
4646
})(App)
4747
);
4848

49-
console.ignoredYellowBox = ['Require cycle: node_modules'];
49+
console.ignoredYellowBox = ['Require cycle: node_modules', 'Header.HEIGHT is deprecated '];

src/modules/application/saga.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ import {
1414
} from './actions';
1515
import { getDrawerState, getAlert } from './selectors';
1616

17-
import * as auth from 'modules/auth';
18-
import * as account from 'modules/account';
19-
import * as navigator from 'modules/navigator';
17+
import * as navigatorActions from 'modules/navigator/actions';
18+
import * as authActions from 'modules/auth/actions';
19+
import * as authSelectors from 'modules/auth/selectors';
20+
import * as accountSelectors from 'modules/account/selectors';
2021

2122
interface IErrorAlert {
2223
error: {
@@ -31,8 +32,8 @@ interface IErrorAlert {
3132

3233
export function* initWorker(): SagaIterator {
3334
const { hasValidToken, token, isTouchIDAvailable, currentLocale } = yield all({
34-
token: select(auth.selectors.getToken),
35-
hasValidToken: select(auth.selectors.hasValidToken),
35+
token: select(authSelectors.getToken),
36+
hasValidToken: select(authSelectors.hasValidToken),
3637
isTouchIDAvailable: call(checkTouchIDAvailiability),
3738
currentLocale: call(getCurrentLocale),
3839
});
@@ -52,15 +53,15 @@ export function* initWorker(): SagaIterator {
5253

5354
yield put(initFinish());
5455
yield put(
55-
navigator.actions.navigateWithReset([{ routeName: navTypes.HOME }])
56+
navigatorActions.navigateWithReset([{ routeName: navTypes.HOME }])
5657
);
5758

5859
return;
5960
} else {
60-
yield put(auth.actions.detachSession());
61+
yield put(authActions.detachSession());
6162
yield put(initFinish());
6263
yield put(
63-
navigator.actions.navigateWithReset([
64+
navigatorActions.navigateWithReset([
6465
{ routeName: navTypes.ACCOUNT_SELECT }
6566
])
6667
);
@@ -73,21 +74,21 @@ export function* persistWorker() {
7374

7475
export function* expiredTokenWorker() {
7576
yield take(cancelAlert);
76-
const isAuthed = yield select(auth.selectors.getAuthStatus);
77+
const isAuthed = yield select(authSelectors.getAuthStatus);
7778
if (!isAuthed) return;
7879

79-
const uniqKey = yield select(auth.selectors.getCurrentAccount);
80+
const uniqKey = yield select(authSelectors.getCurrentAccount);
8081
const { drawerOpen, encKey } = yield all({
8182
drawerOpen: select(getDrawerState),
82-
encKey: select(account.selectors.getAccountEncKey(uniqKey))
83+
encKey: select(accountSelectors.getAccountEncKey(uniqKey))
8384
});
8485

8586
if (drawerOpen) {
8687
yield put(toggleDrawer(false));
8788
}
8889

89-
yield put(auth.actions.detachSession());
90-
yield put(navigator.actions.navigateWithReset([{ routeName: navTypes.SIGN_IN, params: { uniqKey, encKey } }]));
90+
yield put(authActions.detachSession());
91+
yield put(navigatorActions.navigateWithReset([{ routeName: navTypes.SIGN_IN, params: { uniqKey, encKey } }]));
9192
}
9293

9394
export function* alertWorker(action: Action<IErrorAlert>): SagaIterator {
@@ -117,7 +118,7 @@ function* resetDefaultPageWorker() {
117118
export function* applicationWatcher(): SagaIterator {
118119
yield takeEvery(initStart, initWorker);
119120
yield takeEvery(waitForError(), alertWorker);
120-
yield takeEvery(auth.actions.detachSession, resetDefaultPageWorker);
121+
yield takeEvery(authActions.detachSession, resetDefaultPageWorker);
121122
}
122123

123124
export default applicationWatcher;

src/modules/auth/saga.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export function* logoutWorker() {
228228
}
229229

230230
export function* receiveSelectedAccountWorker(action: Action<{uniqKey: string; encKey: string;}>) {
231-
yield put(application.actions.toggleDrawer(false))
231+
yield put(application.actions.toggleDrawer(false));
232232
yield call(delay, 350);
233233
yield put(
234234
navigatorActions.navigate(navTypes.SIGN_IN, action.payload)

src/modules/nodes/saga.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import api, { apiSetUrl, apiSetToken, apiDeleteToken } from '../../utils/api';
88

99
import * as application from 'modules/application';
1010
import * as auth from 'modules/auth';
11-
import * as node from 'modules/nodes';
11+
import * as nodesSelectors from './selectors';
12+
import * as nodesActions from './actions';
1213

1314

1415
export function* nodesWorker() {
1516
const { currentNode, isAuthenticated } = yield all({
16-
currentNode: select(node.selectors.getCurrentNode),
17+
currentNode: select(nodesSelectors.getCurrentNode),
1718
isAuthenticated: select(auth.selectors.getAuthStatus)
1819
});
1920

@@ -35,15 +36,15 @@ export function* nodesWorker() {
3536

3637
export function* setRandomNode() {
3738
const { nodesList, isAuthenticated } = yield all({
38-
nodesList: select(node.selectors.getNodesList),
39+
nodesList: select(nodesSelectors.getNodesList),
3940
isAuthenticated: select(auth.selectors.getAuthStatus),
4041
});
4142

4243
const filteredNodes = !!nodesList.length ? nodesList : yield call(filterDuplicateNodes, fullNodes);
4344

4445
const checkedNodes = yield call(checkNodeValidity, filteredNodes, 1);
4546

46-
yield put(node.actions.setCurrentNode(checkedNodes[0]));
47+
yield put(nodesActions.setCurrentNode(checkedNodes[0]));
4748

4849
if (isAuthenticated) yield put(auth.actions.detachSession());
4950
}
@@ -52,7 +53,7 @@ export function* getFullNodesWorkerHelper() {
5253
try {
5354
const { data: { list } } = yield call(api.getFullNodes);
5455

55-
const nodesList = yield select(node.selectors.getNodesList);
56+
const nodesList = yield select(nodesSelectors.getNodesList);
5657

5758
let nodes = [];
5859

@@ -69,7 +70,7 @@ export function* getFullNodesWorkerHelper() {
6970
}
7071
})));
7172

72-
yield put(node.actions.setNodesList(newNodes));
73+
yield put(nodesActions.setNodesList(newNodes));
7374
} catch(err) {
7475
yield put(auth.actions.logout());
7576
}

src/modules/sagas/sagaHelpers.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ import defaultSchema from 'utils/transactions/schema/defaultSchema';
1111
import { toHex } from 'utils/transactions/convert';
1212
import api, { apiSetToken, apiDeleteToken, apiSetUrl, ApiFactory } from 'utils/api';
1313

14+
import * as authSelectors from 'modules/auth/selectors';
15+
import * as authActions from 'modules/auth/actions';
16+
import * as appActions from 'modules/application/actions';
17+
import * as accountSelectors from 'modules/account/selectors';
18+
import * as nodesSelectors from 'modules/nodes/selectors';
19+
1420
import { IAuthPayload } from 'modules/auth/saga';
15-
import * as account from 'modules/account';
16-
import * as application from 'modules/application';
17-
import * as auth from 'modules/auth';
18-
import * as nodes from 'modules/nodes';
1921

2022
export function* getUsername(token: string, key_id: string) {
2123
apiDeleteToken();
@@ -29,7 +31,7 @@ export function* getUsername(token: string, key_id: string) {
2931
}
3032

3133
export function* loginByGuestKey() {
32-
const currentNode = yield select(nodes.selectors.getCurrentNode);
34+
const currentNode = yield select(nodesSelectors.getCurrentNode);
3335

3436
const apiInstance = create({
3537
baseURL: `${currentNode.apiUrl}api/v2`,
@@ -84,21 +86,21 @@ export function* loginCall(payload: IAuthPayload, role_id?: number, signParams?:
8486
}
8587

8688
export function* roleSelect(roles: IRole[]) {
87-
yield put(application.actions.showModal({ type: ModalTypes.ROLE_SELECT, params: { roles } }));
89+
yield put(appActions.showModal({ type: ModalTypes.ROLE_SELECT, params: { roles } }));
8890

8991
const roleSelected = yield race({
90-
success: take(application.actions.confirmModal),
91-
failed: take(application.actions.closeModal),
92+
success: take(appActions.confirmModal),
93+
failed: take(appActions.closeModal),
9294
});
93-
yield put(application.actions.closeModal());
95+
yield put(appActions.closeModal());
9496
yield call(delay, MODAL_ANIMATION_TIME + 150);
9597

9698
if (roleSelected.failed) return;
9799

98100
if (roleSelected.success) {
99-
yield put(auth.actions.setRole(roleSelected.success.payload));
101+
yield put(authActions.setRole(roleSelected.success.payload));
100102
return roleSelected.success.payload;
101-
};
103+
}
102104
}
103105

104106
export function* checkNodeValidity(nodesArray: INode[], requiredCount = 1, token?: string, currentNode?: INode, withSignature = false) {
@@ -148,17 +150,17 @@ export function* checkNodeValidity(nodesArray: INode[], requiredCount = 1, token
148150
}
149151

150152
export function* defaultPageSetter(role_id?: number | string | undefined) {
151-
const currentRole = yield select(auth.selectors.getCurrentRole);
153+
const currentRole = yield select(authSelectors.getCurrentRole);
152154
if (role_id || currentRole && currentRole.role_id) {
153155
const { data: { value: { default_page } } } = yield call(api.getRow, 'roles', role_id || currentRole.role_id);
154156

155-
yield put(application.actions.setDefaultPage(default_page || DEFAULT_PAGE));
157+
yield put(appActions.setDefaultPage(default_page || DEFAULT_PAGE));
156158
}
157159
}
158160

159161
export function* prepareContractWorker(payload: any, privateKey: string) {
160-
const uniqKey = yield select(auth.selectors.getCurrentAccount);
161-
const currentAcc = yield select(account.selectors.getAccount(uniqKey));
162+
const uniqKey = yield select(authSelectors.getCurrentAccount);
163+
const currentAcc = yield select(accountSelectors.getAccount(uniqKey));
162164

163165
try {
164166
const request: {[hash: string]: any} = {};

tslint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"no-unused-expression": true,
1717
"interface-over-type-literal": false,
1818
"no-empty-interface": false,
19-
"max-line-length": [true, 140]
19+
"max-line-length": [true, 140],
20+
"curly": [true, "ignore-same-line"],
2021
}
2122
}

0 commit comments

Comments
 (0)