Added better auto-update handling. RPS-17

This commit is contained in:
Patrick Fic
2020-10-27 10:21:55 -07:00
parent cab6df75fe
commit 41f0682fd5
14 changed files with 249 additions and 54 deletions

View File

@@ -48,3 +48,7 @@ export const setUpdateAvailable = (available) => ({
type: ApplicationActionTypes.SET_UPDATE_AVAILABLE,
payload: available,
});
export const setUpdateProgress = (progress) => ({
type: ApplicationActionTypes.SET_UPDATE_PROGRESS,
payload: progress,
});

View File

@@ -8,6 +8,7 @@ const INITIAL_STATE = {
selectedJobTargetPc: 0,
settings: {},
updateAvailable: false,
updateProgress: null,
};
const { ipcRenderer } = window;
@@ -63,6 +64,8 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
return { ...state, settings: { ...state.settings, ...action.payload } };
case ApplicationActionTypes.SET_UPDATE_AVAILABLE:
return { ...state, updateAvailable: action.payload };
case ApplicationActionTypes.SET_UPDATE_PROGRESS:
return { ...state, updateProgress: action.payload };
default:
return state;
}

View File

@@ -36,3 +36,7 @@ export const selectUpdateAvailable = createSelector(
[selectApplication],
(application) => application.updateAvailable
);
export const selectUpdateProgress = createSelector(
[selectApplication],
(application) => application.updateProgress
);

View File

@@ -9,5 +9,7 @@ const ApplicationActionTypes = {
SET_SELECTED_JOB_TARGET_PC_SUCCESS: "SET_SELECTED_JOB_TARGET_PC_SUCCESS",
SET_SETTINGS: "SET_SETTINGS",
SET_UPDATE_AVAILABLE: "SET_UPDATE_AVAILABLE",
SET_UPDATE_PROGRESS: "SET_UPDATE_PROGRESS",
};
export default ApplicationActionTypes;

View File

@@ -128,6 +128,7 @@ export function* signInSuccessSaga({ payload }) {
LogRocket.identify(payload.email, {
email: payload.email,
});
ipcRenderer.send(ipcTypes.default.app.toMain.checkForUpdates);
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
event: "SIGN_IN_SUCCESS",