Skip to content

Commit

Permalink
Sort TV entries
Browse files Browse the repository at this point in the history
  • Loading branch information
veloce committed Jan 30, 2025
1 parent d553206 commit be26dce
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions lib/src/view/watch/watch_tab_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,26 @@ const _featuredChannelsSet = ISetConst({
});

final featuredChannelsProvider = FutureProvider.autoDispose<IList<TvGameSnapshot>>((ref) async {
return ref.withClientCacheFor((client) async {
return ref.withClient((client) async {
final channels = await TvRepository(client).channels();
return channels.entries
.where((channel) => _featuredChannelsSet.contains(channel.key))
return _featuredChannelsSet
.map((channel) => MapEntry(channel, channels[channel]))
.where((entry) => entry.value != null)
.map(
(entry) => TvGameSnapshot(
channel: entry.key,
id: entry.value.id,
orientation: entry.value.side ?? Side.white,
id: entry.value!.id,
orientation: entry.value!.side ?? Side.white,
player: FeaturedPlayer(
name: entry.value.user.name,
title: entry.value.user.title,
side: entry.value.side ?? Side.white,
rating: entry.value.rating,
name: entry.value!.user.name,
title: entry.value!.user.title,
side: entry.value!.side ?? Side.white,
rating: entry.value!.rating,
),
),
)
.toIList();
}, const Duration(minutes: 5));
});
});

class WatchTabScreen extends ConsumerStatefulWidget {
Expand Down

0 comments on commit be26dce

Please sign in to comment.