forked from oslabs-beta/QLens
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implented AutoUpdate and ready for GitHub Releases
- Loading branch information
1 parent
c222d9b
commit bfd2bf8
Showing
7 changed files
with
93 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules/ | ||
dist/ | ||
electron-builder.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
// Import dependencies | ||
import React from "react"; | ||
import Container from "./containers/Container"; | ||
import AutoUpdate from "./Components/AutoUpdate"; | ||
import "./public/index.css"; | ||
|
||
// Create main App component | ||
const App = () => ( | ||
<div> | ||
<Container /> | ||
</div> | ||
) | ||
|
||
const App = () => { | ||
<div> | ||
<Container /> | ||
<AutoUpdate /> | ||
</div> | ||
} | ||
// Export the App component | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react' | ||
import "./public/index.css"; | ||
const { ipcRenderer } = require('electron') | ||
|
||
const AutoUpdate = () => { | ||
const notification = document.getElementById('notification'); | ||
const message = document.getElementById('message'); | ||
const restartButton = document.getElementById('restart-button'); | ||
|
||
ipcRenderer.on('update_available', () => { | ||
ipcRenderer.removeAllListeners('update_available'); | ||
message.innerText = 'A new update is available. Downloading now...'; | ||
notification.classList.remove('hidden'); | ||
}); | ||
ipcRenderer.on('update_downloaded', () => { | ||
ipcRenderer.removeAllListeners('update_downloaded'); | ||
message.innerText = 'Update Downloaded. It will be installed on restart. Restart now?'; | ||
restartButton.classList.remove('hidden'); | ||
notification.classList.remove('hidden'); | ||
}); | ||
|
||
function closeNotification() { | ||
notification.classList.add('hidden'); | ||
}; | ||
function restartApp() { | ||
ipcRenderer.send('restart_app'); | ||
}; | ||
|
||
return ( | ||
<div id="notification" class="hidden"> | ||
<p id="message"></p> | ||
<button id="close-button" onClick="closeNotification()"> | ||
Close | ||
</button> | ||
<button id="restart-button" onClick="restartApp()" class="hidden"> | ||
Restart | ||
</button> | ||
</div> | ||
) | ||
} | ||
|
||
export default AutoUpdate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters