Update: 2026-08-01 02:06:59
This commit is contained in:
@@ -230,10 +230,15 @@ class LocationController extends GetxController with WidgetsBindingObserver {
|
||||
// إيقاف خدمة الخلفية
|
||||
BackgroundServiceHelper.stopService();
|
||||
|
||||
if (socket == null || (!socket!.connected && !_isInitializingSocket)) {
|
||||
Log.print("🔄 Initializing Socket on resume...");
|
||||
initSocket();
|
||||
// 🔥 Fix: iOS silently kills WebSockets in background.
|
||||
// The socket_io_client might still report 'connected' as true for ~20s.
|
||||
// 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 ||
|
||||
state == AppLifecycleState.detached) {
|
||||
Log.print("📱 Lifecycle: App is in BACKGROUND");
|
||||
|
||||
Reference in New Issue
Block a user