From 80eec0a0456cbd645d20e3a1cd69c120e0e44cda Mon Sep 17 00:00:00 2001 From: Feichtmeier Date: Fri, 28 Nov 2025 18:25:32 +0100 Subject: [PATCH] refactor(PodcastProxy): add optional constructor parameters --- lib/podcasts/data/podcast_proxy.dart | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/podcasts/data/podcast_proxy.dart b/lib/podcasts/data/podcast_proxy.dart index a4316ba..e9e3102 100644 --- a/lib/podcasts/data/podcast_proxy.dart +++ b/lib/podcasts/data/podcast_proxy.dart @@ -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(), + _playerManager = playerManager ?? di() { fetchEpisodesCommand = Command.createAsyncNoParam>( () async { if (_episodes != null) return _episodes!; @@ -25,6 +29,7 @@ class PodcastProxy { final Item item; final PodcastService _podcastService; + final PlayerManager _playerManager; Podcast? _podcast; List? _episodes; @@ -41,7 +46,7 @@ class PodcastProxy { } if (_episodes != null && _episodes!.isNotEmpty) { - await di().setPlaylist(_episodes!, index: startIndex); + await _playerManager.setPlaylist(_episodes!, index: startIndex); } });