diff --git a/README.md b/README.md index 6aee9611..ad0599e8 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,9 @@ If you use VS Code, you can run this directly from the IDE. Copy the following c "windows": { "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd" }, - "program": "${workspaceRoot}/index.js", + "args": ["."], "console": "integratedTerminal", - "protocol": "inspector", - "timeout": 100000000 + "protocol": "inspector" }, { "name": "Debug Renderer Process", @@ -60,7 +59,7 @@ If you use VS Code, you can run this directly from the IDE. Copy the following c "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd" }, "runtimeArgs": [ - "${workspaceRoot}/index.js", + "${workspaceRoot}/.", "--remote-debugging-port=9222" ], "webRoot": "${workspaceRoot}" diff --git a/app/assets/css/launcher.css b/app/assets/css/launcher.css index 9d210aa1..30350e0d 100644 --- a/app/assets/css/launcher.css +++ b/app/assets/css/launcher.css @@ -1002,8 +1002,12 @@ p { border-radius: 50%; margin-top: 50px; } +#image_seal_container[update]{ + cursor: pointer +} #image_seal_container[update]:before, #image_seal_container[update]:after { + cursor: pointer; position: absolute; content: ''; height: 100%; @@ -1013,10 +1017,47 @@ p { border-radius: 50%; box-shadow: 0 0 15px #43c628; animation: glow-grow 4s ease-out infinite; + background: rgba(0, 0, 0, 0.15); } -#image_seal_container[update]:after { +#image_seal_container[update]:before { animation-delay: 2s; } + +#updateAvailableTooltip { + cursor: pointer; + visibility: hidden; + opacity: 0; + width: 100px; + height: 15px; + background-color: rgb(0, 0, 0); + color: #fff; + text-align: center; + border-radius: 4px; + padding: 2px; + position: absolute; + z-index: 1; + top: 115%; + left: -17.5px; + font-family: 'Avenir Medium'; + font-size: 12px; + transition: visibility 0s linear 0.25s, opacity 0.25s ease; +} +#updateAvailableTooltip::after { + content: " "; + position: absolute; + left: 50%; + bottom: 100%; + margin-left: -5px; + border-width: 5px; + border-style: solid; + border-color: transparent transparent rgb(0, 0, 0) transparent; +} +#image_seal_container[update]:hover #updateAvailableTooltip { + visibility: visible; + opacity: 1; + transition-delay: 0s; +} + @keyframes glow-grow { 0% { opacity: 0; diff --git a/app/assets/images/backgrounds/2.jpg b/app/assets/images/backgrounds/2.jpg index c75ca9cb..7a13e771 100644 Binary files a/app/assets/images/backgrounds/2.jpg and b/app/assets/images/backgrounds/2.jpg differ diff --git a/app/assets/images/backgrounds/6.jpg b/app/assets/images/backgrounds/6.jpg new file mode 100644 index 00000000..acdaa73a Binary files /dev/null and b/app/assets/images/backgrounds/6.jpg differ diff --git a/app/assets/images/backgrounds/7.jpg b/app/assets/images/backgrounds/7.jpg new file mode 100644 index 00000000..35051cd8 Binary files /dev/null and b/app/assets/images/backgrounds/7.jpg differ diff --git a/app/assets/js/scripts/uicore.js b/app/assets/js/scripts/uicore.js index 758f575f..1e41c5f5 100644 --- a/app/assets/js/scripts/uicore.js +++ b/app/assets/js/scripts/uicore.js @@ -6,7 +6,8 @@ */ // Requirements const $ = require('jquery'); -const {remote, shell, webFrame} = require('electron') +const {ipcRenderer, remote, shell, webFrame} = require('electron') +const isDev = require('electron-is-dev') // Disable eval function. // eslint-disable-next-line @@ -26,6 +27,61 @@ webFrame.setZoomLevel(0) webFrame.setVisualZoomLevelLimits(1, 1) webFrame.setLayoutZoomLevelLimits(0, 0) +// Initialize auto updates in production environments. +// TODO Make this the case after implementation is done. +if(!isDev){ + ipcRenderer.on('autoUpdateNotification', (event, arg, info) => { + switch(arg){ + case 'checking-for-update': + console.log('Checking for update..') + break + case 'update-available': + console.log('New update available', info.version) + break + case 'update-downloaded': + console.log('Update ' + info.version + ' ready to be installed.') + showUpdateUI(info) + break + case 'update-not-available': + console.log('No new update found.') + break + case 'ready': + ipcRenderer.send('autoUpdateAction', 'checkForUpdate') + case 'error': + console.log('Error during update check..') + console.debug('Error Code:', info != null ? info.code : null) + if(err.code === 'ERR_UPDATER_INVALID_RELEASE_FEED'){ + console.log('No suitable releases found.') + } + break + default: + console.log('Unknown argument', arg) + break + } + }) + ipcRenderer.send('autoUpdateAction', 'initAutoUpdater') +} + +function showUpdateUI(info){ + //TODO Make this message a bit more informative `${info.version}` + document.getElementById('image_seal_container').setAttribute('update', true) + document.getElementById('image_seal_container').onclick = () => { + setOverlayContent('Update Available', 'A new update for the launcher is available. Would you like to install now?', 'Install', 'Later') + setOverlayHandler(() => { + if(!isDev){ + ipcRenderer.send('autoUpdateAction', 'installUpdateNow') + } else { + console.error('Cannot install updates in development environment.') + toggleOverlay(false) + } + }) + setDismissHandler(() => { + toggleOverlay(false) + }) + toggleOverlay(true, true) + } +} + /* jQuery Example $(function(){ console.log('UICore Initialized'); diff --git a/app/landing.ejs b/app/landing.ejs index ee4f6b38..735bb1fb 100644 --- a/app/landing.ejs +++ b/app/landing.ejs @@ -3,6 +3,7 @@