Update: 2026-08-01 02:06:59
This commit is contained in:
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user