Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Fill dateTime and offsetTime during upload

Neeraj Gupta5d0a15e9e531
diff --git a/mobile/lib/utils/file_uploader.dart b/mobile/lib/utils/file_uploader.dart
index 4ed4497191..1d21e51c72 100644
--- a/mobile/lib/utils/file_uploader.dart
+++ b/mobile/lib/utils/file_uploader.dart
@@ -779,22 +779,9 @@ class FileUploader {
CryptoUtil.bin2base64(encryptedFileKeyData.encryptedData!);
final keyDecryptionNonce =
CryptoUtil.bin2base64(encryptedFileKeyData.nonce!);
- final Map<String, dynamic> pubMetadata = {};
+ final Map<String, dynamic> pubMetadata =
+ _buildPublicMagicData(mediaUploadData, exifTime);
MetadataRequest? pubMetadataRequest;
- if ((mediaUploadData.height ?? 0) != 0 &&
- (mediaUploadData.width ?? 0) != 0) {
- pubMetadata[heightKey] = mediaUploadData.height;
- pubMetadata[widthKey] = mediaUploadData.width;
- pubMetadata[mediaTypeKey] =
- mediaUploadData.isPanorama == true ? 1 : 0;
- }
- if (mediaUploadData.motionPhotoStartIndex != null) {
- pubMetadata[motionVideoIndexKey] =
- mediaUploadData.motionPhotoStartIndex;
- }
- if (mediaUploadData.thumbnail == null) {
- pubMetadata[noThumbKey] = true;
- }
if (pubMetadata.isNotEmpty) {
pubMetadataRequest = await getPubMetadataRequest(
file,
@@ -878,6 +865,34 @@ class FileUploader {
}
}
+ Map<String, dynamic> _buildPublicMagicData(
+ MediaUploadData mediaUploadData,
+ ParsedExifDateTime? exifTime,
+ ) {
+ final Map<String, dynamic> pubMetadata = {};
+ if ((mediaUploadData.height ?? 0) != 0 &&
+ (mediaUploadData.width ?? 0) != 0) {
+ pubMetadata[heightKey] = mediaUploadData.height;
+ pubMetadata[widthKey] = mediaUploadData.width;
+ pubMetadata[mediaTypeKey] = mediaUploadData.isPanorama == true ? 1 : 0;
+ }
+ if (mediaUploadData.motionPhotoStartIndex != null) {
+ pubMetadata[motionVideoIndexKey] = mediaUploadData.motionPhotoStartIndex;
+ }
+ if (mediaUploadData.thumbnail == null) {
+ pubMetadata[noThumbKey] = true;
+ }
+ if (exifTime != null) {
+ if (exifTime.dateTime != null) {
+ pubMetadata[dateTimeKey] = exifTime.dateTime;
+ }
+ if (exifTime.offsetTime != null) {
+ pubMetadata[offsetTimeKey] = exifTime.offsetTime;
+ }
+ }
+ return pubMetadata;
+ }
+
bool isPutOrUpdateFileError(Object e) {
if (e is DioError) {
return e.requestOptions.path.contains("/files") ||