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

Updating a contact does not update the socialmedia information correctly #42

Closed
ORBITXX opened this issue Jan 12, 2022 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@ORBITXX
Copy link

ORBITXX commented Jan 12, 2022

Hi,

when I update a contacts socialmedia information using the socialmedia label "custom", the information is not stored correctly on the device. The socialmedia label is changed to "aim" and the the custom label is lost if I fetch the contact after the update. Updating the socialmedia information with other labels seems to be working. The socialmedia usernames are stored correctly and updating other values like the name works fine as well. Setting custom labels on the device contact menu and fetching them with flutter_contacts works as well, thus I assume the issue is caused by the update method. Currently im testing on an Android emulator (Pixel 4, API: 30). Code example is below.

  Contact? contact = await FlutterContacts.openExternalPick();

  if (contact == null) return;
  // We need to fetch contact again with accounts (including the raw id)
  // to be able to update the contact later (required for android)
  contact = await FlutterContacts.getContact(
    contact.id,
    withAccounts: true,
    withProperties: true,
  );

  List<SocialMedia> socialMedias = [
    SocialMedia(
      "test1",
      label: SocialMediaLabel.custom,
      customLabel: "CustomLabel1",
    ),
    SocialMedia(
      "test2",
      label: SocialMediaLabel.jabber,
    ),
  ];

  contact?.socialMedias = socialMedias;

  contact?.update();

  // Output 1:
  print(contact?.socialMedias);

  if (contact == null) return;

  contact = await FlutterContacts.getContact(
    contact.id,
    withAccounts: true,
    withProperties: true,
  );

  // Output 2:
  print(contact?.socialMedias);

Output 1:

[SocialMedia(userName=test1, label=SocialMediaLabel.custom, customLabel=CustomLabel1), SocialMedia(userName=test2, label=SocialMediaLabel.jabber, customLabel=)]

Output 2:

[SocialMedia(userName=test1, label=SocialMediaLabel.aim, customLabel=), SocialMedia(userName=test2, label=SocialMediaLabel.jabber, customLabel=)]
@ORBITXX
Copy link
Author

ORBITXX commented Jan 21, 2022

UPDATE

This problem seems to only occure on android devices. On iOS it works fine.

@joachim-quis
Copy link
Contributor

Thanks @ORBITXX for reporting! Will be fixed in the next release.

@joachim-quis joachim-quis added the bug Something isn't working label Feb 22, 2022
@joachim-quis
Copy link
Contributor

Fixed in version 1.1.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants