Skip to content

Commit

Permalink
Lead to latest beta or stable release
Browse files Browse the repository at this point in the history
  • Loading branch information
katzuv authored Oct 23, 2024
1 parent acf12ca commit fdbad1d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/main/UpdateChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default class UpdateChecker {
private alertDetail = "Checking for update information. Please try again.";
private alertOptions: string[] | null = null;
private alertCancelId: number | null = null;
private latestVersion = "";
private alertDownloadUrl: string | null = null;

async check() {
Expand Down Expand Up @@ -56,7 +57,7 @@ export default class UpdateChecker {
// Get version info
let currentVersion = app.getVersion();
let latestVersionInfo = releaseData[0];
let latestVersion = latestVersionInfo["tag_name"].slice(1);
this.latestVersion = latestVersionInfo["tag_name"].slice(1);
let latestDate = new Date(latestVersionInfo["published_at"]);
let latestDateText = latestDate.toLocaleDateString();
let translated = process.arch !== "arm64" && app.runningUnderARM64Translation;
Expand All @@ -69,21 +70,21 @@ export default class UpdateChecker {
this.alertDownloadUrl = null;

// Set appropriate prompt
if (currentVersion !== latestVersion && translated) {
if (currentVersion !== this.latestVersion && translated) {
this.alertMessage = "Download latest native version?";
this.alertDetail =
"Version " +
latestVersion +
this.latestVersion +
" is available (released " +
latestDateText +
"). You're currently running the x86 build of version " +
currentVersion +
" on an arm64 platform. Would you like to download the latest native version?";
} else if (currentVersion !== latestVersion) {
} else if (currentVersion !== this.latestVersion) {
this.alertMessage = "Download latest version?";
this.alertDetail =
"Version " +
latestVersion +
this.latestVersion +
" is available (released " +
latestDateText +
"). You're currently running version " +
Expand Down Expand Up @@ -157,11 +158,7 @@ export default class UpdateChecker {
let responseString = this.alertOptions[result.response];
if (responseString === "Download") {
if (this.alertDownloadUrl === null) {
if (isBeta()) {
await shell.openExternal("https://github.com/" + REPOSITORY + "/releases");
} else {
await shell.openExternal("https://github.com/" + REPOSITORY + "/releases/latest");
}
await shell.openExternal(`https://github.com/${REPOSITORY}/releases/v${this.latestVersion}`;
} else {
await shell.openExternal(this.alertDownloadUrl);
}
Expand Down

0 comments on commit fdbad1d

Please sign in to comment.