diff --git a/electron/updater.ts b/electron/updater.ts index 206900f5..86c2d76d 100644 --- a/electron/updater.ts +++ b/electron/updater.ts @@ -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, }); }