Contact Picker
Android-specific implementation of the ContactPicker contract.
This implementation utilizes the Android ContactsContract provider and the Activity Result API (ActivityResultContracts.PickContact) to enable secure and seamless contact selection.
It manages the lifecycle of the activity launcher and performs background queries to the ContentResolver to aggregate contact details like names, multiple phone numbers, emails, and avatars.
An expected class that defines the contract for a platform-specific contact picker.
This class facilitates the selection of contacts from the device's native address book. Implementations are provided for different platforms (e.g., Android and iOS) to handle the specific APIs and UI flows required by each.
iOS-specific implementation of the ContactPicker contract.
This implementation leverages the native CNContactPickerViewController from the ContactsUI framework to provide a familiar and secure contact selection experience for iOS users.
It acts as both the launcher and the delegate (CNContactPickerDelegateProtocol) to handle lifecycle events and data extraction from the native CNContact objects.
Properties
Columns queried from the ContactsContract.Contacts table.
Functions
Invoked by the system when the user selects a specific contact.
Invoked by the system when the user cancels the contact picker.
Recursively traverses the view controller hierarchy to find the visible controller.
Resolves the contact's photo into a ByteArray.
Extracts comprehensive contact data from the provided Uri.
Utility to extract string representations of email addresses from CNLabeledValues.
Queries the ContactsContract.CommonDataKinds.Phone table for all numbers associated with a contact.
Utility to extract string representations of phone numbers from CNLabeledValues.
Triggers the Android system contact picker UI.
Triggers the display of the platform-specific contact picker interface.
Displays the native iOS contact picker.
Registers the ManagedActivityResultLauncher within the Compose composition.
Registers the contact picker within the Compose composition.
Registers the callback to be invoked when a contact is selected.
Converts native NSData to a Kotlin ByteArray.
Companion extension to find the currently active UIViewController in the view hierarchy.