Merge main into codex/tempdir-media-spooling

This commit is contained in:
Levi committed 2026-09-16 23:20:29 +08:00
commit 5342be16d9
32 files changed
+1709 -46

No files matched your search

+4
View File
@@ -29,3 +29,7 @@ linter:
formatter:
page_width: 120
analyzer:
exclude:
- third_party/**
@@ -3,6 +3,7 @@ import 'dart:collection';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import '../../core/common/start_config.dart';
@@ -73,7 +74,6 @@ class WebViewRpcService {
final Map<String, WebViewRpcPageSession> _pagesById = {};
final Completer<void> _overlayReady = Completer<void>();
late final CookieManager _cookieManager = CookieManager.instance();
RpcServerHandle? _server;
int _pageSeq = 0;
@@ -129,6 +129,9 @@ class WebViewRpcService {
switch (method) {
case 'webview.isAvailable':
return {'available': true};
case 'profile.remove':
await _removeProfile(_string(params, 'profileId'));
return {};
case 'page.open':
return _openPage(params);
case 'page.addInitScript':
@@ -162,10 +165,12 @@ class WebViewRpcService {
}
Future<Map<String, dynamic>> _openPage(Map<String, dynamic> params) async {
final profile = WebViewProfile(_string(params, 'profileId'));
await profile.prepare(proxyUrl: Uri.parse(_string(params, 'proxyUrl')));
final pageId = 'page-${++_pageSeq}';
final session = WebViewRpcPageSession(
pageId: pageId,
cookieManager: _cookieManager,
profile: profile,
headless: params['headless'] as bool? ?? false,
debug: params['debug'] as bool? ?? false,
title: params['title'] as String? ?? '',
@@ -185,6 +190,15 @@ class WebViewRpcService {
return {'pageId': pageId};
}
Future<void> _removeProfile(String id) async {
for (final page in _pagesById.values.where((page) => page.profile.id == id).toList()) {
await _closePage(page.pageId);
}
// Let visible platform views unmount before releasing their native store.
await WidgetsBinding.instance.endOfFrame;
await WebViewProfile(id).remove();
}
WebViewRpcPageSession _page(Map<String, dynamic> params) {
final page = _pagesById[_pageId(params)];
if (page == null) {
@@ -271,6 +285,9 @@ class WebViewRpcService {
if (error is WebViewRpcException) {
return {'code': error.code, 'message': error.message};
}
if (error is PlatformException && error.code == 'UNAVAILABLE') {
return {'code': error.code, 'message': error.message ?? 'WebView is unavailable'};
}
final code = switch (method) {
'page.goto' => 'NAVIGATION_FAILED',
'page.execute' => 'EVALUATION_FAILED',
@@ -283,7 +300,7 @@ class WebViewRpcService {
class WebViewRpcPageSession {
WebViewRpcPageSession({
required this.pageId,
required this.cookieManager,
required this.profile,
required this.headless,
required this.debug,
required this.title,
@@ -293,7 +310,8 @@ class WebViewRpcPageSession {
});
final String pageId;
final CookieManager cookieManager;
final WebViewProfile profile;
late final CookieManager cookieManager = profile.cookieManager;
final bool headless;
final bool debug;
final String title;
@@ -449,6 +467,8 @@ class WebViewRpcPageSession {
'path': cookie.path ?? '/',
'secure': cookie.isSecure,
'httpOnly': cookie.isHttpOnly,
if (cookie.expiresDate != null)
'expires': DateTime.fromMillisecondsSinceEpoch(cookie.expiresDate!, isUtc: true).toIso8601String(),
};
})
.toList(growable: false);
@@ -524,6 +544,7 @@ class WebViewRpcPageSession {
}
InAppWebViewSettings get _settings => InAppWebViewSettings(
profileId: profile.id,
javaScriptEnabled: true,
transparentBackground: true,
isInspectable: debug,
+5
View File
@@ -2,6 +2,11 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
+29 -24
View File
@@ -457,18 +457,20 @@ packages:
flutter_inappwebview:
dependency: "direct main"
description:
name: flutter_inappwebview
sha256: "80092d13d3e29b6227e25b67973c67c7210bd5e35c4b747ca908e31eb71a46d5"
url: "https://pub.dev"
source: hosted
path: flutter_inappwebview
ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
resolved-ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
url: "https://github.com/GopeedLab/flutter_inappwebview.git"
source: git
version: "6.1.5"
flutter_inappwebview_android:
dependency: transitive
dependency: "direct overridden"
description:
name: flutter_inappwebview_android
sha256: "62557c15a5c2db5d195cb3892aab74fcaec266d7b86d59a6f0027abd672cddba"
url: "https://pub.dev"
source: hosted
path: flutter_inappwebview_android
ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
resolved-ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
url: "https://github.com/GopeedLab/flutter_inappwebview.git"
source: git
version: "1.1.3"
flutter_inappwebview_internal_annotations:
dependency: transitive
@@ -479,28 +481,31 @@ packages:
source: hosted
version: "1.3.0"
flutter_inappwebview_ios:
dependency: transitive
dependency: "direct overridden"
description:
name: flutter_inappwebview_ios
sha256: "5818cf9b26cf0cbb0f62ff50772217d41ea8d3d9cc00279c45f8aabaa1b4025d"
url: "https://pub.dev"
source: hosted
path: flutter_inappwebview_ios
ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
resolved-ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
url: "https://github.com/GopeedLab/flutter_inappwebview.git"
source: git
version: "1.1.2"
flutter_inappwebview_macos:
dependency: transitive
dependency: "direct overridden"
description:
name: flutter_inappwebview_macos
sha256: c1fbb86af1a3738e3541364d7d1866315ffb0468a1a77e34198c9be571287da1
url: "https://pub.dev"
source: hosted
path: flutter_inappwebview_macos
ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
resolved-ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
url: "https://github.com/GopeedLab/flutter_inappwebview.git"
source: git
version: "1.1.2"
flutter_inappwebview_platform_interface:
dependency: transitive
dependency: "direct overridden"
description:
name: flutter_inappwebview_platform_interface
sha256: cf5323e194096b6ede7a1ca808c3e0a078e4b33cc3f6338977d75b4024ba2500
url: "https://pub.dev"
source: hosted
path: flutter_inappwebview_platform_interface
ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
resolved-ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
url: "https://github.com/GopeedLab/flutter_inappwebview.git"
source: git
version: "1.3.0+1"
flutter_inappwebview_web:
dependency: transitive
+26
View File
@@ -86,6 +86,32 @@ dependencies:
go_router: ^16.2.1
dependency_overrides:
# Public persistent-profile and proxy APIs; keep all packages on one commit.
flutter_inappwebview:
git:
url: https://github.com/GopeedLab/flutter_inappwebview.git
ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
path: flutter_inappwebview
flutter_inappwebview_platform_interface:
git:
url: https://github.com/GopeedLab/flutter_inappwebview.git
ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
path: flutter_inappwebview_platform_interface
flutter_inappwebview_macos:
git:
url: https://github.com/GopeedLab/flutter_inappwebview.git
ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
path: flutter_inappwebview_macos
flutter_inappwebview_ios:
git:
url: https://github.com/GopeedLab/flutter_inappwebview.git
ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
path: flutter_inappwebview_ios
flutter_inappwebview_android:
git:
url: https://github.com/GopeedLab/flutter_inappwebview.git
ref: d579215760e1c1e58a4ff7601a6055b5e6adf8e8
path: flutter_inappwebview_android
# Prevent a native Windows crash when the push notification service is unavailable.
# Keep this fork until https://github.com/MaikuB/flutter_local_notifications/pull/2813 is merged and released.
flutter_local_notifications: