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

feat: Include Identifier in PhotoResponse for iOS #102

Open
stephan-fischer opened this issue Dec 12, 2024 · 1 comment
Open

feat: Include Identifier in PhotoResponse for iOS #102

stephan-fischer opened this issue Dec 12, 2024 · 1 comment

Comments

@stephan-fischer
Copy link
Contributor

Include Identifier in PhotoResponse for iOS

Description

The PhotoResponse currently lacks an identifier for photos saved to the iOS media library. Adding a unique identifier, such as the localIdentifier provided by the PHAsset API, would allow developers to reliably reference and manage saved photos. This feature is already indirectly supported on Android via the uri, but it is missing on iOS.

Proposed Implementation

  1. Use the PHAsset's localIdentifier when saving a photo to the iOS media library. This value is unique and can be easily retrieved during the saving process.

    Example:

    let creationRequest = PHAssetCreationRequest.forAsset()
    creationRequest.addResource(with: .photo, data: imageData as Data, options: nil)
    let identifier = creationRequest.placeholderForCreatedAsset?.localIdentifier
  2. Extend the PhotoResponse type to include an optional identifier field

    interface PhotoResponse {
        filePath?: string;
        identifier?: string; // New field for iOS
    }

Use Case

Including a unique identifier is crucial for developers who need to:

  • Reference saved photos later for updates, sharing, or deletion.
  • Programmatically manage photos in albums.
  • Synchronize photo metadata with a backend.

By aligning with Android's uri behavior, this feature would provide consistency across platforms and enhance the plugin's usability in photo management apps.

Example Response

After saving a photo on iOS, the PhotoResponse could look like this:

{
  "filePath": "file:///var/mobile/Containers/Data/Application/ABC123/Documents/photo.jpg",
  "identifier": "6A11E9F7-1234-ABCD-5678-EF90ABCDEF12" // iOS localIdentifier
}

Additional Notes

This feature would ensure parity between iOS and Android and provide a more robust developer experience for applications relying on media management. Thank you for considering this request!

@nkalupahana
Copy link
Collaborator

nkalupahana commented Dec 12, 2024

Great idea, I should be able to get this done by end of year. I think this should be a pretty simple feature, so PRs welcome :) definitely a good first issue.

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

No branches or pull requests

2 participants