mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-01-15 06:39:32 +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
|
|
@ -29,7 +29,7 @@ class ShakeDetector {
|
|||
DateTime _lastShakeTime = DateTime.now();
|
||||
|
||||
final StreamController<UserAccelerometerEvent>
|
||||
_detectedShakeStreamController = StreamController.broadcast();
|
||||
_detectedShakeStreamController = StreamController.broadcast();
|
||||
|
||||
void start() {
|
||||
if (_accelerometerSubscription != null) {
|
||||
|
|
@ -37,26 +37,27 @@ class ShakeDetector {
|
|||
return;
|
||||
}
|
||||
_accelerometerSubscription =
|
||||
userAccelerometerEventStream(samplingPeriod: _settings.samplingPeriod)
|
||||
.listen((event) {
|
||||
_logger.finest('RMS: ${event.rms}');
|
||||
if (event.rms > _settings.threshold) {
|
||||
_currentShakeCount++;
|
||||
userAccelerometerEventStream(
|
||||
samplingPeriod: _settings.samplingPeriod,
|
||||
).listen((event) {
|
||||
_logger.finest('RMS: ${event.rms}');
|
||||
if (event.rms > _settings.threshold) {
|
||||
_currentShakeCount++;
|
||||
|
||||
if (_currentShakeCount >= _settings.shakeTriggerCount &&
|
||||
!isCoolDownNeeded()) {
|
||||
_logger.fine('Shake detected $_currentShakeCount times');
|
||||
if (_currentShakeCount >= _settings.shakeTriggerCount &&
|
||||
!isCoolDownNeeded()) {
|
||||
_logger.fine('Shake detected $_currentShakeCount times');
|
||||
|
||||
onShakeDetected?.call();
|
||||
_detectedShakeStreamController.add(event);
|
||||
onShakeDetected?.call();
|
||||
_detectedShakeStreamController.add(event);
|
||||
|
||||
_lastShakeTime = DateTime.now();
|
||||
_currentShakeCount = 0;
|
||||
}
|
||||
} else {
|
||||
_currentShakeCount = 0;
|
||||
}
|
||||
});
|
||||
_lastShakeTime = DateTime.now();
|
||||
_currentShakeCount = 0;
|
||||
}
|
||||
} else {
|
||||
_currentShakeCount = 0;
|
||||
}
|
||||
});
|
||||
|
||||
_logger.fine('ShakeDetector started');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue