mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
ui: fire autoCheck async
This commit is contained in:
committed by
Aiden McClelland
parent
e96ef695a3
commit
e482ccf7fd
@@ -2,8 +2,7 @@ import { Component, Input } from '@angular/core'
|
||||
import { ModalController } from '@ionic/angular'
|
||||
import { ServerModel } from 'src/app/models/server-model'
|
||||
import { ApiService } from 'src/app/services/api/api.service'
|
||||
import { LoaderService } from 'src/app/services/loader.service'
|
||||
import { pauseFor } from 'src/app/util/misc.util'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
|
||||
@Component({
|
||||
selector: 'os-welcome',
|
||||
@@ -19,12 +18,15 @@ export class OSWelcomePage {
|
||||
private readonly modalCtrl: ModalController,
|
||||
private readonly apiService: ApiService,
|
||||
private readonly serverModel: ServerModel,
|
||||
private readonly config: ConfigService,
|
||||
) { }
|
||||
|
||||
// autoCheckUpdates default must be false when upgrading to 0.2.8
|
||||
async dismiss () {
|
||||
this.apiService
|
||||
.patchServerConfig('autoCheckUpdates', this.autoCheckUpdates)
|
||||
.then(() => this.serverModel.update({ autoCheckUpdates: this.autoCheckUpdates }))
|
||||
.then(() => this.apiService.acknowledgeOSWelcome(this.config.version))
|
||||
.catch(console.error),
|
||||
|
||||
this.modalCtrl.dismiss({ autoCheckUpdates: this.autoCheckUpdates })
|
||||
|
||||
@@ -23,7 +23,6 @@ export class StartupAlertsNotifier {
|
||||
|
||||
displayedWelcomeMessage = false
|
||||
checkedForUpdates = false
|
||||
welcomeSetAutoUpdateCheck = false
|
||||
|
||||
async handleSpecial (server: Readonly<S9Server>): Promise<void> {
|
||||
this.handleOSWelcome(server)
|
||||
@@ -44,17 +43,11 @@ export class StartupAlertsNotifier {
|
||||
},
|
||||
})
|
||||
|
||||
modal.onDidDismiss().then(res => {
|
||||
this.welcomeSetAutoUpdateCheck = res.data.autoCheckUpdates
|
||||
this.apiService.acknowledgeOSWelcome(this.config.version)
|
||||
this.handleUpdateCheck(server)
|
||||
})
|
||||
await modal.present()
|
||||
}
|
||||
|
||||
private async handleUpdateCheck (server: Readonly<S9Server>) {
|
||||
if (this.displayedWelcomeMessage && !this.welcomeSetAutoUpdateCheck) return
|
||||
if (!this.displayedWelcomeMessage && (!server.autoCheckUpdates || this.checkedForUpdates)) return
|
||||
if (!server.autoCheckUpdates || this.checkedForUpdates) return
|
||||
|
||||
this.checkedForUpdates = true
|
||||
if (this.osUpdateService.updateIsAvailable(server.versionInstalled, server.versionLatest)) {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"useMocks": true
|
||||
"useMocks": false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user