π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] migrate exif_reader to pub.dev
Neeraj Guptac38a5a38e95f
diff --git a/mobile/apps/photos/lib/utils/exif_util.dart b/mobile/apps/photos/lib/utils/exif_util.dartindex 416a990a06..6ba4c7e36b 100644--- a/mobile/apps/photos/lib/utils/exif_util.dart+++ b/mobile/apps/photos/lib/utils/exif_util.dart@@ -174,7 +174,10 @@ Location? locationFromExif(Map<String, IfdTag> exif) {}Future<Map<String, IfdTag>> _readExifArgs(Map<String, dynamic> args) {- return readExifFromFile(args["file"]);+ final file = args["file"] as File;+ return file+ .readAsBytes()+ .then((bytes) => readExifFromBytes(bytes).then(_normalizeExifResult));}Future<Map<String, IfdTag>> readExifAsync(File file) async {@@ -185,6 +188,17 @@ Future<Map<String, IfdTag>> readExifAsync(File file) async {);}+Map<String, IfdTag> _normalizeExifResult(dynamic result) {+ if (result is Map<String, IfdTag>) {+ return result;+ }+ final dynamic tags = result.tags;+ if (tags is Map<String, IfdTag>) {+ return tags;+ }+ throw ArgumentError("Unsupported EXIF result type: ${result.runtimeType}");+}+GPSData gpsDataFromExif(Map<String, IfdTag> exif) {final Map<String, dynamic> exifLocationData = {"lat": null,diff --git a/mobile/apps/photos/lib/utils/image_ml_util.dart b/mobile/apps/photos/lib/utils/image_ml_util.dartindex cfc0d07242..2e51dd2684 100644--- a/mobile/apps/photos/lib/utils/image_ml_util.dart+++ b/mobile/apps/photos/lib/utils/image_ml_util.dart@@ -64,7 +64,7 @@ Future<DecodedImage> decodeImageFromPath(if (skipExifRead) {_logger.info('Skipping EXIF read for JXL on iOS');} else {- exifData = await readExifFromBytes(imageData);+ exifData = _normalizeExifResult(await readExifFromBytes(imageData));}final int orientation =exifData['Image Orientation']?.values.firstAsInt() ?? 1;@@ -137,6 +137,17 @@ Future<DecodedImage> decodeImageFromPath();}+Map<String, IfdTag> _normalizeExifResult(dynamic result) {+ if (result is Map<String, IfdTag>) {+ return result;+ }+ final dynamic tags = result.tags;+ if (tags is Map<String, IfdTag>) {+ return tags;+ }+ throw ArgumentError("Unsupported EXIF result type: ${result.runtimeType}");+}+Future<Uint8List?> createSafeJpegDecodeFallbackBytes({required String imagePath,}) async {diff --git a/mobile/apps/photos/pubspec.lock b/mobile/apps/photos/pubspec.lockindex 286da242f9..ecfc20ec34 100644--- a/mobile/apps/photos/pubspec.lock+++ b/mobile/apps/photos/pubspec.lock@@ -669,12 +669,11 @@ packages:exif_reader:dependency: "direct main"description:- path: "."- ref: "476f701c084861a8e9de5f4f4e5e067fc85fda96"- resolved-ref: "476f701c084861a8e9de5f4f4e5e067fc85fda96"- url: "https://github.com/mgenware/exif_reader.git"- source: git- version: "3.16.1"+ name: exif_reader+ sha256: "8491a1733f31b5b0c49d05e3fd2690538f1906b52f156d9d1fe7fad9d76bcced"+ url: "https://pub.dev"+ source: hosted+ version: "4.1.0"expandable:dependency: "direct main"description:@@ -1445,10 +1444,10 @@ packages:dependency: transitivedescription:name: iso_base_media- sha256: "0a94fa4ff4ce7e6894d7afc96c1eee6911c12827f8cf184ca752ce3437a818a1"+ sha256: "0bd81707d2608b63d30e99b4ad89ad189a438c03842a480fb593641939bc534a"url: "https://pub.dev"source: hosted- version: "4.6.1"+ version: "6.3.0"jni:dependency: transitivedescription:@@ -1457,6 +1456,14 @@ packages:url: "https://pub.dev"source: hostedversion: "0.12.2"+ jpeg_markers:+ dependency: transitive+ description:+ name: jpeg_markers+ sha256: "9417cd62862e5e9f38087bb13193623c1be70c477d93c329540f105643716059"+ url: "https://pub.dev"+ source: hosted+ version: "2.7.0"js:dependency: "direct overridden"description:@@ -2296,10 +2303,10 @@ packages:dependency: transitivedescription:name: random_access_source- sha256: "26d1509a9fd935ab9c77102ab4c94b343d36216387d985975c380efe450b81b8"+ sha256: "2cb3578e3027d6f7e44a66ec9bf72f5e0b73e9c0e62f4768977a0ed962d08be7"url: "https://pub.dev"source: hosted- version: "3.0.0"+ version: "4.2.1"receive_sharing_intent:dependency: "direct main"description:diff --git a/mobile/apps/photos/pubspec.yaml b/mobile/apps/photos/pubspec.yamlindex 7b57abdd70..b405ff4252 100644--- a/mobile/apps/photos/pubspec.yaml+++ b/mobile/apps/photos/pubspec.yaml@@ -72,10 +72,7 @@ dependencies:path: ../../packages/rustequatable: ^2.0.5event_bus: ^2.0.0- exif_reader:- git:- url: https://github.com/mgenware/exif_reader.git- ref: 476f701c084861a8e9de5f4f4e5e067fc85fda96+ exif_reader: ^4.1.0expandable: ^5.0.1expansion_tile_card: ^3.0.0extended_image: ^9.1.0