pre map passenger splitting

This commit is contained in:
Hamza-Ayed
2026-05-26 22:46:08 +03:00
parent b102af8f28
commit 118781fd66
3 changed files with 32 additions and 1 deletions

View File

@@ -74,6 +74,20 @@
<data android:scheme="geo" /> <data android:scheme="geo" />
</intent-filter> </intent-filter>
<!-- Navigation Intents -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="google.navigation" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/map" />
</intent-filter>
</activity> </activity>
<meta-data <meta-data

File diff suppressed because one or more lines are too long

View File

@@ -3015,6 +3015,23 @@ class MapPassengerController extends GetxController {
Future<Map<String, double>?> extractCoordinatesFromLinkAsync( Future<Map<String, double>?> extractCoordinatesFromLinkAsync(
String link) async { String link) async {
try { try {
// 1. معالجة روابط الخرائط المباشرة (geo: و google.navigation:)
if (link.startsWith('geo:') || link.startsWith('google.navigation:')) {
RegExp regex = RegExp(r'(-?\d+\.\d+)[,/~=](-?\d+\.\d+)');
var match = regex.firstMatch(link);
if (match != null) {
double lat = double.parse(match.group(1)!);
double lng = double.parse(match.group(2)!);
if (lat > 40 && lat > lng) {
double temp = lat;
lat = lng;
lng = temp;
}
return {'latitude': lat, 'longitude': lng};
}
}
// 2. معالجة الروابط العادية (http/https)
int urlStartIndex = link.indexOf(RegExp(r'https?://')); int urlStartIndex = link.indexOf(RegExp(r'https?://'));
if (urlStartIndex == -1) return null; if (urlStartIndex == -1) return null;
String cleanLink = link.substring(urlStartIndex).trim(); String cleanLink = link.substring(urlStartIndex).trim();