dart - Flutter Web - Force open externally in Facebok - Stack Overflow

I have a problem with deeplinks in Facebook.This is working perfectly in android and iOS apps but when

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

相关推荐

  • dart - Flutter Web - Force open externally in Facebok - Stack Overflow

    I have a problem with deeplinks in Facebook.This is working perfectly in android and iOS apps but when

    8小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信