[native] Unlink files as necessary in useUploadSelectedMedia
Summary:
expo-image-picker will always copy the contents of image into cache and provide a URL to cached image:
As a result we'll ALWAYS need to unlink the selection.uri. We also clean up processedMedia.uploadURI if necessary.
Test Plan:
Tested small images which weren't processed and large images which were processed. Logged the contents of selection, processedMedia, and urisToBeDisposed. When I commented out the unlink line (159), I was able to open all of the images in Finder. When I uncommented the unlink line, all of the images were inaccessible because they'd been removed:
Before:
After:
Tested Android by ensuring that files remained in caches when unlink was commented out and weren't in caches when unlink was uncommented:
Selected an image avatar and ensured contents were as before:
Selected an image avatar with unlink left out and observed that new files were added:
Reviewers: ashoat, ginsu
Reviewed By: ashoat
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D7704