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): preserving EXIF data #712

Merged
merged 4 commits into from Mar 22, 2022
Merged

fix(ios): preserving EXIF data #712

merged 4 commits into from Mar 22, 2022

Conversation

codeconsole
Copy link
Contributor

Incorporates the changes done by @ryaa that enable EXIF information to be retained on selected image.

https://github.com/apache/cordova-plugin-camera/commits/master/src/ios/CDVCamera.m

@ryaa: Enabled preserving exif data
Change to prevent saving the image file twice
Added authorization/permission request for camera roll
Added the fix to correctly handle iOS 14 new Photos picker permissions

@karlvr Fix background thread calling UI APIs

…ge file twice, Added authorization/permission request for camera roll, Added the fix to correctly handle iOS 14 new Photos picker permissions, @karlvr Fix background thread calling UI APIs
@codeconsole
Copy link
Contributor Author

PING: @jukka @shazron @infil00p @jlongster Please fix this plugin by either merging or coming up with you own solution. This plugin has been broken for years as is and does not work according to its documentation. Being such an important plugin, having this one broken is killing the cordova community.

@codeconsole codeconsole mentioned this pull request Mar 19, 2021
5 tasks
@erisu
Copy link
Member

erisu commented Sep 2, 2021

@codeconsole Can you explain how you are testing the PR changes?

When I took a photo using the changes from #712, the GPS Exif data does not exist.

JavaScript Sample:

const cameraOptions = {
  quality: 100,
  destinationType: Camera.DestinationType.FILE_URI,
  sourceType: Camera.PictureSourceType.CAMERA,
  encodingType: Camera.EncodingType.JPEG,
  mediaType: Camera.MediaType.PICTURE,
  saveToPhotoAlbum: true,
}

cameraTakePhoto.onclick = function() {
  navigator.camera.getPicture(onPhotoDataSuccess, onFail, cameraOptions);
};

config.xml Sample

<platform name="ios">
    <preference name="CameraUsesGeolocation" value="true" />

    <edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
        <string>need camera access to take pictures</string>
    </edit-config>

    <edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
        <string>need photo library access to get pictures from there</string>
    </edit-config>

    <edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
        <string>need location access to find things nearby</string>
    </edit-config>

    <edit-config target="NSPhotoLibraryAddUsageDescription" file="*-Info.plist" mode="merge">
        <string>need photo library access to save pictures there</string>
    </edit-config>
</platform>

From iOS's "Photo" app, I selected the photos from the gallery and airdropped them to my macOS. I opened the JPG photos with the "Previewer" app and opened the "Show Inspector" > "More Info" tab > "Exif" sub-tab. In this tab, there is no GPS location data.

From iOS's "Photo" app, I also tried checking by the "Places" category, and it's not there.

After taking the photo and clicking on the "Select" button, the location permission request dialog did open. I tried both options, "Allow Once" and "Allow While Using App" but neither of them made a difference.

There was also a minor issue that I noticed while testing. The location permission dialog will automatically close itself after a few seconds. This does not give people enough time to read and confirm. The dialog should not close until the user responds.

@codeconsole
Copy link
Contributor Author

@erisu These are just @ryaa 's iOS changes from here #759 . I believe all it fixes is just the exif information when a photo is selected from the Photos library.

@codeconsole
Copy link
Contributor Author

@erisu I've had this working on a released app for months. I can confirm that it fixes the issue of exif information being stored on photos chose from the photo library.

@erisu erisu changed the title Preserving of EXIF data on IOS fix(ios): preserving of EXIF data Mar 18, 2022
@erisu erisu changed the title fix(ios): preserving of EXIF data fix(ios): preserving EXIF data Mar 18, 2022
Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • app builds
  • photos can be taken
  • can fetch photos from gallery

@erisu erisu merged commit 4608f8e into apache:master Mar 22, 2022
Siedlerchr added a commit to safetyinnovation/cordova-plugin-camera that referenced this pull request Aug 1, 2022
* upstream/master:
  ci(android): update java requirement for cordova-android@11 (apache#798)
  fix(ios): preserving EXIF data (apache#712)
  fix(android): update queries in plugin.xml (apache#780)
davidofwatkins added a commit to zenput/cordova-plugin-camera that referenced this pull request Oct 20, 2023
* fix(android): update queries in plugin.xml (apache#780)

Solves the issue with duplicate queries elements in AppManifest.xml

apache#779

* fix(ios): preserving EXIF data (apache#712)

* ci(android): update java requirement for cordova-android@11 (apache#798)

* dep(npm): bump package-lock v2 w/ rebuild (apache#800)

* docs(README): Document ANDROIDX_CORE_VERSION variable (apache#808)

* fix(browser): use navigator.mediaDevices.getUserMedia (apache#810)

* ci: sync workflow with paramedic (apache#804)

* fix(android): set applicationId (apache#827)

Co-authored-by: Alexandre Alves <aalves@seamlink.com>

* chore(android): Cleanup obsolete BuildConfig comments (apache#831)

* ci(android): Drop API 22 & 31. Added API 24 & 33 (apache#835)

Co-authored-by: エリス <erisu@users.noreply.github.com>

* chore: bump plugin version 7.0.0-dev (apache#845)

* dep(dev)!: bump @cordova/eslint-config@5.0.0 (apache#846)

* dep(dev)!: bump @cordova/eslint-config@5.0.0
* chore: apply automatic lint fix

* feat(android)!: Android 13 support (apache#844)

* feat(android)!: Android 13 support
* refactor(android): simplify getPermissions logic
* feat(android)!: bump cordova-android requirement to >=12.0.0
* feat(android): update saveAlbumPermission to include Android 9 and below use case

---------

Co-authored-by: ochakov <evgeny@ochakov.com>

* chore: Update SUPPORT_QUESTION.md template (apache#849)

* fix!: remove deprecated platforms (apache#848)

* chore: remove windows/osx from plugin.xml (apache#850)

* ci(gh-action): sync with paramedic configs (apache#851)

* release(camera-v7.0.0): updated version and RELEASENOTES.md

* chore: bump version 7.0.1-dev

---------

Co-authored-by: Marcus Abrahamsson <marcus.abrahamsson13@gmail.com>
Co-authored-by: Scott Murphy <scott@alwaysvip.com>
Co-authored-by: エリス <erisu@users.noreply.github.com>
Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>
Co-authored-by: seamlink-aalves <49952868+seamlink-aalves@users.noreply.github.com>
Co-authored-by: Alexandre Alves <aalves@seamlink.com>
Co-authored-by: Norman Breau <norman@nbsolutions.ca>
Co-authored-by: ochakov <evgeny@ochakov.com>
Co-authored-by: Erisu <erisu@apache.org>
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.

None yet

2 participants