Remove old and no longer necessary desktop cutoff version flag

It's been more than an 1.5 years since this was needed, everyone should've
updated by now.
This commit is contained in:
Manav Rathi 2024-03-22 15:17:59 +05:30
parent 8391e7edfc
commit 8c40b950c7
No known key found for this signature in database
2 changed files with 31 additions and 63 deletions

View file

@ -2,10 +2,8 @@ import { compareVersions } from "compare-versions";
import { app, BrowserWindow } from "electron";
import { default as ElectronLog, default as log } from "electron-log";
import { autoUpdater } from "electron-updater";
import fetch from "node-fetch";
import { setIsAppQuitting, setIsUpdateAvailable } from "../main";
import { AppUpdateInfo, GetFeatureFlagResponse } from "../types";
import { isPlatform } from "../utils/common/platform";
import { AppUpdateInfo } from "../types";
import { logErrorSentry } from "./sentry";
import {
clearMuteUpdateNotificationVersion,
@ -64,56 +62,42 @@ async function checkForUpdateAndNotify(mainWindow: BrowserWindow) {
);
return;
}
const desktopCutoffVersion = await getDesktopCutoffVersion();
let timeout: NodeJS.Timeout;
log.debug("attempting auto update");
autoUpdater.downloadUpdate();
const muteUpdateNotificationVersion =
getMuteUpdateNotificationVersion();
if (
desktopCutoffVersion &&
isPlatform("mac") &&
compareVersions(
updateCheckResult.updateInfo.version,
desktopCutoffVersion,
) > 0
muteUpdateNotificationVersion &&
updateCheckResult.updateInfo.version ===
muteUpdateNotificationVersion
) {
log.debug("auto update not possible due to key change");
log.info(
"user chose to mute update notification for version ",
updateCheckResult.updateInfo.version,
);
return;
}
autoUpdater.on("update-downloaded", () => {
timeout = setTimeout(
() =>
showUpdateDialog(mainWindow, {
autoUpdatable: true,
version: updateCheckResult.updateInfo.version,
}),
FIVE_MIN_IN_MICROSECOND,
);
});
autoUpdater.on("error", (error) => {
clearTimeout(timeout);
logErrorSentry(error, "auto update failed");
showUpdateDialog(mainWindow, {
autoUpdatable: false,
version: updateCheckResult.updateInfo.version,
});
} else {
let timeout: NodeJS.Timeout;
log.debug("attempting auto update");
autoUpdater.downloadUpdate();
const muteUpdateNotificationVersion =
getMuteUpdateNotificationVersion();
if (
muteUpdateNotificationVersion &&
updateCheckResult.updateInfo.version ===
muteUpdateNotificationVersion
) {
log.info(
"user chose to mute update notification for version ",
updateCheckResult.updateInfo.version,
);
return;
}
autoUpdater.on("update-downloaded", () => {
timeout = setTimeout(
() =>
showUpdateDialog(mainWindow, {
autoUpdatable: true,
version: updateCheckResult.updateInfo.version,
}),
FIVE_MIN_IN_MICROSECOND,
);
});
autoUpdater.on("error", (error) => {
clearTimeout(timeout);
logErrorSentry(error, "auto update failed");
showUpdateDialog(mainWindow, {
autoUpdatable: false,
version: updateCheckResult.updateInfo.version,
});
});
}
});
setIsUpdateAvailable(true);
} catch (e) {
logErrorSentry(e, "checkForUpdateAndNotify failed");
@ -138,18 +122,6 @@ export function muteUpdateNotification(version: string) {
setMuteUpdateNotificationVersion(version);
}
async function getDesktopCutoffVersion() {
try {
const featureFlags = (
await fetch("https://static.ente.io/feature_flags.json")
).json() as GetFeatureFlagResponse;
return featureFlags.desktopCutoffVersion;
} catch (e) {
logErrorSentry(e, "failed to get feature flags");
return undefined;
}
}
function showUpdateDialog(
mainWindow: BrowserWindow,
updateInfo: AppUpdateInfo,

View file

@ -77,10 +77,6 @@ export interface AppUpdateInfo {
version: string;
}
export interface GetFeatureFlagResponse {
desktopCutoffVersion?: string;
}
export enum Model {
GGML_CLIP = "ggml-clip",
ONNX_CLIP = "onnx-clip",