Incorporated code review changes
This commit is contained in:
parent
a563cba9da
commit
15539aa616
1 changed files with 26 additions and 11 deletions
|
@ -10,9 +10,16 @@ const application = remote.app;
|
||||||
const win = remote.BrowserWindow.getFocusedWindow();
|
const win = remote.BrowserWindow.getFocusedWindow();
|
||||||
|
|
||||||
const reducers = {};
|
const reducers = {};
|
||||||
type appState = {
|
|
||||||
|
export type SnackBar = {
|
||||||
|
message: string,
|
||||||
|
linkText: string,
|
||||||
|
linkTarget: string,
|
||||||
|
isError: boolean,
|
||||||
|
};
|
||||||
|
export type AppState = {
|
||||||
isLoaded: boolean,
|
isLoaded: boolean,
|
||||||
modal: mixed,
|
modal: ?string,
|
||||||
modalProps: mixed,
|
modalProps: mixed,
|
||||||
platform: string,
|
platform: string,
|
||||||
upgradeSkipped: boolean,
|
upgradeSkipped: boolean,
|
||||||
|
@ -21,15 +28,16 @@ type appState = {
|
||||||
hasSignature: boolean,
|
hasSignature: boolean,
|
||||||
badgeNumber: number,
|
badgeNumber: number,
|
||||||
volume: number,
|
volume: number,
|
||||||
downloadProgress?: number,
|
downloadProgress: ?number,
|
||||||
upgradeDownloading?: boolean,
|
upgradeDownloading: ?boolean,
|
||||||
upgradeDownloadComplete?: boolean,
|
upgradeDownloadComplete: ?boolean,
|
||||||
checkUpgradeTimer?: mixed,
|
checkUpgradeTimer: ?number,
|
||||||
isUpgradeAvailable?: boolean,
|
isUpgradeAvailable: ?boolean,
|
||||||
isUpgradeSkipped?: boolean,
|
isUpgradeSkipped: ?boolean,
|
||||||
snackBar?: mixed,
|
snackBar: ?SnackBar,
|
||||||
};
|
};
|
||||||
const defaultState: appState = {
|
|
||||||
|
const defaultState: AppState = {
|
||||||
isLoaded: false,
|
isLoaded: false,
|
||||||
modal: null,
|
modal: null,
|
||||||
modalProps: {},
|
modalProps: {},
|
||||||
|
@ -40,6 +48,13 @@ const defaultState: appState = {
|
||||||
hasSignature: false,
|
hasSignature: false,
|
||||||
badgeNumber: 0,
|
badgeNumber: 0,
|
||||||
volume: Number(sessionStorage.getItem("volume")) || 1,
|
volume: Number(sessionStorage.getItem("volume")) || 1,
|
||||||
|
downloadProgress: undefined,
|
||||||
|
upgradeDownloading: undefined,
|
||||||
|
upgradeDownloadComplete: undefined,
|
||||||
|
checkUpgradeTimer: undefined,
|
||||||
|
isUpgradeAvailable: undefined,
|
||||||
|
isUpgradeSkipped: undefined,
|
||||||
|
snackBar: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
reducers[types.DAEMON_READY] = function(state, action) {
|
reducers[types.DAEMON_READY] = function(state, action) {
|
||||||
|
@ -187,7 +202,7 @@ reducers[types.VOLUME_CHANGED] = function(state, action) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function reducer(state: appState = defaultState, action: any) {
|
export default function reducer(state: AppState = defaultState, action: any) {
|
||||||
const handler = reducers[action.type];
|
const handler = reducers[action.type];
|
||||||
if (handler) return handler(state, action);
|
if (handler) return handler(state, action);
|
||||||
return state;
|
return state;
|
||||||
|
|
Loading…
Reference in a new issue