feat: add Android sharing intent support, network security configuration, and headless link extraction service
This commit is contained in:
@@ -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)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user