Add an opt-in 'background playback' setting (default off) that keeps audio playing on the native player when the app is backgrounded or the screen locks. Drives a media3 mediaPlayback foreground service via a setting reaction, started while the app is visible so Android 14+ grants it while-in-use. Includes ScreenLockAudioPolicy for the audio-only decision. Requires the matching plugin foreground-service support. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
15 lines
535 B
Dart
15 lines
535 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:frosty/screens/settings/stores/settings_store.dart';
|
|
|
|
void main() {
|
|
test('backgroundPlayback defaults to false', () {
|
|
final store = SettingsStore.fromJson({});
|
|
expect(store.backgroundPlayback, isFalse);
|
|
});
|
|
|
|
test('backgroundPlayback round-trips through json', () {
|
|
final store = SettingsStore.fromJson({})..backgroundPlayback = true;
|
|
final restored = SettingsStore.fromJson(store.toJson());
|
|
expect(restored.backgroundPlayback, isTrue);
|
|
});
|
|
}
|