mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-01-16 15:19:33 +00:00
chore: run dart format
Some checks are pending
Flutter CI & Release / Test (push) Waiting to run
Flutter CI & Release / Build Android APKs (push) Blocked by required conditions
Flutter CI & Release / build_linux (push) Blocked by required conditions
Flutter CI & Release / Create GitHub Release (push) Blocked by required conditions
Some checks are pending
Flutter CI & Release / Test (push) Waiting to run
Flutter CI & Release / Build Android APKs (push) Blocked by required conditions
Flutter CI & Release / build_linux (push) Blocked by required conditions
Flutter CI & Release / Create GitHub Release (push) Blocked by required conditions
This commit is contained in:
parent
a520136e01
commit
e23c0b6c5f
84 changed files with 1565 additions and 1945 deletions
|
|
@ -59,34 +59,29 @@ class ShakeDetector extends _$ShakeDetector {
|
|||
final sleepTimer = ref.watch(sleepTimerProvider);
|
||||
if (!shakeDetectionSettings.shakeAction.isPlaybackManagementEnabled &&
|
||||
sleepTimer == null) {
|
||||
_logger
|
||||
.config('No playback management is enabled and sleep timer is off, '
|
||||
'so shake detection is disabled');
|
||||
_logger.config(
|
||||
'No playback management is enabled and sleep timer is off, '
|
||||
'so shake detection is disabled',
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
_logger.config('Creating shake detector');
|
||||
final detector = core.ShakeDetector(
|
||||
shakeDetectionSettings,
|
||||
() {
|
||||
final wasActionComplete = doShakeAction(
|
||||
shakeDetectionSettings.shakeAction,
|
||||
ref: ref,
|
||||
);
|
||||
if (wasActionComplete) {
|
||||
shakeDetectionSettings.feedback.forEach(postShakeFeedback);
|
||||
}
|
||||
},
|
||||
);
|
||||
final detector = core.ShakeDetector(shakeDetectionSettings, () {
|
||||
final wasActionComplete = doShakeAction(
|
||||
shakeDetectionSettings.shakeAction,
|
||||
ref: ref,
|
||||
);
|
||||
if (wasActionComplete) {
|
||||
shakeDetectionSettings.feedback.forEach(postShakeFeedback);
|
||||
}
|
||||
});
|
||||
ref.onDispose(detector.dispose);
|
||||
return detector;
|
||||
}
|
||||
|
||||
/// Perform the shake action and return whether the action was successful
|
||||
bool doShakeAction(
|
||||
ShakeAction shakeAction, {
|
||||
required Ref ref,
|
||||
}) {
|
||||
bool doShakeAction(ShakeAction shakeAction, {required Ref ref}) {
|
||||
final player = ref.read(simpleAudiobookPlayerProvider);
|
||||
if (player.book == null && shakeAction.isPlaybackManagementEnabled) {
|
||||
_logger.warning('No book is loaded');
|
||||
|
|
@ -166,8 +161,11 @@ extension on ShakeAction {
|
|||
}
|
||||
|
||||
bool get isPlaybackManagementEnabled {
|
||||
return {ShakeAction.playPause, ShakeAction.fastForward, ShakeAction.rewind}
|
||||
.contains(this);
|
||||
return {
|
||||
ShakeAction.playPause,
|
||||
ShakeAction.fastForward,
|
||||
ShakeAction.rewind,
|
||||
}.contains(this);
|
||||
}
|
||||
|
||||
bool get shouldActOnSleepTimer {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue