move app modal actions to doNotify type
This commit is contained in:
parent
84dc9f45bc
commit
c702a89454
3 changed files with 6 additions and 64 deletions
|
@ -1,7 +1,3 @@
|
||||||
export const OPEN_MODAL = 'OPEN_MODAL';
|
|
||||||
export const CLOSE_MODAL = 'CLOSE_MODAL';
|
|
||||||
export const SHOW_SNACKBAR = 'SHOW_SNACKBAR';
|
|
||||||
export const REMOVE_SNACKBAR_SNACK = 'REMOVE_SNACKBAR_SNACK';
|
|
||||||
export const WINDOW_FOCUSED = 'WINDOW_FOCUSED';
|
export const WINDOW_FOCUSED = 'WINDOW_FOCUSED';
|
||||||
export const DAEMON_READY = 'DAEMON_READY';
|
export const DAEMON_READY = 'DAEMON_READY';
|
||||||
export const DAEMON_VERSION_MATCH = 'DAEMON_VERSION_MATCH';
|
export const DAEMON_VERSION_MATCH = 'DAEMON_VERSION_MATCH';
|
||||||
|
|
|
@ -84,7 +84,7 @@ export function doDownloadUpgrade() {
|
||||||
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
|
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
|
||||||
});
|
});
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.OPEN_MODAL,
|
type: ACTIONS.CREATE_NOTIFICATION,
|
||||||
data: {
|
data: {
|
||||||
modal: MODALS.DOWNLOADING,
|
modal: MODALS.DOWNLOADING,
|
||||||
},
|
},
|
||||||
|
@ -111,14 +111,14 @@ export function doDownloadUpgradeRequested() {
|
||||||
if (autoUpdateDeclined) {
|
if (autoUpdateDeclined) {
|
||||||
// The user declined an update before, so show the "confirm" dialog
|
// The user declined an update before, so show the "confirm" dialog
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.OPEN_MODAL,
|
type: ACTIONS.CREATE_NOTIFICATION,
|
||||||
data: { modal: MODALS.AUTO_UPDATE_CONFIRM },
|
data: { modal: MODALS.AUTO_UPDATE_CONFIRM },
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// The user was never shown the original update dialog (e.g. because they were
|
// The user was never shown the original update dialog (e.g. because they were
|
||||||
// watching a video). So show the inital "update downloaded" dialog.
|
// watching a video). So show the inital "update downloaded" dialog.
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.OPEN_MODAL,
|
type: ACTIONS.CREATE_NOTIFICATION,
|
||||||
data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED },
|
data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ export function doAutoUpdate() {
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.OPEN_MODAL,
|
type: ACTIONS.CREATE_NOTIFICATION,
|
||||||
data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED },
|
data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED },
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -207,7 +207,7 @@ export function doCheckUpgradeAvailable() {
|
||||||
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
|
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
|
||||||
) {
|
) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.OPEN_MODAL,
|
type: ACTIONS.CREATE_NOTIFICATION,
|
||||||
data: {
|
data: {
|
||||||
modal: MODALS.UPGRADE,
|
modal: MODALS.UPGRADE,
|
||||||
},
|
},
|
||||||
|
@ -257,7 +257,7 @@ export function doCheckDaemonVersion() {
|
||||||
export function doAlertError(errorList) {
|
export function doAlertError(errorList) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.OPEN_MODAL,
|
type: ACTIONS.CREATE_NOTIFICATION,
|
||||||
data: {
|
data: {
|
||||||
modal: MODALS.ERROR,
|
modal: MODALS.ERROR,
|
||||||
modalProps: { error: errorList },
|
modalProps: { error: errorList },
|
||||||
|
@ -284,12 +284,6 @@ export function doDaemonReady() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doRemoveSnackBarSnack() {
|
|
||||||
return {
|
|
||||||
type: ACTIONS.REMOVE_SNACKBAR_SNACK,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function doClearCache() {
|
export function doClearCache() {
|
||||||
return () => {
|
return () => {
|
||||||
window.cacheStore.purge();
|
window.cacheStore.purge();
|
||||||
|
|
|
@ -155,59 +155,11 @@ reducers[ACTIONS.CHECK_UPGRADE_SUBSCRIBE] = (state, action) =>
|
||||||
checkUpgradeTimer: action.data.checkUpgradeTimer,
|
checkUpgradeTimer: action.data.checkUpgradeTimer,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.OPEN_MODAL] = (state, action) => {
|
|
||||||
if (!state.modalsAllowed) {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
return Object.assign({}, state, {
|
|
||||||
modal: action.data.modal,
|
|
||||||
modalProps: action.data.modalProps || {},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
reducers[ACTIONS.CLOSE_MODAL] = state =>
|
|
||||||
Object.assign({}, state, {
|
|
||||||
modal: undefined,
|
|
||||||
modalProps: {},
|
|
||||||
});
|
|
||||||
|
|
||||||
reducers[ACTIONS.UPGRADE_DOWNLOAD_PROGRESSED] = (state, action) =>
|
reducers[ACTIONS.UPGRADE_DOWNLOAD_PROGRESSED] = (state, action) =>
|
||||||
Object.assign({}, state, {
|
Object.assign({}, state, {
|
||||||
downloadProgress: action.data.percent,
|
downloadProgress: action.data.percent,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.SHOW_SNACKBAR] = (state, action) => {
|
|
||||||
const { message, linkText, linkTarget, isError } = action.data;
|
|
||||||
const snackBar = Object.assign({}, state.snackBar);
|
|
||||||
const snacks = Object.assign([], snackBar.snacks);
|
|
||||||
snacks.push({
|
|
||||||
message,
|
|
||||||
linkText,
|
|
||||||
linkTarget,
|
|
||||||
isError,
|
|
||||||
});
|
|
||||||
const newSnackBar = Object.assign({}, snackBar, {
|
|
||||||
snacks,
|
|
||||||
});
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
|
||||||
snackBar: newSnackBar,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
reducers[ACTIONS.REMOVE_SNACKBAR_SNACK] = state => {
|
|
||||||
const snackBar = Object.assign({}, state.snackBar);
|
|
||||||
const snacks = Object.assign([], snackBar.snacks);
|
|
||||||
snacks.shift();
|
|
||||||
|
|
||||||
const newSnackBar = Object.assign({}, snackBar, {
|
|
||||||
snacks,
|
|
||||||
});
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
|
||||||
snackBar: newSnackBar,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
reducers[ACTIONS.DOWNLOADING_COMPLETED] = state => {
|
reducers[ACTIONS.DOWNLOADING_COMPLETED] = state => {
|
||||||
const { badgeNumber } = state;
|
const { badgeNumber } = state;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue