feat(voice-call): Improve socket connection and mic permission handling

This commit is contained in:
cogwheel0
2025-11-29 13:30:31 +05:30
parent 24bf1f06cb
commit 2ef49a2974
4 changed files with 83 additions and 8 deletions

View File

@@ -576,6 +576,16 @@ class AppIntentCoordinator extends _$AppIntentCoordinator {
throw StateError('Choose a model before starting a voice call.');
}
// Pre-warm socket connection before navigating to voice call.
// This reduces the chance of "websocket not connected" errors when
// opening voice call right after app start or from deep links.
final socketService = ref.read(socketServiceProvider);
if (socketService != null && !socketService.isConnected) {
// Start connection attempt in parallel, don't wait for full connection
// The VoiceCallService.startCall() will wait with extended timeout
unawaited(socketService.connect());
}
await NavigationService.navigateToChat();
// Wait a tick for navigation to settle so navigator/context are present.