Update: 2026-08-01 02:06:59

This commit is contained in:
Hamza-Ayed
2026-08-01 02:06:59 +03:00
parent 46e74330a1
commit 12fc64dc9a
@@ -230,10 +230,15 @@ class LocationController extends GetxController with WidgetsBindingObserver {
// إيقاف خدمة الخلفية // إيقاف خدمة الخلفية
BackgroundServiceHelper.stopService(); BackgroundServiceHelper.stopService();
if (socket == null || (!socket!.connected && !_isInitializingSocket)) { // 🔥 Fix: iOS silently kills WebSockets in background.
Log.print("🔄 Initializing Socket on resume..."); // The socket_io_client might still report 'connected' as true for ~20s.
initSocket(); // We MUST force a disconnect so initSocket() properly creates a fresh connection
// and immediately emits 'get_pending_orders' to catch missed FCM payloads.
if (socket != null) {
socket!.disconnect();
} }
initSocket();
} else if (state == AppLifecycleState.paused || } else if (state == AppLifecycleState.paused ||
state == AppLifecycleState.detached) { state == AppLifecycleState.detached) {
Log.print("📱 Lifecycle: App is in BACKGROUND"); Log.print("📱 Lifecycle: App is in BACKGROUND");