-
-
Notifications
You must be signed in to change notification settings - Fork 810
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this way will navigate to release page instead of auto updater.
- Loading branch information
Showing
8 changed files
with
74 additions
and
24 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
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,3 +1,5 @@ | ||
{ | ||
"url": "https://github.com/jhen0409/react-native-debugger/releases/download/v0.4.0/rn-debugger-darwin-x64.zip" | ||
"url": "https://github.com/jhen0409/react-native-debugger/releases/download/v0.4.0/rn-debugger-darwin-x64.zip", | ||
"name": "v0.4.0", | ||
"notes": "<Test with old version>\n<New line>\n\n<New line>" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,29 +1,69 @@ | ||
import { app, dialog } from 'electron'; | ||
import { app, dialog, shell } from 'electron'; | ||
import GhReleases from 'electron-gh-releases'; | ||
|
||
export default mainWindow => { | ||
if (process.env.NODE_ENV === 'production' && process.platform === 'darwin') { | ||
const updater = new GhReleases({ | ||
repo: 'jhen0409/react-native-debugger', | ||
currentVersion: app.getVersion(), | ||
}); | ||
let checking = false; | ||
|
||
updater.check((err, status) => { | ||
if (err || !status) return; | ||
updater.download(); | ||
}); | ||
export default (mainWindow, icon, notify) => { | ||
if (checking) return; | ||
|
||
updater.on('update-downloaded', ([, releaseNotes, releaseName]) => { | ||
checking = true; | ||
const updater = new GhReleases({ | ||
repo: 'jhen0409/react-native-debugger', | ||
currentVersion: app.getVersion(), | ||
}); | ||
|
||
updater.check((err, status) => { | ||
if ( | ||
process.platform === 'linux' && | ||
err.message === 'This platform is not supported.' | ||
) { | ||
err = null; // eslint-disable-line | ||
status = true; // eslint-disable-line | ||
} | ||
if (notify && err) { | ||
dialog.showMessageBox(mainWindow, { | ||
type: 'info', | ||
buttons: ['OK'], | ||
title: 'React Native Debugger', | ||
icon, | ||
message: err.message, | ||
}); | ||
checking = false; | ||
return; | ||
} | ||
if (err || !status) return; | ||
if (notify) { | ||
const index = dialog.showMessageBox(mainWindow, { | ||
type: 'info', | ||
buttons: ['Restart', 'Later'], | ||
buttons: ['Download', 'Later'], | ||
title: 'React Native Debugger', | ||
message: 'The new version has been downloaded. ' + | ||
'Please restart the application to apply the updates.', | ||
detail: `${releaseName}\n\n${releaseNotes}`, | ||
icon, | ||
message: 'The new version has been released.', | ||
}); | ||
if (index === 1) return; | ||
updater.install(); | ||
shell.openExternal('https://github.com/jhen0409/react-native-debugger/releases'); | ||
checking = false; | ||
return; | ||
} | ||
if (process.env.NODE_ENV === 'production' && process.platform === 'darwin') { | ||
updater.download(); | ||
} | ||
}); | ||
|
||
updater.on('update-downloaded', ([, releaseNotes, releaseName]) => { | ||
const index = dialog.showMessageBox(mainWindow, { | ||
type: 'info', | ||
buttons: ['Restart', 'Later'], | ||
title: 'React Native Debugger', | ||
icon, | ||
message: 'The new version has been downloaded. ' + | ||
'Please restart the application to apply the updates.', | ||
detail: `${releaseName}\n\n${releaseNotes}`, | ||
}); | ||
} | ||
if (index === 1) { | ||
checking = false; | ||
return; | ||
} | ||
updater.install(); | ||
}); | ||
}; |