Port modular app notifications, pargar date display, and closed-store product UX.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -375,6 +375,24 @@ function handleAssetsPayload(payload: unknown) {
|
||||
void applyAssetsFromStream(payload)
|
||||
}
|
||||
|
||||
function handleAppNotificationPayload(payload: unknown) {
|
||||
if (!payload || typeof payload !== 'object') {
|
||||
return
|
||||
}
|
||||
|
||||
touchStreamActivity()
|
||||
void applyAppNotificationFromStream(payload as Record<string, unknown>)
|
||||
}
|
||||
|
||||
async function applyAppNotificationFromStream(payload: Record<string, unknown>) {
|
||||
try {
|
||||
const { bumpUnreadFromStream } = await import('@/composables/useAppNotificationBadge')
|
||||
bumpUnreadFromStream(payload)
|
||||
} catch (error) {
|
||||
console.warn('App notification SSE apply failed', error)
|
||||
}
|
||||
}
|
||||
|
||||
function bindStreamEvents(source: EventSource) {
|
||||
source.addEventListener('last', (event) => {
|
||||
try {
|
||||
@@ -400,6 +418,14 @@ function bindStreamEvents(source: EventSource) {
|
||||
}
|
||||
})
|
||||
|
||||
source.addEventListener('app_notification', (event) => {
|
||||
try {
|
||||
handleAppNotificationPayload(JSON.parse(event.data))
|
||||
} catch (error) {
|
||||
console.warn('App notification SSE parse failed', error)
|
||||
}
|
||||
})
|
||||
|
||||
source.addEventListener('ping', () => {
|
||||
touchStreamActivity()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user