mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-04 04:45:11 +00:00
Code refactor
Create action for clearing upgrade timer
This commit is contained in:
parent
30c32d4c2b
commit
90d1b18586
2 changed files with 21 additions and 11 deletions
|
@ -139,10 +139,21 @@ export function doDownloadUpgradeRequested() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doAutoUpdate() {
|
export function doClearUpgradeTimer() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
|
|
||||||
|
if (selectUpgradeTimer(state)) {
|
||||||
|
clearInterval(selectUpgradeTimer(state));
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.CLEAR_UPGRADE_TIMER,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doAutoUpdate() {
|
||||||
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.AUTO_UPDATE_DOWNLOADED,
|
type: ACTIONS.AUTO_UPDATE_DOWNLOADED,
|
||||||
});
|
});
|
||||||
|
@ -153,19 +164,13 @@ export function doAutoUpdate() {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
if (selectUpgradeTimer(state)) {
|
dispatch(doClearUpgradeTimer());
|
||||||
clearInterval(selectUpgradeTimer(state));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doAutoUpdateDeclined() {
|
export function doAutoUpdateDeclined() {
|
||||||
return (dispatch, getState) => {
|
return dispatch => {
|
||||||
const state = getState();
|
dispatch(doClearUpgradeTimer());
|
||||||
|
|
||||||
if (selectUpgradeTimer(state)) {
|
|
||||||
clearInterval(selectUpgradeTimer(state));
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.AUTO_UPDATE_DECLINED,
|
type: ACTIONS.AUTO_UPDATE_DECLINED,
|
||||||
|
|
|
@ -184,6 +184,11 @@ reducers[ACTIONS.HISTORY_NAVIGATE] = state =>
|
||||||
modalProps: {},
|
modalProps: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
reducers[ACTIONS.CLEAR_UPGRADE_TIMER] = state =>
|
||||||
|
Object.assign({}, state, {
|
||||||
|
checkUpgradeTimer: undefined,
|
||||||
|
});
|
||||||
|
|
||||||
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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue