mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-11-09 23:43:35 +00:00
Simulate native update channels accurately
This commit is contained in:
1 parent
e83114a45d
commit
70bf0c38ee
1 file changed
+26
-4
+26
-4
@@ -580,12 +580,19 @@ async function showAvailableUpdateDialog(
|
||||
getMainWindow: () => BrowserWindow | null,
|
||||
version: string,
|
||||
sendToRenderer?: UpdateToastSender,
|
||||
options?: { isPreview?: boolean; isExperimental?: boolean },
|
||||
) {
|
||||
const isPreview = Boolean(options?.isPreview);
|
||||
const isExperimental = options?.isExperimental ?? getExperimentalUpdatesEnabled();
|
||||
const result = await showMessageBox(getMainWindow, {
|
||||
type: "info",
|
||||
title: "Update Available",
|
||||
message: `Recordly ${version} is available.`,
|
||||
detail: "Install and restart now, or remind me later.",
|
||||
title: isExperimental ? "Experimental Update Available" : "Update Available",
|
||||
message: `Recordly ${version} is available${isExperimental ? " on the experimental channel" : ""}.`,
|
||||
detail: isPreview
|
||||
? `${isExperimental ? EXPERIMENTAL_UPDATE_DESCRIPTION : "This is a development preview of the standard update flow."} No real update will be installed.`
|
||||
: isExperimental
|
||||
? EXPERIMENTAL_UPDATE_DESCRIPTION
|
||||
: "Install and restart now, or remind me later.",
|
||||
buttons: ["Install & Restart", "Later"],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
@@ -593,10 +600,24 @@ async function showAvailableUpdateDialog(
|
||||
});
|
||||
|
||||
if (result.response === 0) {
|
||||
if (isPreview) {
|
||||
await showMessageBox(getMainWindow, {
|
||||
type: "info",
|
||||
title: "Preview Only",
|
||||
message: "No real update was installed.",
|
||||
detail: "This was only a manual development preview of the update prompt.",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
await downloadAvailableUpdate(sendToRenderer, { installAfterDownload: true });
|
||||
return;
|
||||
}
|
||||
|
||||
if (isPreview) {
|
||||
return;
|
||||
}
|
||||
|
||||
deferUpdateReminder(getMainWindow, sendToRenderer, UPDATE_REMINDER_DELAY_MS);
|
||||
}
|
||||
|
||||
@@ -649,8 +670,9 @@ async function showDownloadedUpdateDialog(
|
||||
}
|
||||
|
||||
export function previewNativeUpdateDialog(getMainWindow: () => BrowserWindow | null) {
|
||||
return showDownloadedUpdateDialog(getMainWindow, DEV_UPDATE_PREVIEW_VERSION, {
|
||||
return showAvailableUpdateDialog(getMainWindow, DEV_UPDATE_PREVIEW_VERSION, undefined, {
|
||||
isPreview: true,
|
||||
isExperimental: DEV_UPDATE_PREVIEW_IS_EXPERIMENTAL,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user