From 15539aa616cdbde1defb4ee8b1f859cda881e055 Mon Sep 17 00:00:00 2001 From: Liam Cardenas Date: Wed, 29 Nov 2017 22:53:23 -0800 Subject: [PATCH] Incorporated code review changes --- src/renderer/js/redux/reducers/app.js | 37 +++++++++++++++++++-------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/renderer/js/redux/reducers/app.js b/src/renderer/js/redux/reducers/app.js index 25ca59091..7facd4e72 100644 --- a/src/renderer/js/redux/reducers/app.js +++ b/src/renderer/js/redux/reducers/app.js @@ -10,9 +10,16 @@ const application = remote.app; const win = remote.BrowserWindow.getFocusedWindow(); const reducers = {}; -type appState = { + +export type SnackBar = { + message: string, + linkText: string, + linkTarget: string, + isError: boolean, +}; +export type AppState = { isLoaded: boolean, - modal: mixed, + modal: ?string, modalProps: mixed, platform: string, upgradeSkipped: boolean, @@ -21,15 +28,16 @@ type appState = { hasSignature: boolean, badgeNumber: number, volume: number, - downloadProgress?: number, - upgradeDownloading?: boolean, - upgradeDownloadComplete?: boolean, - checkUpgradeTimer?: mixed, - isUpgradeAvailable?: boolean, - isUpgradeSkipped?: boolean, - snackBar?: mixed, + downloadProgress: ?number, + upgradeDownloading: ?boolean, + upgradeDownloadComplete: ?boolean, + checkUpgradeTimer: ?number, + isUpgradeAvailable: ?boolean, + isUpgradeSkipped: ?boolean, + snackBar: ?SnackBar, }; -const defaultState: appState = { + +const defaultState: AppState = { isLoaded: false, modal: null, modalProps: {}, @@ -40,6 +48,13 @@ const defaultState: appState = { hasSignature: false, badgeNumber: 0, 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) { @@ -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]; if (handler) return handler(state, action); return state;