Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize the local app version when checking for updates #20061

Merged
merged 1 commit into from
Dec 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/vector/platform/WebPlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default class WebPlatform extends VectorBasePlatform {
});
}

getAppVersion(): Promise<string> {
getNormalizedAppVersion(): string {
let ver = process.env.VERSION;

// if version looks like semver with leading v, strip it
Expand All @@ -137,7 +137,11 @@ export default class WebPlatform extends VectorBasePlatform {
if (semVerRegex.test(process.env.VERSION)) {
ver = process.env.VERSION.substr(1);
}
return Promise.resolve(ver);
return ver;
}

getAppVersion(): Promise<string> {
return Promise.resolve(this.getNormalizedAppVersion());
}

startUpdater() {
Expand All @@ -151,9 +155,11 @@ export default class WebPlatform extends VectorBasePlatform {

pollForUpdate = () => {
return this.getMostRecentVersion().then((mostRecentVersion) => {
if (process.env.VERSION !== mostRecentVersion) {
const currentVersion = this.getNormalizedAppVersion();

if (currentVersion !== mostRecentVersion) {
if (this.shouldShowUpdate(mostRecentVersion)) {
showUpdateToast(process.env.VERSION, mostRecentVersion);
showUpdateToast(currentVersion, mostRecentVersion);
}
return { status: UpdateCheckStatus.Ready };
} else {
Expand Down