Up until now we relied on implicit loading of middlewares and reducers, through having imports in each feature's index.js. This leads to many complex import cycles which result in (sometimes) hard to fix bugs in addition to (often) breaking mobile because a web-only feature gets imported on mobile too, thanks to the implicit loading. This PR changes that to make the process explicit. Both middlewares and reducers are imported in a single place, the app entrypoint. They have been divided into 3 categories: any, web and native, which represent each of the platforms respectively. Ideally no feature should have an index.js exporting actions, action types and components, but that's a larger ordeal, so this is just the first step in getting there. In order to both set example and avoid large cycles the app feature has been refactored to not have an idex.js itself.
37 lines
867 B
JavaScript
37 lines
867 B
JavaScript
// @flow
|
|
|
|
import type { Dispatch } from 'redux';
|
|
|
|
import { appNavigate } from '../app/actions';
|
|
|
|
import { OPEN_DESKTOP_APP, OPEN_WEB_APP } from './actionTypes';
|
|
|
|
/**
|
|
* Continue to the conference page.
|
|
*
|
|
* @returns {Function}
|
|
*/
|
|
export function openWebApp() {
|
|
return (dispatch: Dispatch<any>) => {
|
|
// In order to go to the web app we need to skip the deep linking
|
|
// interceptor. OPEN_WEB_APP action should set launchInWeb to true in
|
|
// the redux store. After this when appNavigate() is called the
|
|
// deep linking interceptor will be skipped (will return undefined).
|
|
dispatch({ type: OPEN_WEB_APP });
|
|
dispatch(appNavigate());
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Opens the desktop app.
|
|
*
|
|
* @returns {{
|
|
* type: OPEN_DESKTOP_APP
|
|
* }}
|
|
*/
|
|
export function openDesktopApp() {
|
|
return {
|
|
type: OPEN_DESKTOP_APP
|
|
};
|
|
}
|