feat: add Android sharing intent support, network security configuration, and headless link extraction service

This commit is contained in:
Ümit Tunç
2026-04-29 22:50:41 +03:00
parent a3d3de0c0d
commit 25c312de28
3 changed files with 35 additions and 1 deletions
+7 -1
View File
@@ -1,8 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application <application
android:label="fastwatcher" android:label="fastwatcher"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher"
android:networkSecurityConfig="@xml/network_security_config">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true" android:exported="true"
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
<certificates src="user" />
</trust-anchors>
</base-config>
</network-security-config>
@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart';
abstract class ILinkExtractionService { abstract class ILinkExtractionService {
@@ -17,6 +18,24 @@ class LinkExtractionService implements ILinkExtractionService {
_headlessWebView = HeadlessInAppWebView( _headlessWebView = HeadlessInAppWebView(
initialUrlRequest: URLRequest(url: WebUri(pageUrl)), 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) { onLoadResource: (controller, resource) {
final url = resource.url.toString(); final url = resource.url.toString();
if (_isVideoUrl(url)) { if (_isVideoUrl(url)) {