All checks were successful
Trigger cinny-mobile / dispatch (push) Successful in 1s
Replace legacy profile style metadata with MSC4133 profile fields, add in-app update notes, tighten account profile name spacing, and wire desktop media save helpers through the client.
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import { atom } from 'jotai';
|
|
|
|
const LAST_SEEN_VERSION_KEY = 'paarrot:lastSeenVersion';
|
|
const PENDING_RELEASE_NOTES_KEY = 'paarrot:pendingReleaseNotes';
|
|
|
|
export type PendingReleaseNotes = {
|
|
version: string;
|
|
releaseNotes: unknown;
|
|
};
|
|
|
|
export type ReleaseNotesDialogState = {
|
|
open: boolean;
|
|
/** Opened from About instead of an automatic post-update prompt. */
|
|
manual: boolean;
|
|
};
|
|
|
|
export const releaseNotesDialogAtom = atom<ReleaseNotesDialogState>({
|
|
open: false,
|
|
manual: false,
|
|
});
|
|
|
|
export function getLastSeenAppVersion(): string | null {
|
|
return localStorage.getItem(LAST_SEEN_VERSION_KEY);
|
|
}
|
|
|
|
export function setLastSeenAppVersion(version: string): void {
|
|
localStorage.setItem(LAST_SEEN_VERSION_KEY, version);
|
|
}
|
|
|
|
export function storePendingReleaseNotes(version: string, releaseNotes: unknown): void {
|
|
try {
|
|
localStorage.setItem(
|
|
PENDING_RELEASE_NOTES_KEY,
|
|
JSON.stringify({ version, releaseNotes } satisfies PendingReleaseNotes)
|
|
);
|
|
} catch {
|
|
// ignore quota errors
|
|
}
|
|
}
|
|
|
|
export function getPendingReleaseNotes(): PendingReleaseNotes | null {
|
|
try {
|
|
const raw = localStorage.getItem(PENDING_RELEASE_NOTES_KEY);
|
|
if (!raw) return null;
|
|
const parsed = JSON.parse(raw) as PendingReleaseNotes;
|
|
if (typeof parsed?.version !== 'string') return null;
|
|
return parsed;
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
export function clearPendingReleaseNotes(): void {
|
|
localStorage.removeItem(PENDING_RELEASE_NOTES_KEY);
|
|
}
|