Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new field to sort last read mangas #131

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ class CategoryMangaListWithQueryAndFilter
return (m1.inLibraryAt ?? 0).compareTo(m2.inLibraryAt ?? 0) *
sortDirToggle;
case MangaSort.lastRead:
return (m1.lastChapterRead?.lastReadAt ?? 0)
.compareTo(m2.lastChapterRead?.lastReadAt ?? 0) *
sortDirToggle *
-1;
return (m2.lastReadAt ?? 0).compareTo(m1.lastReadAt ?? 0) *
sortDirToggle;
default:
return 0;
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/features/manga_book/domain/manga/manga_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Manga with _$Manga {
String? description,
int? downloadCount,
int? chapterCount,
int? lastReadAt,
Chapter? lastChapterRead,
bool? freshData,
List<String>? genre,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ mixin _$Manga {
String? get description => throw _privateConstructorUsedError;
int? get downloadCount => throw _privateConstructorUsedError;
int? get chapterCount => throw _privateConstructorUsedError;
int? get lastReadAt => throw _privateConstructorUsedError;
Chapter? get lastChapterRead => throw _privateConstructorUsedError;
bool? get freshData => throw _privateConstructorUsedError;
List<String>? get genre => throw _privateConstructorUsedError;
Expand Down Expand Up @@ -61,6 +62,7 @@ abstract class $MangaCopyWith<$Res> {
String? description,
int? downloadCount,
int? chapterCount,
int? lastReadAt,
Chapter? lastChapterRead,
bool? freshData,
List<String>? genre,
Expand Down Expand Up @@ -104,6 +106,7 @@ class _$MangaCopyWithImpl<$Res, $Val extends Manga>
Object? description = freezed,
Object? downloadCount = freezed,
Object? chapterCount = freezed,
Object? lastReadAt = freezed,
Object? lastChapterRead = freezed,
Object? freshData = freezed,
Object? genre = freezed,
Expand Down Expand Up @@ -144,6 +147,10 @@ class _$MangaCopyWithImpl<$Res, $Val extends Manga>
? _value.chapterCount
: chapterCount // ignore: cast_nullable_to_non_nullable
as int?,
lastReadAt: freezed == lastReadAt
? _value.lastReadAt
: lastReadAt // ignore: cast_nullable_to_non_nullable
as int?,
lastChapterRead: freezed == lastChapterRead
? _value.lastChapterRead
: lastChapterRead // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -268,6 +275,7 @@ abstract class _$$_MangaCopyWith<$Res> implements $MangaCopyWith<$Res> {
String? description,
int? downloadCount,
int? chapterCount,
int? lastReadAt,
Chapter? lastChapterRead,
bool? freshData,
List<String>? genre,
Expand Down Expand Up @@ -310,6 +318,7 @@ class __$$_MangaCopyWithImpl<$Res> extends _$MangaCopyWithImpl<$Res, _$_Manga>
Object? description = freezed,
Object? downloadCount = freezed,
Object? chapterCount = freezed,
Object? lastReadAt = freezed,
Object? lastChapterRead = freezed,
Object? freshData = freezed,
Object? genre = freezed,
Expand Down Expand Up @@ -350,6 +359,10 @@ class __$$_MangaCopyWithImpl<$Res> extends _$MangaCopyWithImpl<$Res, _$_Manga>
? _value.chapterCount
: chapterCount // ignore: cast_nullable_to_non_nullable
as int?,
lastReadAt: freezed == lastReadAt
? _value.lastReadAt
: lastReadAt // ignore: cast_nullable_to_non_nullable
as int?,
lastChapterRead: freezed == lastChapterRead
? _value.lastChapterRead
: lastChapterRead // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -435,6 +448,7 @@ class _$_Manga implements _Manga {
this.description,
this.downloadCount,
this.chapterCount,
this.lastReadAt,
this.lastChapterRead,
this.freshData,
final List<String>? genre,
Expand Down Expand Up @@ -470,6 +484,8 @@ class _$_Manga implements _Manga {
@override
final int? chapterCount;
@override
final int? lastReadAt;
@override
final Chapter? lastChapterRead;
@override
final bool? freshData;
Expand Down Expand Up @@ -517,7 +533,7 @@ class _$_Manga implements _Manga {

@override
String toString() {
return 'Manga(artist: $artist, author: $author, description: $description, downloadCount: $downloadCount, chapterCount: $chapterCount, lastChapterRead: $lastChapterRead, freshData: $freshData, genre: $genre, inLibrary: $inLibrary, id: $id, inLibraryAt: $inLibraryAt, initialized: $initialized, realUrl: $realUrl, source: $source, sourceId: $sourceId, status: $status, thumbnailUrl: $thumbnailUrl, title: $title, unreadCount: $unreadCount, lastFetchedAt: $lastFetchedAt, chaptersLastFetchedAt: $chaptersLastFetchedAt, url: $url, meta: $meta)';
return 'Manga(artist: $artist, author: $author, description: $description, downloadCount: $downloadCount, chapterCount: $chapterCount, lastReadAt: $lastReadAt, lastChapterRead: $lastChapterRead, freshData: $freshData, genre: $genre, inLibrary: $inLibrary, id: $id, inLibraryAt: $inLibraryAt, initialized: $initialized, realUrl: $realUrl, source: $source, sourceId: $sourceId, status: $status, thumbnailUrl: $thumbnailUrl, title: $title, unreadCount: $unreadCount, lastFetchedAt: $lastFetchedAt, chaptersLastFetchedAt: $chaptersLastFetchedAt, url: $url, meta: $meta)';
}

@override
Expand All @@ -533,6 +549,8 @@ class _$_Manga implements _Manga {
other.downloadCount == downloadCount) &&
(identical(other.chapterCount, chapterCount) ||
other.chapterCount == chapterCount) &&
(identical(other.lastReadAt, lastReadAt) ||
other.lastReadAt == lastReadAt) &&
(identical(other.lastChapterRead, lastChapterRead) ||
other.lastChapterRead == lastChapterRead) &&
(identical(other.freshData, freshData) ||
Expand Down Expand Up @@ -572,6 +590,7 @@ class _$_Manga implements _Manga {
description,
downloadCount,
chapterCount,
lastReadAt,
lastChapterRead,
freshData,
const DeepCollectionEquality().hash(_genre),
Expand Down Expand Up @@ -613,6 +632,7 @@ abstract class _Manga implements Manga {
final String? description,
final int? downloadCount,
final int? chapterCount,
final int? lastReadAt,
final Chapter? lastChapterRead,
final bool? freshData,
final List<String>? genre,
Expand Down Expand Up @@ -646,6 +666,8 @@ abstract class _Manga implements Manga {
@override
int? get chapterCount;
@override
int? get lastReadAt;
@override
Chapter? get lastChapterRead;
@override
bool? get freshData;
Expand Down
2 changes: 2 additions & 0 deletions lib/src/features/manga_book/domain/manga/manga_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.