Skip to content

Commit

Permalink
Don't bundle prelease owlet compliancies in stable AdvantageScope rel…
Browse files Browse the repository at this point in the history
…eases
  • Loading branch information
jwbonner committed Oct 31, 2024
1 parent 64dbd98 commit 53d5c76
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/main/UpdateChecker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { app, dialog, shell } from "electron";
import fetch from "electron-fetch";
import { isBeta } from "./BetaConfig";
import { REPOSITORY, WINDOW_ICON } from "./Constants";
import { isBeta } from "./betaUtil";

/** Checks for updates from GitHub and prompts the user when requested. */
export default class UpdateChecker {
Expand Down
12 changes: 12 additions & 0 deletions src/main/betaConfig2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const BETA_CONFIG: BetaConfig | null = {
year: "2025",
expiration: new Date(2025, 0, 4),
surveyUrl:
"https://docs.google.com/forms/d/e/1FAIpQLSe7xxOln2NUO6pNrGQAPAJ5W7HH2dcIfcCYYi0etTQQE5ORwg/viewform?usp=pp_url&entry.1466744914=__version__"
};

export type BetaConfig = {
year: string;
expiration: Date;
surveyUrl: string;
};
13 changes: 1 addition & 12 deletions src/main/BetaConfig.ts → src/main/betaUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@ import path from "path";
import { DISTRIBUTOR, Distributor } from "../shared/buildConstants";
import { scaleValue } from "../shared/util";
import { APP_VERSION } from "./Constants";
import { BETA_CONFIG } from "./betaConfig2";

// Constants
const BETA_CONFIG: BetaConfig | null = {
year: "2025",
expiration: new Date(2025, 0, 4),
surveyUrl:
"https://docs.google.com/forms/d/e/1FAIpQLSe7xxOln2NUO6pNrGQAPAJ5W7HH2dcIfcCYYi0etTQQE5ORwg/viewform?usp=pp_url&entry.1466744914=__version__"
};
const BETA_STATE_FILENAME =
BETA_CONFIG === null ? null : path.join(app.getPath("userData"), "beta-" + BETA_CONFIG.year + ".json");

Expand Down Expand Up @@ -110,11 +104,6 @@ export function openBetaSurvey(): void {
}

// Types
type BetaConfig = {
year: string;
expiration: Date;
surveyUrl: string;
};
type BetaState = {
welcomeComplete: boolean;
surveyStatus: number | boolean;
Expand Down
18 changes: 9 additions & 9 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@ import { SourceListConfig, SourceListItemState, SourceListTypeMemory } from "../
import TabType, { getAllTabTypes, getDefaultTabTitle, getTabAccelerator, getTabIcon } from "../shared/TabType";
import { BUILD_DATE, COPYRIGHT, DISTRIBUTOR, Distributor } from "../shared/buildConstants";
import { MAX_RECENT_UNITS, NoopUnitConversion, UnitConversionPreset } from "../shared/units";
import {
delayBetaSurvey,
isBeta,
isBetaExpired,
isBetaWelcomeComplete,
openBetaSurvey,
saveBetaWelcomeComplete,
shouldPromptBetaSurvey
} from "./BetaConfig";
import {
APP_VERSION,
DEFAULT_PREFS,
Expand Down Expand Up @@ -78,6 +69,15 @@ import UpdateChecker from "./UpdateChecker";
import { VideoProcessor } from "./VideoProcessor";
import { getAssetDownloadStatus, startAssetDownloadLoop } from "./assetsDownload";
import { convertLegacyAssets, createAssetFolders, getUserAssetsPath, loadAssets } from "./assetsUtil";
import {
delayBetaSurvey,
isBeta,
isBetaExpired,
isBetaWelcomeComplete,
openBetaSurvey,
saveBetaWelcomeComplete,
shouldPromptBetaSurvey
} from "./betaUtil";
import { getOwletDownloadStatus, startOwletDownloadLoop } from "./owletDownloadLoop";
import { checkHootIsPro, convertHoot } from "./owletInterface";

Expand Down
8 changes: 7 additions & 1 deletion src/main/owletDownload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function getOwletPlatform(electronPlatform: string): string {
* @param target Target folder where owlet is stored
* @param platform Platform key in Electron format
*/
export async function downloadOwletInternal(target: string, platform: string): Promise<void> {
export async function downloadOwletInternal(target: string, platform: string, stableOnly = false): Promise<void> {
// Create target folder
if (!fs.existsSync(target)) {
fs.mkdirSync(target, { recursive: true });
Expand All @@ -67,6 +67,12 @@ export async function downloadOwletInternal(target: string, platform: string): P

// Loop through each compliancy version
for (let i = 0; i < redistIndex.ChannelCompliancy.length; i++) {
// Check if stable
let compliancyName = redistIndex.ChannelCompliancy[i].Name.toLowerCase();
if (stableOnly && (compliancyName.includes("beta") || compliancyName.includes("alpha"))) {
continue;
}

// Find latest version for compliancy
let compatibleVersions = owletIndex.Items.filter(
(version) => version.Compliancy === redistIndex.ChannelCompliancy[i].Compliancy
Expand Down
3 changes: 2 additions & 1 deletion src/runOwletDownload.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import path from "path";
import { BETA_CONFIG } from "./main/betaConfig2";
import { downloadOwletInternal } from "./main/owletDownload";

function download(platform: string) {
downloadOwletInternal(path.join("owlet", platform), platform).then(() => {
downloadOwletInternal(path.join("owlet", platform), platform, BETA_CONFIG === null).then(() => {
console.log("Finished downloading for " + platform);
});
}
Expand Down

0 comments on commit 53d5c76

Please sign in to comment.