AppView in a box as a Vite plugin thing hatk.dev
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add optional badge field to push notifications

Allows callers to set the app icon badge count via APNs by passing
badge in the PushPayload.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+10 -5
+1 -1
packages/hatk/package.json
··· 1 1 { 2 2 "name": "@hatk/hatk", 3 - "version": "0.0.1-alpha.54", 3 + "version": "0.0.1-alpha.55", 4 4 "license": "MIT", 5 5 "bin": { 6 6 "hatk": "dist/cli.js"
+9 -4
packages/hatk/src/push.ts
··· 31 31 body: string 32 32 data?: Record<string, string> 33 33 collapseId?: string 34 + badge?: number 34 35 } 35 36 36 37 export interface PushInterface { ··· 126 127 if (tokens.length === 0) return 127 128 128 129 const jwt = getApnsJwt() 130 + const aps: Record<string, unknown> = { 131 + alert: { title: payload.title, body: payload.body }, 132 + sound: 'default', 133 + } 134 + if (payload.badge !== undefined) { 135 + aps.badge = payload.badge 136 + } 129 137 const apnsPayload = JSON.stringify({ 130 - aps: { 131 - alert: { title: payload.title, body: payload.body }, 132 - sound: 'default', 133 - }, 138 + aps, 134 139 ...(payload.data || {}), 135 140 }) 136 141