استكمال قرار 2026-07-27 (كوميت fff76c9 أرشف الباك إند):
apps/rider → apps/rider-archive-cubit
apps/driver → apps/driver-archive-cubit
dashboards/admin-web → dashboards/admin-web-archive
dashboards/service-web → dashboards/service-web-archive
إعادة تسمية بلا تعديل محتوى. rider/driver كانا إعادة بناء Cubit مبنية على
عقد NestJS المؤرشف. admin-web و service-web نموذجان بملف HTML واحد (164 و
128 سطراً) — يحلّ محلهما siro_admin و siro_service المكتملان.
يُحمل من المؤرشف ولا يُعاد اكتشافه: عقد map-saas المثبَّت بالتجربة في
apps/rider-archive-cubit/lib/core/api/ (x-api-key ترويسة، reverse مصفوفة،
route في points) ودرس مسار FCM.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
110 lines
2.8 KiB
Dart
110 lines
2.8 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
|
|
/// أحداث TripBloc — المصادر الثلاث: المستخدم، WebSocket، FCM.
|
|
///
|
|
/// كل حدث يحمل `timestamp` لتمييز التسلسل عند الحاجة.
|
|
sealed class TripEvent extends Equatable {
|
|
const TripEvent();
|
|
|
|
@override
|
|
List<Object?> get props => [];
|
|
}
|
|
|
|
/// فحص رحلة نشطة عند بدء التشغيل أو العودة للخلفية.
|
|
class TripCheckActive extends TripEvent {
|
|
const TripCheckActive();
|
|
}
|
|
|
|
/// طلب رحلة جديدة (من شاشة تأكيد الاختيار).
|
|
class TripRequested extends TripEvent {
|
|
final double pickupLat;
|
|
final double pickupLng;
|
|
final String? pickupAddress;
|
|
final double dropoffLat;
|
|
final double dropoffLng;
|
|
final String? dropoffAddress;
|
|
final String vehicleClass;
|
|
final String paymentMethod;
|
|
final String? couponCode;
|
|
|
|
const TripRequested({
|
|
required this.pickupLat,
|
|
required this.pickupLng,
|
|
this.pickupAddress,
|
|
required this.dropoffLat,
|
|
required this.dropoffLng,
|
|
this.dropoffAddress,
|
|
required this.vehicleClass,
|
|
this.paymentMethod = 'cash',
|
|
this.couponCode,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [pickupLat, pickupLng, dropoffLat, dropoffLng, vehicleClass];
|
|
}
|
|
|
|
/// تحديث حالة الرحلة — ي הגיע عبر WebSocket أو FCM.
|
|
/// الترتيب: searching < assigned < driver_arriving < driver_arrived < in_progress < completed < paid
|
|
class TripUpdateReceived extends TripEvent {
|
|
final String tripId;
|
|
final String status;
|
|
final String? driverId;
|
|
final Map<String, dynamic> extra;
|
|
|
|
const TripUpdateReceived({
|
|
required this.tripId,
|
|
required this.status,
|
|
this.driverId,
|
|
this.extra = const {},
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [tripId, status, driverId];
|
|
}
|
|
|
|
/// موقع السائق الحي — من WebSocket.
|
|
class TripDriverLocation extends TripEvent {
|
|
final String tripId;
|
|
final double lat;
|
|
final double lng;
|
|
final double heading;
|
|
final double speed;
|
|
|
|
const TripDriverLocation({
|
|
required this.tripId,
|
|
required this.lat,
|
|
required this.lng,
|
|
this.heading = 0,
|
|
this.speed = 0,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [tripId, lat, lng];
|
|
}
|
|
|
|
/// إلغاء الرحلة من الراكب.
|
|
class TripCancelRequested extends TripEvent {
|
|
const TripCancelRequested();
|
|
}
|
|
|
|
/// إعادة المحاولة بعد خطأ.
|
|
class TripRetry extends TripEvent {
|
|
const TripRetry();
|
|
}
|
|
|
|
/// تقييم الرحلة المكتملة.
|
|
class TripRate extends TripEvent {
|
|
final int stars;
|
|
final String? comment;
|
|
|
|
const TripRate({required this.stars, this.comment});
|
|
|
|
@override
|
|
List<Object?> get props => [stars, comment];
|
|
}
|
|
|
|
/// مسح الرحلة من الذاكرة (بعد التقييم أو العودة للرئيسية).
|
|
class TripClear extends TripEvent {
|
|
const TripClear();
|
|
}
|