refactor(library): drop unwired DB pagination providers

This commit is contained in:
zarzet
2026-07-26 18:44:06 +07:00
parent 04a71d0211
commit 97758908ca
3 changed files with 95 additions and 374 deletions
@@ -1860,37 +1860,6 @@ final downloadHistoryProvider =
DownloadHistoryNotifier.new,
);
class DownloadHistoryPageRequest {
final int limit;
final int offset;
const DownloadHistoryPageRequest({this.limit = 100, this.offset = 0});
@override
bool operator ==(Object other) =>
other is DownloadHistoryPageRequest &&
other.limit == limit &&
other.offset == offset;
@override
int get hashCode => Object.hash(limit, offset);
}
final downloadHistoryPageProvider = FutureProvider.autoDispose
.family<List<DownloadHistoryItem>, DownloadHistoryPageRequest>((
ref,
request,
) async {
ref.watch(
downloadHistoryProvider.select((state) => state.loadedIndexVersion),
);
final rows = await HistoryDatabase.instance.getAll(
limit: request.limit,
offset: request.offset,
);
return rows.map(DownloadHistoryItem.fromJson).toList(growable: false);
});
class DownloadHistoryGroupedCounts {
final int albumCount;
final int singleTrackCount;
-77
View File
@@ -1044,80 +1044,3 @@ final localLibraryFirstCoverProvider = FutureProvider.autoDispose
return null;
});
final localLibraryPageProvider = FutureProvider.autoDispose
.family<List<LocalLibraryItem>, LocalLibraryPageRequest>((
ref,
request,
) async {
ref.watch(
localLibraryProvider.select((state) => state.loadedIndexVersion),
);
final rows = await LibraryDatabase.instance.getPage(request);
return rows.map(LocalLibraryItem.fromJson).toList(growable: false);
});
final localLibraryPageCountProvider = FutureProvider.autoDispose
.family<int, LocalLibraryPageRequest>((ref, request) async {
ref.watch(
localLibraryProvider.select((state) => state.loadedIndexVersion),
);
return LibraryDatabase.instance.getPageCount(request);
});
class LocalLibraryAlbumPageRequest {
final int limit;
final int offset;
final LocalLibraryFilterMode filterMode;
final LocalLibrarySortMode sortMode;
final String? searchQuery;
const LocalLibraryAlbumPageRequest({
this.limit = 100,
this.offset = 0,
this.filterMode = LocalLibraryFilterMode.albums,
this.sortMode = LocalLibrarySortMode.album,
this.searchQuery,
});
@override
bool operator ==(Object other) {
return other is LocalLibraryAlbumPageRequest &&
other.limit == limit &&
other.offset == offset &&
other.filterMode == filterMode &&
other.sortMode == sortMode &&
other.searchQuery == searchQuery;
}
@override
int get hashCode =>
Object.hash(limit, offset, filterMode, sortMode, searchQuery);
}
final localLibraryAlbumPageProvider = FutureProvider.autoDispose
.family<List<LocalLibraryAlbumGroup>, LocalLibraryAlbumPageRequest>((
ref,
request,
) async {
ref.watch(
localLibraryProvider.select((state) => state.loadedIndexVersion),
);
return LibraryDatabase.instance.getAlbumPage(
limit: request.limit,
offset: request.offset,
filterMode: request.filterMode,
sortMode: request.sortMode,
searchQuery: request.searchQuery,
);
});
final localLibraryAlbumCountProvider = FutureProvider.autoDispose
.family<int, LocalLibraryAlbumPageRequest>((ref, request) async {
ref.watch(
localLibraryProvider.select((state) => state.loadedIndexVersion),
);
return LibraryDatabase.instance.getAlbumCount(
filterMode: request.filterMode,
searchQuery: request.searchQuery,
);
});