diff --git a/siro_driver/lib/controller/functions/background_service.dart b/siro_driver/lib/controller/functions/background_service.dart index 513dd44f..47417ce3 100644 --- a/siro_driver/lib/controller/functions/background_service.dart +++ b/siro_driver/lib/controller/functions/background_service.dart @@ -40,6 +40,9 @@ Future onStart(ServiceInstance service) async { .setQuery({ 'driver_id': driverId, 'token': token, + // ‏نفس سبب location_controller: بلا platform يعتبره السيرفر + // ‏أندرويد فلا يرسل إشعار FCM الاحتياطي لكباتن الآيفون. + 'platform': Platform.isIOS ? 'ios' : 'android', 'EIO': '3', // توافقية مع Workerman }) .setReconnectionAttempts(double.infinity) diff --git a/siro_driver/lib/controller/functions/location_controller.dart b/siro_driver/lib/controller/functions/location_controller.dart index f060630b..612f394f 100755 --- a/siro_driver/lib/controller/functions/location_controller.dart +++ b/siro_driver/lib/controller/functions/location_controller.dart @@ -234,7 +234,16 @@ class LocationController extends GetxController with WidgetsBindingObserver { AppLink.locationSocketUrl, IO.OptionBuilder() .setTransports(['websocket']) - .setQuery({'driver_id': driverId, 'token': token, 'EIO': '3'}) + // ‏إرسال platform إجباري: driver_socket.php يرسل إشعار FCM + // ‏احتياطياً عند توزيع الطلب **فقط** إذا كانت المنصّة ios، لأن iOS + // ‏يخنق أحداث السوكيت في الخلفية. وبلا هذا الحقل يصير الافتراضي + // ‏'android' فيفوت كابتن الآيفون الطلب وهو في الخلفية. + .setQuery({ + 'driver_id': driverId, + 'token': token, + 'platform': Platform.isIOS ? 'ios' : 'android', + 'EIO': '3', + }) .enableForceNew() .build());