Normalize the local app version (#20062)
We need to strip the leading v from the local app version as well as the one fetched from the server
This commit is contained in:
parent
b14b2967ec
commit
39901b8d72
1 changed files with 10 additions and 4 deletions
|
@ -128,7 +128,7 @@ export default class WebPlatform extends VectorBasePlatform {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getAppVersion(): Promise<string> {
|
getNormalizedAppVersion(): string {
|
||||||
let ver = process.env.VERSION;
|
let ver = process.env.VERSION;
|
||||||
|
|
||||||
// if version looks like semver with leading v, strip it
|
// if version looks like semver with leading v, strip it
|
||||||
|
@ -137,7 +137,11 @@ export default class WebPlatform extends VectorBasePlatform {
|
||||||
if (semVerRegex.test(process.env.VERSION)) {
|
if (semVerRegex.test(process.env.VERSION)) {
|
||||||
ver = process.env.VERSION.substr(1);
|
ver = process.env.VERSION.substr(1);
|
||||||
}
|
}
|
||||||
return Promise.resolve(ver);
|
return ver;
|
||||||
|
}
|
||||||
|
|
||||||
|
getAppVersion(): Promise<string> {
|
||||||
|
return Promise.resolve(this.getNormalizedAppVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
startUpdater() {
|
startUpdater() {
|
||||||
|
@ -151,9 +155,11 @@ export default class WebPlatform extends VectorBasePlatform {
|
||||||
|
|
||||||
pollForUpdate = () => {
|
pollForUpdate = () => {
|
||||||
return this.getMostRecentVersion().then((mostRecentVersion) => {
|
return this.getMostRecentVersion().then((mostRecentVersion) => {
|
||||||
if (process.env.VERSION !== mostRecentVersion) {
|
const currentVersion = this.getNormalizedAppVersion();
|
||||||
|
|
||||||
|
if (currentVersion !== mostRecentVersion) {
|
||||||
if (this.shouldShowUpdate(mostRecentVersion)) {
|
if (this.shouldShowUpdate(mostRecentVersion)) {
|
||||||
showUpdateToast(process.env.VERSION, mostRecentVersion);
|
showUpdateToast(currentVersion, mostRecentVersion);
|
||||||
}
|
}
|
||||||
return { status: UpdateCheckStatus.Ready };
|
return { status: UpdateCheckStatus.Ready };
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue