/** * Build-time release notes for the "what's new" screen. * * The screen appears once after unlock when the build version differs from the * last version the user acknowledged. `__PEACH_VERSION__` is injected by Vite * from package.json at build time. When `CURRENT_NOTES` is empty the screen is * skipped entirely — no content, no interruption. * * To ship a new changelog: bump the version in package.json (which Vite injects * as `__PEACH_VERSION__`), then add entries to `CURRENT_NOTES` below. The * version mismatch triggers the screen on next unlock; "Continue" stores the * version and suppresses it until the next bump. */ declare const __PEACH_VERSION__: string; export interface ReleaseNote { heading: string; body: string; breaking?: boolean; } export const PEACH_VERSION: string = typeof __PEACH_VERSION__ !== "undefined" ? __PEACH_VERSION__ : "0.0.0"; export const CURRENT_NOTES: ReleaseNote[] = [ { heading: "Passphrases & long passwords", body: "Peach now supports passphrases and passwords up to 256 characters. Existing vaults remain fully readable.", }, { heading: "Update your Android app first", body: "Vault V4 is not readable by Peach Android before v2.15.3. Open Peach on Android → Settings → Update, or visit peachpasswords.com to download the latest version. Export a backup on Android before updating.", breaking: true, }, ]; export function hasReleaseNotes(): boolean { return CURRENT_NOTES.length > 0; } const WHATS_NEW_SEEN_KEY = "peach_whats_new_seen"; export async function shouldShowWhatsNew(): Promise { if (!hasReleaseNotes()) return false; try { const seen = await chrome.storage.local.get(WHATS_NEW_SEEN_KEY); const last = seen[WHATS_NEW_SEEN_KEY]; // A fresh install has no stored version — there is nothing to catch up // on, so the screen never appears. It only fires on an upgrade from a // previously-seen version. Mirrors Android's WhatsNewScreen gate. if (last === undefined) return false; return last !== PEACH_VERSION; } catch { return false; } } export async function markWhatsNewSeen(): Promise { try { await chrome.storage.local.set({ [WHATS_NEW_SEEN_KEY]: PEACH_VERSION }); } catch { // best-effort — the screen just won't reshow, which is the lesser evil } }