mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
fix local comic display
This commit is contained in:
@@ -11,6 +11,14 @@ class ComicType {
|
||||
@override
|
||||
int get hashCode => value.hashCode;
|
||||
|
||||
String get sourceKey {
|
||||
if(this == local) {
|
||||
return "local";
|
||||
} else {
|
||||
return comicSource!.key;
|
||||
}
|
||||
}
|
||||
|
||||
ComicSource? get comicSource {
|
||||
if(this == local) {
|
||||
return null;
|
||||
|
@@ -19,6 +19,11 @@ extension Navigation on BuildContext {
|
||||
.push<T>(AppPageRoute(builder: (context) => builder()));
|
||||
}
|
||||
|
||||
Future<void> toReplacement<T>(Widget Function() builder) {
|
||||
return Navigator.of(this)
|
||||
.pushReplacement(AppPageRoute(builder: (context) => builder()));
|
||||
}
|
||||
|
||||
double get width => MediaQuery.of(this).size.width;
|
||||
|
||||
double get height => MediaQuery.of(this).size.height;
|
||||
|
@@ -55,7 +55,7 @@ class FavoriteItem implements Comic {
|
||||
@override
|
||||
String toString() {
|
||||
var s = "FavoriteItem: $name $author $coverPath $hashCode $tags";
|
||||
if(s.length > 100) {
|
||||
if (s.length > 100) {
|
||||
return s.substring(0, 100);
|
||||
}
|
||||
return s;
|
||||
@@ -65,7 +65,9 @@ class FavoriteItem implements Comic {
|
||||
String get cover => coverPath;
|
||||
|
||||
@override
|
||||
String get description => "$time | ${type.comicSource?.name ?? "Unknown"}";
|
||||
String get description {
|
||||
return "$time | ${type == ComicType.local ? 'local' : type.comicSource?.name ?? "Unknown"}";
|
||||
}
|
||||
|
||||
@override
|
||||
String? get favoriteId => null;
|
||||
@@ -77,7 +79,7 @@ class FavoriteItem implements Comic {
|
||||
int? get maxPage => null;
|
||||
|
||||
@override
|
||||
String get sourceKey => type.comicSource?.key ?? "Unknown:${type.value}";
|
||||
String get sourceKey => type == ComicType.local ? 'local' : type.comicSource?.key ?? "Unknown:${type.value}";
|
||||
|
||||
@override
|
||||
double? get stars => null;
|
||||
@@ -514,6 +516,13 @@ class LocalFavoritesManager {
|
||||
update "$folder"
|
||||
set name = ?, author = ?, cover_path = ?, tags = ?
|
||||
where id == ? and type == ?;
|
||||
""", [comic.name, comic.author, comic.coverPath, comic.tags.join(","), comic.id, comic.type.value]);
|
||||
""", [
|
||||
comic.name,
|
||||
comic.author,
|
||||
comic.coverPath,
|
||||
comic.tags.join(","),
|
||||
comic.id,
|
||||
comic.type.value
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -79,7 +79,7 @@ class LocalComic with HistoryMixin implements Comic {
|
||||
String get description => "";
|
||||
|
||||
@override
|
||||
String get sourceKey => comicType.comicSource?.key ?? '_local_';
|
||||
String get sourceKey => comicType == ComicType.local ? "local" : "";
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
@@ -214,7 +214,7 @@ class LocalManager with ChangeNotifier {
|
||||
SELECT id FROM comics WHERE comic_type = ?
|
||||
ORDER BY CAST(id AS INTEGER) DESC
|
||||
LIMIT 1;
|
||||
'''[type.value],
|
||||
''', [type.value],
|
||||
);
|
||||
if (res.isEmpty) {
|
||||
return '1';
|
||||
@@ -341,7 +341,7 @@ class LocalManager with ChangeNotifier {
|
||||
if (comic == null) return false;
|
||||
if (comic.chapters == null) return true;
|
||||
return comic.downloadedChapters
|
||||
.contains(comic.chapters!.keys.elementAt(ep));
|
||||
.contains(comic.chapters!.keys.elementAt(ep-1));
|
||||
}
|
||||
|
||||
List<DownloadTask> downloadingTasks = [];
|
||||
|
Reference in New Issue
Block a user