diff --git a/ci/version.info.txt b/ci/version.info.txt index 21be885..696d205 100644 --- a/ci/version.info.txt +++ b/ci/version.info.txt @@ -1,2 +1,3 @@ v1.7.6 - [x] ♻️ 优化发电 +- [x] ✨ 导出多个cbz的zip diff --git a/lib/basic/Method.dart b/lib/basic/Method.dart index c5afe91..e74de7e 100644 --- a/lib/basic/Method.dart +++ b/lib/basic/Method.dart @@ -641,6 +641,15 @@ class Method { }); } + /// 导出下载的漫画到cbzs.zip + Future exportComicDownloadToCbzsZip(String comicId, String dir, String name) { + return _flatInvoke("exportComicDownloadToCbzsZip", { + "comicId": comicId, + "dir": dir, + "name": name, + }); + } + /// 导入文件夹所有的文件 Future importComicDownloadDir( String dir, diff --git a/lib/screens/DownloadExportToFileScreen.dart b/lib/screens/DownloadExportToFileScreen.dart index 06b1c85..77a144d 100644 --- a/lib/screens/DownloadExportToFileScreen.dart +++ b/lib/screens/DownloadExportToFileScreen.dart @@ -116,6 +116,8 @@ class _DownloadExportToFileScreenState Container(height: 10), _exportToHtmlJPEGNotDownOverButton(), Container(height: 10), + _exportComicDownloadToCbzsZipButton(), + Container(height: 10), MaterialButton( onPressed: () async { Navigator.of(context).push( @@ -446,6 +448,59 @@ class _DownloadExportToFileScreenState ); } + Widget _exportComicDownloadToCbzsZipButton() { + return MaterialButton( + onPressed: () async { + if (!isPro) { + defaultToast(context, "请先发电鸭"); + return; + } + var name = ""; + if (currentExportRename()) { + var rename = await inputString( + context, + "请输入保存后的名称", + defaultValue: _task.title, + ); + if (rename != null && rename.isNotEmpty) { + name = rename; + } else { + return; + } + } else { + if (!await confirmDialog( + context, "导出确认", "将您所选的漫画导出cbk.zip${showExportPath()}")) { + return; + } + } + try { + setState(() { + exporting = true; + }); + await method.exportComicDownloadToCbzsZip( + widget.comicId, + await attachExportPath(), + name, + ); + setState(() { + exportResult = "导出成功"; + }); + } catch (e) { + setState(() { + exportResult = "导出失败 $e"; + }); + } finally { + setState(() { + exporting = false; + }); + } + }, + child: _buildButtonInner( + '导出阅读器用cbk.zip\n(暂时不能导入)' + (!isPro ? "\n(发电后使用)" : ""), + ), + ); + } + Widget _buildButtonInner(String text) { return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { diff --git a/lib/screens/DownloadExportingGroupScreen.dart b/lib/screens/DownloadExportingGroupScreen.dart index 61c6a56..28cbec8 100644 --- a/lib/screens/DownloadExportingGroupScreen.dart +++ b/lib/screens/DownloadExportingGroupScreen.dart @@ -91,6 +91,13 @@ class _DownloadExportingGroupScreenState ), ), Container(height: 20), + MaterialButton( + onPressed: _exportComicDownloadToCbzsZip, + child: _buildButtonInner( + "每部漫画都导出成cbz.zip" + (!isPro ? "\n(发电后使用)" : ""), + ), + ), + Container(height: 20), ], ); } @@ -250,6 +257,38 @@ class _DownloadExportingGroupScreenState } } + _exportComicDownloadToCbzsZip() async { + if (!isPro) { + defaultToast(context, "请先发电鸭"); + return; + } + if (!await confirmDialog( + context, "导出确认", "将您所选的漫画分别导出cbz.zip${showExportPath()}")) { + return; + } + try { + setState(() { + exporting = true; + }); + final path = await attachExportPath(); + for (var id in widget.idList) { + await method.exportComicDownloadToCbzsZip( + id, + path, + "", + ); + } + exported = true; + } catch (err) { + e = err; + exportFail = true; + } finally { + setState(() { + exporting = false; + }); + } + } + @override Widget build(BuildContext context) { return WillPopScope( diff --git a/lib/screens/ProScreen.dart b/lib/screens/ProScreen.dart index 3dff64c..f44ab04 100644 --- a/lib/screens/ProScreen.dart +++ b/lib/screens/ProScreen.dart @@ -71,6 +71,8 @@ class _ProScreenState extends State { "去\"关于\"界面找到维护地址可获得发电指引\n" "\n \"我曾经发过电\"可同步相应发电状态" "\n \"我刚才发了电\"兑换神秘代码" + "\n \"发电方式\"可以在网络不通时尝试更换" + "\n \"PAT入会\"是独立的发电方式" "\n\n发电小功能: 多线程下载 / 批量导入导出下载", ), ),