mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-12 06:30:37 +00:00
Fixed auto-updating
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
(this will be possible in a future update to Bridge)
|
||||
</div>
|
||||
|
||||
<h3 class="ui header">Theme</h3>
|
||||
<!-- <h3 class="ui header">Theme</h3>
|
||||
<div #themeDropdown class="ui selection dropdown mr">
|
||||
<input type="hidden" name="sort" [value]="settingsService.theme">
|
||||
<i class="dropdown icon"></i>
|
||||
@@ -44,9 +44,15 @@
|
||||
<div class="menu">
|
||||
<div class="item" [attr.data-value]="i" *ngFor="let theme of settingsService.builtinThemes; let i = index">{{theme}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="bottom">
|
||||
<div class="ui buttons">
|
||||
<button *ngIf="updateAvailable" class="ui labeled icon positive button" (click)="downloadUpdate()">
|
||||
<i class="left cloud download alternate icon"></i>Update available</button>
|
||||
<button id="versionNumberButton" class="ui basic disabled button">v0.0.0</button>
|
||||
</div>
|
||||
|
||||
<button class="ui basic icon button" data-tooltip="Toggle developer tools" data-position="top right"
|
||||
(click)="toggleDevTools()">
|
||||
<i class="cog icon"></i>
|
||||
|
||||
@@ -17,4 +17,8 @@
|
||||
position: absolute;
|
||||
bottom: 2em;
|
||||
right: 2em;
|
||||
}
|
||||
|
||||
#versionNumberButton {
|
||||
margin-right: 1em;
|
||||
}
|
||||
@@ -8,23 +8,30 @@ import { SettingsService } from 'src/app/core/services/settings.service'
|
||||
styleUrls: ['./settings.component.scss']
|
||||
})
|
||||
export class SettingsComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('themeDropdown', { static: true }) themeDropdown: ElementRef
|
||||
// @ViewChild('themeDropdown', { static: true }) themeDropdown: ElementRef
|
||||
|
||||
cacheSize = 'Calculating...'
|
||||
updateAvailable = false
|
||||
updateVersion: string = null
|
||||
|
||||
constructor(public settingsService: SettingsService, private electronService: ElectronService) { }
|
||||
|
||||
async ngOnInit() {
|
||||
const cacheSize = await this.settingsService.getCacheSize()
|
||||
this.cacheSize = Math.round(cacheSize / 1000000) + ' MB'
|
||||
this.electronService.receiveIPC('update-available', (result) => {
|
||||
this.updateVersion = result.version
|
||||
this.updateAvailable = true
|
||||
})
|
||||
this.updateAvailable = await this.electronService.invoke('get-update-available', undefined)
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
$(this.themeDropdown.nativeElement).dropdown({
|
||||
onChange: (_value: string, text: string) => {
|
||||
this.settingsService.theme = text
|
||||
}
|
||||
})
|
||||
// $(this.themeDropdown.nativeElement).dropdown({
|
||||
// onChange: (_value: string, text: string) => {
|
||||
// this.settingsService.theme = text
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
async clearCache() {
|
||||
@@ -55,6 +62,18 @@ export class SettingsComponent implements OnInit, AfterViewInit {
|
||||
this.settingsService.rateLimitDelay = Number(inputElement.value)
|
||||
}
|
||||
|
||||
downloadUpdate() {
|
||||
this.electronService.sendIPC('download-update', undefined)
|
||||
this.electronService.receiveIPC('update-progress', (result) => console.log(result.percent))
|
||||
this.electronService.receiveIPC('update-downloaded', (result) => {
|
||||
console.log(result)
|
||||
setTimeout(() => {
|
||||
console.log('quit and install...')
|
||||
this.electronService.sendIPC('quit-and-install', undefined)
|
||||
}, 30000)
|
||||
})
|
||||
}
|
||||
|
||||
toggleDevTools() {
|
||||
const toolsOpened = this.electronService.currentWindow.webContents.isDevToolsOpened()
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<div class="ui top menu">
|
||||
<a class="item" routerLinkActive="active" routerLink="/browse">Browse</a>
|
||||
<a class="item" routerLinkActive="active" routerLink="/library">Library</a>
|
||||
<a class="item" routerLinkActive="active" routerLink="/settings">Settings</a>
|
||||
<a class="item" routerLinkActive="active" routerLink="/about"><i class="teal small circle icon"></i>About</a>
|
||||
<a class="item" routerLinkActive="active" routerLink="/settings"><i *ngIf="updateAvailable" class="teal small circle icon"></i>Settings</a>
|
||||
|
||||
<div class="right menu">
|
||||
<a class="item traffic-light" (click)="minimize()"><i class="minus icon"></i></a>
|
||||
|
||||
@@ -13,7 +13,7 @@ export class ToolbarComponent implements OnInit {
|
||||
|
||||
constructor(private electronService: ElectronService, private ref: ChangeDetectorRef) { }
|
||||
|
||||
ngOnInit() {
|
||||
async ngOnInit() {
|
||||
this.isMaximized = this.electronService.currentWindow.isMaximized()
|
||||
this.electronService.currentWindow.on('unmaximize', () => {
|
||||
this.isMaximized = false
|
||||
@@ -27,6 +27,7 @@ export class ToolbarComponent implements OnInit {
|
||||
this.electronService.receiveIPC('update-available', () => {
|
||||
this.updateAvailable = true
|
||||
})
|
||||
this.updateAvailable = await this.electronService.invoke('get-update-available', undefined)
|
||||
}
|
||||
|
||||
minimize() {
|
||||
|
||||
Reference in New Issue
Block a user