Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] use file-backed exif source

Neeraj Gupta69c779fe982e
diff --git a/mobile/apps/photos/lib/utils/exif_util.dart b/mobile/apps/photos/lib/utils/exif_util.dart
index 6ba4c7e36b..114e0f482f 100644
--- a/mobile/apps/photos/lib/utils/exif_util.dart
+++ b/mobile/apps/photos/lib/utils/exif_util.dart
@@ -12,6 +12,7 @@ import "package:photos/services/isolated_ffmpeg_service.dart";
import "package:photos/services/location_service.dart";
import "package:photos/src/rust/api/motion_photo_api.dart";
import 'package:photos/utils/file_util.dart';
+import 'package:random_access_source/random_access_source.dart';
const kDateTimeOriginal = "EXIF DateTimeOriginal";
const kImageDateTime = "Image DateTime";
@@ -175,9 +176,13 @@ Location? locationFromExif(Map<String, IfdTag> exif) {
Future<Map<String, IfdTag>> _readExifArgs(Map<String, dynamic> args) {
final file = args["file"] as File;
- return file
- .readAsBytes()
- .then((bytes) => readExifFromBytes(bytes).then(_normalizeExifResult));
+ return FileRASource.loadFile(file).then((src) async {
+ try {
+ return _normalizeExifResult(await readExifFromSource(src));
+ } finally {
+ await src.close();
+ }
+ });
}
Future<Map<String, IfdTag>> readExifAsync(File file) async {
diff --git a/mobile/apps/photos/pubspec.lock b/mobile/apps/photos/pubspec.lock
index ecfc20ec34..8016f8e5bf 100644
--- a/mobile/apps/photos/pubspec.lock
+++ b/mobile/apps/photos/pubspec.lock
@@ -2300,7 +2300,7 @@ packages:
source: hosted
version: "3.2.2"
random_access_source:
- dependency: transitive
+ dependency: "direct main"
description:
name: random_access_source
sha256: "2cb3578e3027d6f7e44a66ec9bf72f5e0b73e9c0e62f4768977a0ed962d08be7"
diff --git a/mobile/apps/photos/pubspec.yaml b/mobile/apps/photos/pubspec.yaml
index b405ff4252..c964f853c0 100644
--- a/mobile/apps/photos/pubspec.yaml
+++ b/mobile/apps/photos/pubspec.yaml
@@ -72,7 +72,7 @@ dependencies:
path: ../../packages/rust
equatable: ^2.0.5
event_bus: ^2.0.0
- exif_reader: ^4.1.0
+ exif_reader: 4.1.0
expandable: ^5.0.1
expansion_tile_card: ^3.0.0
extended_image: ^9.1.0
@@ -192,6 +192,7 @@ dependencies:
url: https://github.com/ente-io/privacy_screen.git
ref: v2-only
pro_image_editor: ^11.3.0
+ random_access_source: 4.2.1
receive_sharing_intent: # pub.dev is behind
git:
url: https://github.com/KasemJaffer/receive_sharing_intent.git