deeplink
This commit is contained in:
@@ -3005,6 +3005,16 @@ class MapPassengerController extends GetxController {
|
||||
'longitude': double.parse(matchSearch.group(2)!),
|
||||
};
|
||||
}
|
||||
|
||||
// النمط الرابع: place/lat,lng (غالباً متواجد في الروابط المشتركة من خرائط جوجل)
|
||||
RegExp regexPlace = RegExp(r'place/(-?\d+\.\d+),(-?\d+\.\d+)');
|
||||
var matchPlace = regexPlace.firstMatch(finalUrl);
|
||||
if (matchPlace != null) {
|
||||
return {
|
||||
'latitude': double.parse(matchPlace.group(1)!),
|
||||
'longitude': double.parse(matchPlace.group(2)!),
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
Log.print('Error parsing location link: $e');
|
||||
}
|
||||
@@ -8184,8 +8194,10 @@ Intaleq Team''';
|
||||
Log.print(
|
||||
'🚀 Drawing route from Deep Link: $originStr to $destStr');
|
||||
|
||||
// 3. مسح أي مسارات سابقة
|
||||
// 3. مسح أي مسارات ونقاط توقف سابقة
|
||||
clearPolyline();
|
||||
waypoints.clear();
|
||||
clearAllMenuWaypoints();
|
||||
|
||||
// 4. استدعاء دالة رسم المسار وحساب التكلفة التي برمجتها
|
||||
await getDirectionMap(originStr, destStr);
|
||||
@@ -8210,6 +8222,43 @@ Intaleq Team''';
|
||||
_deepLinkController.rawDeepLink.value = null;
|
||||
}
|
||||
});
|
||||
|
||||
// معالجة الرابط إذا كان موجوداً مسبقاً (Cold Start) قبل تفعيل المستمع
|
||||
if (_deepLinkController.rawDeepLink.value != null && _deepLinkController.rawDeepLink.value!.isNotEmpty) {
|
||||
String link = _deepLinkController.rawDeepLink.value!;
|
||||
_deepLinkController.rawDeepLink.value = null;
|
||||
|
||||
// نؤجل التنفيذ قليلاً لضمان تحميل الخريطة
|
||||
Future.delayed(const Duration(milliseconds: 500), () async {
|
||||
Log.print('📍 MapPassengerController processing link (Cold Start): $link');
|
||||
|
||||
Map<String, double>? coordinates = await extractCoordinatesFromLinkAsync(link);
|
||||
|
||||
if (coordinates != null) {
|
||||
double destLat = coordinates['latitude']!;
|
||||
double destLng = coordinates['longitude']!;
|
||||
myDestination = LatLng(destLat, destLng);
|
||||
|
||||
if (passengerLocation == null || (passengerLocation.latitude == 0 && passengerLocation.longitude == 0)) {
|
||||
await getLocation();
|
||||
}
|
||||
|
||||
if (passengerLocation != null) {
|
||||
String originStr = '${passengerLocation.latitude},${passengerLocation.longitude}';
|
||||
String destStr = '$destLat,$destLng';
|
||||
|
||||
clearPolyline();
|
||||
waypoints.clear();
|
||||
clearAllMenuWaypoints();
|
||||
await getDirectionMap(originStr, destStr);
|
||||
|
||||
isBottomSheetShown = true;
|
||||
heightBottomSheetShown = 250;
|
||||
update();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user