deeplink
This commit is contained in:
@@ -81,6 +81,29 @@
|
||||
<data android:scheme="intaleq" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- 🔗 Intercept Geo URIs (geo:lat,lng) -->
|
||||
<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="geo" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- 🔗 Intercept External Map URLs (Google/Apple) -->
|
||||
<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="http" android:host="maps.google.com" />
|
||||
<data android:scheme="https" android:host="maps.google.com" />
|
||||
<data android:scheme="https" android:host="maps.apple.com" />
|
||||
<data android:scheme="https" android:host="goo.gl" />
|
||||
<data android:scheme="http" android:host="goo.gl" />
|
||||
<data android:scheme="https" android:host="maps.app.goo.gl" />
|
||||
<data android:scheme="http" android:host="maps.app.goo.gl" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<!-- Google Maps API -->
|
||||
|
||||
@@ -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
|
||||
|
||||
21
test_intent.xml
Normal file
21
test_intent.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<!-- 🔗 Intercept Geo URIs -->
|
||||
<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="geo" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- 🔗 Intercept Google Maps Links -->
|
||||
<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="http" android:host="maps.google.com" />
|
||||
<data android:scheme="https" android:host="maps.google.com" />
|
||||
<data android:scheme="https" android:host="safemap.net" />
|
||||
<data android:scheme="https" android:host="maps.apple.com" />
|
||||
<data android:scheme="https" android:host="goo.gl" />
|
||||
<data android:scheme="http" android:host="goo.gl" />
|
||||
<data android:scheme="https" android:host="maps.app.goo.gl" />
|
||||
</intent-filter>
|
||||
Reference in New Issue
Block a user