Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Index shared files

Neeraj Gupta8ab6109a77ed
diff --git a/mobile/lib/models/file/extensions/file_props.dart b/mobile/lib/models/file/extensions/file_props.dart
index 9be9bd4c11..7b5c0c32ad 100644
--- a/mobile/lib/models/file/extensions/file_props.dart
+++ b/mobile/lib/models/file/extensions/file_props.dart
@@ -49,6 +49,8 @@ extension FilePropsExtn on EnteFile {
String? get uploaderName => pubMagicMetadata?.uploaderName;
+ bool get skip => !isUploaded || fileType == FileType.other;
+
bool canReUpload(int userID) =>
localID != null &&
localID!.isNotEmpty &&
diff --git a/mobile/lib/utils/ml_util.dart b/mobile/lib/utils/ml_util.dart
index 89848ecf1c..b5ab50c43a 100644
--- a/mobile/lib/utils/ml_util.dart
+++ b/mobile/lib/utils/ml_util.dart
@@ -100,7 +100,7 @@ Future<List<FileMLInstruction>> getFilesForMlIndexing() async {
final List<FileMLInstruction> filesWithoutLocalID = [];
final List<FileMLInstruction> hiddenFilesToIndex = [];
for (final EnteFile enteFile in enteFiles) {
- if (_skipAnalysisEnteFile(enteFile, allowFetch: false)) {
+ if (enteFile.skipIndex) {
continue;
}
if (queuedFiledIDs.contains(enteFile.uploadedFileID)) {
@@ -127,7 +127,7 @@ Future<List<FileMLInstruction>> getFilesForMlIndexing() async {
}
}
for (final EnteFile enteFile in hiddenFiles) {
- if (_skipAnalysisEnteFile(enteFile)) {
+ if (enteFile.skipIndex) {
continue;
}
if (queuedFiledIDs.contains(enteFile.uploadedFileID)) {
@@ -359,18 +359,6 @@ Future<String> getImagePathForML(EnteFile enteFile) async {
return imagePath;
}
-bool _skipAnalysisEnteFile(EnteFile enteFile, {bool allowFetch = false}) {
- // Skip if the file is not uploaded or not owned by the user
- if (!enteFile.isUploaded || (enteFile.isOwner == false && !allowFetch)) {
- return true;
- }
- // I don't know how motionPhotos and livePhotos work, so I'm also just skipping them for now
- if (enteFile.fileType == FileType.other) {
- return true;
- }
- return false;
-}
-
bool _shouldRunIndexing(
EnteFile enteFile,
Map<int, int> indexedFileIds,