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

Primary Phone/Email support? #77

Open
bmc08gt opened this issue Apr 17, 2023 · 1 comment
Open

Primary Phone/Email support? #77

bmc08gt opened this issue Apr 17, 2023 · 1 comment
Labels
feature request New feature or request

Comments

@bmc08gt
Copy link

bmc08gt commented Apr 17, 2023

Does this exist in the current API scheme with fetching? Im not seeing an easy way to check this data without a secondary cursor query on the phones and emails.

@bmc08gt bmc08gt changed the title easier access to primary phone and emails Primary Phone/Email support? Apr 17, 2023
@alexstyl alexstyl added the feature request New feature or request label Apr 23, 2023
@alexstyl
Copy link
Owner

alexstyl commented Apr 23, 2023

This is not something currently supported by ContactStore but it seems like a straightforward thing to support.

It should be a as simple as adding a isPrimary boolean to LabeledValue and forwarding the respective value in ContactQueries If you are up for contributing. (Line 301ish)

columnsToFetch.contains(Phones) && mimetype == PhoneColumns.CONTENT_ITEM_TYPE -> {
                          val phoneNumberString = item.getAsStringOrEmpty(PhoneColumns.NUMBER)
                          val id = item.getAsLong(PhoneColumns._ID)
                          if (phoneNumberString.isNotBlank() && id != null) {
                              // check if primary
                              val isPrimary = item.getAsInteger(PhoneColumns.IS_PRIMARY) != 0
                              val value = PhoneNumber(phoneNumberString)
                              val phoneEntry =
                                  // forward primary to LabeledValue
                                  LabeledValue(value, phoneLabelFrom(item), id, account, isPrimary)
                              phones.add(phoneEntry)
                          }
                      }

this would need to be done for all ContactColumns.

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

No branches or pull requests

2 participants