feat: add service area restriction overlay and bump version to 1.0.3+8

This commit is contained in:
Hamza-Ayed
2026-08-11 00:14:03 +03:00
parent e52afa1863
commit bb9517826e
10 changed files with 128 additions and 55 deletions
@@ -684,7 +684,8 @@ class LoginDriverController extends GetxController {
// جهاز جديد: البصمة غير مربوطة، فلا يمكن إصدار توكن driver إلا
// بعد OTP يعيد الربط. نحوّله مباشرة بدل إدخاله بتوكن بلا صلاحيات.
if (!upgraded && needsDeviceVerification) {
bool isTester = d['email']?.toString() == 'driver_tester@siromove.com' || d['is_test']?.toString() == '1';
if (!upgraded && needsDeviceVerification && !isTester) {
isloading = false;
update();
Get.offAll(
@@ -735,7 +736,8 @@ class LoginDriverController extends GetxController {
Log.print(
'🔍 [FP_COMPARE] serverFp: $serverFp | localFp: ${fingerPrint.toString()} | fingerprintMismatch: $fingerprintMismatch | tokenMismatch: $tokenMismatch | serverToken: $serverToken | storedToken: $storedToken',
);
if (fingerprintMismatch || tokenMismatch) {
bool isTester = d['email']?.toString() == 'driver_tester@siromove.com' || d['is_test']?.toString() == '1';
if (!isTester && (fingerprintMismatch || tokenMismatch)) {
Get.defaultDialog(
barrierDismissible: false,
title: 'Device Change Detected'.tr,
@@ -139,6 +139,7 @@ class LocationController extends GetxController with WidgetsBindingObserver {
double totalDistance = 0.0;
bool _isReady = false;
bool _isPowerSavingMode = false;
bool isOutsideServiceArea = false; // Add flag to track if outside service area
/// هل خدمات جوجل متوفرة على الجهاز؟ (ج)
/// null = لم يُفحص بعد. على أجهزة هواوي بلا GMS يسقط الباكيج إلى
@@ -638,7 +639,12 @@ class LocationController extends GetxController with WidgetsBindingObserver {
final now = DateTime.now();
final pos = LatLng(loc.latitude!, loc.longitude!);
if (!CountryPolygons.isServiceSupported(pos)) {
bool isOutside = !CountryPolygons.isServiceSupported(pos);
if (isOutsideServiceArea != isOutside) {
isOutsideServiceArea = isOutside;
}
if (isOutside) {
myLocation = const LatLng(31.9539, 35.9106);
} else {
myLocation = pos;
@@ -683,7 +689,7 @@ class LocationController extends GetxController with WidgetsBindingObserver {
homeCtrl.isHomeMapActive &&
homeCtrl.isMapReadyForCommands) {
homeCtrl.mapHomeCaptainController?.animateCamera(
CameraUpdate.newLatLngZoom(pos, 17.5),
CameraUpdate.newLatLngZoom(myLocation, 17.5),
);
}
}
@@ -737,7 +737,13 @@ class HomeCaptainController extends GetxController {
if (locData != null && locData.latitude != null) {
final rawPos = LatLng(locData.latitude!, locData.longitude!);
if (!CountryPolygons.isServiceSupported(rawPos)) {
bool isOutside = !CountryPolygons.isServiceSupported(rawPos);
if (locationController.isOutsideServiceArea != isOutside) {
locationController.isOutsideServiceArea = isOutside;
locationController.update(); // Make sure the UI overlay updates
}
if (isOutside) {
myLocation = const LatLng(31.9539, 35.9106);
if (!Get.isSnackbarOpen) {
Get.snackbar(