m3_lightmeter/lib/interactors/timer_interactor.dart

25 lines
772 B
Dart
Raw Normal View History

2024-05-03 10:43:45 +00:00
import 'package:lightmeter/data/haptics_service.dart';
import 'package:lightmeter/data/shared_prefs_service.dart';
class TimerInteractor {
final UserPreferencesService _userPreferencesService;
final HapticsService _hapticsService;
TimerInteractor(
this._userPreferencesService,
this._hapticsService,
);
/// Executes vibration if haptics are enabled in settings
2024-05-06 12:14:50 +00:00
Future<void> startVibration() async {
2024-05-03 10:43:45 +00:00
if (_userPreferencesService.haptics) await _hapticsService.quickVibration();
}
/// Executes vibration if haptics are enabled in settings
2024-05-06 12:14:50 +00:00
Future<void> endVibration() async {
if (_userPreferencesService.haptics) await _hapticsService.errorVibration();
2024-05-03 10:43:45 +00:00
}
2024-05-04 17:58:19 +00:00
bool get isAutostartTimerEnabled => _userPreferencesService.autostartTimer;
2024-05-03 10:43:45 +00:00
}