mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-21 15:02:21 +02:00
refactor(player): port tests to musicPlayerRuntime and delete the test-only wrappers
The wrappers only forwarded to musicPlayerRuntime and were referenced by one test file. The forwarding helpers now live in that test.
This commit is contained in:
1 parent
95666c1043
commit
992e21e297
3 files changed
+47
-48
No files matched your search
@@ -22,14 +22,6 @@ AutoplayLearningTrack _learningTrack(PlayableMedia media) =>
|
||||
duration: media.duration,
|
||||
);
|
||||
|
||||
void setAutoplayEnabled(bool enabled, {bool includeLocal = true}) =>
|
||||
musicPlayerRuntime.configure(
|
||||
musicPlayerRuntime.settings.copyWith(
|
||||
autoplay: enabled,
|
||||
localLibraryEnabled: includeLocal,
|
||||
),
|
||||
);
|
||||
|
||||
/// Bounded database pages keep recommendation work independent of Library
|
||||
/// size. Both downloaded tracks and enabled scanned sources are local files.
|
||||
Future<List<PlayableMedia>> _loadAutoplayLibrary(
|
||||
|
||||
@@ -30,7 +30,6 @@ import 'package:spotiflac_android/services/music_playback_deck.dart';
|
||||
import 'package:spotiflac_android/services/automix_analysis.dart';
|
||||
import 'package:spotiflac_android/services/autoplay_personalization.dart';
|
||||
import 'package:spotiflac_android/services/automix_analyzer.dart';
|
||||
import 'package:spotiflac_android/models/automix_options.dart';
|
||||
import 'package:spotiflac_android/models/settings.dart';
|
||||
import 'package:spotiflac_android/services/automix_effect_renderer.dart';
|
||||
import 'package:spotiflac_android/services/automix_status.dart';
|
||||
@@ -50,50 +49,11 @@ part 'music_player_autoplay.dart';
|
||||
|
||||
final _log = AppLogger('MusicPlayer');
|
||||
|
||||
void configurePlaybackNotification({
|
||||
required PlaybackNotification presentation,
|
||||
required Future<bool> Function(MediaItem) toggleFavorite,
|
||||
}) => musicPlayerRuntime.configureNotification(
|
||||
presentation: presentation,
|
||||
toggleFavorite: toggleFavorite,
|
||||
);
|
||||
|
||||
/// Muted artwork shares the music session. Recover its Now Playing ownership
|
||||
/// after video initialization, including failed or abandoned initialization.
|
||||
Future<void> restoreMusicAudioSessionAfterVideo() async =>
|
||||
musicPlayerRuntime.handler?.restoreIosNowPlaying();
|
||||
|
||||
void setPlaybackAutomationOptions({
|
||||
required bool enabled,
|
||||
required bool pauseOnMute,
|
||||
required bool playOnHeadphonesConnected,
|
||||
}) => musicPlayerRuntime.configure(
|
||||
musicPlayerRuntime.settings.copyWith(
|
||||
playerMode: enabled ? 'internal' : 'external',
|
||||
pauseOnMute: pauseOnMute,
|
||||
playOnHeadphonesConnected: playOnHeadphonesConnected,
|
||||
),
|
||||
);
|
||||
|
||||
void setAutoMixEnabled(bool enabled) => musicPlayerRuntime.configure(
|
||||
musicPlayerRuntime.settings.copyWith(autoMix: enabled),
|
||||
);
|
||||
|
||||
void setAutoMixOptions(AutoMixOptions options) => musicPlayerRuntime.configure(
|
||||
musicPlayerRuntime.settings.copyWith(
|
||||
autoMixDuration: options.durationSeconds,
|
||||
autoMixEffect: options.effect,
|
||||
autoMixSpeed: options.speed,
|
||||
autoMixPitch: options.pitchSemitones,
|
||||
autoMixEcho: options.echo,
|
||||
autoMixLowPass: options.lowPass,
|
||||
),
|
||||
);
|
||||
|
||||
void setUsbBitPerfectEnabled(bool enabled) => musicPlayerRuntime.configure(
|
||||
musicPlayerRuntime.settings.copyWith(usbBitPerfect: enabled),
|
||||
);
|
||||
|
||||
/// Gain and rate the player applies to the current track.
|
||||
class PlaybackProcessing {
|
||||
const PlaybackProcessing({
|
||||
|
||||
@@ -227,6 +227,53 @@ Future<void> _until(bool Function() ready) async {
|
||||
fail('Playback did not reach the expected state');
|
||||
}
|
||||
|
||||
void configurePlaybackNotification({
|
||||
required PlaybackNotification presentation,
|
||||
required Future<bool> Function(MediaItem) toggleFavorite,
|
||||
}) => musicPlayerRuntime.configureNotification(
|
||||
presentation: presentation,
|
||||
toggleFavorite: toggleFavorite,
|
||||
);
|
||||
|
||||
void setPlaybackAutomationOptions({
|
||||
required bool enabled,
|
||||
required bool pauseOnMute,
|
||||
required bool playOnHeadphonesConnected,
|
||||
}) => musicPlayerRuntime.configure(
|
||||
musicPlayerRuntime.settings.copyWith(
|
||||
playerMode: enabled ? 'internal' : 'external',
|
||||
pauseOnMute: pauseOnMute,
|
||||
playOnHeadphonesConnected: playOnHeadphonesConnected,
|
||||
),
|
||||
);
|
||||
|
||||
void setAutoMixEnabled(bool enabled) => musicPlayerRuntime.configure(
|
||||
musicPlayerRuntime.settings.copyWith(autoMix: enabled),
|
||||
);
|
||||
|
||||
void setAutoMixOptions(AutoMixOptions options) => musicPlayerRuntime.configure(
|
||||
musicPlayerRuntime.settings.copyWith(
|
||||
autoMixDuration: options.durationSeconds,
|
||||
autoMixEffect: options.effect,
|
||||
autoMixSpeed: options.speed,
|
||||
autoMixPitch: options.pitchSemitones,
|
||||
autoMixEcho: options.echo,
|
||||
autoMixLowPass: options.lowPass,
|
||||
),
|
||||
);
|
||||
|
||||
void setUsbBitPerfectEnabled(bool enabled) => musicPlayerRuntime.configure(
|
||||
musicPlayerRuntime.settings.copyWith(usbBitPerfect: enabled),
|
||||
);
|
||||
|
||||
void setAutoplayEnabled(bool enabled, {bool includeLocal = true}) =>
|
||||
musicPlayerRuntime.configure(
|
||||
musicPlayerRuntime.settings.copyWith(
|
||||
autoplay: enabled,
|
||||
localLibraryEnabled: includeLocal,
|
||||
),
|
||||
);
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
|
||||
Reference in new issue
Block a user