download cache

This commit is contained in:
niuhuan 2022-10-27 15:21:46 +08:00
parent 8ac33b43db
commit 442cc5d045
9 changed files with 103 additions and 13 deletions

View File

@ -1 +1 @@
v1.5.13
v1.5.14

View File

@ -6,6 +6,10 @@ IOS 用户请注意, 由于导出权限的问题, 本次升级后, 数据将会
##
v1.5.14
- [x] 🚀使用其他漫画软件的下载内容加速
v1.5.13
- [x] ♻升级flutter

View File

@ -249,7 +249,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
};
A66AE356A44E049B8DF0FD4F /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;

View File

@ -723,6 +723,16 @@ class Method {
return _flatInvoke("saveDownloadAndExportPath", folder);
}
/// 使-
Future loadDownloadCachePath() {
return _flatInvoke("loadDownloadCachePath", "");
}
/// 使-
Future saveDownloadCachePath(String folder) {
return _flatInvoke("saveDownloadCachePath", folder);
}
/// (, , )
Future androidSecureFlag(bool flag) {
return _channel.invokeMethod("androidSecureFlag", {

View File

@ -0,0 +1,72 @@
///
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:pikapika/basic/Common.dart';
import 'package:pikapika/basic/Cross.dart';
import '../Method.dart';
late String _downloadCachePath;
Future initDownloadCachePath() async {
if (Platform.isWindows ||
Platform.isMacOS ||
Platform.isAndroid ||
Platform.isLinux) {
_downloadCachePath = await method.loadDownloadCachePath();
}
}
Widget downloadCachePathSetting() {
if (Platform.isWindows ||
Platform.isMacOS ||
Platform.isAndroid ||
Platform.isLinux) {
return StatefulBuilder(
builder: (BuildContext context, void Function(void Function()) setState) {
return ListTile(
title: const Text("使用下载缓存"),
subtitle: Text(_downloadCachePath),
onTap: () async {
if (_downloadCachePath == "") {
bool b = await confirmDialog(
context,
"使用其他软件的下载内容加速",
"您即将选择一个目录, 作为下载加速使用, 这个目录名字通常叫files",
);
if (b) {
late String? folder;
try {
folder = await chooseFolder(context);
} catch (e) {
defaultToast(context, "$e");
return;
}
if (folder != null) {
await method.saveDownloadCachePath(folder);
_downloadCachePath = folder;
setState(() {});
}
}
} else {
bool b = await confirmDialog(
context,
"使用其他软件的下载内容加速",
"您确定取消使用其他软件的下载内容加速的功能吗? 取消之后您可以再次点击设置",
);
if (b) {
var folder = "";
await method.saveDownloadCachePath(folder);
_downloadCachePath = folder;
setState(() {});
}
}
},
);
},
);
}
return Container();
}

View File

@ -40,6 +40,7 @@ import 'package:pikapika/screens/ComicInfoScreen.dart';
import 'package:pikapika/screens/PkzArchiveScreen.dart';
import 'package:uni_links/uni_links.dart';
import 'package:uri_to_file/uri_to_file.dart';
import '../basic/config/DownloadCachePath.dart';
import '../basic/config/ExportRename.dart';
import '../basic/config/IconLoading.dart';
import '../basic/config/IsPro.dart';
@ -105,6 +106,7 @@ class _InitScreenState extends State<InitScreen> {
autoCheckNewVersion();
await initWillPopNotice();
await initShowCommentAtDownload();
await initDownloadCachePath();
String? initUrl;
if (Platform.isAndroid || Platform.isIOS) {

View File

@ -34,6 +34,7 @@ import 'package:pikapika/screens/components/RightClickPop.dart';
import '../basic/config/Authentication.dart';
import '../basic/config/CategoriesColumnCount.dart';
import '../basic/config/DownloadCachePath.dart';
import '../basic/config/UsingRightClickPop.dart';
import '../basic/config/WillPopNotice.dart';
import 'CleanScreen.dart';
@ -116,6 +117,7 @@ class SettingsScreen extends StatelessWidget {
downloadThreadCountSetting(),
downloadAndExportPathSetting(),
showCommentAtDownloadSetting(),
downloadCachePathSetting(),
exportRenameSetting(),
fontSetting(),
usingRightClickPopSetting(),

View File

@ -14,7 +14,7 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.1"
version: "3.3.2"
async:
dependency: transitive
description:
@ -112,7 +112,7 @@ packages:
name: file_picker
url: "https://pub.dartlang.org"
source: hosted
version: "5.2.1"
version: "5.2.2"
filesystem_picker:
dependency: "direct main"
description:
@ -171,7 +171,7 @@ packages:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.5"
version: "1.1.6"
flutter_test:
dependency: "direct dev"
description: flutter
@ -335,21 +335,21 @@ packages:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "10.1.0"
version: "10.2.0"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
url: "https://pub.dartlang.org"
source: hosted
version: "10.1.0"
version: "10.2.0"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.6"
version: "9.0.7"
permission_handler_platform_interface:
dependency: transitive
description:
@ -363,14 +363,14 @@ packages:
name: permission_handler_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1"
version: "0.1.2"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
version: "5.1.0"
photo_view:
dependency: "direct main"
description:
@ -487,7 +487,7 @@ packages:
name: url_launcher_android
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.19"
version: "6.0.20"
url_launcher_ios:
dependency: transitive
description:
@ -552,5 +552,5 @@ packages:
source: hosted
version: "6.1.0"
sdks:
dart: ">=2.17.0 <3.0.0"
dart: ">=2.18.0 <3.0.0"
flutter: ">=3.0.0"

View File

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.5.13+7
version: 1.5.14+8
environment:
sdk: ">=2.12.0 <3.0.0"