mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
更改安卓端的文件访问方式,优化导入逻辑 (#64)
* Refactor import function & Allow import local comics without copying them to local path. * android: use file_picker instead, support directory access for android 10 * Improve import logic * Fix sql query. * Add ability to remove invalid favorite items. * Perform sort before choosing cover * Revert changes of "use file_picker instead". * Try catch on "check update" * Added module 'flutter_saf' * gitignore * remove unsupported arch in build.gradle * Use flutter_saf to handle android's directory and files, improve import logic. * revert changes of 'requestLegacyExternalStorage' * fix cbz import * openDirectoryPlatform * Remove double check on source folder * use openFilePlatform * remove unused import * improve local comic's path handling * bump version * fix pubspec format * return null when comic folder is empty
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:sqlite3/sqlite3.dart';
|
||||
import 'package:venera/foundation/appdata.dart';
|
||||
import 'package:venera/foundation/image_provider/local_favorite_image.dart';
|
||||
import 'package:venera/foundation/local.dart';
|
||||
import 'package:venera/foundation/log.dart';
|
||||
import 'dart:io';
|
||||
|
||||
@@ -496,6 +497,22 @@ class LocalFavoritesManager with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<int> removeInvalid() async {
|
||||
int count = 0;
|
||||
await Future.microtask(() {
|
||||
var all = allComics();
|
||||
for(var c in all) {
|
||||
var comicSource = c.type.comicSource;
|
||||
if ((c.type == ComicType.local && LocalManager().find(c.id, c.type) == null)
|
||||
|| (c.type != ComicType.local && comicSource == null)) {
|
||||
deleteComicWithId(c.folder, c.id, c.type);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
});
|
||||
return count;
|
||||
}
|
||||
|
||||
Future<void> clearAll() async {
|
||||
_db.dispose();
|
||||
File("${App.dataPath}/local_favorite.db").deleteSync();
|
||||
|
Reference in New Issue
Block a user