Skip to content
Merged
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
11 changes: 8 additions & 3 deletions lib/podcasts/data/podcast_proxy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ import '../podcast_service.dart';
/// Wraps Item (search result) and lazily loads Podcast + episodes.
/// Each podcast owns its own fetchEpisodesCommand.
class PodcastProxy {
PodcastProxy({required this.item, required PodcastService podcastService})
: _podcastService = podcastService {
PodcastProxy({
required this.item,
PodcastService? podcastService,
PlayerManager? playerManager,
}) : _podcastService = podcastService ?? di<PodcastService>(),
_playerManager = playerManager ?? di<PlayerManager>() {
fetchEpisodesCommand = Command.createAsyncNoParam<List<EpisodeMedia>>(
() async {
if (_episodes != null) return _episodes!;
Expand All @@ -25,6 +29,7 @@ class PodcastProxy {

final Item item;
final PodcastService _podcastService;
final PlayerManager _playerManager;

Podcast? _podcast;
List<EpisodeMedia>? _episodes;
Expand All @@ -41,7 +46,7 @@ class PodcastProxy {
}

if (_episodes != null && _episodes!.isNotEmpty) {
await di<PlayerManager>().setPlaylist(_episodes!, index: startIndex);
await _playerManager.setPlaylist(_episodes!, index: startIndex);
}
});

Expand Down