Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Skip memory key create for empty share list

Neeraj Gupta5cdbbf627c22
diff --git a/mobile/apps/photos/lib/services/memory_share_service.dart b/mobile/apps/photos/lib/services/memory_share_service.dart
index 55aba29541..0b907f1885 100644
--- a/mobile/apps/photos/lib/services/memory_share_service.dart
+++ b/mobile/apps/photos/lib/services/memory_share_service.dart
@@ -199,6 +199,16 @@ class MemoryShareService {
try {
final response = await _enteDio.get('/memory-share');
final List<dynamic> shares = response.data['memoryShares'] ?? [];
+ final localSharesByID = {
+ for (final share in await _db.getAll()) share.id: share,
+ };
+ if (shares.isEmpty) {
+ _memoryShareByHashCache.clear();
+ for (final localShare in localSharesByID.values) {
+ await _db.delete(localShare.id);
+ }
+ return [];
+ }
Uint8List? memoryEntityKey;
try {
memoryEntityKey = await entityService.getOrCreateEntityKey(
@@ -226,10 +236,6 @@ class MemoryShareService {
}
return share;
}).toList();
-
- final localSharesByID = {
- for (final share in await _db.getAll()) share.id: share,
- };
_memoryShareByHashCache.clear();
final activeRemoteShareIDs = <int>{};
final activeShares = <MemoryShare>[];