2023-01-21 10:37:49 +00:00
|
|
|
import 'package:lightmeter/data/haptics_service.dart';
|
|
|
|
import 'package:lightmeter/data/shared_prefs_service.dart';
|
|
|
|
|
2023-01-25 18:58:29 +00:00
|
|
|
class SettingsInteractor {
|
2023-01-21 10:37:49 +00:00
|
|
|
final UserPreferencesService _userPreferencesService;
|
|
|
|
final HapticsService _hapticsService;
|
|
|
|
|
2023-01-25 18:58:29 +00:00
|
|
|
const SettingsInteractor(
|
2023-01-21 10:37:49 +00:00
|
|
|
this._userPreferencesService,
|
|
|
|
this._hapticsService,
|
|
|
|
);
|
|
|
|
|
2023-01-25 18:58:29 +00:00
|
|
|
double get cameraEvCalibration => _userPreferencesService.cameraEvCalibration;
|
|
|
|
void setCameraEvCalibration(double value) => _userPreferencesService.cameraEvCalibration = value;
|
|
|
|
|
|
|
|
bool get isHapticsEnabled => _userPreferencesService.haptics;
|
2023-01-21 10:37:49 +00:00
|
|
|
|
|
|
|
/// Executes vibration if haptics are enabled in settings
|
|
|
|
void quickVibration() {
|
|
|
|
if (_userPreferencesService.haptics) _hapticsService.quickVibration();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Executes vibration if haptics are enabled in settings
|
|
|
|
void responseVibration() {
|
|
|
|
if (_userPreferencesService.haptics) _hapticsService.responseVibration();
|
|
|
|
}
|
|
|
|
|
|
|
|
void enableHaptics(bool enable) => _userPreferencesService.haptics = enable;
|
|
|
|
}
|