@@ -127,8 +127,8 @@ public final class T3NativeControlsModule: Module {
127127 } . runOnQueue ( . main )
128128
129129 // Photos names the asset itself, so iOS ignores the Android display name.
130- AsyncFunction ( " saveImageToLibrary " ) { ( url : URL , mimeType : String , _ : String , promise : Promise ) in
131- Self . saveImageToLibrary ( url : url , mimeType : mimeType , promise : promise )
130+ AsyncFunction ( " saveImageToLibrary " ) { ( url : URL , mimeType : String , name : String , promise : Promise ) in
131+ Self . saveImageToLibrary ( url : url , mimeType : mimeType , name : name , promise : promise )
132132 }
133133 }
134134
@@ -304,7 +304,7 @@ public final class T3NativeControlsModule: Module {
304304 if filePresentation ? . identifier == identifier { filePresentation ? . dismiss ( ) }
305305 }
306306
307- private static func saveImageToLibrary ( url : URL , mimeType : String , promise : Promise ) {
307+ private static func saveImageToLibrary ( url : URL , mimeType : String , name : String , promise : Promise ) {
308308 PHPhotoLibrary . requestAuthorization ( for : . addOnly ) { status in
309309 guard status == . authorized || status == . limited else {
310310 promise . reject ( NSError (
@@ -317,6 +317,7 @@ public final class T3NativeControlsModule: Module {
317317 PHPhotoLibrary . shared ( ) . performChanges ( {
318318 let options = PHAssetResourceCreationOptions ( )
319319 options . uniformTypeIdentifier = UTType ( mimeType : mimeType ) ? . identifier
320+ options . originalFilename = name
320321 PHAssetCreationRequest . forAsset ( ) . addResource ( with : . photo , fileURL : url , options : options )
321322 } , completionHandler : { saved , error in
322323 if saved {
0 commit comments