diff --git a/.planning/phases/08-mobile-pwa/08-03-PLAN.md b/.planning/phases/08-mobile-pwa/08-03-PLAN.md index b7eb44c..c249caa 100644 --- a/.planning/phases/08-mobile-pwa/08-03-PLAN.md +++ b/.planning/phases/08-mobile-pwa/08-03-PLAN.md @@ -5,6 +5,7 @@ type: execute wave: 2 depends_on: - "08-01" + - "08-02" files_modified: - packages/portal/app/sw.ts - packages/portal/components/install-prompt.tsx @@ -88,6 +89,7 @@ Output: Working push notification pipeline (client subscription -> DB storage -> @.planning/phases/08-mobile-pwa/08-CONTEXT.md @.planning/phases/08-mobile-pwa/08-RESEARCH.md @.planning/phases/08-mobile-pwa/08-01-SUMMARY.md +@.planning/phases/08-mobile-pwa/08-02-SUMMARY.md @@ -98,7 +100,7 @@ From packages/portal/app/sw.ts (created in Plan 01): // Push event listener to be added here ``` -From packages/portal/lib/use-chat-socket.ts: +From packages/portal/lib/use-chat-socket.ts (modified in Plan 02 for mobile chat): ```typescript export interface UseChatSocketOptions { conversationId: string; @@ -111,6 +113,7 @@ export interface UseChatSocketOptions { export function useChatSocket(options: UseChatSocketOptions): { send: (text: string) => void; isConnected: boolean } // WebSocket connects to gateway at WS_URL/ws/chat // Uses refs for callbacks to avoid reconnection on handler changes +// NOTE: Plan 02 may have modified this file for mobile chat — read current state before editing ``` From packages/gateway/main.py: @@ -230,6 +233,8 @@ From migrations/versions/: packages/portal/app/(dashboard)/layout.tsx + IMPORTANT: Plan 08-02 modifies use-chat-socket.ts for mobile chat. Read the current file state before making changes — do not overwrite 08-02's modifications. + 1. Update `app/sw.ts` — add push event handlers: ```typescript // After installSerwist(...) @@ -297,6 +302,7 @@ From migrations/versions/: ``` 5. Update `lib/use-chat-socket.ts` — integrate offline queue: + - Read the file first to see 08-02's changes, then add offline queue integration on top - Import enqueueMessage and drainQueue from message-queue - In the `send` function: if WebSocket is not connected (isConnected is false), call `enqueueMessage(conversationId, text)` instead of sending via WebSocket - On reconnection (when WebSocket opens): call `drainQueue((convId, text) => ws.send(...))` to send queued messages