download cache

1.6.1

1.6.1

1.6.1
This commit is contained in:
niuhuan 2022-10-27 15:21:46 +08:00
parent 8ac33b43db
commit 6a4828c5a6
15 changed files with 191 additions and 75 deletions

View File

@ -59,9 +59,12 @@ jobs:
- target: macos
host: macos-latest
flutter_version: '2.10.3'
- target: linux
host: ubuntu-latest
flutter_version: '2.10.3'
- target: ios
host: macos-latest
flutter_version: '3.3.4'
flutter_version: '3.3.10'
- target: android-arm32
host: ubuntu-latest
flutter_version: '2.10.5'
@ -73,13 +76,13 @@ jobs:
flutter_version: '2.10.5'
- target: android-arm32
host: ubuntu-latest
flutter_version: '3.3.4'
flutter_version: '3.3.10'
- target: android-arm64
host: ubuntu-latest
flutter_version: '3.3.4'
flutter_version: '3.3.10'
- target: android-x86_64
host: ubuntu-latest
flutter_version: '3.3.4'
flutter_version: '3.3.10'
runs-on: ${{ matrix.config.host }}
@ -210,7 +213,7 @@ jobs:
mv appimagetool-x86_64.AppImage ${GITHUB_WORKSPACE}/bin/appimagetool
echo ::add-path::${GITHUB_WORKSPACE}/bin
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev xorg-dev
sudo apt-get install -y libgl1-mesa-dev xorg-dev libfuse2
- name: Install hover (desktop)
if: steps.check_asset.outputs.skip_build != 'true' && ( matrix.config.target == 'linux' || matrix.config.target == 'windows' || matrix.config.target == 'macos')
@ -235,6 +238,7 @@ jobs:
sed -i "s/flutter_styled_toast: ^2.0.0/flutter_styled_toast: 2.0.0/g" pubspec.yaml
sed -i "s/filesystem_picker: ^3.0.0-beta.1/filesystem_picker: 2.0.0/g" pubspec.yaml
sed -i "s/file_picker: ^5.2.1/file_picker: 4.6.1/g" pubspec.yaml
sed -i "s/multi_select_flutter: ^4.0.0/multi_select_flutter: 4.1.2/g" pubspec.yaml
flutter pub get
- name: Upgrade deps version (flutter2 mac)
@ -245,6 +249,7 @@ jobs:
gsed -i "s/flutter_styled_toast: ^2.0.0/flutter_styled_toast: 2.0.0/g" pubspec.yaml
gsed -i "s/filesystem_picker: ^3.0.0-beta.1/filesystem_picker: 2.0.0/g" pubspec.yaml
gsed -i "s/file_picker: ^5.2.1/file_picker: 4.6.1/g" pubspec.yaml
gsed -i "s/multi_select_flutter: ^4.0.0/multi_select_flutter: 4.1.2/g" pubspec.yaml
flutter pub get
- name: Build (windows)

View File

@ -1 +1 @@
v1.5.13
v1.6.1

View File

@ -1,16 +1,5 @@
## !! WARNING !!
IOS 用户请注意, 由于导出权限的问题, 本次升级后, 数据将会被移出数据库 并现显示到文件管理器, 您登录windows端后, 将文件复制到windows端的data目录并覆盖, 即可恢复数据继续阅读。 随后系统将会重新创建数据库, 您可将下载传输回手机。
其他平台用户不受影响。
##
v1.5.13
v1.6.2
- [x] ♻使用分流1和CDN-3分流进行直连
- [x] ♻升级flutter
- [x] 🚀IOS支持导出到文件
- [x] ♻消除WebToon横向阅读时的抖动
- [x] 🐛修复一些布局问题
- [x] ♻️反转下载章节的列表
- [x] 🚀下载支持搜索

View File

@ -92,7 +92,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
image_cropper: 60c2789d1f1a78c873235d4319ca0c34a69f2d98
image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb
@ -102,7 +102,7 @@ SPEC CHECKSUMS:
TOCropViewController: edfd4f25713d56905ad1e0b9f5be3fbe0f59c863
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
uri_to_file: c4726881848febf4806f0a5707bd12903e02b0f0
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

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

@ -504,8 +504,10 @@ class Method {
}
///
Future<List<DownloadComic>> allDownloads() async {
var data = await _flatInvoke("allDownloads", "");
Future<List<DownloadComic>> allDownloads(String search) async {
var data = await _flatInvoke("allDownloads", {
"search": search,
});
data = jsonDecode(data);
if (data == null) {
return [];
@ -723,6 +725,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

@ -3,11 +3,12 @@ import 'package:flutter/material.dart';
import '../Method.dart';
var _imageAddresses = {
"-1": "跟随api分流",
"-3": "CDN-3",
"-2": "CDN-2",
"-1": "CDN-1",
"0": "不分流",
"1": "分流1 (推荐)",
"1": "分流1",
"2": "分流2",
"3": "分流3",
};
late String _currentImageAddress;

View File

@ -15,7 +15,7 @@ class DownloadExportGroupScreen extends StatefulWidget {
}
class _DownloadExportGroupScreenState extends State<DownloadExportGroupScreen> {
late Future<List<DownloadComic>> _f = method.allDownloads();
late Future<List<DownloadComic>> _f = method.allDownloads("");
@override
Widget build(BuildContext context) {
@ -68,7 +68,7 @@ class _DownloadExportGroupScreenState extends State<DownloadExportGroupScreen> {
onRefresh: () async {
setState(() {
selected.clear();
_f = method.allDownloads();
_f = method.allDownloads("");
});
},
child: ListView(

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_search_bar/flutter_search_bar.dart';
import 'package:pikapika/basic/Channels.dart';
import 'package:pikapika/basic/Common.dart';
import 'package:pikapika/basic/Entities.dart';
@ -22,9 +23,35 @@ class DownloadListScreen extends StatefulWidget {
}
class _DownloadListScreenState extends State<DownloadListScreen> {
String _search = "";
late final SearchBar _searchBar = SearchBar(
hintText: '搜索下载',
inBar: false,
setState: setState,
onSubmitted: (value) {
if (value.isNotEmpty) {
_search = value;
_f = method.allDownloads(_search);
_searchBar.controller.text = value;
}
},
buildDefaultAppBar: (BuildContext context) {
return AppBar(
title: Text(_search == "" ? "下载列表" : ('搜索下载 - $_search')),
actions: [
_searchBar.getSearchAction(context),
exportButton(),
importButton(),
resetFailedButton(),
pauseButton(),
],
);
},
);
DownloadComic? _downloading;
late bool _downloadRunning = false;
late Future<List<DownloadComic>> _f = method.allDownloads();
late Future<List<DownloadComic>> _f = method.allDownloads(_search);
void _onMessageChange(String event) {
print("EVENT");
@ -57,15 +84,7 @@ class _DownloadListScreenState extends State<DownloadListScreen> {
@override
Widget build(BuildContext context) {
final screen = Scaffold(
appBar: AppBar(
title: const Text('下载列表'),
actions: [
exportButton(),
importButton(),
resetFailedButton(),
pauseButton(),
],
),
appBar: _searchBar.build(context),
body: FutureBuilder(
future: _f,
builder: (BuildContext context,
@ -97,7 +116,7 @@ class _DownloadListScreenState extends State<DownloadListScreen> {
return RefreshIndicator(
onRefresh: () async {
setState(() {
_f = method.allDownloads();
_f = method.allDownloads(_search);
});
},
child: ListView(
@ -183,7 +202,7 @@ class _DownloadListScreenState extends State<DownloadListScreen> {
),
);
setState(() {
_f = method.allDownloads();
_f = method.allDownloads(_search);
});
},
icon: Column(
@ -262,7 +281,7 @@ class _DownloadListScreenState extends State<DownloadListScreen> {
onPressed: () async {
await method.resetFailed();
setState(() {
_f = method.allDownloads();
_f = method.allDownloads(_search);
});
defaultToast(context, "所有失败的下载已经恢复");
},

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

@ -182,8 +182,8 @@ class _ControllerComicPagerState extends State<ControllerComicPager> {
if (num == 0 || num > comicsPage.pages) {
return;
}
if (num > 50 && !isPro) {
defaultToast(context, "发电以后才能看50页以后的内容");
if (num > 10 && !isPro) {
defaultToast(context, "发电以后才能看10页以后的内容");
return;
}
_currentPage = num;
@ -218,8 +218,8 @@ class _ControllerComicPagerState extends State<ControllerComicPager> {
minWidth: 0,
onPressed: () {
if (comicsPage.page < comicsPage.pages) {
if (_currentPage >= 50 && !isPro) {
defaultToast(context, "发电以后才能看50页以后的内容");
if (_currentPage >= 10 && !isPro) {
defaultToast(context, "发电以后才能看10页以后的内容");
return;
}
_currentPage = comicsPage.page + 1;
@ -240,8 +240,8 @@ class _ControllerComicPagerState extends State<ControllerComicPager> {
if (comicsPage.page < comicsPage.pages) {
return FitButton(
onPressed: () {
if (_currentPage >= 50 && !isPro) {
defaultToast(context, "发电以后才能看50页以后的内容");
if (_currentPage >= 10 && !isPro) {
defaultToast(context, "发电以后才能看10页以后的内容");
return;
}
_currentPage = comicsPage.page + 1;
@ -317,7 +317,7 @@ class _StreamComicPagerState extends State<StreamComicPager> {
_maxPage = page.pages;
_list.addAll(page.docs);
_over = page.page >= page.pages;
_noPro = _currentPage > 50 && !isPro;
_noPro = _currentPage > 10 && !isPro;
});
} catch (e, s) {
_error = true;
@ -430,8 +430,8 @@ class _StreamComicPagerState extends State<StreamComicPager> {
if (num == 0 || num > _maxPage) {
return;
}
if (_currentPage >= 50 && !isPro) {
defaultToast(context, "发电以后才能看50页以后的内容");
if (_currentPage >= 10 && !isPro) {
defaultToast(context, "发电以后才能看10页以后的内容");
return;
}
_currentPage = num;

View File

@ -14,7 +14,7 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.1"
version: "3.3.5"
async:
dependency: transitive
description:
@ -57,6 +57,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
crop_image:
dependency: "direct main"
description:
@ -112,7 +119,7 @@ packages:
name: file_picker
url: "https://pub.dartlang.org"
source: hosted
version: "5.2.1"
version: "5.2.5"
filesystem_picker:
dependency: "direct main"
description:
@ -171,7 +178,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
@ -202,7 +209,7 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.2"
version: "3.3.0"
image_cropper:
dependency: "direct main"
description:
@ -216,14 +223,14 @@ packages:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.6"
version: "0.8.6+1"
image_picker_android:
dependency: transitive
description:
name: image_picker_android
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.5+3"
version: "0.8.5+5"
image_picker_for_web:
dependency: transitive
description:
@ -237,7 +244,7 @@ packages:
name: image_picker_ios
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.6+1"
version: "0.8.6+6"
image_picker_platform_interface:
dependency: transitive
description:
@ -307,7 +314,7 @@ packages:
name: multi_select_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.2"
version: "4.1.3"
path:
dependency: "direct main"
description:
@ -335,21 +342,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 +370,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:
@ -385,6 +392,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
pointycastle:
dependency: transitive
description:
name: pointycastle
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.2"
scrollable_positioned_list:
dependency: "direct main"
description:
@ -480,35 +494,35 @@ packages:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.6"
version: "6.1.8"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.19"
version: "6.0.23"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.17"
version: "6.0.18"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.0.2"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.0.2"
url_launcher_platform_interface:
dependency: transitive
description:
@ -522,14 +536,14 @@ packages:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
version: "2.0.14"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.0.2"
vector_math:
dependency: transitive
description:
@ -543,7 +557,7 @@ packages:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.1.3"
xml:
dependency: transitive
description:
@ -552,5 +566,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.6.1+9
environment:
sdk: ">=2.12.0 <3.0.0"