mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
feat: add notification optimization with visibility tracking and toast messages
Implement a visibility-aware notification system that delivers toast messages via SSE to visible browser tabs instead of sending push notifications, reducing unnecessary push requests. Includes VisibilityTracker for monitoring connection visibility, toast UI components, and enhanced SSEManager with toast delivery capability.
This commit is contained in:
@@ -13,6 +13,7 @@ import type {
|
||||
PushVapidPublicKeyResponse,
|
||||
SlashCommandsResponse,
|
||||
SpawnResponse,
|
||||
VisibilityPayload,
|
||||
SessionResponse,
|
||||
SessionsResponse
|
||||
} from '@/types/api'
|
||||
@@ -172,6 +173,13 @@ export class ApiClient {
|
||||
})
|
||||
}
|
||||
|
||||
async setVisibility(payload: VisibilityPayload): Promise<void> {
|
||||
await this.request('/api/visibility', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload)
|
||||
})
|
||||
}
|
||||
|
||||
async getSession(sessionId: string): Promise<SessionResponse> {
|
||||
return await this.request<SessionResponse>(`/api/sessions/${encodeURIComponent(sessionId)}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user