From b18d987ba259a5fe2ac43046f682b58ea2295fb5 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:26:31 +0530 Subject: [PATCH 1/4] [mob] Upgrade discover results more frequently --- mobile/lib/generated/intl/messages_cs.dart | 4 +++- mobile/lib/generated/intl/messages_de.dart | 20 ++++++++++++++++ mobile/lib/generated/intl/messages_it.dart | 23 ++++++++++++++++++- mobile/lib/generated/intl/messages_pt.dart | 21 +++++++++++++++++ mobile/lib/generated/intl/messages_sv.dart | 3 +++ mobile/lib/generated/intl/messages_zh.dart | 16 +++++++++++++ .../services/machine_learning/ml_service.dart | 7 ++++++ mobile/lib/services/magic_cache_service.dart | 4 ++++ 8 files changed, 96 insertions(+), 2 deletions(-) diff --git a/mobile/lib/generated/intl/messages_cs.dart b/mobile/lib/generated/intl/messages_cs.dart index 2bfb5800f1..7365a9e089 100644 --- a/mobile/lib/generated/intl/messages_cs.dart +++ b/mobile/lib/generated/intl/messages_cs.dart @@ -21,5 +21,7 @@ class MessageLookup extends MessageLookupByLibrary { String get localeName => 'cs'; final messages = _notInlinedMessages(_notInlinedMessages); - static Map _notInlinedMessages(_) => {}; + static Map _notInlinedMessages(_) => { + "incorrectRecoveryKeyBody": MessageLookupByLibrary.simpleMessage("") + }; } diff --git a/mobile/lib/generated/intl/messages_de.dart b/mobile/lib/generated/intl/messages_de.dart index 38b6f346ba..9b002598fd 100644 --- a/mobile/lib/generated/intl/messages_de.dart +++ b/mobile/lib/generated/intl/messages_de.dart @@ -661,6 +661,26 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage( "Zwei-Faktor-Authentifizierung (2FA) wird deaktiviert..."), "discord": MessageLookupByLibrary.simpleMessage("Discord"), + "discover": MessageLookupByLibrary.simpleMessage("Entdecken"), + "discover_babies": MessageLookupByLibrary.simpleMessage("Babys"), + "discover_celebrations": MessageLookupByLibrary.simpleMessage("Feiern"), + "discover_food": MessageLookupByLibrary.simpleMessage("Essen"), + "discover_greenery": MessageLookupByLibrary.simpleMessage("Grün"), + "discover_hills": MessageLookupByLibrary.simpleMessage("Berge"), + "discover_identity": MessageLookupByLibrary.simpleMessage("Identität"), + "discover_memes": MessageLookupByLibrary.simpleMessage("Memes"), + "discover_notes": MessageLookupByLibrary.simpleMessage("Notizen"), + "discover_pets": MessageLookupByLibrary.simpleMessage("Haustiere"), + "discover_receipts": MessageLookupByLibrary.simpleMessage("Belege"), + "discover_screenshots": + MessageLookupByLibrary.simpleMessage("Bildschirmfotos"), + "discover_selfies": MessageLookupByLibrary.simpleMessage("Selfies"), + "discover_sunset": + MessageLookupByLibrary.simpleMessage("Sonnenuntergang"), + "discover_visiting_cards": + MessageLookupByLibrary.simpleMessage("Visitenkarten"), + "discover_wallpapers": + MessageLookupByLibrary.simpleMessage("Hintergründe"), "dismiss": MessageLookupByLibrary.simpleMessage("Verwerfen"), "distanceInKMUnit": MessageLookupByLibrary.simpleMessage("km"), "doNotSignOut": diff --git a/mobile/lib/generated/intl/messages_it.dart b/mobile/lib/generated/intl/messages_it.dart index cd8b3a199d..2d334b0fdb 100644 --- a/mobile/lib/generated/intl/messages_it.dart +++ b/mobile/lib/generated/intl/messages_it.dart @@ -126,7 +126,7 @@ class MessageLookup extends MessageLookupByLibrary { static String m38(albumName) => "Spostato con successo su ${albumName}"; - static String m39(name) => "Non sei ${name}?"; + static String m39(name) => "Non è ${name}?"; static String m40(familyAdminEmail) => "Per favore contatta ${familyAdminEmail} per cambiare il tuo codice."; @@ -659,6 +659,27 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage( "Disattivazione autenticazione a due fattori..."), "discord": MessageLookupByLibrary.simpleMessage("Discord"), + "discover": MessageLookupByLibrary.simpleMessage("Scopri"), + "discover_babies": MessageLookupByLibrary.simpleMessage("Neonati"), + "discover_celebrations": + MessageLookupByLibrary.simpleMessage("Festeggiamenti"), + "discover_food": MessageLookupByLibrary.simpleMessage("Cibo"), + "discover_greenery": + MessageLookupByLibrary.simpleMessage("Vegetazione"), + "discover_hills": MessageLookupByLibrary.simpleMessage("Colline"), + "discover_identity": MessageLookupByLibrary.simpleMessage("Identità"), + "discover_memes": MessageLookupByLibrary.simpleMessage("Meme"), + "discover_notes": MessageLookupByLibrary.simpleMessage("Note"), + "discover_pets": + MessageLookupByLibrary.simpleMessage("Animali domestici"), + "discover_receipts": MessageLookupByLibrary.simpleMessage("Ricette"), + "discover_screenshots": + MessageLookupByLibrary.simpleMessage("Schermate"), + "discover_selfies": MessageLookupByLibrary.simpleMessage("Selfie"), + "discover_sunset": MessageLookupByLibrary.simpleMessage("Tramonto"), + "discover_visiting_cards": + MessageLookupByLibrary.simpleMessage("Biglietti da Visita"), + "discover_wallpapers": MessageLookupByLibrary.simpleMessage("Sfondi"), "dismiss": MessageLookupByLibrary.simpleMessage("Ignora"), "distanceInKMUnit": MessageLookupByLibrary.simpleMessage("km"), "doNotSignOut": MessageLookupByLibrary.simpleMessage("Non uscire"), diff --git a/mobile/lib/generated/intl/messages_pt.dart b/mobile/lib/generated/intl/messages_pt.dart index a95d9fc2cb..421201d489 100644 --- a/mobile/lib/generated/intl/messages_pt.dart +++ b/mobile/lib/generated/intl/messages_pt.dart @@ -655,6 +655,27 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage( "Desativando a autenticação de dois fatores..."), "discord": MessageLookupByLibrary.simpleMessage("Discord"), + "discover": MessageLookupByLibrary.simpleMessage("Explorar"), + "discover_babies": MessageLookupByLibrary.simpleMessage("Bebés"), + "discover_celebrations": + MessageLookupByLibrary.simpleMessage("Celebrações"), + "discover_food": MessageLookupByLibrary.simpleMessage("Comida"), + "discover_greenery": MessageLookupByLibrary.simpleMessage("Vegetação"), + "discover_hills": MessageLookupByLibrary.simpleMessage("Montanhas"), + "discover_identity": MessageLookupByLibrary.simpleMessage("Identidade"), + "discover_memes": MessageLookupByLibrary.simpleMessage("Memes"), + "discover_notes": MessageLookupByLibrary.simpleMessage("Notas"), + "discover_pets": + MessageLookupByLibrary.simpleMessage("Animais de Estimação"), + "discover_receipts": MessageLookupByLibrary.simpleMessage("Recibos"), + "discover_screenshots": + MessageLookupByLibrary.simpleMessage("Capturas de Tela"), + "discover_selfies": MessageLookupByLibrary.simpleMessage("Selfies"), + "discover_sunset": MessageLookupByLibrary.simpleMessage("Pôr do Sol"), + "discover_visiting_cards": + MessageLookupByLibrary.simpleMessage("Cartões de Visita"), + "discover_wallpapers": + MessageLookupByLibrary.simpleMessage("Papéis de Parede"), "dismiss": MessageLookupByLibrary.simpleMessage("Descartar"), "distanceInKMUnit": MessageLookupByLibrary.simpleMessage("km"), "doNotSignOut": diff --git a/mobile/lib/generated/intl/messages_sv.dart b/mobile/lib/generated/intl/messages_sv.dart index bc2bc3a97b..7589244ebb 100644 --- a/mobile/lib/generated/intl/messages_sv.dart +++ b/mobile/lib/generated/intl/messages_sv.dart @@ -378,6 +378,7 @@ class MessageLookup extends MessageLookupByLibrary { "oops": MessageLookupByLibrary.simpleMessage("Hoppsan"), "orPickAnExistingOne": MessageLookupByLibrary.simpleMessage("Eller välj en befintlig"), + "passkey": MessageLookupByLibrary.simpleMessage("Nyckel"), "password": MessageLookupByLibrary.simpleMessage("Lösenord"), "passwordChangedSuccessfully": MessageLookupByLibrary.simpleMessage("Lösenordet har ändrats"), @@ -558,6 +559,8 @@ class MessageLookup extends MessageLookupByLibrary { "verifyEmail": MessageLookupByLibrary.simpleMessage("Bekräfta e-postadress"), "verifyEmailID": m70, + "verifyPasskey": + MessageLookupByLibrary.simpleMessage("Verifiera nyckel"), "verifyPassword": MessageLookupByLibrary.simpleMessage("Bekräfta lösenord"), "verifyingRecoveryKey": MessageLookupByLibrary.simpleMessage( diff --git a/mobile/lib/generated/intl/messages_zh.dart b/mobile/lib/generated/intl/messages_zh.dart index 03c7704c4b..0343a44f1e 100644 --- a/mobile/lib/generated/intl/messages_zh.dart +++ b/mobile/lib/generated/intl/messages_zh.dart @@ -548,6 +548,22 @@ class MessageLookup extends MessageLookupByLibrary { "disablingTwofactorAuthentication": MessageLookupByLibrary.simpleMessage("正在禁用双重认证..."), "discord": MessageLookupByLibrary.simpleMessage("Discord"), + "discover": MessageLookupByLibrary.simpleMessage("发现"), + "discover_babies": MessageLookupByLibrary.simpleMessage("婴儿"), + "discover_celebrations": MessageLookupByLibrary.simpleMessage("节日"), + "discover_food": MessageLookupByLibrary.simpleMessage("食物"), + "discover_greenery": MessageLookupByLibrary.simpleMessage("绿植"), + "discover_hills": MessageLookupByLibrary.simpleMessage("山"), + "discover_identity": MessageLookupByLibrary.simpleMessage("身份"), + "discover_memes": MessageLookupByLibrary.simpleMessage("表情包"), + "discover_notes": MessageLookupByLibrary.simpleMessage("备注"), + "discover_pets": MessageLookupByLibrary.simpleMessage("宠物"), + "discover_receipts": MessageLookupByLibrary.simpleMessage("收据"), + "discover_screenshots": MessageLookupByLibrary.simpleMessage("屏幕截图"), + "discover_selfies": MessageLookupByLibrary.simpleMessage("自拍"), + "discover_sunset": MessageLookupByLibrary.simpleMessage("日落"), + "discover_visiting_cards": MessageLookupByLibrary.simpleMessage("访问卡"), + "discover_wallpapers": MessageLookupByLibrary.simpleMessage("壁纸"), "dismiss": MessageLookupByLibrary.simpleMessage("忽略"), "distanceInKMUnit": MessageLookupByLibrary.simpleMessage("公里"), "doNotSignOut": MessageLookupByLibrary.simpleMessage("不要登出"), diff --git a/mobile/lib/services/machine_learning/ml_service.dart b/mobile/lib/services/machine_learning/ml_service.dart index 650bfa7184..b384c7286e 100644 --- a/mobile/lib/services/machine_learning/ml_service.dart +++ b/mobile/lib/services/machine_learning/ml_service.dart @@ -131,6 +131,10 @@ class MLService { ); await clusterAllImages(); } + if (_mlControllerStatus == true) { + // refresh discover section + MagicCacheService.instance.updateCache().ignore(); + } await indexAllImages(); if ((await MLDataDB.instance.getUnclusteredFaceCount()) > 0) { await clusterAllImages(); @@ -208,6 +212,9 @@ class MLService { ); fileAnalyzedCount += sumFutures; } + if (fileAnalyzedCount > 0) { + MagicCacheService.instance.queueUpdate('fileIndexed'); + } _logger.info( "`indexAllImages()` finished. Analyzed $fileAnalyzedCount images, in ${stopwatch.elapsed.inSeconds} seconds (avg of ${stopwatch.elapsed.inSeconds / fileAnalyzedCount} seconds per image)", ); diff --git a/mobile/lib/services/magic_cache_service.dart b/mobile/lib/services/magic_cache_service.dart index e8828177b6..6758562c80 100644 --- a/mobile/lib/services/magic_cache_service.dart +++ b/mobile/lib/services/magic_cache_service.dart @@ -191,6 +191,10 @@ class MagicCacheService { bool get enableDiscover => localSettings.isMLIndexingEnabled; + void queueUpdate(String reason) { + _pendingUpdateReason.add(reason); + } + Future _updateCacheIfTheTimeHasCome() async { if (!enableDiscover) { return; From 46e6af660ec93c0116cf6da5842466feda06ee30 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:29:02 +0530 Subject: [PATCH 2/4] [mob] Log to match count for magicSearch --- mobile/lib/services/magic_cache_service.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mobile/lib/services/magic_cache_service.dart b/mobile/lib/services/magic_cache_service.dart index 6758562c80..ba96daeba5 100644 --- a/mobile/lib/services/magic_cache_service.dart +++ b/mobile/lib/services/magic_cache_service.dart @@ -230,7 +230,6 @@ class MagicCacheService { return; } _logger.info("updating magic cache ${_pendingUpdateReason.toList()}"); - _pendingUpdateReason.clear(); _isUpdateInProgress = true; final EnteWatch? w = kDebugMode ? EnteWatch("magicCacheWatch") : null; w?.start(); @@ -249,6 +248,7 @@ class MagicCacheService { w?.log("cacheWritten"); await _resetLastMagicCacheUpdateTime(); w?.logAndReset('done'); + _pendingUpdateReason.clear(); Bus.instance.fire(MagicCacheUpdatedEvent()); } catch (e, s) { _logger.info("Error updating magic cache", e, s); @@ -380,6 +380,7 @@ class MagicCacheService { List magicPromptsData, ) async { final results = []; + final List matchCount = []; for (Prompt prompt in magicPromptsData) { final fileUploadedIDs = await SemanticSearchService.instance.getMatchingFileIDs( @@ -391,7 +392,9 @@ class MagicCacheService { MagicCache(prompt.title, fileUploadedIDs), ); } + matchCount.add(fileUploadedIDs.length); } + _logger.info('magic result count $matchCount'); return results; } } From 6464bf172f580d02b232e2b009fb0071d0a2220b Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:30:20 +0530 Subject: [PATCH 3/4] refactor --- mobile/lib/services/magic_cache_service.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mobile/lib/services/magic_cache_service.dart b/mobile/lib/services/magic_cache_service.dart index ba96daeba5..3178e8c4ca 100644 --- a/mobile/lib/services/magic_cache_service.dart +++ b/mobile/lib/services/magic_cache_service.dart @@ -174,7 +174,7 @@ class MagicCacheService { _updateCacheIfTheTimeHasCome(); }); Bus.instance.on().listen((event) { - _pendingUpdateReason.add("File uploaded"); + queueUpdate("File uploaded"); }); } @@ -202,12 +202,12 @@ class MagicCacheService { final updatedJSONFile = await RemoteAssetsService.instance .getAssetIfUpdated(_kMagicPromptsDataUrl); if (updatedJSONFile != null) { - _pendingUpdateReason.add("Prompts data updated"); + queueUpdate("Prompts data updated"); } else if (lastMagicCacheUpdateTime < DateTime.now() .subtract(const Duration(days: 1)) .millisecondsSinceEpoch) { - _pendingUpdateReason.add("Cache is old"); + queueUpdate("Cache is old"); } } From c036c8c7ba8cdb5f8486015dada18cfe768f2c07 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Mon, 23 Sep 2024 14:34:35 +0530 Subject: [PATCH 4/4] [mob] Bump version --- mobile/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml index 0ce6b60a3f..0fe7784ac8 100644 --- a/mobile/pubspec.yaml +++ b/mobile/pubspec.yaml @@ -12,7 +12,7 @@ description: ente photos application # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.9.43+943 +version: 0.9.44+944 publish_to: none environment: