Skip to content

Commit

Permalink
Modify AutoUpdater behavior on macOS.
Browse files Browse the repository at this point in the history
The AutoUpdater requires that macOS builds be code signed. That is currently not possible.
As a workaround, the autoupdater on mac will now alert users that an update is available and give the option to download the file directly from GitHub.
Closes #16.
  • Loading branch information
dscalzi committed Nov 19, 2018
1 parent 11cb9e6 commit acd6143
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ matrix:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
- ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true
- CSC_IDENTITY_AUTO_DISCOVERY=false

- os: linux
services: docker
Expand Down
2 changes: 2 additions & 0 deletions app/assets/css/launcher.css
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,8 @@ input:checked + .toggleSwitchSlider:before {

/* Update action button styles. */
#settingsUpdateActionButton {
display: flex;
flex-direction: column;
padding-left: 10px;
background: none;
border: none;
Expand Down
9 changes: 8 additions & 1 deletion app/assets/js/scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,14 @@ function populateSettingsUpdateInformation(data){
settingsUpdateChangelogTitle.innerHTML = data.releaseName
settingsUpdateChangelogText.innerHTML = data.releaseNotes
populateVersionInformation(data.version, settingsUpdateVersionValue, settingsUpdateVersionTitle, settingsUpdateVersionCheck)
settingsUpdateButtonStatus('Downloading..', true)

if(process.platform === 'darwin'){
settingsUpdateButtonStatus('Download from GitHub<span style="font-size: 10px;color: gray;text-shadow: none !important;">Close the launcher and run the file to update.</span>', false, () => {
shell.openExternal(data.darwindownload)
})
} else {
settingsUpdateButtonStatus('Downloading..', true)
}
} else {
settingsUpdateTitle.innerHTML = 'You Are Running the Latest Version'
settingsUpdateChangelogCont.style.display = 'none'
Expand Down
6 changes: 6 additions & 0 deletions app/assets/js/scripts/uicore.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ if(!isDev){
break
case 'update-available':
loggerAutoUpdaterSuccess.log('New update available', info.version)

if(process.platform === 'darwin'){
info.darwindownload = `https://github.com/WesterosCraftCode/ElectronLauncher/releases/download/v${info.version}/westeroscraftlauncher-${info.version}.dmg`
showUpdateUI(info)
}

populateSettingsUpdateInformation(info)
break
case 'update-downloaded':
Expand Down
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ function initAutoUpdater(event, data) {
autoUpdater.autoInstallOnAppQuit = false
autoUpdater.updateConfigPath = path.join(__dirname, 'dev-app-update.yml')
}
if(process.platform === 'darwin'){
autoUpdater.autoDownload = false
}
autoUpdater.on('update-available', (info) => {
event.sender.send('autoUpdateNotification', 'update-available', info)
})
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "westeroscraftlauncher",
"version": "1.0.6-pre.2",
"version": "1.1.0-pre.1",
"productName": "WesterosCraft Launcher",
"description": "Modded Minecraft Launcher",
"author": "Daniel Scalzi (https://github.com/dscalzi/)",
Expand Down Expand Up @@ -76,6 +76,7 @@
"uninstallerIcon": "build/icon.ico"
},
"mac": {
"target": "dmg",
"category": "public.app-category.games",
"icon": "build/icon.icns"
},
Expand Down

0 comments on commit acd6143

Please sign in to comment.