Update: 2026-08-07 02:58:47

This commit is contained in:
Hamza-Ayed
2026-08-07 02:58:47 +03:00
parent e070c2d9a8
commit f0ea698ab2
7 changed files with 407 additions and 0 deletions
@@ -128,6 +128,10 @@ class UiInteractionsController extends GetxController {
kolor: AppColor.redColor,
onPressed: () {
Get.back();
// ‏الشركة أولاً ثم الواتساب: تسجيل البلاغ لا ينتظر شيئاً ولا
// ‏يؤخّر الرسالة (بلا await)، لكنه يُطلق قبلها حتى لا يضيع
// ‏إن أغلق المستخدم التطبيق بعد فتح واتساب.
_reportSafetyIncident();
_shareTripDetailsSOS();
},
),
@@ -142,6 +146,32 @@ class UiInteractionsController extends GetxController {
});
}
/// ‏يسجّل البلاغ لدى الشركة: يُنشئ سجل حادثة، يُجمّد إسناد الرحلات
/// ‏للسائق حتى المراجعة، ويُنبّه غرفة العمليات.
///
/// ‏لا ينتظر ولا يرمي: زر الطوارئ يجب ألا يتعطّل أبداً بسبب الشبكة.
/// ‏أي فشل هنا لا يمنع رسالة الواتساب التي تليه.
void _reportSafetyIncident({String trigger = 'sos_button'}) {
try {
final rideLifecycle = Get.find<RideLifecycleController>();
final locSearch = Get.find<LocationSearchController>();
CRUD().post(
link: AppLink.safetyIncident,
payload: {
'reporter_type': 'passenger',
'reporter_id': box.read(BoxName.passengerID).toString(),
'ride_id': rideLifecycle.rideId?.toString() ?? '',
'trigger_type': trigger,
'lat': locSearch.passengerLocation.latitude.toString(),
'lng': locSearch.passengerLocation.longitude.toString(),
},
);
} catch (e) {
Log.print("⚠️ تعذّر تسجيل بلاغ السلامة: $e");
}
}
void _shareTripDetailsSOS() {
final rideLifecycle = Get.find<RideLifecycleController>();
final locSearch = Get.find<LocationSearchController>();