Skip to content

armgit / ente

Public Imported from GitHub
0

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

Populate location for shared media uploads

ashilknd4c10b49e3a8
diff --git a/mobile/apps/photos/lib/utils/file_uploader_util.dart b/mobile/apps/photos/lib/utils/file_uploader_util.dart
index 7de82cfeb7..fda7ae2b8f 100644
--- a/mobile/apps/photos/lib/utils/file_uploader_util.dart
+++ b/mobile/apps/photos/lib/utils/file_uploader_util.dart
@@ -408,6 +408,12 @@ Future<MediaUploadData> _getMediaUploadDataFromAppCache(
if (exifData != null) {
cameraMake = _extractPrintableExifValue(exifData['Image Make']);
cameraModel = _extractPrintableExifValue(exifData['Image Model']);
+ if (!file.hasLocation) {
+ final exifLocation = locationFromExif(exifData);
+ if (Location.isValidLocation(exifLocation)) {
+ file.location = exifLocation;
+ }
+ }
}
} else if (thumbnailData != null) {
// the thumbnail null check is to ensure that we are able to generate thum
@@ -420,6 +426,13 @@ Future<MediaUploadData> _getMediaUploadDataFromAppCache(
);
dimensions = await getImageHeightAndWith(imagePath: thumbnailFilePath);
}
+
+ if (!file.hasLocation && file.isVideo && Platform.isAndroid) {
+ final FFProbeProps? props = await getVideoPropsAsync(sourceFile);
+ if (props?.location != null) {
+ file.location = props!.location;
+ }
+ }
return MediaUploadData(
sourceFile,
thumbnailData,