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

Add thumbnailImage projection #115

Open
gregzo opened this issue Feb 6, 2024 · 4 comments
Open

Add thumbnailImage projection #115

gregzo opened this issue Feb 6, 2024 · 4 comments

Comments

@gregzo
Copy link

gregzo commented Feb 6, 2024

Is your feature request related to a problem? Please describe.
As it stands, on iOS the plugin retrieves the full size image, which can slow things down considerably.

Describe the solution you'd like
When displaying contact images as thumbnails, it would be much more efficient to retrieve CNContactThumbnailImageDataKey instead of CNContactImageDataKey.

I'm happy to give it a shot on iOS. I'd simply add a new projection for thumbnailImage and implement the Swift plugin accordingly. I have no experience with Android dev unfortunately.

Describe alternatives you've considered
We could:

  • resize the images and store them in a cache. Wildly impractical and overkill.
  • write a quick and dirty plugin which only performs thumbnail image retrieval. An hour of work tops, but community wouldn't benefit and our codebase would be that much dirtier.
@gregzo
Copy link
Author

gregzo commented Jun 11, 2024

After looking at the Android code, and at the relevant docs (https://developer.android.com/reference/android/provider/ContactsContract.Contacts.Photo#PHOTO), it seems that the current behaviour is to get the thumbnail size asset on Android, and the full size asset on iOS.

Ideally, we would need to parametrise the image projection to retrieve the asset matching the requested size. In order to preserve the current behaviour, I propose that we:

  1. Add an imageSize?: "display" | "thumbnail" property to Projection
  2. Map accordingly native side
  3. If imageSize is undefined, default to thumbnail size OR keep current behaviour for compatibility reasons (full size on iOS, thumbnail on Android)

@tafelnl
Copy link
Member

tafelnl commented Jun 11, 2024

Yeah, I have done some work on this. I've got a few changes on device locally. I'll commit them when I've got the time. If I remember correctly, I was struggling with keeping it both consistent and backwards compatible.

@tafelnl
Copy link
Member

tafelnl commented Jun 12, 2024

@stephan-fischer
Copy link

@tafelnl could you please create a pull request to add this feature finally? 😊

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

3 participants