Allow export to jpegs even if not download finish

This commit is contained in:
niuhuan 2023-02-03 10:09:39 +08:00
parent 4f2c4ec90d
commit 09e6b3b659
2 changed files with 70 additions and 4 deletions

View File

@ -567,6 +567,19 @@ class Method {
}); });
} }
/// HTML+JPG (使)
Future<dynamic> exportComicJpegsEvenNotFinish(
String comicId,
String dir,
String name,
) {
return _flatInvoke("exportComicJpegsEvenNotFinish", {
"comicId": comicId,
"dir": dir,
"name": name,
});
}
/// HTML+JPG /// HTML+JPG
Future<dynamic> exportComicDownloadToJPG( Future<dynamic> exportComicDownloadToJPG(
String comicId, String comicId,

View File

@ -351,6 +351,59 @@ class _DownloadExportToFileScreenState
child: _buildButtonInner('导出到HTML.zip\n(可从其他设备导入 / 解压后可阅读)'), child: _buildButtonInner('导出到HTML.zip\n(可从其他设备导入 / 解压后可阅读)'),
)); ));
widgets.add(Container(height: 10)); widgets.add(Container(height: 10));
//////////////////////
widgets.add(MaterialButton(
onPressed: () async {
late String? path;
try {
path = Platform.isIOS
? await method.iosGetDocumentDir()
: await chooseFolder(context);
} catch (e) {
defaultToast(context, "$e");
return;
}
var name = "";
if (currentExportRename()) {
var rename = await inputString(
context,
"请输入保存后的名称",
defaultValue: _task.title,
);
if (rename != null && rename.isNotEmpty) {
name = rename;
} else {
return;
}
}
print("path $path");
if (path != null) {
try {
setState(() {
exporting = true;
});
await method.exportComicJpegsEvenNotFinish(
widget.comicId,
path,
name,
);
setState(() {
exportResult = "导出成功";
});
} catch (e) {
setState(() {
exportResult = "导出失败 $e";
});
} finally {
setState(() {
exporting = false;
});
}
}
},
child: _buildButtonInner('导出到HTML+JPG\n(即使没有下载成功)'),
));
widgets.add(Container(height: 10));
} }
if (Platform.isIOS || Platform.isAndroid) { if (Platform.isIOS || Platform.isAndroid) {
widgets.add(MaterialButton( widgets.add(MaterialButton(