fix(ios): Sync camera API return to match Android changes #911
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Platforms affected
iOS
Motivation and Context
Android had a public API change so that it's returned data is URIs instead of paths.
This PR makes iOS do the same thing.
Unlike Android, iOS only ever deals with
file://
ordata:
URIs.Description
The most notable change
- (NSData*) processImage:(UIImage*) info:(NSDictionary*) options:(CDVPictureOptions*)
API implementation got moved to:The old API signature calls on the new signature with a
nil
outMime, which if nil, the implementation will not set.outMime
is a new out parameter. If given an pointer-pointer to a NSString*, it will set it to the MIME type of the encoded type. It's used by a third new method:which also uses the
processImage
implementation, supplying theNSString*
to fill in, which is used to prepare the data URI format.The
resultForImage
API was then refactored to make use of these newprocessImage
constructs.Based on my testing, it seems like iOS always did return
file://
paths unlike android which historically returned raw file paths. Therefore there was no changes done to theFILE_URI
path ofgetPicture
.Testing
Manual testing on iOS 15 physical device (simulators do not simulate camera hardware 😞)
Paramedic tests doesn't run locally for ios platform so I'll let the PR do it's thing.
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)