Modify AutoUpdater behavior on macOS.

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.
This commit is contained in:
Daniel Scalzi 2018-11-18 21:51:48 -05:00
parent 11cb9e6c28
commit acd6143d30
No known key found for this signature in database
GPG Key ID: 5CA2F145B63535F9
7 changed files with 23 additions and 3 deletions

View File

@ -8,6 +8,7 @@ matrix:
- ELECTRON_CACHE=$HOME/.cache/electron - ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder - ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
- ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true - ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true
- CSC_IDENTITY_AUTO_DISCOVERY=false
- os: linux - os: linux
services: docker services: docker

View File

@ -2099,6 +2099,8 @@ input:checked + .toggleSwitchSlider:before {
/* Update action button styles. */ /* Update action button styles. */
#settingsUpdateActionButton { #settingsUpdateActionButton {
display: flex;
flex-direction: column;
padding-left: 10px; padding-left: 10px;
background: none; background: none;
border: none; border: none;

View File

@ -1109,7 +1109,14 @@ function populateSettingsUpdateInformation(data){
settingsUpdateChangelogTitle.innerHTML = data.releaseName settingsUpdateChangelogTitle.innerHTML = data.releaseName
settingsUpdateChangelogText.innerHTML = data.releaseNotes settingsUpdateChangelogText.innerHTML = data.releaseNotes
populateVersionInformation(data.version, settingsUpdateVersionValue, settingsUpdateVersionTitle, settingsUpdateVersionCheck) populateVersionInformation(data.version, settingsUpdateVersionValue, settingsUpdateVersionTitle, settingsUpdateVersionCheck)
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) settingsUpdateButtonStatus('Downloading..', true)
}
} else { } else {
settingsUpdateTitle.innerHTML = 'You Are Running the Latest Version' settingsUpdateTitle.innerHTML = 'You Are Running the Latest Version'
settingsUpdateChangelogCont.style.display = 'none' settingsUpdateChangelogCont.style.display = 'none'

View File

@ -47,6 +47,12 @@ if(!isDev){
break break
case 'update-available': case 'update-available':
loggerAutoUpdaterSuccess.log('New update available', info.version) 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) populateSettingsUpdateInformation(info)
break break
case 'update-downloaded': case 'update-downloaded':

View File

@ -22,6 +22,9 @@ function initAutoUpdater(event, data) {
autoUpdater.autoInstallOnAppQuit = false autoUpdater.autoInstallOnAppQuit = false
autoUpdater.updateConfigPath = path.join(__dirname, 'dev-app-update.yml') autoUpdater.updateConfigPath = path.join(__dirname, 'dev-app-update.yml')
} }
if(process.platform === 'darwin'){
autoUpdater.autoDownload = false
}
autoUpdater.on('update-available', (info) => { autoUpdater.on('update-available', (info) => {
event.sender.send('autoUpdateNotification', 'update-available', info) event.sender.send('autoUpdateNotification', 'update-available', info)
}) })

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "westeroscraftlauncher", "name": "westeroscraftlauncher",
"version": "1.0.6-pre.2", "version": "1.1.0-pre.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "westeroscraftlauncher", "name": "westeroscraftlauncher",
"version": "1.0.6-pre.2", "version": "1.1.0-pre.1",
"productName": "WesterosCraft Launcher", "productName": "WesterosCraft Launcher",
"description": "Modded Minecraft Launcher", "description": "Modded Minecraft Launcher",
"author": "Daniel Scalzi (https://github.com/dscalzi/)", "author": "Daniel Scalzi (https://github.com/dscalzi/)",
@ -76,6 +76,7 @@
"uninstallerIcon": "build/icon.ico" "uninstallerIcon": "build/icon.ico"
}, },
"mac": { "mac": {
"target": "dmg",
"category": "public.app-category.games", "category": "public.app-category.games",
"icon": "build/icon.icns" "icon": "build/icon.icns"
}, },