This commit is contained in:
João Moreno 2021-09-29 09:28:41 +02:00
parent 0c3d2cf590
commit 8dae395177
No known key found for this signature in database
GPG key ID: 896B853774D1A575

View file

@ -72,7 +72,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
return;
}
const updateMode = getMigratedSettingValue<string>(this.configurationService, 'update.mode', 'update.channel');
const updateMode = this.getUpdateMode();
const quality = this.getProductQuality(updateMode);
if (!quality) {
@ -104,6 +104,10 @@ export abstract class AbstractUpdateService implements IUpdateService {
}
}
private getUpdateMode(): 'none' | 'manual' | 'start' | 'default' {
return getMigratedSettingValue<'none' | 'manual' | 'start' | 'default'>(this.configurationService, 'update.mode', 'update.channel');
}
private getProductQuality(updateMode: string): string | undefined {
return updateMode === 'none' ? undefined : this.productService.quality;
}
@ -177,20 +181,18 @@ export abstract class AbstractUpdateService implements IUpdateService {
return Promise.resolve(undefined);
}
isLatestVersion(): Promise<boolean | undefined> {
async isLatestVersion(): Promise<boolean | undefined> {
if (!this.url) {
return Promise.resolve(undefined);
return undefined;
} else if (this.getUpdateMode() === 'none') {
return false;
}
return this.requestService.request({ url: this.url }, CancellationToken.None).then(context => {
// The update server replies with 204 (No Content) when no
// update is available - that's all we want to know.
if (context.res.statusCode === 204) {
return true;
} else {
return false;
}
});
const context = await this.requestService.request({ url: this.url }, CancellationToken.None);
// The update server replies with 204 (No Content) when no
// update is available - that's all we want to know.
return context.res.statusCode === 204;
}
protected getUpdateType(): UpdateType {