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

@@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -139,6 +140,16 @@ class AndroidAssistantHandler {
return;
}
// 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 Android assistant.
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());
}
// Navigate to chat if not already there
final isOnChatRoute = NavigationService.currentRoute == Routes.chat;
if (!isOnChatRoute) {