diff --git a/lib/utils/cbz.dart b/lib/utils/cbz.dart index f6c3b67..4116217 100644 --- a/lib/utils/cbz.dart +++ b/lib/utils/cbz.dart @@ -1,5 +1,4 @@ import 'dart:convert'; -import 'dart:isolate'; import 'package:venera/foundation/app.dart'; import 'package:venera/foundation/comic_type.dart'; @@ -63,7 +62,7 @@ abstract class CBZ { var cache = Directory(FilePath.join(App.cachePath, 'cbz_import')); if (cache.existsSync()) cache.deleteSync(recursive: true); cache.createSync(); - await Isolate.run(() => ZipFile.openAndExtract(file.path, cache.path)); + await ZipFile.openAndExtractAsync(file.path, cache.path, 4); var metaDataFile = File(FilePath.join(cache.path, 'metadata.json')); ComicMetaData? metaData; if (metaDataFile.existsSync()) { @@ -208,13 +207,13 @@ abstract class CBZ { ).toJson(), ), ); - var cbz = File(FilePath.join(App.cachePath, '${comic.title}.cbz')); + var cbz = File(FilePath.join(App.cachePath, sanitizeFileName('${comic.title}.cbz'))); await _compress(cache.path, cbz.path); cache.deleteSync(recursive: true); return cbz; } static _compress(String src, String dst) async { - await Isolate.run(() => ZipFile.compressFolder(src, dst)); + await ZipFile.compressFolderAsync(src, dst, 4); } } diff --git a/pubspec.lock b/pubspec.lock index a254914..401089e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1125,12 +1125,11 @@ packages: zip_flutter: dependency: "direct main" description: - path: "." - ref: HEAD - resolved-ref: d5721f1fd8179ee4a5db59f932ae7c89d94e12a0 - url: "https://github.com/wgh136/zip_flutter" - source: git - version: "0.0.1" + name: zip_flutter + sha256: "72b85f84dc5737e1c1dd7ed97ed0242f397872acc8d03044a5789b466dbf42b2" + url: "https://pub.dev" + source: hosted + version: "0.0.2" sdks: dart: ">=3.6.0 <4.0.0" flutter: ">=3.27.0" diff --git a/pubspec.yaml b/pubspec.yaml index 3aa2b77..b2c8950 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,9 +51,7 @@ dependencies: sliver_tools: ^0.2.12 flutter_file_dialog: ^3.0.2 file_selector: ^1.0.3 - zip_flutter: - git: - url: https://github.com/wgh136/zip_flutter + zip_flutter: ^0.0.2 lodepng_flutter: git: url: https://github.com/venera-app/lodepng_flutter