قرار المالك 2026-07-27: باك إند سيرو PHP هو المعتمد، وتطبيقاته المجرّبة ميدانياً تحل محل إعادة البناء المؤرشفة. سيرو نفسه لم يُمسّ. الخريطة: backend · payment_server · loction_server · ride_server · passenger_server · docker · dashboard · stress_test → الجذر siro_rider → apps/rider siro_driver → apps/driver siro_admin → dashboards/admin siro_service → dashboards/service android_bot → apps/android_bot socialBot → apps/socialBot نُسخ المتعقَّب في git سيرو فقط عبر `git archive` (3,198 ملفاً / ~169 م.ب) لا `cp -r` — فاستُثنيت مخلفات البناء تلقائياً. بلا أي تعديل محتوى عمداً: كل ما يلي يصير فرقاً مقروءاً مقابل المصدر. لم يُستورد وسببه: siromove.com (الموقع التسويقي يبقى marketing/ في تريبز، سيرو فيه 8 ملفات) · docs و planning (تريبز له docs/ الخاص) · deploy.sh (ليس نشراً على سيرفر بل `git add . && git push origin --all` — فخّ في مستودع آخر) · transit_dashboard (بانتظار قرار مصير backend-transit و dashboards/transit-web). ⚠️ لا يبني بعد — ثلاثة نواقص متوقعة ومقصودة: 1. `.env` و `lib/env/env.g.dart` غير متعقَّبين في سيرو (أسرار لكل مستأجر): كل تطبيق فلاتر يحتاج .env خاصاً ثم توليد env.g.dart بـ build_runner. 2. إعدادات Firebase (9 ملفات google-services.json و GoogleService-Info.plist) يستبعدها .gitignore تريبز — ولكل مستأجر مشروع Firebase خاص أصلاً. 3. apps/driver في سيرو يشير إلى `../../Intaleq/packages/get` خارج المستودع → يجب ضمّ الحزم داخله أسوة بـ apps/rider. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
134 lines
4.4 KiB
Dart
134 lines
4.4 KiB
Dart
// import 'dart:async';
|
|
|
|
// import 'package:get/get.dart';
|
|
// import 'package:google_maps_flutter/google_maps_flutter.dart';
|
|
// import 'package:location/location.dart';
|
|
|
|
// import '../../constant/box_name.dart';
|
|
// import '../../constant/links.dart';
|
|
// import '../../main.dart';
|
|
// import 'crud.dart';
|
|
|
|
// // LocationController.dart
|
|
// class LocationController extends GetxController {
|
|
// LocationData? _currentLocation;
|
|
// late Location location;
|
|
// bool isLoading = false;
|
|
// late double heading = 0;
|
|
// late double accuracy = 0;
|
|
// late double previousTime = 0;
|
|
// late double latitude;
|
|
// late double totalDistance = 0;
|
|
// late double longitude;
|
|
// late DateTime time;
|
|
// late double speed = 0;
|
|
// late double speedAccuracy = 0;
|
|
// late double headingAccuracy = 0;
|
|
// bool isActive = false;
|
|
// late LatLng myLocation;
|
|
// String totalPoints = '0';
|
|
// LocationData? get currentLocation => _currentLocation;
|
|
// Timer? _locationTimer;
|
|
|
|
// @override
|
|
// void onInit() async {
|
|
// super.onInit();
|
|
// location = Location();
|
|
// getLocation();
|
|
// // startLocationUpdates();
|
|
// }
|
|
|
|
// Future<void> startLocationUpdates() async {
|
|
// if (box.read(BoxName.driverID) != null) {
|
|
// _locationTimer =
|
|
// Timer.periodic(const Duration(seconds: 5), (timer) async {
|
|
// try {
|
|
// // if (isActive) {
|
|
// if (double.parse(totalPoints) > -300) {
|
|
|
|
// await getLocation();
|
|
|
|
// // if (box.read(BoxName.driverID) != null) {
|
|
// await CRUD()
|
|
// .post(link: AppLink.addCarsLocationByPassenger, payload: {
|
|
// 'driver_id': box.read(BoxName.driverID).toString(),
|
|
// 'latitude': myLocation.latitude.toString(),
|
|
// 'longitude': myLocation.longitude.toString(),
|
|
// 'heading': heading.toString(),
|
|
// 'speed': (speed * 3.6).toStringAsFixed(1),
|
|
// 'distance': totalDistance == 0
|
|
// ? '0'
|
|
// : totalDistance < 1
|
|
// ? totalDistance.toStringAsFixed(3)
|
|
// : totalDistance.toStringAsFixed(1),
|
|
// 'status': box.read(BoxName.statusDriverLocation).toString()
|
|
// });
|
|
// }
|
|
// } catch (e) {
|
|
// // Handle the error gracefully
|
|
// }
|
|
// });
|
|
// }
|
|
// }
|
|
|
|
// void stopLocationUpdates() {
|
|
// _locationTimer?.cancel();
|
|
// }
|
|
|
|
// Future<void> getLocation() async {
|
|
// // isLoading = true;
|
|
// // update();
|
|
// bool serviceEnabled;
|
|
// PermissionStatus permissionGranted;
|
|
|
|
// // Check if location services are enabled
|
|
// serviceEnabled = await location.serviceEnabled();
|
|
// if (!serviceEnabled) {
|
|
// serviceEnabled = await location.requestService();
|
|
// if (!serviceEnabled) {
|
|
// // Location services are still not enabled, handle the error
|
|
// return;
|
|
// }
|
|
// }
|
|
|
|
// // Check if the app has permission to access location
|
|
// permissionGranted = await location.hasPermission();
|
|
// if (permissionGranted == PermissionStatus.denied) {
|
|
// permissionGranted = await location.requestPermission();
|
|
// if (permissionGranted != PermissionStatus.granted) {
|
|
// // Location permission is still not granted, handle the error
|
|
// return;
|
|
// }
|
|
// }
|
|
|
|
// // Configure location accuracy
|
|
// // LocationAccuracy desiredAccuracy = LocationAccuracy.high;
|
|
|
|
// // Get the current location
|
|
// LocationData _locationData = await location.getLocation();
|
|
// myLocation =
|
|
// (_locationData.latitude != null && _locationData.longitude != null
|
|
// ? LatLng(_locationData.latitude!, _locationData.longitude!)
|
|
// : null)!;
|
|
// speed = _locationData.speed!;
|
|
// heading = _locationData.heading!;
|
|
|
|
// // isLoading = false;
|
|
// update();
|
|
// }
|
|
|
|
// double calculateDistanceInKmPerHour(
|
|
// double? startTime, double? endTime, double speedInMetersPerSecond) {
|
|
// // Calculate the time difference in hours
|
|
// double timeDifferenceInHours = (endTime! - startTime!) / 1000 / 3600;
|
|
|
|
// // Convert speed to kilometers per hour
|
|
// double speedInKmPerHour = speedInMetersPerSecond * 3.6;
|
|
|
|
// // Calculate the distance in kilometers
|
|
// double distanceInKilometers = speedInKmPerHour * timeDifferenceInHours;
|
|
|
|
// return distanceInKilometers;
|
|
// }
|
|
// }
|