Let each install pick its app icon
Settings > General gets an App icon (super admin): one of the seven stones, or an uploaded image with the picked stone as a top-left corner mark (inside a round launcher's crop, clear of the browser's badge), previewed in both launcher crops before saving. Uploads are decoded and cropped to a stored square (no SVG); the set is drawn into DATA_DIR/install-icon/<version>/ and served publicly and immutable. The manifest, head icon links and push notifications point at it; the ember stone keeps the stock icons. The generator shares the icon renderer. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { PwaDefaultInstallIcon } from "@/src/data/pwa-data";
|
||||
import parseInstallIcon from "./parse-install-icon";
|
||||
|
||||
describe("parseInstallIcon", () => {
|
||||
test("falls back to the stock icon when nothing or junk is saved", () => {
|
||||
expect(parseInstallIcon({})).toEqual(PwaDefaultInstallIcon);
|
||||
expect(parseInstallIcon({ saved: "not json" })).toEqual(PwaDefaultInstallIcon);
|
||||
expect(parseInstallIcon({ saved: "[1]" })).toEqual(PwaDefaultInstallIcon);
|
||||
});
|
||||
|
||||
test("reads a saved icon", () => {
|
||||
expect(
|
||||
parseInstallIcon({
|
||||
saved: JSON.stringify({ mode: "image", stone: "cobalt", mark: false, version: "0123456789ab" }),
|
||||
}),
|
||||
).toEqual({ mode: "image", stone: "cobalt", mark: false, version: "0123456789ab" });
|
||||
});
|
||||
|
||||
test("drops unknown values field by field", () => {
|
||||
expect(
|
||||
parseInstallIcon({
|
||||
saved: JSON.stringify({ mode: "video", stone: "plaid", mark: "yes", version: "../etc" }),
|
||||
}),
|
||||
).toEqual(PwaDefaultInstallIcon);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user