mod: web down

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-10 11:13:02 +08:00
parent 8f5c2bf3ba
commit a951d42623

View File

@@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:PiliPlus/http/constants.dart'; import 'package:PiliPlus/http/constants.dart';
import 'package:PiliPlus/http/init.dart'; import 'package:PiliPlus/http/init.dart';
@@ -196,16 +197,18 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
// ''', // ''',
// ); // );
}, },
onDownloadStartRequest: (controller, request) { onDownloadStartRequest: Platform.isAndroid
? (controller, request) {
showDialog( showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
String suggestedFilename = String suggestedFilename =
request.suggestedFilename.toString(); request.suggestedFilename.toString();
String fileSize = String fileSize = CacheManage.formatSize(
CacheManage.formatSize(request.contentLength.toDouble()); request.contentLength.toDouble());
try { try {
suggestedFilename = Uri.decodeComponent(suggestedFilename); suggestedFilename =
Uri.decodeComponent(suggestedFilename);
} catch (e) { } catch (e) {
debugPrint(e.toString()); debugPrint(e.toString());
} }
@@ -230,7 +233,8 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
); );
}); });
_progressStream.add(1); _progressStream.add(1);
}, }
: null,
shouldOverrideUrlLoading: (controller, navigationAction) async { shouldOverrideUrlLoading: (controller, navigationAction) async {
final String? str = final String? str =
navigationAction.request.url!.pathSegments.getOrNull(0); navigationAction.request.url!.pathSegments.getOrNull(0);