2021-03-06 19:09:19 +01:00
|
|
|
import '../entities/song.dart';
|
|
|
|
import '../modules/queue_manager.dart';
|
|
|
|
import '../repositories/audio_player_repository.dart';
|
|
|
|
import '../repositories/platform_integration_repository.dart';
|
|
|
|
|
|
|
|
class AddToQueue {
|
|
|
|
AddToQueue(
|
|
|
|
this._audioPlayerRepository,
|
|
|
|
this._platformIntegrationRepository,
|
|
|
|
this._queueManagerModule,
|
|
|
|
);
|
|
|
|
|
|
|
|
final AudioPlayerRepository _audioPlayerRepository;
|
|
|
|
final PlatformIntegrationRepository _platformIntegrationRepository;
|
|
|
|
|
|
|
|
final QueueManagerModule _queueManagerModule;
|
|
|
|
|
|
|
|
Future<void> call(Song song) async {
|
|
|
|
|
|
|
|
_queueManagerModule.addToQueue(song);
|
|
|
|
await _audioPlayerRepository.addToQueue(song);
|
|
|
|
|
2021-05-09 21:38:34 +02:00
|
|
|
final songList = _audioPlayerRepository.queueStream.valueWrapper.value;
|
2021-03-06 19:09:19 +01:00
|
|
|
print(songList.length);
|
|
|
|
_platformIntegrationRepository.setQueue(songList);
|
|
|
|
}
|
|
|
|
}
|