Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Rename variables for clarity

laurenspriem3800ba1dc9a0
diff --git a/mobile/lib/services/machine_learning/compute_controller.dart b/mobile/lib/services/machine_learning/compute_controller.dart
index 72f9dab1fd..984de59432 100644
--- a/mobile/lib/services/machine_learning/compute_controller.dart
+++ b/mobile/lib/services/machine_learning/compute_controller.dart
@@ -31,8 +31,8 @@ class ComputeController {
bool _isDeviceHealthy = true;
bool _isUserInteracting = true;
- bool _canRunML = false;
- bool mlInteractionOverride = false;
+ bool _canRunCompute = false;
+ bool interactionOverride = false;
late Timer _userInteractionTimer;
_ComputeRunState _currentRunState = _ComputeRunState.idle;
@@ -41,7 +41,7 @@ class ComputeController {
bool get isDeviceHealthy => _isDeviceHealthy;
ComputeController() {
- _logger.info('MachineLearningController constructor');
+ _logger.info('ComputeController constructor');
_startInteractionTimer(kDefaultInteractionTimeout);
if (Platform.isIOS) {
if (kDebugMode) {
@@ -106,7 +106,8 @@ class ComputeController {
_logger.info("Stream request granted");
_currentRunState = _ComputeRunState.generatingStream;
return true;
- } else if (_currentRunState == _ComputeRunState.generatingStream && !_waitingToRunML) {
+ } else if (_currentRunState == _ComputeRunState.generatingStream &&
+ !_waitingToRunML) {
return true;
}
_logger.info(
@@ -142,23 +143,23 @@ class ComputeController {
}
bool _canRunGivenUserInteraction() {
- return !_isUserInteracting || mlInteractionOverride;
+ return !_isUserInteracting || interactionOverride;
}
void forceOverrideML({required bool turnOn}) {
_logger.info("Forcing to turn on ML: $turnOn");
- mlInteractionOverride = turnOn;
+ interactionOverride = turnOn;
_fireControlEvent();
}
void _fireControlEvent() {
- final shouldRunML = _isDeviceHealthy && _canRunGivenUserInteraction();
- if (shouldRunML != _canRunML) {
- _canRunML = shouldRunML;
+ final shouldRunCompute = _isDeviceHealthy && _canRunGivenUserInteraction();
+ if (shouldRunCompute != _canRunCompute) {
+ _canRunCompute = shouldRunCompute;
_logger.info(
- "Firing event: $shouldRunML (device health: $_isDeviceHealthy, user interaction: $_isUserInteracting, mlInteractionOverride: $mlInteractionOverride)",
+ "Firing event: $shouldRunCompute (device health: $_isDeviceHealthy, user interaction: $_isUserInteracting, mlInteractionOverride: $interactionOverride)",
);
- Bus.instance.fire(MachineLearningControlEvent(shouldRunML));
+ Bus.instance.fire(MachineLearningControlEvent(shouldRunCompute));
}
}