-
+
+
+
+ {!this.props.updateAvailable && (
+ No updates available
+ )}
+
@@ -108,13 +123,16 @@ const FlexContainer = styled.div`
`
const mapDispatchToProps = {
- userLogout
+ userLogout,
+ setChecking
}
const mapStateToProps = state => ({
authToken: state.user.authToken,
profile: state.user.profile,
version: state.updater.version,
+ updateAvailable: state.updater.updateAvailable,
+ updatesChecking: state.updater.checking,
})
export default connect(mapStateToProps, mapDispatchToProps)(SettingsContainer)
diff --git a/src/index.js b/src/index.js
index 30aa3bf..e8e8415 100644
--- a/src/index.js
+++ b/src/index.js
@@ -20,7 +20,7 @@ import store from './lib/create-store'
import api from './lib/api'
import { storeState } from './lib/storage'
import { addWorklogs, setUpdating, fetchWorklogs } from './modules/worklog'
-import { setVersion, setUpdateInfo, setDownloaded } from './modules/updater'
+import { setVersion, setUpdateInfo, setDownloaded, setChecking, setUpdateAvailable } from './modules/updater'
import { setAuthToken, setJiraDomain } from './modules/user'
import AppContainer from 'containers/app/app-container'
@@ -71,9 +71,16 @@ ipcRenderer.on('updateStatus', (event, info) => {
var updateInfo = JSON.parse(info)
console.log('updateStatus', updateInfo)
store.dispatch(setUpdateInfo(updateInfo))
+ store.dispatch(setChecking(false))
})
ipcRenderer.on('updateReady', () => {
console.log('updateReady')
store.dispatch(setDownloaded())
})
+
+ipcRenderer.on('updateNotAvailable', () => {
+ console.log('updateNotAvailable')
+ store.dispatch(setUpdateAvailable(false))
+ store.dispatch(setChecking(false))
+})
diff --git a/src/modules/updater.js b/src/modules/updater.js
index 1b6a03b..a089baa 100644
--- a/src/modules/updater.js
+++ b/src/modules/updater.js
@@ -4,11 +4,15 @@ import Immutable from 'seamless-immutable'
const SET_VERSION = 'jt/updater/SET_VERSION'
const SET_UPDATE_INFO = 'jt/updater/SET_UPDATE_INFO'
const SET_DOWNLOADED = 'jt/updater/SET_DOWNLOADED'
+const SET_AVAILABLE = 'jt/updater/SET_AVAILABLE'
+const SET_CHECKING = 'jt/updater/SET_CHECKING'
export const initialState = Immutable({
version: null,
updateInfo: null,
- downloaded: false
+ downloaded: false,
+ checking: false,
+ updateAvailable: false,
})
// Reducer
@@ -24,6 +28,12 @@ export default function reducer (state = initialState, action = {}) {
case SET_DOWNLOADED:
return state.set('downloaded', true)
+ case SET_AVAILABLE:
+ return state.set('updateAvailable', action.available)
+
+ case SET_CHECKING:
+ return state.set('checking', action.checking)
+
default: return state
}
}
@@ -42,3 +52,13 @@ export const setUpdateInfo = updateInfo => ({
export const setDownloaded = () => ({
type: SET_DOWNLOADED
})
+
+export const setUpdateAvailable = available => ({
+ type: SET_AVAILABLE,
+ available
+})
+
+export const setChecking = checking => ({
+ type: SET_CHECKING,
+ checking
+})