diff --git a/ci/version.code.txt b/ci/version.code.txt index 21163d3..dd0587d 100644 --- a/ci/version.code.txt +++ b/ci/version.code.txt @@ -1 +1 @@ -v1.5.13 \ No newline at end of file +v1.5.14 \ No newline at end of file diff --git a/ci/version.info.txt b/ci/version.info.txt index ee3c98c..392f7c1 100644 --- a/ci/version.info.txt +++ b/ci/version.info.txt @@ -6,6 +6,10 @@ IOS 用户请注意, 由于导出权限的问题, 本次升级后, 数据将会 ## +v1.5.14 + +- [x] 🚀使用其他漫画软件的下载内容加速 + v1.5.13 - [x] ♻️升级flutter diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index b88282e..00a27c4 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -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; diff --git a/lib/basic/Method.dart b/lib/basic/Method.dart index a4afabe..4123440 100644 --- a/lib/basic/Method.dart +++ b/lib/basic/Method.dart @@ -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", { diff --git a/lib/basic/config/DownloadCachePath.dart b/lib/basic/config/DownloadCachePath.dart new file mode 100644 index 0000000..ef57e6b --- /dev/null +++ b/lib/basic/config/DownloadCachePath.dart @@ -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(); +} diff --git a/lib/screens/InitScreen.dart b/lib/screens/InitScreen.dart index e2f40e3..7e0b436 100644 --- a/lib/screens/InitScreen.dart +++ b/lib/screens/InitScreen.dart @@ -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 { autoCheckNewVersion(); await initWillPopNotice(); await initShowCommentAtDownload(); + await initDownloadCachePath(); String? initUrl; if (Platform.isAndroid || Platform.isIOS) { diff --git a/lib/screens/SettingsScreen.dart b/lib/screens/SettingsScreen.dart index 8eb6e72..ea11c32 100644 --- a/lib/screens/SettingsScreen.dart +++ b/lib/screens/SettingsScreen.dart @@ -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(), diff --git a/pubspec.lock b/pubspec.lock index 2d4e4f2..9acf153 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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" diff --git a/pubspec.yaml b/pubspec.yaml index 39201bb..f549cb4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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"