File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ import * as Exify from "@lodev09/react-native-exify";
33import type Realm from "realm" ;
44import Observation from "realmModels/Observation" ;
55import type { RealmObservation } from "realmModels/types" ;
6+ import { log } from "sharedHelpers/logger" ;
7+
8+ const logger = log . extend ( "saveObservation.ts" ) ;
69
710const writeExifToCameraRollPhotos = async (
811 observation : RealmObservation ,
@@ -28,9 +31,12 @@ const writeExifToCameraRollPhotos = async (
2831 } ;
2932
3033 // Update all photos taken via the app with the new fetched location.
31- cameraRollUris . forEach ( uri => {
32- Exify . write ( uri , exifToWrite ) ;
33- } ) ;
34+ const results = await Promise . allSettled (
35+ cameraRollUris . map ( uri => Exify . write ( uri , exifToWrite ) ) ,
36+ ) ;
37+ results
38+ . filter ( ( r ) : r is PromiseRejectedResult => r . status === "rejected" )
39+ . forEach ( r => logger . error ( "Failed to write EXIF to camera roll photo:" , r . reason ) ) ;
3440} ;
3541
3642const saveObservation = async (
You can’t perform that action at this time.
0 commit comments