-
Notifications
You must be signed in to change notification settings - Fork 57
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
[Android] Contacts showing twice #74
Comments
Can you post the raw object responses for each contact? I want to see what the ids and unique values are. |
Yes, I'll fire it back up. I'm 90% sure the Android code from this library is returning the contacts twice somehow (rather than it being on the app side) - I've confirmed in both my app and the example app. One sec and I'll see what the full object logs out. |
The above is from the example app (not my app) |
Weird. They have the same id values. You'd think Android would be smarter than return duplicate records. I'm not seeing this on my ExampleApp. If you add another test Contact, do you get 4 contacts in total, 2 duplicates? |
You're not seeing this on your ExampleApp? So weird. Yes, I'm seeing 4 contacts for 2 in both my app and my ExampleApp. Are you running 8.0? I'm running 8.0 in emulator. |
No, it just shows up once for each Contact, just like in the example GIF in the README. Running 8.1 (API 27) on the emulator. I added the contacts manually, but my contacts only have a name. That's it. Maybe it has to do with the Address. Try adding a new Contact with just a name and see if you get a duplicate as well. |
Ack, okay, we'll have to figure this out. |
Looks like a similar issue to expo/expo#877. |
OK weird - I totally disagree with the admins of those two libraries that it should be handled in application code. I'm not sure the logic there. If I ask a library to return my contacts, how could I ever have expected it to turn duplicates? Why would 100 app developers all have to come up with a fix for one library? Seems weird. This would also mean iOS and Android aren't returning the same thing... |
What does https://github.com/wix/react-native-paged-contacts do? |
I agree. I think the library should handle it. Either we need to modify the query in such a way that it doesn't return duplicate contacts or (more likely) we need to do some post-query processing that merges contacts together before returning over the bridge to React Native. |
I would have expected it to have progressively merged data into one object and return that. But yes before or after I don’t know. What would be faster? Is there a performance part of this? |
I wouldn't be surprised if that Wix one held some answers. I scanned it, but the Java is a bit over me, but they have each of the queries and metadata broken into sections |
You're probably right, merging as we go probably makes the most sense. Not sure about performance but it doesn't look like there's any other way. Frustrating that the Android SDK doesn't just handle this for us. I wish I could spend a week dedicated to getting this all sorted but, alas, daytime job. :) |
Haha, yeah I understand. Only so much time. But putting a few hours here and there will get us there. I think if we can solve this one and the matching postal address formats between iOS and Android (#52) then this contact module will solve the headaches that many other fail to. Since iOS and Android will then return exactly the same thing across the board, it'll be pretty solid. I've tried 4 other libraries in my app and none of them offered complete parity. Slowly filling in the other methods over time can wait. I can jump in and try to help out with some of them. But this one and #52 are out of my league. |
Yup, that looks like processing it as you're looping through it. I think that's what we'll have to do. In our case I think we'll look at the |
Not to mention that we have to standardize the return object/array between iOS and Android |
You know what's interesting about this bug? Each of the duplicate contacts are identical. Yes, the IDs are the same, but if you look at the content, the content is also identical. Original I assumed that each contact ID duplicate had different content (one with the phone number, one with the email address, one with the postalAddress). But no, it appears that they are all identical, meaning it should be as simple as returning only one of them - but it wouldn't matter which one. I'd imaging the first or last in the array. We'd have to double check that this is true, but if so, it should be a LOT easier than we thought to fix this. |
Now that is VERY interesting.
Are you able to test this more thoroughly? With different phone numbers, addresses, email addresses, etc.?
If all we have to do is not return Contacts more than once we’ll be in great shape! I might also be able to do a quick comparison check of the two contact records to make sure that they are the same.
Let me know what you find and I’ll write the code to do that!
…On May 16, 2018, 7:56 AM -0600, Paul Wright ***@***.***>, wrote:
You know what's interesting about this bug? Each of the duplicate contacts are identical. Yes, the IDs are the same, but if you look at the content, the content is also identical.
Original I assumed that each contact ID duplicate had different content (one with the phone number, one with the email address, one with the postalAddress). But no, it appears that they are all identical, meaning it should be as simple as returning only one of them - but it wouldn't matter which one. I'd imaging the first or last in the array.
We'd have to double check that this is true, but if so, it should be a LOT easier than we thought to fix this.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Ok I did some more tests. I created several contacts:
So looks like what I found was true. You can safely just add only one of each of the IDs to the array before returning. |
And you confirmed that the "Duplicates" are equivalent? They have all of the same information? |
Yeah, but I only did so by eye. The below array is not in one piece, I've pieced it together from a few, but you can give it a scan.
|
Certainly looks like it! We'll see how it works in practice when we change this. This will make it much easier! Great catch! |
This should be fixed now @paintedbicycle! Give it a shot and let me know how it works for you! |
Close this Issue when you've confirmed it's working. Thanks. |
Looks good to me! |
When I load contacts on Android, each contact shows up twice.
The text was updated successfully, but these errors were encountered: