feat: new settings to configure when to report playback and when to mark item complete (#32)

This commit is contained in:
Dr.Blank 2024-09-26 01:39:43 -04:00 committed by GitHub
parent 7279fa0bd6
commit 8049a660e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 129 additions and 7 deletions

View file

@ -514,7 +514,10 @@ mixin _$PlayerSettings {
List<double> get speedOptions => throw _privateConstructorUsedError;
SleepTimerSettings get sleepTimerSettings =>
throw _privateConstructorUsedError;
Duration get minimumPositionForReporting =>
throw _privateConstructorUsedError;
Duration get playbackReportInterval => throw _privateConstructorUsedError;
Duration get markCompleteWhenTimeLeft => throw _privateConstructorUsedError;
bool get configurePlayerForEveryBook => throw _privateConstructorUsedError;
/// Serializes this PlayerSettings to a JSON map.
@ -540,7 +543,9 @@ abstract class $PlayerSettingsCopyWith<$Res> {
double preferredDefaultSpeed,
List<double> speedOptions,
SleepTimerSettings sleepTimerSettings,
Duration minimumPositionForReporting,
Duration playbackReportInterval,
Duration markCompleteWhenTimeLeft,
bool configurePlayerForEveryBook});
$MinimizedPlayerSettingsCopyWith<$Res> get miniPlayerSettings;
@ -569,7 +574,9 @@ class _$PlayerSettingsCopyWithImpl<$Res, $Val extends PlayerSettings>
Object? preferredDefaultSpeed = null,
Object? speedOptions = null,
Object? sleepTimerSettings = null,
Object? minimumPositionForReporting = null,
Object? playbackReportInterval = null,
Object? markCompleteWhenTimeLeft = null,
Object? configurePlayerForEveryBook = null,
}) {
return _then(_value.copyWith(
@ -597,10 +604,18 @@ class _$PlayerSettingsCopyWithImpl<$Res, $Val extends PlayerSettings>
? _value.sleepTimerSettings
: sleepTimerSettings // ignore: cast_nullable_to_non_nullable
as SleepTimerSettings,
minimumPositionForReporting: null == minimumPositionForReporting
? _value.minimumPositionForReporting
: minimumPositionForReporting // ignore: cast_nullable_to_non_nullable
as Duration,
playbackReportInterval: null == playbackReportInterval
? _value.playbackReportInterval
: playbackReportInterval // ignore: cast_nullable_to_non_nullable
as Duration,
markCompleteWhenTimeLeft: null == markCompleteWhenTimeLeft
? _value.markCompleteWhenTimeLeft
: markCompleteWhenTimeLeft // ignore: cast_nullable_to_non_nullable
as Duration,
configurePlayerForEveryBook: null == configurePlayerForEveryBook
? _value.configurePlayerForEveryBook
: configurePlayerForEveryBook // ignore: cast_nullable_to_non_nullable
@ -657,7 +672,9 @@ abstract class _$$PlayerSettingsImplCopyWith<$Res>
double preferredDefaultSpeed,
List<double> speedOptions,
SleepTimerSettings sleepTimerSettings,
Duration minimumPositionForReporting,
Duration playbackReportInterval,
Duration markCompleteWhenTimeLeft,
bool configurePlayerForEveryBook});
@override
@ -687,7 +704,9 @@ class __$$PlayerSettingsImplCopyWithImpl<$Res>
Object? preferredDefaultSpeed = null,
Object? speedOptions = null,
Object? sleepTimerSettings = null,
Object? minimumPositionForReporting = null,
Object? playbackReportInterval = null,
Object? markCompleteWhenTimeLeft = null,
Object? configurePlayerForEveryBook = null,
}) {
return _then(_$PlayerSettingsImpl(
@ -715,10 +734,18 @@ class __$$PlayerSettingsImplCopyWithImpl<$Res>
? _value.sleepTimerSettings
: sleepTimerSettings // ignore: cast_nullable_to_non_nullable
as SleepTimerSettings,
minimumPositionForReporting: null == minimumPositionForReporting
? _value.minimumPositionForReporting
: minimumPositionForReporting // ignore: cast_nullable_to_non_nullable
as Duration,
playbackReportInterval: null == playbackReportInterval
? _value.playbackReportInterval
: playbackReportInterval // ignore: cast_nullable_to_non_nullable
as Duration,
markCompleteWhenTimeLeft: null == markCompleteWhenTimeLeft
? _value.markCompleteWhenTimeLeft
: markCompleteWhenTimeLeft // ignore: cast_nullable_to_non_nullable
as Duration,
configurePlayerForEveryBook: null == configurePlayerForEveryBook
? _value.configurePlayerForEveryBook
: configurePlayerForEveryBook // ignore: cast_nullable_to_non_nullable
@ -737,7 +764,9 @@ class _$PlayerSettingsImpl implements _PlayerSettings {
this.preferredDefaultSpeed = 1,
final List<double> speedOptions = const [0.75, 1, 1.25, 1.5, 1.75, 2],
this.sleepTimerSettings = const SleepTimerSettings(),
this.minimumPositionForReporting = const Duration(seconds: 10),
this.playbackReportInterval = const Duration(seconds: 10),
this.markCompleteWhenTimeLeft = const Duration(seconds: 15),
this.configurePlayerForEveryBook = true})
: _speedOptions = speedOptions;
@ -770,14 +799,20 @@ class _$PlayerSettingsImpl implements _PlayerSettings {
final SleepTimerSettings sleepTimerSettings;
@override
@JsonKey()
final Duration minimumPositionForReporting;
@override
@JsonKey()
final Duration playbackReportInterval;
@override
@JsonKey()
final Duration markCompleteWhenTimeLeft;
@override
@JsonKey()
final bool configurePlayerForEveryBook;
@override
String toString() {
return 'PlayerSettings(miniPlayerSettings: $miniPlayerSettings, expandedPlayerSettings: $expandedPlayerSettings, preferredDefaultVolume: $preferredDefaultVolume, preferredDefaultSpeed: $preferredDefaultSpeed, speedOptions: $speedOptions, sleepTimerSettings: $sleepTimerSettings, playbackReportInterval: $playbackReportInterval, configurePlayerForEveryBook: $configurePlayerForEveryBook)';
return 'PlayerSettings(miniPlayerSettings: $miniPlayerSettings, expandedPlayerSettings: $expandedPlayerSettings, preferredDefaultVolume: $preferredDefaultVolume, preferredDefaultSpeed: $preferredDefaultSpeed, speedOptions: $speedOptions, sleepTimerSettings: $sleepTimerSettings, minimumPositionForReporting: $minimumPositionForReporting, playbackReportInterval: $playbackReportInterval, markCompleteWhenTimeLeft: $markCompleteWhenTimeLeft, configurePlayerForEveryBook: $configurePlayerForEveryBook)';
}
@override
@ -797,8 +832,15 @@ class _$PlayerSettingsImpl implements _PlayerSettings {
.equals(other._speedOptions, _speedOptions) &&
(identical(other.sleepTimerSettings, sleepTimerSettings) ||
other.sleepTimerSettings == sleepTimerSettings) &&
(identical(other.minimumPositionForReporting,
minimumPositionForReporting) ||
other.minimumPositionForReporting ==
minimumPositionForReporting) &&
(identical(other.playbackReportInterval, playbackReportInterval) ||
other.playbackReportInterval == playbackReportInterval) &&
(identical(
other.markCompleteWhenTimeLeft, markCompleteWhenTimeLeft) ||
other.markCompleteWhenTimeLeft == markCompleteWhenTimeLeft) &&
(identical(other.configurePlayerForEveryBook,
configurePlayerForEveryBook) ||
other.configurePlayerForEveryBook ==
@ -815,7 +857,9 @@ class _$PlayerSettingsImpl implements _PlayerSettings {
preferredDefaultSpeed,
const DeepCollectionEquality().hash(_speedOptions),
sleepTimerSettings,
minimumPositionForReporting,
playbackReportInterval,
markCompleteWhenTimeLeft,
configurePlayerForEveryBook);
/// Create a copy of PlayerSettings
@ -843,7 +887,9 @@ abstract class _PlayerSettings implements PlayerSettings {
final double preferredDefaultSpeed,
final List<double> speedOptions,
final SleepTimerSettings sleepTimerSettings,
final Duration minimumPositionForReporting,
final Duration playbackReportInterval,
final Duration markCompleteWhenTimeLeft,
final bool configurePlayerForEveryBook}) = _$PlayerSettingsImpl;
factory _PlayerSettings.fromJson(Map<String, dynamic> json) =
@ -862,8 +908,12 @@ abstract class _PlayerSettings implements PlayerSettings {
@override
SleepTimerSettings get sleepTimerSettings;
@override
Duration get minimumPositionForReporting;
@override
Duration get playbackReportInterval;
@override
Duration get markCompleteWhenTimeLeft;
@override
bool get configurePlayerForEveryBook;
/// Create a copy of PlayerSettings