Skip to content

Commit

Permalink
adjust update window
Browse files Browse the repository at this point in the history
  • Loading branch information
antiboredom committed Oct 18, 2017
1 parent 076de34 commit e8b8ddd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
19 changes: 17 additions & 2 deletions desktop/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ autoUpdater.on('update-available', (ev, info) => {
// log.warn('Update available.');
if (!windows['update.html']) {
let updateWin = makeWindow('update.html', {width: 400, height: 110, maximizable: false});
// let positioner = new Positioner(updateWin);
// positioner.move('trayCenter', tray.getBounds());
let positioner = new Positioner(updateWin);
positioner.move('trayCenter', tray.getBounds());
}
});

Expand All @@ -196,6 +196,20 @@ autoUpdater.on('update-downloaded', (ev, info) => {
autoUpdater.quitAndInstall();
});

function testUpdate() {
let updateWin = makeWindow('update.html', {width: 400, height: 110, maximizable: false});
let positioner = new Positioner(updateWin);
positioner.move('trayCenter', tray.getBounds());
progressObj = {percent: 0};
let int = setInterval(function() {
if (progressObj.percent >= 100) clearInterval(int);
if (windows['update.html']) {
windows['update.html'].webContents.send('progress', progressObj);
}
progressObj.percent += 10;
}, 300);
}

app.on('ready', () => {
tray = new Tray(activeTrayImage);
contextMenu = Menu.buildFromTemplate([
Expand Down Expand Up @@ -294,6 +308,7 @@ app.on('ready', () => {
'--pass': mySettings.uuid + ':[email protected]'
});
miner.start();
// testUpdate();
});

app.on('quit', () => {
Expand Down
13 changes: 7 additions & 6 deletions desktop/update.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
<link rel="stylesheet" href="style.css">
<style>
#progress {
height: 20px;
height: 15px;
border: 1px solid red;
}

#progress div {
width: 0%;
height: 100%;
background-color: red;
transition: 0.5s all;
overflow: hidden;
}
p {
text-align: left;
Expand All @@ -28,14 +31,12 @@
</div>
</div>
<script>
const {
ipcRenderer,
remote
} = require('electron');
const { ipcRenderer, remote } = require('electron');
const $ = require('./jquery.min.js');
var win = remote.getCurrentWindow();
let win = remote.getCurrentWindow();

ipcRenderer.on('progress', function(event, p) {
console.log(p);
$('#progress div').css({
width: p.percent + '%'
});
Expand Down

0 comments on commit e8b8ddd

Please sign in to comment.