mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
chore: fix queue collections not being loaded
This commit is contained in:
parent
ffb3a3377f
commit
261e1b6685
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
4
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -53,7 +53,7 @@ body:
|
||||
description: Where did you install Spotube from?
|
||||
multiple: true
|
||||
options:
|
||||
- "Website (spotube.netlify.app) or (spotube.krtirtho.dev)"
|
||||
- "Website (spotube.krtirtho.dev)"
|
||||
- "GitHub Releases (Binary)"
|
||||
- "GitHub Actions (Nightly Binary)"
|
||||
- "Play Store (Android)"
|
||||
@ -77,4 +77,4 @@ body:
|
||||
description: If you are a developer and want to work on this issue yourself, you can check this box and wait for maintainer response. We welcome contributions!
|
||||
options:
|
||||
- label: I'm ready to work on this issue!
|
||||
required: false
|
||||
required: false
|
||||
|
@ -89,6 +89,12 @@ class AudioPlayerNotifier extends Notifier<AudioPlayerState> {
|
||||
autoPlay: false,
|
||||
);
|
||||
}
|
||||
|
||||
if (playerState.collections.isNotEmpty) {
|
||||
state = state.copyWith(
|
||||
collections: playerState.collections,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _updatePlayerState(
|
||||
|
@ -9,28 +9,31 @@ class RecentlyPlayedItemNotifier extends AsyncNotifier<List<HistoryTableData>> {
|
||||
build() async {
|
||||
final database = ref.watch(databaseProvider);
|
||||
|
||||
final uniqueItemIds =
|
||||
await (database.selectOnly(database.historyTable, distinct: true)
|
||||
..addColumns([database.historyTable.itemId])
|
||||
..where(
|
||||
database.historyTable.type.isIn([
|
||||
HistoryEntryType.playlist.name,
|
||||
HistoryEntryType.album.name,
|
||||
]),
|
||||
)
|
||||
..limit(10))
|
||||
.map((row) => row.read(database.historyTable.itemId))
|
||||
.get()
|
||||
.then((value) => value.whereNotNull().toList());
|
||||
final uniqueItemIds = await (database.selectOnly(database.historyTable,
|
||||
distinct: true)
|
||||
..addColumns([database.historyTable.itemId, database.historyTable.id])
|
||||
..where(
|
||||
database.historyTable.type.isIn([
|
||||
HistoryEntryType.playlist.name,
|
||||
HistoryEntryType.album.name,
|
||||
]),
|
||||
)
|
||||
..limit(10)
|
||||
..orderBy([
|
||||
OrderingTerm(
|
||||
expression: database.historyTable.createdAt,
|
||||
mode: OrderingMode.desc,
|
||||
),
|
||||
]))
|
||||
.map(
|
||||
(row) => row.read(database.historyTable.id),
|
||||
)
|
||||
.get()
|
||||
.then((value) => value.whereNotNull().toList());
|
||||
|
||||
final query = database.select(database.historyTable)
|
||||
..where(
|
||||
(tbl) =>
|
||||
tbl.type.isIn([
|
||||
HistoryEntryType.playlist.name,
|
||||
HistoryEntryType.album.name,
|
||||
]) &
|
||||
tbl.itemId.isIn(uniqueItemIds),
|
||||
(tbl) => tbl.id.isIn(uniqueItemIds),
|
||||
)
|
||||
..orderBy([
|
||||
(tbl) => OrderingTerm(
|
||||
@ -45,7 +48,9 @@ class RecentlyPlayedItemNotifier extends AsyncNotifier<List<HistoryTableData>> {
|
||||
|
||||
ref.onDispose(() => subscription.cancel());
|
||||
|
||||
return await query.get();
|
||||
final items = await query.get();
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user