π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Refine EXIF copying and iOS xcconfig
Priyanshu Dangared18d3fdccce0
diff --git a/.gitignore b/.gitignoreindex 7cb7b88498..ce95043c2c 100644--- a/.gitignore+++ b/.gitignore@@ -10,3 +10,6 @@ CLAUDE.local.md# Nodenode_modules/++# FVM Version Cache+.fvm/\ No newline at end of filediff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dartindex 072fa68c04..a179e5d47f 100644--- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart+++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart@@ -85,7 +85,11 @@ class _ImageEditorPageState extends State<ImageEditorPage> {try {final image = img.decodePng(bytes);if (image != null) {- await copyEXIF(widget.originalFile, image);+ await copyEXIF(+ widget.originalFile,+ image,+ copyRenderingFields: false,+ );result = img.encodeJpg(image, quality: 95);}} catch (e, s) {diff --git a/mobile/apps/photos/lib/utils/image_util.dart b/mobile/apps/photos/lib/utils/image_util.dartindex 231f6ace7b..09f84e4f52 100644--- a/mobile/apps/photos/lib/utils/image_util.dart+++ b/mobile/apps/photos/lib/utils/image_util.dart@@ -55,21 +55,76 @@ Future<ui.Image> convertImageToFlutterUi(img.Image image) async {}const _copiedExifFields = [- (ifd: "Image", source: "Make", dest: "Make"),- (ifd: "Image", source: "Model", dest: "Model"),- (ifd: "Image", source: "Orientation", dest: "Orientation"),- (ifd: "Image", source: "Artist", dest: "Artist"),- (ifd: "Image", source: "Copyright", dest: "Copyright"),- (ifd: "EXIF", source: "DateTimeOriginal", dest: "DateTimeOriginal"),- (ifd: "EXIF", source: "DateTimeDigitized", dest: "DateTimeDigitized"),- (ifd: "EXIF", source: "OffsetTimeOriginal", dest: "OffsetTimeOriginal"),- (ifd: "EXIF", source: "LensModel", dest: "LensModel"),- (ifd: "EXIF", source: "ExposureTime", dest: "ExposureTime"),- (ifd: "EXIF", source: "FNumber", dest: "FNumber"),- (ifd: "EXIF", source: "ISOSpeedRatings", dest: "ISOSpeed"), //ishowspeed- (ifd: "EXIF", source: "FocalLength", dest: "FocalLength"),- (ifd: "EXIF", source: "FocalLengthIn35mmFilm", dest: "FocalLengthIn35mmFilm"),- (ifd: "EXIF", source: "ColorSpace", dest: "ColorSpace"),+ (ifd: "Image", source: "Make", dest: "Make", affectsRendering: false),+ (ifd: "Image", source: "Model", dest: "Model", affectsRendering: false),+ (+ ifd: "Image",+ source: "Orientation",+ dest: "Orientation",+ affectsRendering: true,+ ),+ (ifd: "Image", source: "Artist", dest: "Artist", affectsRendering: false),+ (+ ifd: "Image",+ source: "Copyright",+ dest: "Copyright",+ affectsRendering: false,+ ),+ (+ ifd: "EXIF",+ source: "DateTimeOriginal",+ dest: "DateTimeOriginal",+ affectsRendering: false,+ ),+ (+ ifd: "EXIF",+ source: "DateTimeDigitized",+ dest: "DateTimeDigitized",+ affectsRendering: false,+ ),+ (+ ifd: "EXIF",+ source: "OffsetTimeOriginal",+ dest: "OffsetTimeOriginal",+ affectsRendering: false,+ ),+ (+ ifd: "EXIF",+ source: "LensModel",+ dest: "LensModel",+ affectsRendering: false,+ ),+ (+ ifd: "EXIF",+ source: "ExposureTime",+ dest: "ExposureTime",+ affectsRendering: false,+ ),+ (ifd: "EXIF", source: "FNumber", dest: "FNumber", affectsRendering: false),+ (+ ifd: "EXIF",+ source: "ISOSpeedRatings",+ dest: "ISOSpeed",+ affectsRendering: false,+ ), //ishowspeed+ (+ ifd: "EXIF",+ source: "FocalLength",+ dest: "FocalLength",+ affectsRendering: false,+ ),+ (+ ifd: "EXIF",+ source: "FocalLengthIn35mmFilm",+ dest: "FocalLengthIn35mmFilm",+ affectsRendering: false,+ ),+ (+ ifd: "EXIF",+ source: "ColorSpace",+ dest: "ColorSpace",+ affectsRendering: false,+ ),];img.IfdValue? convertExifReaderValueToImageValue(exif.IfdTag? tag) {@@ -112,9 +167,17 @@ img.IfdValue? convertExifReaderValueToImageValue(exif.IfdTag? tag) {};}-Future<void> copyEXIF(EnteFile src, img.Image dest) async {+// TODO: Move EXIF writes off the Dart image library to a Rust implementation.+Future<void> copyEXIF(+ EnteFile src,+ img.Image dest, {+ bool copyRenderingFields = true,+}) async {final srcExif = await getExif(src);for (final field in _copiedExifFields) {+ if (!copyRenderingFields && field.affectsRendering) {+ continue;+ }final destIfd = field.ifd == "Image"? dest.exif.imageIfd: dest.exif.exifIfd;diff --git a/mobile/packages/ente_components/example/ios/Flutter/Debug.xcconfig b/mobile/packages/ente_components/example/ios/Flutter/Debug.xcconfigindex 592ceee85b..ec97fc6f30 100644--- a/mobile/packages/ente_components/example/ios/Flutter/Debug.xcconfig+++ b/mobile/packages/ente_components/example/ios/Flutter/Debug.xcconfig@@ -1 +1,2 @@+#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"#include "Generated.xcconfig"diff --git a/mobile/packages/ente_components/example/ios/Flutter/Release.xcconfig b/mobile/packages/ente_components/example/ios/Flutter/Release.xcconfigindex 592ceee85b..c4855bfe20 100644--- a/mobile/packages/ente_components/example/ios/Flutter/Release.xcconfig+++ b/mobile/packages/ente_components/example/ios/Flutter/Release.xcconfig@@ -1 +1,2 @@+#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"#include "Generated.xcconfig"diff --git a/mobile/packages/ente_components/example/ios/Podfile b/mobile/packages/ente_components/example/ios/Podfilenew file mode 100644index 0000000000..620e46eba6--- /dev/null+++ b/mobile/packages/ente_components/example/ios/Podfile@@ -0,0 +1,43 @@+# Uncomment this line to define a global platform for your project+# platform :ios, '13.0'++# CocoaPods analytics sends network stats synchronously affecting flutter build latency.+ENV['COCOAPODS_DISABLE_STATS'] = 'true'++project 'Runner', {+ 'Debug' => :debug,+ 'Profile' => :release,+ 'Release' => :release,+}++def flutter_root+ generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)+ unless File.exist?(generated_xcode_build_settings_path)+ raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"+ end++ File.foreach(generated_xcode_build_settings_path) do |line|+ matches = line.match(/FLUTTER_ROOT\=(.*)/)+ return matches[1].strip if matches+ end+ raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"+end++require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)++flutter_ios_podfile_setup++target 'Runner' do+ use_frameworks!++ flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))+ target 'RunnerTests' do+ inherit! :search_paths+ end+end++post_install do |installer|+ installer.pods_project.targets.each do |target|+ flutter_additional_ios_build_settings(target)+ end+end