This commit is contained in:
Hamza-Ayed
2025-02-06 21:53:49 +03:00
parent a09bfbd646
commit 0997d9301f
10 changed files with 2425 additions and 892 deletions

View File

@@ -254,8 +254,18 @@ class RegisterController extends GetxController {
);
}
// await controller.sendSmsEgypt(phoneNumber, otp.toString());
} else {
await CRUD().sendWhatsAppAuth(phoneNumber, otp.toString());
} else if (phoneController.text.toString().length >= 10) {
box.write(BoxName.isVerified, '1');
box.write(BoxName.isFirstTime, '0'); //todo check if first or not
box.write(
BoxName.phone, encryptionHelper.encryptData(phoneController.text));
Get.put(LoginController()).loginUsingCredentials(
box.read(BoxName.passengerID).toString(),
box.read(BoxName.email).toString(),
);
// this for whatsapp messsage
// await CRUD().sendWhatsAppAuth(phoneNumber, otp.toString());
}
isLoading = false;

View File

@@ -1,6 +1,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:math' show Random, cos, max, min, pi, pow, sin, sqrt;
import 'dart:math' show Random, atan2, cos, max, min, pi, pow, sin, sqrt;
import 'dart:math' as math;
import 'dart:ui';
import 'package:Tripz/constant/univeries_polygon.dart';
@@ -3089,6 +3089,36 @@ class MapPassengerController extends GetxController {
update();
}
//driver behaviour
double calculateBearing(double lat1, double lon1, double lat2, double lon2) {
double deltaLon = lon2 - lon1;
double y = sin(deltaLon) * cos(lat2);
double x = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(deltaLon);
double bearing = atan2(y, x);
return (bearing * 180 / pi + 360) % 360; // تحويل إلى درجات
}
void analyzeBehavior(Position currentPosition, List<LatLng> routePoints) {
double actualBearing = currentPosition.heading; // الاتجاه الفعلي من GPS
double expectedBearing = calculateBearing(
routePoints[0].latitude,
routePoints[0].longitude,
routePoints[1].latitude,
routePoints[1].longitude,
);
double bearingDifference = (expectedBearing - actualBearing).abs();
if (bearingDifference > 30) {
print("⚠️ السائق انحرف عن المسار!");
}
}
void detectStops(Position currentPosition) {
if (currentPosition.speed < 0.5) {
print("🚦 السائق توقف في موقع غير متوقع!");
}
}
Future<void> cancelRideAfterRejectFromAll() async {
clearPlacesDestination();
clearPolyline();

View File

@@ -74,6 +74,16 @@ class LocaleController extends GetxController {
appTheme = lightThemeEnglish;
box.write(BoxName.lang, 'hi');
break;
case "ar-ma":
locale = const Locale("ar-ma");
appTheme = lightThemeArabic;
box.write(BoxName.lang, 'ar-ma');
break;
case "ar-gulf":
locale = const Locale("ar-gulf");
appTheme = lightThemeArabic;
box.write(BoxName.lang, 'ar-gulf');
break;
default:
locale = Locale(Get.deviceLocale!.languageCode);
box.write(BoxName.lang, Get.deviceLocale!.languageCode);

File diff suppressed because it is too large Load Diff

View File

@@ -145,8 +145,7 @@ class PaymobPaymentWallet {
}) async {
final Map<String, dynamic> data = {
"source": {
"identifier": encryptionHelper
.decryptData(box.read(BoxName.phoneWallet).toString()),
"identifier": (box.read(BoxName.phoneWallet).toString()),
"subtype": "WALLET",
},
"payment_token": paymentToken,
@@ -268,15 +267,15 @@ class PaymobBillingDataWallet {
Map<String, dynamic> toJson() {
return {
"email": box.read(BoxName.email),
"email": encryptionHelper.decryptData(box.read(BoxName.email)),
"first_name": encryptionHelper
.decryptData(box.read(BoxName.name).toString().split(' ')[0])
.toString(),
"last_name": encryptionHelper
.decryptData(box.read(BoxName.name).toString().split(' ')[1])
.toString(),
"phone_number":
encryptionHelper.decryptData(box.read(BoxName.phoneWallet)),
.decryptData(box.read(BoxName.name).toString().split(' ')[1])
.toString() ??
'tripz',
"phone_number": (box.read(BoxName.phoneWallet)),
"apartment": apartment ?? "NA",
"floor": floor ?? "NA",
"building": building ?? "NA",