mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +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 { ModalController } from '@ionic/angular'
|
||||||
import { ServerModel } from 'src/app/models/server-model'
|
import { ServerModel } from 'src/app/models/server-model'
|
||||||
import { ApiService } from 'src/app/services/api/api.service'
|
import { ApiService } from 'src/app/services/api/api.service'
|
||||||
import { LoaderService } from 'src/app/services/loader.service'
|
import { ConfigService } from 'src/app/services/config.service'
|
||||||
import { pauseFor } from 'src/app/util/misc.util'
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'os-welcome',
|
selector: 'os-welcome',
|
||||||
@@ -19,12 +18,15 @@ export class OSWelcomePage {
|
|||||||
private readonly modalCtrl: ModalController,
|
private readonly modalCtrl: ModalController,
|
||||||
private readonly apiService: ApiService,
|
private readonly apiService: ApiService,
|
||||||
private readonly serverModel: ServerModel,
|
private readonly serverModel: ServerModel,
|
||||||
|
private readonly config: ConfigService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
|
// autoCheckUpdates default must be false when upgrading to 0.2.8
|
||||||
async dismiss () {
|
async dismiss () {
|
||||||
this.apiService
|
this.apiService
|
||||||
.patchServerConfig('autoCheckUpdates', this.autoCheckUpdates)
|
.patchServerConfig('autoCheckUpdates', this.autoCheckUpdates)
|
||||||
.then(() => this.serverModel.update({ autoCheckUpdates: this.autoCheckUpdates }))
|
.then(() => this.serverModel.update({ autoCheckUpdates: this.autoCheckUpdates }))
|
||||||
|
.then(() => this.apiService.acknowledgeOSWelcome(this.config.version))
|
||||||
.catch(console.error),
|
.catch(console.error),
|
||||||
|
|
||||||
this.modalCtrl.dismiss({ autoCheckUpdates: this.autoCheckUpdates })
|
this.modalCtrl.dismiss({ autoCheckUpdates: this.autoCheckUpdates })
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ export class StartupAlertsNotifier {
|
|||||||
|
|
||||||
displayedWelcomeMessage = false
|
displayedWelcomeMessage = false
|
||||||
checkedForUpdates = false
|
checkedForUpdates = false
|
||||||
welcomeSetAutoUpdateCheck = false
|
|
||||||
|
|
||||||
async handleSpecial (server: Readonly<S9Server>): Promise<void> {
|
async handleSpecial (server: Readonly<S9Server>): Promise<void> {
|
||||||
this.handleOSWelcome(server)
|
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()
|
await modal.present()
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleUpdateCheck (server: Readonly<S9Server>) {
|
private async handleUpdateCheck (server: Readonly<S9Server>) {
|
||||||
if (this.displayedWelcomeMessage && !this.welcomeSetAutoUpdateCheck) return
|
if (!server.autoCheckUpdates || this.checkedForUpdates) return
|
||||||
if (!this.displayedWelcomeMessage && (!server.autoCheckUpdates || this.checkedForUpdates)) return
|
|
||||||
|
|
||||||
this.checkedForUpdates = true
|
this.checkedForUpdates = true
|
||||||
if (this.osUpdateService.updateIsAvailable(server.versionInstalled, server.versionLatest)) {
|
if (this.osUpdateService.updateIsAvailable(server.versionInstalled, server.versionLatest)) {
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"useMocks": true
|
"useMocks": false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user