refactor: migrate amount fields to decimal and implement location service restriction for unsupported regions

This commit is contained in:
Hamza-Ayed
2026-07-24 15:08:37 +03:00
parent e7629a9eb9
commit 474c212bcb
16 changed files with 129 additions and 26 deletions
@@ -11,6 +11,7 @@ import 'package:permission_handler/permission_handler.dart' as ph;
import 'package:socket_io_client/socket_io_client.dart' as IO;
import 'package:siro_driver/constant/table_names.dart';
import 'package:trip_overlay_plugin/trip_overlay_plugin.dart';
import '../../constant/country_polygons.dart';
import '../../constant/box_name.dart';
import '../../constant/links.dart';
import '../../main.dart';
@@ -559,7 +560,11 @@ class LocationController extends GetxController with WidgetsBindingObserver {
final now = DateTime.now();
final pos = LatLng(loc.latitude!, loc.longitude!);
myLocation = pos;
if (!CountryPolygons.isServiceSupported(pos)) {
myLocation = const LatLng(31.9539, 35.9106);
} else {
myLocation = pos;
}
speed = loc.speed ?? 0.0;
heading = loc.heading ?? 0.0;
@@ -863,7 +868,12 @@ class LocationController extends GetxController with WidgetsBindingObserver {
if (locData != null &&
locData.latitude != null &&
locData.longitude != null) {
myLocation = LatLng(locData.latitude!, locData.longitude!);
final rawPos = LatLng(locData.latitude!, locData.longitude!);
if (!CountryPolygons.isServiceSupported(rawPos)) {
myLocation = const LatLng(31.9539, 35.9106);
} else {
myLocation = rawPos;
}
heading = locData.heading ?? 0.0;
speed = locData.speed ?? 0.0;
@@ -736,11 +736,9 @@ class HomeCaptainController extends GetxController {
);
if (locData != null && locData.latitude != null) {
myLocation = LatLng(locData.latitude!, locData.longitude!);
print(
"📍 [HomeCaptain] Location updated: ${myLocation.latitude}, ${myLocation.longitude}");
if (!CountryPolygons.isServiceSupported(myLocation)) {
final rawPos = LatLng(locData.latitude!, locData.longitude!);
if (!CountryPolygons.isServiceSupported(rawPos)) {
myLocation = const LatLng(31.9539, 35.9106);
if (!Get.isSnackbarOpen) {
Get.snackbar(
'Alert'.tr,
@@ -754,7 +752,11 @@ class HomeCaptainController extends GetxController {
isDismissible: true,
);
}
} else {
myLocation = rawPos;
}
print(
"📍 [HomeCaptain] Location updated: ${myLocation.latitude}, ${myLocation.longitude}");
} else {
print(
"⚠️ [HomeCaptain] Could not get current location, using default.");
+1 -1
View File
@@ -2692,5 +2692,5 @@ final Map<String, String> ar_eg = {
"Clear Destination": "مسح الوجهة",
"Destination cleared!": "تم مسح الوجهة الشخصية!",
"Move map to select destination": "حرك الخريطة لتحديد الوجهة الشخصية",
"service_unavailable_area": "هذه الخدمة غير متوفرة حالياً في منطقتك",
"service_unavailable_area": "هذا التطبيق لا يعمل في منطقتك حالياً",
};
+1 -1
View File
@@ -2692,7 +2692,7 @@ final Map<String, String> ar_jo = {
"Clear Destination": "مسح الوجهة",
"Destination cleared!": "تم مسح الوجهة الشخصية!",
"Move map to select destination": "حرك الخريطة لتحديد الوجهة الشخصية",
"service_unavailable_area": "هذه الخدمة غير متوفرة حالياً في منطقتك",
"service_unavailable_area": "هذا التطبيق لا يعمل في منطقتك حالياً",
"بطاقة الصعود (Boarding Pass)": "بطاقة الصعود (Boarding Pass)",
"بطاقة الصعود": "بطاقة الصعود",
"يرجى إبراز هذا الرمز للسائق عند الصعود للحافلة": "يرجى إبراز هذا الرمز للسائق عند الصعود للحافلة",
+1 -1
View File
@@ -2694,5 +2694,5 @@ final Map<String, String> ar_sy = {
"🏆 \\\${'Maximum Level Reached!": "🏆 \\\${'وصلت لأعلى مستوى!",
"💰 Pay with Wallet": "💰 ادفع من المحفظة",
"💳 Pay with Credit Card": "💳 ادفع ببطاقة ائتمان",
"service_unavailable_area": "هذه الخدمة غير متوفرة حالياً في منطقتك",
"service_unavailable_area": "هذا التطبيق لا يعمل في منطقتك حالياً",
};