Phase 3.2 docs + Phase 3.1 testing fixes
- Add phase3.2.md requirement: overlay UX, mitra activity log - Add phase3.2-plan.md implementation plan - Fix stale request validation: add GET /:sessionId/status endpoint - Fix notification tap flow: setIncomingFromNotification + onChatRequestTapped - IncomingRequestSheet shows stale message instead of auto-dismiss - Home screen validates on resume, shows immediately on fresh WS Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -130,19 +130,26 @@ class ChatRequest extends _$ChatRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/// Called when user taps a chat_request notification. Sets the incoming state
|
||||
/// with the given session and validates it's still pending.
|
||||
Future<void> setIncomingFromNotification(String sessionId) async {
|
||||
state = ChatRequestIncomingData(sessionId);
|
||||
await validateIncomingRequest();
|
||||
}
|
||||
|
||||
/// Check if the current incoming request is still valid (pending_acceptance).
|
||||
/// If stale, reset to listening state.
|
||||
Future<void> validateIncomingRequest() async {
|
||||
if (state is! ChatRequestIncomingData) return;
|
||||
final sessionId = (state as ChatRequestIncomingData).sessionId;
|
||||
try {
|
||||
final response = await _apiClient.get('/api/shared/chat/$sessionId/info');
|
||||
final response = await _apiClient.get('/api/mitra/chat-requests/$sessionId/status');
|
||||
final status = response['data']?['status'] as String?;
|
||||
if (status != 'pending_acceptance') {
|
||||
state = const ChatRequestListeningData();
|
||||
}
|
||||
} catch (_) {
|
||||
state = const ChatRequestListeningData();
|
||||
// On error, keep current state — don't dismiss valid requests
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user