mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: web down
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -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,41 +197,44 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
|
|||||||
// ''',
|
// ''',
|
||||||
// );
|
// );
|
||||||
},
|
},
|
||||||
onDownloadStartRequest: (controller, request) {
|
onDownloadStartRequest: Platform.isAndroid
|
||||||
showDialog(
|
? (controller, request) {
|
||||||
context: context,
|
showDialog(
|
||||||
builder: (context) {
|
context: context,
|
||||||
String suggestedFilename =
|
builder: (context) {
|
||||||
request.suggestedFilename.toString();
|
String suggestedFilename =
|
||||||
String fileSize =
|
request.suggestedFilename.toString();
|
||||||
CacheManage.formatSize(request.contentLength.toDouble());
|
String fileSize = CacheManage.formatSize(
|
||||||
try {
|
request.contentLength.toDouble());
|
||||||
suggestedFilename = Uri.decodeComponent(suggestedFilename);
|
try {
|
||||||
} catch (e) {
|
suggestedFilename =
|
||||||
debugPrint(e.toString());
|
Uri.decodeComponent(suggestedFilename);
|
||||||
}
|
} catch (e) {
|
||||||
return AlertDialog(
|
debugPrint(e.toString());
|
||||||
title: Text(
|
}
|
||||||
'下载文件: $suggestedFilename ?',
|
return AlertDialog(
|
||||||
style: const TextStyle(fontSize: 18),
|
title: Text(
|
||||||
),
|
'下载文件: $suggestedFilename ?',
|
||||||
content: SelectableText(request.url.toString()),
|
style: const TextStyle(fontSize: 18),
|
||||||
actions: [
|
),
|
||||||
TextButton(
|
content: SelectableText(request.url.toString()),
|
||||||
onPressed: Get.back,
|
actions: [
|
||||||
child: const Text('取消'),
|
TextButton(
|
||||||
),
|
onPressed: Get.back,
|
||||||
TextButton(
|
child: const Text('取消'),
|
||||||
onPressed: () async {
|
),
|
||||||
Get.back();
|
TextButton(
|
||||||
Utils.launchURL(request.url.toString());
|
onPressed: () async {
|
||||||
},
|
Get.back();
|
||||||
child: Text('确定 ($fileSize)')),
|
Utils.launchURL(request.url.toString());
|
||||||
],
|
},
|
||||||
);
|
child: Text('确定 ($fileSize)')),
|
||||||
});
|
],
|
||||||
_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);
|
||||||
|
|||||||
Reference in New Issue
Block a user