Skip to content

armgit / ente

Public Imported from GitHub
0

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

Adjust offline behavior for memories search

Neeraj Gupta2999cc63de1c
diff --git a/mobile/apps/photos/lib/services/memories_cache_service.dart b/mobile/apps/photos/lib/services/memories_cache_service.dart
index ac06ccb1c1..56f3893c02 100644
--- a/mobile/apps/photos/lib/services/memories_cache_service.dart
+++ b/mobile/apps/photos/lib/services/memories_cache_service.dart
@@ -217,6 +217,10 @@ class MemoriesCacheService {
Future<List<SmartMemory>> getMemories({bool onlyUseCache = false}) async {
_logger.info("getMemories called");
+ if (isOfflineMode && kDebugMode) {
+ _logger.info("skip cache in offline in debugMode");
+ onlyUseCache = false;
+ }
if (!showAnyMemories) {
_logger.info('Showing memories is disabled in settings, showing none');
return [];
@@ -372,6 +376,10 @@ class MemoriesCacheService {
}
Future<void> updateCache({bool forced = false}) async {
+ if (isOfflineMode && kDebugMode) {
+ _logger.warning('Force updating cache in offline debug mode');
+ forced = true;
+ }
if (!showAnyMemories) {
return;
}
diff --git a/mobile/apps/photos/lib/services/search_service.dart b/mobile/apps/photos/lib/services/search_service.dart
index 001d732176..a33b94cce0 100644
--- a/mobile/apps/photos/lib/services/search_service.dart
+++ b/mobile/apps/photos/lib/services/search_service.dart
@@ -224,6 +224,9 @@ class SearchService {
int? limit,
) async {
try {
+ if (isOfflineMode) {
+ return <AlbumSearchResult>[];
+ }
final List<Collection> collections =
_collectionService.getCollectionsForUI(
includedShared: true,
diff --git a/mobile/apps/photos/lib/services/smart_memories_service.dart b/mobile/apps/photos/lib/services/smart_memories_service.dart
index e1e5d60c5c..ed98132835 100644
--- a/mobile/apps/photos/lib/services/smart_memories_service.dart
+++ b/mobile/apps/photos/lib/services/smart_memories_service.dart
@@ -1886,6 +1886,9 @@ class SmartMemoriesService {
}
Future<Set<int>> getCollectionIDsToExclude() async {
+ if (isOfflineMode) {
+ return <int>{};
+ }
final collections = CollectionsService.instance.getCollectionsForUI();
// Names of collections to exclude