Skip to content

armgit / ente

Public Imported from GitHub
0

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

Simplify offline background ML gate

Prateek Sunal583e54a64b3e
diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dart
index ce921b7c33..1ba50ca3c7 100644
--- a/mobile/apps/photos/lib/main.dart
+++ b/mobile/apps/photos/lib/main.dart
@@ -240,7 +240,7 @@ Future<void> _runMinimally(String taskId, TimeLogger tlog) async {
_logger.info("[BG TASK] home widget sync");
await _homeWidgetSync(true);
- if (flagService.enableMLInBackgroundForCurrentMode &&
+ if ((isOfflineMode || flagService.enableMLInBackground) &&
hasGrantedMLConsent) {
await controller.init();
final canRunML = controller.requestCompute(ml: true);
diff --git a/mobile/apps/photos/lib/service_locator.dart b/mobile/apps/photos/lib/service_locator.dart
index 1745cf8787..eafb4e5d3c 100644
--- a/mobile/apps/photos/lib/service_locator.dart
+++ b/mobile/apps/photos/lib/service_locator.dart
@@ -75,7 +75,6 @@ FlagService get flagService {
_flagService ??= FlagService(
ServiceLocator.instance.prefs,
ServiceLocator.instance.enteDio,
- isOfflineMode: () => isOfflineMode,
);
return _flagService!;
}
diff --git a/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart b/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart
index 784a1b2362..562819f126 100644
--- a/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart
+++ b/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart
@@ -18,20 +18,13 @@ class FlagService {
final SharedPreferences _prefs;
final Dio _enteDio;
- final bool Function() _isOfflineMode;
- FlagService(
- this._prefs,
- this._enteDio, {
- bool Function()? isOfflineMode,
- }) : _isOfflineMode = isOfflineMode ?? _defaultIsOfflineMode {
+ FlagService(this._prefs, this._enteDio) {
Future.delayed(const Duration(seconds: 5), () {
_fetch();
});
}
- static bool _defaultIsOfflineMode() => false;
-
RemoteFlags? _flags;
RemoteFlags get flags {
@@ -109,9 +102,6 @@ class FlagService {
bool get enableMLInBackground => internalUser;
- bool get enableMLInBackgroundForCurrentMode =>
- _isOfflineMode() || enableMLInBackground;
-
bool get useRustForFaceThumbnails => internalUser;
bool get petEnabled => internalUser;