Update: 2026-07-12 18:53:59
This commit is contained in:
@@ -22,6 +22,7 @@ import '../home/payment/captain_wallet_controller.dart';
|
||||
import '../home/navigation/navigation_controller.dart';
|
||||
import 'background_service.dart';
|
||||
import 'crud.dart';
|
||||
import '../transit/transit_driver_controller.dart';
|
||||
|
||||
class LocationController extends GetxController with WidgetsBindingObserver {
|
||||
// ===================================================================
|
||||
@@ -56,6 +57,10 @@ class LocationController extends GetxController with WidgetsBindingObserver {
|
||||
isBusMode = enabled;
|
||||
activeBusTripId = enabled ? tripId : null;
|
||||
activeBusRouteId = enabled ? routeId : null;
|
||||
// نحفظ الحالة في GetStorage ليقرأها background_service في الـ isolate المستقل
|
||||
box.write(BoxName.isBusMode, enabled);
|
||||
box.write(BoxName.busModeTripId, enabled ? tripId : null);
|
||||
box.write(BoxName.busModeRouteId, enabled ? routeId : null);
|
||||
Log.print('🚌 Bus mode ${enabled ? "enabled" : "disabled"} (trip: $tripId, route: $routeId)');
|
||||
}
|
||||
|
||||
@@ -572,6 +577,10 @@ class LocationController extends GetxController with WidgetsBindingObserver {
|
||||
// 🚌 وضع الباص: بثّ موقع الباص فقط — لا يدخل حوض الرحلات العادي
|
||||
if (isBusMode) {
|
||||
emitBusLocationToSocket(pos, heading, speed);
|
||||
// كشف الوصول للمحطات (جيوفينس)
|
||||
if (Get.isRegistered<TransitDriverController>()) {
|
||||
Get.find<TransitDriverController>().onLocationUpdate(pos);
|
||||
}
|
||||
await _saveBehaviorIfMoved(pos, now, currentSpeed: speed);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user