From 25c312de28592c6b63a5cd5672b9e25dd0772b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Wed, 29 Apr 2026 22:50:41 +0300 Subject: [PATCH] feat: add Android sharing intent support, network security configuration, and headless link extraction service --- android/app/src/main/AndroidManifest.xml | 8 +++++++- .../main/res/xml/network_security_config.xml | 9 +++++++++ .../services/link_extraction_service.dart | 19 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 android/app/src/main/res/xml/network_security_config.xml diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 7f0e0f3..75db9e9 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,8 +1,14 @@ + + + + + + android:icon="@mipmap/ic_launcher" + android:networkSecurityConfig="@xml/network_security_config"> + + + + + + + + diff --git a/lib/features/sender/data/services/link_extraction_service.dart b/lib/features/sender/data/services/link_extraction_service.dart index b11ad6c..1fc376e 100644 --- a/lib/features/sender/data/services/link_extraction_service.dart +++ b/lib/features/sender/data/services/link_extraction_service.dart @@ -1,3 +1,4 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; abstract class ILinkExtractionService { @@ -17,6 +18,24 @@ class LinkExtractionService implements ILinkExtractionService { _headlessWebView = HeadlessInAppWebView( initialUrlRequest: URLRequest(url: WebUri(pageUrl)), + initialSettings: InAppWebViewSettings( + javaScriptEnabled: true, + isInspectable: true, + mixedContentMode: MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW, + userAgent: "Mozilla/5.0 (Linux; Android 13; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Mobile Safari/537.36", + ), + onReceivedServerTrustAuthRequest: (controller, challenge) async { + return ServerTrustAuthResponse(action: ServerTrustAuthResponseAction.PROCEED); + }, + onConsoleMessage: (controller, consoleMessage) { + debugPrint("WEBVIEW CONSOLE: ${consoleMessage.message}"); + }, + onLoadError: (controller, url, code, message) { + debugPrint("WEBVIEW ERROR: $message ($code) for $url"); + }, + onLoadHttpError: (controller, url, statusCode, description) { + debugPrint("WEBVIEW HTTP ERROR: $description ($statusCode) for $url"); + }, onLoadResource: (controller, resource) { final url = resource.url.toString(); if (_isVideoUrl(url)) {