Skip to content

Commit

Permalink
Merge pull request #305 from Kyusung4698/develop
Browse files Browse the repository at this point in the history
0.6.2 (2020-03-13)
  • Loading branch information
Kyusung4698 committed Mar 13, 2020
2 parents 3c3b8d5 + 50829cf commit 456e16b
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 31 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.6.2 (2020-03-13)

- add periodic version check
- remove version popup
- fix auto update not working

## 0.6.1 (2020-03-13)

- add allow user to change install path (#296, #300)
Expand Down
3 changes: 2 additions & 1 deletion electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"target": [
"nsis",
"portable"
]
],
"publisherName": ["Nicklas Ronge"]
},
"linux": {
"icon": "dist/favicon.png",
Expand Down
32 changes: 22 additions & 10 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import AutoLaunch from 'auto-launch';
import { app, BrowserWindow, Display, ipcMain, Menu, MenuItem, MenuItemConstructorOptions, screen, Tray } from 'electron';
import * as log from 'electron-log';
import { autoUpdater } from 'electron-updater';
import * as path from 'path';
import * as robot from 'robotjs';
Expand All @@ -15,6 +16,11 @@ app.allowRendererProcessReuse = true;
app.commandLine.appendSwitch('high-dpi-support', 'true');
app.commandLine.appendSwitch('force-device-scale-factor', '1');

log.transports.file.level = 'info';
log.info('App starting...');

autoUpdater.logger = log;

const args = process.argv.slice(1),
serve = args.some(val => val === '--serve');

Expand All @@ -25,6 +31,7 @@ const launch = new AutoLaunch({
let win: BrowserWindow = null;
let tray: Tray = null;
let menu: Menu = null;
let downloadItem: MenuItem = null;

const childs: {
[key: string]: BrowserWindow
Expand Down Expand Up @@ -109,15 +116,17 @@ autoUpdater.on('update-available', () => {
title: 'New update available',
content: 'A new update is available. Will be automatically downloaded unless otherwise specified.',
});
const item = new MenuItem({
label: 'Download Update',
type: 'normal',
click: () => {
autoUpdater.downloadUpdate();
item.enabled = false;
}
});
menu?.insert(2, item);
if (!downloadItem) {
downloadItem = new MenuItem({
label: 'Download Update',
type: 'normal',
click: () => {
autoUpdater.downloadUpdate();
downloadItem.enabled = false;
}
});
menu?.insert(2, downloadItem);
}
});

autoUpdater.on('update-downloaded', () => {
Expand All @@ -131,7 +140,10 @@ autoUpdater.on('update-downloaded', () => {

ipcMain.on('app-download-init', (event, autoDownload) => {
autoUpdater.autoDownload = autoDownload;
autoUpdater.checkForUpdatesAndNotify();
autoUpdater.checkForUpdates();
setInterval(() => {
autoUpdater.checkForUpdates();
}, 1000 * 60 * 5);
event.returnValue = true;
});

Expand Down
7 changes: 6 additions & 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": "poe-overlay",
"version": "0.6.1",
"version": "0.6.2",
"private": true,
"description": "A Overlay for Path of Exile. Built with Electron and Angular.",
"main": "main.js",
Expand Down Expand Up @@ -78,6 +78,7 @@
"@swimlane/ngx-charts": "^13.0.2",
"active-win": "git+https://github.com/Kyusung4698/active-win.git#f2292727f7e979d9fb5c6919e3742bf5d6140014",
"auto-launch": "^5.0.5",
"electron-log": "^4.1.0",
"electron-updater": "^4.2.5",
"iohook": "^0.6.5",
"localforage": "^1.7.3",
Expand Down
18 changes: 0 additions & 18 deletions src/app/layout/page/overlay/overlay.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { DialogRefService } from '@app/service/dialog';
import { ShortcutService } from '@app/service/input';
import { FEATURE_MODULES } from '@app/token';
import { AppUpdateState, FeatureModule, VisibleFlag } from '@app/type';
import { ReleasesHttpService } from '@data/github';
import { TranslateService } from '@ngx-translate/core';
import { SnackBarService } from '@shared/module/material/service';
import { ContextService } from '@shared/module/poe/service';
Expand All @@ -29,7 +28,6 @@ export class OverlayComponent implements OnInit, OnDestroy {
constructor(
@Inject(FEATURE_MODULES)
private readonly modules: FeatureModule[],
private readonly releasesHttpService: ReleasesHttpService,
private readonly userSettingsService: UserSettingsService,
private readonly context: ContextService,
private readonly app: AppService,
Expand All @@ -49,29 +47,13 @@ export class OverlayComponent implements OnInit, OnDestroy {
}

public ngOnInit(): void {
this.checkVersion();
this.initSettings();
}

public ngOnDestroy(): void {
this.reset();
}

// deprecated. will be removed with 0.6.1 - if the auto update works.
private checkVersion(): void {
this.version = this.app.version();

this.releasesHttpService.getLatestRelease().subscribe(release => {
if (release && release.tag_name.replace('v', '') !== this.version && release.assets && release.assets[0].browser_download_url) {
if (confirm(
`A new version: '${release.tag_name}' is available. Go to download Page?\n` +
`*** Deprecated. will be removed with 0.6.1`)) {
this.browser.open(release.html_url);
}
}
});
}

private initSettings(): void {
this.userSettingsService.init(this.modules).subscribe(settings => {
this.translate.use(`${settings.language}`);
Expand Down

0 comments on commit 456e16b

Please sign in to comment.