π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mobile][photos] Add local gallery ID diagnostics
laurenspriem2800b74e3055
diff --git a/mobile/apps/photos/lib/services/search_service.dart b/mobile/apps/photos/lib/services/search_service.dartindex 23acb77179..9d5a1312d8 100644--- a/mobile/apps/photos/lib/services/search_service.dart+++ b/mobile/apps/photos/lib/services/search_service.dart@@ -391,6 +391,41 @@ class SearchService {}}+ Future<List<GenericSearchResult>> getLocalFileIDsSearchResults(+ String query,+ Set<String> localFileIDs,+ ) async {+ if (!isLocalGalleryMode || localFileIDs.isEmpty) {+ return [];+ }++ try {+ final files = (await getAllFilesForSearch())+ .where((file) => localFileIDs.contains(file.localID))+ .toList();+ if (files.isEmpty) {+ return [];+ }++ return [+ GenericSearchResult(+ ResultType.file,+ query.trim(),+ files,+ hierarchicalSearchFilter: TopLevelGenericFilter(+ filterName: query.trim(),+ occurrence: kMostRelevantFilter,+ filterResultType: ResultType.file,+ matchedUploadedIDs: filesToUploadedFileIDs(files),+ ),+ ),+ ];+ } catch (e, s) {+ _logger.severe("Failed to search by local file IDs", e, s);+ return [];+ }+ }+Future<List<EnteFile>> getAllFilesForHierarchicalSearch() async {if (_cachedFilesFuture != null &&_cachedFilesForHierarchicalSearch != null) {diff --git a/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart b/mobile/apps/photos/lib/ui/viewer/search/search_widget.dartindex 2b74783236..b1b631acab 100644--- a/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart@@ -31,6 +31,7 @@ class SearchWidget extends StatefulWidget {}class SearchWidgetState extends State<SearchWidget> {+ static const _localFileIDsSearchPrefix = "local_ids:";static const _uploadedFileIDsSearchPrefix = "uploaded_ids:";static final ValueNotifier<Stream<List<SearchResult>>?>searchResultsStreamNotifier = ValueNotifier(null);@@ -220,6 +221,18 @@ class SearchWidgetState extends State<SearchWidget> {);}+ if (query.startsWith(_localFileIDsSearchPrefix)) {+ final localFileIDs = query+ .substring(_localFileIDsSearchPrefix.length)+ .split(",")+ .map((value) => value.trim())+ .where((id) => id.isNotEmpty)+ .toSet();+ return Stream.fromFuture(+ _searchService.getLocalFileIDsSearchResults(query, localFileIDs),+ );+ }+int resultCount = 0;final maxResultCount = isYearSearchQuery(query) ? 13 : 12;final streamController = StreamController<List<SearchResult>>();diff --git a/mobile/apps/photos/lib/utils/ml_util.dart b/mobile/apps/photos/lib/utils/ml_util.dartindex 0a79a30e5f..2ce7b6e7a5 100644--- a/mobile/apps/photos/lib/utils/ml_util.dart+++ b/mobile/apps/photos/lib/utils/ml_util.dart@@ -751,8 +751,11 @@ Future<String> getImagePathForML(EnteFile enteFile) async {);if (imagePath == null) {+ final fileIdentifier = isLocalGalleryMode+ ? "localID ${enteFile.localID}"+ : "uploadedFileID ${enteFile.uploadedFileID}";_logger.severe(- "Failed to get any data for enteFile with uploadedFileID ${enteFile.uploadedFileID} and format ${enteFile.displayName.split('.').last} and size ${enteFile.fileSize} since its file path is null (isVideo: $isVideo)",+ "Failed to get any data for enteFile with $fileIdentifier and format ${enteFile.displayName.split('.').last} and size ${enteFile.fileSize} since its file path is null (isVideo: $isVideo)",);throw CouldNotRetrieveAnyFileData();}