Repository navigation
Description
Context
The push listener shows a notification with only body, tag and data (packages/ui-sdk/src/client/push-handlers.ts:83-89). Without badge, Android draws a generic bell in the status bar; without icon, the shade shows the browser's or WebAPK's default rather than the brand mark.
The brand package has no file suitable as a badge. Android uses only the alpha channel of a badge, so it needs a single-colour mark on transparency. BRAND_RASTERS (packages/ui-kit/src/brand.ts:51-59) holds the favicon, touch and manifest icons, all on opaque or coloured grounds. The single-colour master mark-mono-dark.svg (fill #f8f5ee only, no ground) is in BRAND_MASTERS (brand.ts:22-36). The rasters are rendered by renderBrandRasters (packages/ui-kit/tools/brand/generate.ts:78, bun run brand:generate) from a table of master and widths (generate.ts:35-38) and checked by packages/ui-kit/tests/brand-rasters.test.ts.
The brand exports are part of the documented package API (package-api.md "Logo assets"), so a new raster name is an additive contract change.
Guide: (no guide). Support (MDN BCD 8.1.6): the badge option is in Chrome for Android 53 and Samsung Internet 6, and not in Firefox for Android, which ignores it. icon is in all three.
Binding: Action notifications (copy and payload unchanged). The brand files' "name and presence are the promise; its bytes change only with a newly accepted design" (package-api.md): this adds a rendering of an accepted master and changes no existing file. docs/decisions/http-api-boundary.md:67 cites push-handlers.ts:72; a PR that moves that line updates the citation.
Scope
ui-kit: addbadge-96.pngtoBRAND_RASTERS, rendered bygenerate.tsfrommark-mono-dark.svgat 96px on a transparent ground, and commit the generated file.ui-sdk: addicon?: string | nullandbadge?: string | nulltoPushHandlerOptions. The defaults are"/icon-192.png"and"/badge-96.png", root-relative becauseWEB_APP_MANIFEST_ICONSassumes a host serving brand files from its root.nullomits the option. Pass both toshowNotification.- Document the two options in the
registerPushHandlersdoc comment and the "Service-worker handlers" section ofpackages/ui-sdk/README.md, and document the new raster in package-api.md's "Logo assets".
Out of scope
- A
timestamp: the payload carries no event time, and adding one is a wire change ({ title, body, tag, url }in wire.md). - New artwork, or changing an existing brand file.
- The Badging API (
navigator.setAppBadge). - Notification
actions,image,renotifyorvibrate. - Serving the files: the host decides where brand files live and overrides the paths.
Acceptance criteria
-
BRAND_RASTERSincludesbadge-96.png; the file is 96x96, every opaque pixel has one colour, and the corners are fully transparent.brand-rasters.test.tsasserts all three and that the file matches a freshrenderBrandRasters()output. -
packages/ui-kit/tests/brand-assets.test.tsproves the new name is in the packed tarball and resolves through@schlessera/brain-ui-kit/brand/badge-96.png. -
showNotificationreceivesicon: "/icon-192.png"andbadge: "/badge-96.png"by default, the host's values when given, and neither key when givennull. Covered inpackages/ui-sdk/tests/push-handlers.test.tsand failing before the change. - Firefox for Android shows the notification unchanged (
badgeis ignored,iconhonoured); no feature detection is needed because unknown options are ignored. - package-api.md, the api-report and a changeset for
ui-kitandui-sdkland in the same commit, prefixedCONTRACT:.
Verification
bun run --cwd packages/ui-kit brand:generate
bun run test packages/ui-kit/tests/brand-rasters.test.ts packages/ui-kit/tests/brand-assets.test.ts packages/ui-sdk/tests/push-handlers.test.ts
bun run api-report
bun run typecheck
bun run lintContract impact
- This touches the integration contract, so it needs the
contractlabel, aCONTRACT:commit prefix, and the doc updated in the same commit. - This changes a published package's behaviour, so it needs a changeset.
Activity