I have a problem with deeplinks in Facebook.
This is working perfectly in android and iOS apps but when I try to open a link on facebook, even redirecting and removing junk from link, it fails saying the result don't exist.
I tried:
RewriteEngine on
RewriteCond %{QUERY_STRING} (^|&)result=([^&]+) [NC]
RewriteRule ^$ /web/?result=%2 [L,R=302]
and it cleans the URL but still fail in facebook browser.
my main.dart
void _initDeepLinks() {
try {
_appLinks = AppLinks();
_linkSubscription = _appLinks.uriLinkStream.listen((Uri? uri) {
if (uri != null) {
DeepLinkManager.instance.setPendingUri(uri);
}
});
} catch (e) {
print("Deep linking error: $e");
}
}
my result screen:
void _waitForLoadingAndHandleDeepLink() async {
while (_isLoading) {
await Future.delayed(Duration(milliseconds: 100));
}
// After loading is complete, handle any pending deep link
_handlePendingDeepLink();
}
dynamic _getResultById(String resultId) {
return _resultsList?.firstWhere(
(result) {
if (result is ResultModel) {
return result.id.trim().toLowerCase() == resultId.toLowerCase();
} else if (result is OSMResultModel) {
return (result.tags?['ref'] ?? '').trim().toLowerCase() ==
resultId.toLowerCase();
}
return false;
},
orElse: () => null,
);
}
void _handlePendingDeepLink() {
final resultId = DeepLinkManager.instance.getResultIntent();
if (resultId != null) {
final result =
_getResultById(resultId); // Fetch the full result object
if (result != null) {
Get.to(
() => DetailsScreen(result: result),
);
} else {
Get.snackbar(
'Error'.toUpperCase(),
colorText: AppColors.white,
'',
messageText: Text(
'Result not found'.toUpperCase(),
style: TextStyle(
fontVariations: <FontVariation>[FontVariation('wght', (kIsWeb) ? 600 : 700)],
color: AppColors.white,
),
),
snackPosition: SnackPosition.BOTTOM,
margin: EdgeInsets.all(16.0),
duration: Duration(seconds: 4),
backgroundColor: AppColors.hintColor,
);
}
DeepLinkManager.instance.clearChargerIntent();
}
}
How can I make this links ask that facebook popup "App trying to open externally? Thank you!
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745099969a4611214.html
评论列表(0条)