ui: finalize PR

This commit is contained in:
Aaron Greenspan
2021-01-20 17:14:32 -07:00
committed by Aiden McClelland
parent 39accaa382
commit ba04b7c431
3 changed files with 3 additions and 26 deletions

View File

@@ -38,7 +38,7 @@ export class OsUpdateService {
this.serverModel.watch().versionInstalled.pipe(take(1)),
this.apiService.getVersionLatest(),
]).pipe(
map(([vi, vl]) => updateIsAvailable(this.emver, vi, vl.versionLatest)),
map(([vi, vl]) => this.updateIsAvailable(vi, vl.versionLatest) ? vl : undefined),
catchError(e => {
console.error(`OsUpdateService Error: ${e}`)
return of(undefined)
@@ -59,11 +59,6 @@ export class OsUpdateService {
}
}
async checkForAppsUpdate (): Promise<boolean> {
const availableApps = await this.apiService.getAvailableApps()
return !!availableApps.find(app => this.emver.compare(app.versionInstalled, app.versionLatest) === -1)
}
async updateEmbassyOS (versionLatest: string): Promise<void> {
await this.apiService.updateAgent(versionLatest)
this.serverModel.update({ status: ServerStatus.UPDATING })
@@ -71,8 +66,3 @@ export class OsUpdateService {
await this.navCtrl.navigateRoot('/embassy')
}
}
function updateIsAvailable (e: Emver, vi: string, vl: string): string | undefined {
if (!vi || !vl) return undefined
return e.compare(vi, vl) === -1 ? vl : undefined
}