Skip to content

Commit 5ed9f66

Browse files
committed
Auto stash before merge of "master" and "origin/master"
1 parent 7211b4f commit 5ed9f66

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

app/renderer/src/reducers/update.ts

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import {
2+
showUpdateNotAvailableNotification,
3+
showUpdateAvailableNotification,
4+
} from '../Notifications';
5+
import {
6+
CHECK_FOR_UPDATE,
7+
UDPATE_INFO,
8+
UPDATE_DOWNLOADING,
9+
UPDATE_DOWNLOADED
10+
} from '../actions/update/';
11+
12+
const initialState = {
13+
checkingForUpdate: false,
14+
error: null,
15+
updateAvailable: false,
16+
msg: null,
17+
downloading: false,
18+
updating: false,
19+
downloadPercentage: 0,
20+
};
21+
22+
export function update(state = initialState, action) {
23+
switch (action.type) {
24+
case CHECK_FOR_UPDATE:
25+
return {
26+
...state,
27+
checkingForUpdate: action.data.checkingForUpdate,
28+
};
29+
case UDPATE_INFO:
30+
if (action.data.updateAvailable) {
31+
showUpdateAvailableNotification(action.data.msg);
32+
} else {
33+
showUpdateNotAvailableNotification(action.data.msg);
34+
}
35+
36+
return {
37+
...state,
38+
checkingForUpdate: action.data.checkingForUpdate,
39+
error: action.data.error,
40+
updateAvailable: action.data.updateAvailable,
41+
msg: action.data.msg,
42+
};
43+
case UPDATE_DOWNLOADING:
44+
return {
45+
...state,
46+
downloading: action.data.downloading,
47+
updating: action.data.updating,
48+
downloadPercentage: action.data.downloadPercentage,
49+
error: action.data.error,
50+
updateAvailable: action.data.updateAvailable,
51+
msg: action.data.msg,
52+
};
53+
case UPDATE_DOWNLOADED:
54+
return {
55+
...state,
56+
downloading: action.data.downloading,
57+
updating: action.data.updating,
58+
downloadPercentage: action.data.downloadPercentage,
59+
error: action.data.error,
60+
updateAvailable: action.data.updateAvailable,
61+
msg: action.data.msg,
62+
};
63+
default:
64+
return state;
65+
}
66+
}

0 commit comments

Comments
 (0)