ui: pass toggle value to server object

This commit is contained in:
Aaron Greenspan
2021-01-20 17:41:56 -07:00
committed by Aiden McClelland
parent ba04b7c431
commit c61c164c0f
2 changed files with 7 additions and 6 deletions

View File

@@ -21,7 +21,6 @@ export class OSWelcomePage {
private readonly config: ConfigService, private readonly config: ConfigService,
) { } ) { }
// autoCheckUpdates default must be false when upgrading to
async dismiss () { async dismiss () {
this.apiService this.apiService
.patchServerConfig('autoCheckUpdates', this.autoCheckUpdates) .patchServerConfig('autoCheckUpdates', this.autoCheckUpdates)

View File

@@ -27,8 +27,9 @@ export class StartupAlertsNotifier {
async handleSpecial (server: Readonly<S9Server>): Promise<void> { async handleSpecial (server: Readonly<S9Server>): Promise<void> {
if (this.needsWelcomeMessage(server)) { if (this.needsWelcomeMessage(server)) {
await this.handleOSWelcome(server) const serverUpdates = await this.handleOSWelcome(server)
if (this.needsAppsCheck(server)) await this.handleAppsCheck() if (this.needsAppsCheck({ ...server, ...serverUpdates })) await this.handleAppsCheck()
return
} }
if (this.needsOSCheck(server)) { if (this.needsOSCheck(server)) {
@@ -43,6 +44,7 @@ export class StartupAlertsNotifier {
} }
needsAppsCheck (server: S9Server): boolean { needsAppsCheck (server: S9Server): boolean {
console.log('server', server)
return server.autoCheckUpdates && !this.checkedAppsForUpdates return server.autoCheckUpdates && !this.checkedAppsForUpdates
} }
@@ -50,7 +52,7 @@ export class StartupAlertsNotifier {
return server.autoCheckUpdates && !this.checkedOSForUpdates return server.autoCheckUpdates && !this.checkedOSForUpdates
} }
private async handleOSWelcome (server: Readonly<S9Server>): Promise<void> { private async handleOSWelcome (server: Readonly<S9Server>): Promise<Partial<S9Server>> {
this.displayedWelcomeMessage = true this.displayedWelcomeMessage = true
return new Promise(async resolve => { return new Promise(async resolve => {
@@ -64,7 +66,7 @@ export class StartupAlertsNotifier {
}) })
await modal.present() await modal.present()
modal.onWillDismiss().then(() => resolve()) modal.onWillDismiss().then(res => resolve(res.data))
}) })
} }
@@ -74,7 +76,7 @@ export class StartupAlertsNotifier {
const { versionLatest } = await this.apiService.getVersionLatest() const { versionLatest } = await this.apiService.getVersionLatest()
if (this.osUpdateService.updateIsAvailable(server.versionInstalled, versionLatest)) { if (this.osUpdateService.updateIsAvailable(server.versionInstalled, versionLatest)) {
const { update } = await this.presentAlertNewOS(server.versionLatest) const { update } = await this.presentAlertNewOS(versionLatest)
if (update) { if (update) {
await this.loader.displayDuringP( await this.loader.displayDuringP(
this.osUpdateService.updateEmbassyOS(versionLatest), this.osUpdateService.updateEmbassyOS(versionLatest),