Fix Shake Detector not working when app in background (#40)

* feat: update shake detection settings to reduce cooldown and feedback options

* fix: shake detector not detecting in background

* enhance shake action handling to avoid unnecessary feedback

* disable shake detector when player not playing anything

* refactor: remove outdated TODO regarding shake detection optimization

* refactor: comment out notifyListeners call in restartTimer method for clarity
This commit is contained in:
Dr.Blank 2024-09-30 02:34:13 -04:00 committed by GitHub
parent 6c0265fe5f
commit 67d6c9240b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 93 additions and 47 deletions

View file

@ -294,10 +294,10 @@ _$ShakeDetectionSettingsImpl _$$ShakeDetectionSettingsImplFromJson(
feedback: (json['feedback'] as List<dynamic>?)
?.map((e) => $enumDecode(_$ShakeDetectedFeedbackEnumMap, e))
.toSet() ??
const {ShakeDetectedFeedback.vibrate, ShakeDetectedFeedback.beep},
const {ShakeDetectedFeedback.vibrate},
beepVolume: (json['beepVolume'] as num?)?.toDouble() ?? 0.5,
shakeTriggerCoolDown: json['shakeTriggerCoolDown'] == null
? const Duration(seconds: 5)
? const Duration(seconds: 2)
: Duration(
microseconds: (json['shakeTriggerCoolDown'] as num).toInt()),
shakeTriggerCount: (json['shakeTriggerCount'] as num?)?.toInt() ?? 2,