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

Thumbnail photo #11

Closed
RicardoDMelo opened this issue Apr 25, 2015 · 14 comments
Closed

Thumbnail photo #11

RicardoDMelo opened this issue Apr 25, 2015 · 14 comments

Comments

@RicardoDMelo
Copy link

I know this is meant to be a light plugin, but we have not a way to retreive contact photos.
I will make this feature for my project, if you want, i can pull it.

@dbaq
Copy link
Owner

dbaq commented Apr 26, 2015

hey @ricksmelo, that would be great to have this feature if it does not impact the performances (on android at least). And it would be awesome if it could be an option too.

thank you for contributing anyway 🍻

@dbaq
Copy link
Owner

dbaq commented May 12, 2015

any updates @ricksmelo?

@RicardoDMelo
Copy link
Author

So @dbaq, I did the feature, but, by now, is very simple. I only added a attribute in the object contact, labeled "thumbnailPhoto". It's a url string pointing to the android directory, virtual or not, where the photo is stored. If no photo is found, it returns a empty value. I didn't test the times, but it's still fast, on my Nexus 5 with ~110 contacts. I want to make a option, but I'm still working. If you want, I can already make a pull request :)

PS: sorry for bad english, not my first language.

@dbaq
Copy link
Owner

dbaq commented May 12, 2015

No rush, thank you for working on it.

You said: It's a url string pointing to the android directory

So that means we need to add an extra permission to access the file storage? How are you displaying the file in the UI?

@RicardoDMelo
Copy link
Author

I guess not, at least I didn't add anymore permissions. Url comes like this: "content://com.android.contacts/contacts/739/photo".

If we put in a img src, android makes the work for us, like this:
img src="content://com.android.contacts/contacts/739/photo"

The only thing that we might pay attention when working with this is the default sanitization, who adds "unsafe:" at the beginning of the url. On app.js we need to configure what types of protocols can be used:

.config(['$compileProvider', function($compileProvider) {
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|blob|content|data):|data:image//);
}])

Besides that, no more worries.

@dbaq
Copy link
Owner

dbaq commented May 12, 2015

I like that!

Have you thought about supporting iOS?

@RicardoDMelo
Copy link
Author

Well, I never worked with iOS platforms, but I want to. Windows Phone is C#, isn't it?

@dbaq
Copy link
Owner

dbaq commented May 12, 2015

yes or visual basic, it would be nice to have the iOS support in the PR.

@RicardoDMelo
Copy link
Author

Well, I'll give a look at the language, maybe I can do something. Knowledge is never too much

@philecom
Copy link

@ricksmelo Please can you paste your code for some of us to follow. I have tried but still cannot get the photo to show.

@natanraj
Copy link

it is an awesome one Ricksmelo. I am not a developer (android or iOS). But can do a little bit on Js/Html. Could we add a filter like mobileNumber starting with some XYZ etc. (WIll add some flexibility for developers) ... I assume Cordova takes an arguments as one of its parameter on exec. Can we pass it ? I assume cr.query may need one extra condition in ContactsManager.java. But as i said i have been searching for this plugin for last 3 days. Thanks once again.

@dbaq
Copy link
Owner

dbaq commented Jun 22, 2015

@natanraj for feature request, open another issue thanks.

@dbaq
Copy link
Owner

dbaq commented May 29, 2017

Closing this one since #44 has been merged.

@dbaq dbaq closed this as completed May 29, 2017
@dbaq
Copy link
Owner

dbaq commented May 29, 2017

I released a new version on npm https://www.npmjs.com/package/cordova-plugin-contacts-phonenumbers (v0.0.9)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants