Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): Sync camera API return to match Android changes #911

Merged
merged 1 commit into from
Oct 27, 2024

Conversation

breautek
Copy link
Contributor

@breautek breautek commented Oct 26, 2024

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:// or data: URIs.

Description

The most notable change - (NSData*) processImage:(UIImage*) info:(NSDictionary*) options:(CDVPictureOptions*) API implementation got moved to:

- (NSData*) processImage:(UIImage*) info:(NSDictionary*) options:(CDVPictureOptions*) outMime:(NSString**)

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:

- (NSString*) processImageAsDataUri:(UIImage*) info:(NSDictionary*) options:(CDVPictureOptions*)

which also uses the processImage implementation, supplying the NSString* to fill in, which is used to prepare the data URI format.

The resultForImage API was then refactored to make use of these new processImage 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 the FILE_URI path of getPicture.

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

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary (Will be making a PR later for v8 Public API changes)

@breautek breautek added this to the 8.0.0 milestone Oct 26, 2024
@breautek breautek requested review from dpogue and erisu October 26, 2024 13:25
@breautek breautek force-pushed the fix/ios/sync-api-with-android branch from 64475f1 to 386ea43 Compare October 26, 2024 14:49
@breautek breautek merged commit 7adccc8 into apache:master Oct 27, 2024
13 of 15 checks passed
@breautek breautek deleted the fix/ios/sync-api-with-android branch October 27, 2024 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants