diff --git a/packages/expo-contacts/android/src/main/java/expo/modules/contacts/Contact.java b/packages/expo-contacts/android/src/main/java/expo/modules/contacts/Contact.java index 3b7f74c5b89c1..a0d83333f1244 100644 --- a/packages/expo-contacts/android/src/main/java/expo/modules/contacts/Contact.java +++ b/packages/expo-contacts/android/src/main/java/expo/modules/contacts/Contact.java @@ -1,5 +1,6 @@ package expo.modules.contacts; +import android.util.Log; import android.content.ContentProviderOperation; import android.content.ContentValues; import android.database.Cursor; @@ -37,7 +38,7 @@ public class Contact { protected String contactId; - protected String lookupKey; + protected String lookupKey; protected String displayName; @@ -380,41 +381,57 @@ public Bundle toMap(Set fieldSet) throws ParseException { if (showDates || showBirthday) { // double if check with query with cursor boolean hasYear; - Calendar calendar = Calendar.getInstance(); - SimpleDateFormat datePattern = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); - SimpleDateFormat noYearPattern = new SimpleDateFormat("--MM-dd", Locale.getDefault()); - ArrayList datesArray = new ArrayList(); + ArrayList rawDatesArray = new ArrayList(); + ArrayList datesArray = new ArrayList(); for (BaseModel item : dates) { + Calendar calendar = Calendar.getInstance(); + SimpleDateFormat datePattern = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); + SimpleDateFormat noYearPattern = new SimpleDateFormat("--MM-dd", Locale.getDefault()); + Bundle details = new Bundle(); String dateString = item.getData(); String label = item.getLabel(); - - hasYear = !dateString.startsWith("--"); - - if (hasYear) { - calendar.setTime(datePattern.parse(dateString)); - } else { - calendar.setTime(noYearPattern.parse(dateString)); + + Bundle rawDate = new Bundle(); + rawDate.putString("type", label); + rawDate.putString("value", dateString); + rawDatesArray.add(rawDate); + + try { + hasYear = !dateString.startsWith("--"); + + if (hasYear) { + calendar.setTime(datePattern.parse(dateString)); + } else { + calendar.setTime(noYearPattern.parse(dateString)); + } + + if (hasYear) { + details.putInt("year", calendar.get(Calendar.YEAR)); + } + details.putInt("month", calendar.get(Calendar.MONTH)); + details.putInt("day", calendar.get(Calendar.DAY_OF_MONTH)); + // TODO: Evan: The type is only supported in 26+ + details.putString("format", "gregorian"); + if (showBirthday && label != null && label.equals("birthday")) { + contact.putBundle("birthday", details); + } else { + details.putString("label", label); + datesArray.add(details); + } + } catch (Exception e) { + Log.w("Contact", e.toString()); } - - if (hasYear) { - details.putInt("year", calendar.get(Calendar.YEAR)); + } + if (showDates) { + if (datesArray.size() > 0) { + contact.putParcelableArrayList("dates", datesArray); } - details.putInt("month", calendar.get(Calendar.MONTH)); - details.putInt("day", calendar.get(Calendar.DAY_OF_MONTH)); - // TODO: Evan: The type is only supported in 26+ - details.putString("format", "gregorian"); - if (showBirthday && label != null && label.equals("birthday")) { - contact.putBundle("birthday", details); - } else { - details.putString("label", label); - datesArray.add(details); + if (rawDatesArray.size() > 0) { + contact.putParcelableArrayList("rawDates", rawDatesArray); } } - if (showDates && datesArray.size() > 0) { - contact.putParcelableArrayList("dates", datesArray); - } } return contact; diff --git a/packages/expo-contacts/build/Contacts.d.ts b/packages/expo-contacts/build/Contacts.d.ts index 89642ad9dbcca..f24e7137dd9b9 100644 --- a/packages/expo-contacts/build/Contacts.d.ts +++ b/packages/expo-contacts/build/Contacts.d.ts @@ -154,7 +154,7 @@ export declare function shareContactAsync(contactId: string, message: string, sh export declare function getContactsAsync(contactQuery?: ContactQuery): Promise; export declare function getPagedContactsAsync(contactQuery?: ContactQuery): Promise; export declare function getContactByIdAsync(id: string, fields?: FieldType[]): Promise; -export declare function addContactAsync(contact: Contact, containerId: string): Promise; +export declare function addContactAsync(contact: Contact, containerId?: string): Promise; export declare function updateContactAsync(contact: Contact): Promise; export declare function removeContactAsync(contactId: string): Promise; export declare function writeContactToFileAsync(contactQuery?: ContactQuery): Promise; diff --git a/packages/expo-contacts/build/Contacts.js.map b/packages/expo-contacts/build/Contacts.js.map index 695236d9a1b54..7251769b9bcb0 100644 --- a/packages/expo-contacts/build/Contacts.js.map +++ b/packages/expo-contacts/build/Contacts.js.map @@ -1 +1 @@ -{"version":3,"file":"Contacts.js","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,EAAE,SAAS;IAClB,YAAY,EAAE,cAAc;IAC5B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,eAAe,EAAE,iBAAiB;IAClC,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,YAAY;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CACnB,CAAC","sourcesContent":["import { UnavailabilityError } from '@unimodules/core';\nimport { PermissionResponse, PermissionStatus } from 'unimodules-permissions-interface';\nimport { Platform, Share } from 'react-native';\nimport UUID from 'uuid-js';\n\nimport ExpoContacts from './ExpoContacts';\n\nexport type CalendarFormatType =\n | typeof CalendarFormats.Gregorian\n | typeof CalendarFormats.Buddhist\n | typeof CalendarFormats.Chinese\n | typeof CalendarFormats.Coptic\n | typeof CalendarFormats.EthiopicAmeteMihret\n | typeof CalendarFormats.EthiopicAmeteAlem\n | typeof CalendarFormats.Hebrew\n | typeof CalendarFormats.ISO8601\n | typeof CalendarFormats.Indian\n | typeof CalendarFormats.Islamic\n | typeof CalendarFormats.IslamicCivil\n | typeof CalendarFormats.Japanese\n | typeof CalendarFormats.Persian\n | typeof CalendarFormats.RepublicOfChina\n | typeof CalendarFormats.IslamicTabular\n | typeof CalendarFormats.IslamicUmmAlQura;\n\nexport type ContainerType =\n | typeof ContainerTypes.Local\n | typeof ContainerTypes.Exchange\n | typeof ContainerTypes.CardDAV\n | typeof ContainerTypes.Unassigned;\n\nexport type ContactType = typeof ContactTypes.Person | typeof ContactTypes.Company;\n\nexport type FieldType =\n | typeof Fields.ID\n | typeof Fields.ContactType\n | typeof Fields.Name\n | typeof Fields.FirstName\n | typeof Fields.MiddleName\n | typeof Fields.LastName\n | typeof Fields.MaidenName\n | typeof Fields.NamePrefix\n | typeof Fields.NameSuffix\n | typeof Fields.Nickname\n | typeof Fields.PhoneticFirstName\n | typeof Fields.PhoneticMiddleName\n | typeof Fields.PhoneticLastName\n | typeof Fields.Birthday\n | typeof Fields.NonGregorianBirthday\n | typeof Fields.Emails\n | typeof Fields.PhoneNumbers\n | typeof Fields.Addresses\n | typeof Fields.SocialProfiles\n | typeof Fields.InstantMessageAddresses\n | typeof Fields.UrlAddresses\n | typeof Fields.Company\n | typeof Fields.JobTitle\n | typeof Fields.Department\n | typeof Fields.ImageAvailable\n | typeof Fields.Image\n | typeof Fields.RawImage\n | typeof Fields.ExtraNames\n | typeof Fields.Note\n | typeof Fields.Dates\n | typeof Fields.Relationships;\n\nexport type Date = {\n day?: number;\n month?: number;\n year?: number;\n id: string;\n label: string;\n format?: CalendarFormatType;\n};\n\nexport type Relationship = {\n label: string;\n name?: string;\n id: string;\n};\n\nexport type Email = {\n email?: string;\n isPrimary?: boolean;\n label: string;\n id: string;\n};\n\nexport type PhoneNumber = {\n number?: string;\n isPrimary?: boolean;\n digits?: string;\n countryCode?: string;\n label: string;\n id: string;\n};\n\nexport type Address = {\n street?: string;\n city?: string;\n country?: string;\n region?: string;\n neighborhood?: string;\n postalCode?: string;\n poBox?: string;\n isoCountryCode?: string;\n label: string;\n id: string;\n};\n\nexport type SocialProfile = {\n service?: string;\n localizedProfile?: string;\n url?: string;\n username?: string;\n userId?: string;\n label: string;\n id: string;\n};\n\nexport type InstantMessageAddress = {\n service?: string;\n username?: string;\n localizedService?: string;\n label: string;\n id: string;\n};\n\nexport type UrlAddress = {\n label: string;\n url?: string;\n id: string;\n};\n\nexport type Image = {\n uri?: string;\n width?: number;\n height?: number;\n base64?: string;\n};\n\nexport type Contact = {\n id: string;\n contactType: ContactType;\n name: string;\n firstName?: string;\n middleName?: string;\n lastName?: string;\n maidenName?: string;\n namePrefix?: string;\n nameSuffix?: string;\n nickname?: string;\n phoneticFirstName?: string;\n phoneticMiddleName?: string;\n phoneticLastName?: string;\n company?: string;\n jobTitle?: string;\n department?: string;\n note?: string;\n imageAvailable?: boolean;\n image?: Image;\n rawImage?: Image;\n birthday?: Date;\n dates?: Date[];\n relationships?: Relationship[];\n emails?: Email[];\n phoneNumbers?: PhoneNumber[];\n addresses?: Address[];\n instantMessageAddresses?: InstantMessageAddress[];\n urlAddresses?: UrlAddress[];\n\n nonGregorianBirthday?: Date;\n socialProfiles?: SocialProfile[];\n};\n\nexport type ContactResponse = {\n data: Contact[];\n hasNextPage: boolean;\n hasPreviousPage: boolean;\n};\n\nexport type ContactSort =\n | typeof SortTypes.UserDefault\n | typeof SortTypes.FirstName\n | typeof SortTypes.LastName\n | typeof SortTypes.None;\n\nexport type ContactQuery = {\n pageSize?: number;\n pageOffset?: number;\n fields?: FieldType[];\n sort?: ContactSort;\n name?: string;\n id?: string | string[];\n groupId?: string;\n containerId?: string;\n rawContacts?: boolean;\n};\n\nexport type FormOptions = {\n displayedPropertyKeys?: FieldType[];\n message?: string;\n alternateName?: string;\n allowsEditing?: boolean;\n allowsActions?: boolean;\n shouldShowLinkedContacts?: boolean;\n isNew?: boolean;\n cancelButtonTitle?: string;\n preventAnimation?: boolean;\n groupId?: string;\n};\n\nexport type GroupQuery = {\n groupId?: string;\n groupName?: string;\n containerId?: string;\n};\n\nexport type Group = {\n name?: string;\n id?: string;\n};\n\nexport type ContainerQuery = {\n contactId?: string;\n groupId?: string;\n containerId?: string | string[];\n};\n\nexport type Container = {\n name: string;\n id: string;\n type: ContainerType;\n};\n\nexport { PermissionStatus, PermissionResponse };\n\nexport async function shareContactAsync(\n contactId: string,\n message: string,\n shareOptions: object = {}\n): Promise {\n if (Platform.OS === 'ios') {\n const url = await writeContactToFileAsync({\n id: contactId,\n });\n return await Share.share(\n {\n url,\n message,\n },\n shareOptions\n );\n } else if (!ExpoContacts.shareContactAsync) {\n throw new UnavailabilityError('Contacts', 'shareContactAsync');\n }\n return await ExpoContacts.shareContactAsync(contactId, message);\n}\n\nexport async function getContactsAsync(contactQuery: ContactQuery = {}): Promise {\n if (!ExpoContacts.getContactsAsync) {\n throw new UnavailabilityError('Contacts', 'getContactsAsync');\n }\n return await ExpoContacts.getContactsAsync(contactQuery);\n}\n\nexport async function getPagedContactsAsync(\n contactQuery: ContactQuery = {}\n): Promise {\n const { pageSize, ...nOptions } = contactQuery;\n\n if (pageSize && pageSize <= 0) {\n throw new Error('Error: Contacts.getPagedContactsAsync: `pageSize` must be greater than 0');\n }\n\n return await getContactsAsync({\n ...nOptions,\n pageSize,\n });\n}\n\nexport async function getContactByIdAsync(\n id: string,\n fields?: FieldType[]\n): Promise {\n if (!ExpoContacts.getContactsAsync) {\n throw new UnavailabilityError('Contacts', 'getContactsAsync');\n }\n\n if (id == null) {\n throw new Error('Error: Contacts.getContactByIdAsync: Please pass an ID as a parameter');\n } else {\n const results = await ExpoContacts.getContactsAsync({\n pageSize: 1,\n pageOffset: 0,\n fields,\n id,\n });\n if (results && results.data && results.data.length > 0) {\n return results.data[0];\n }\n }\n return undefined;\n}\n\nexport async function addContactAsync(contact: Contact, containerId: string): Promise {\n if (!ExpoContacts.addContactAsync) {\n throw new UnavailabilityError('Contacts', 'addContactAsync');\n }\n return await ExpoContacts.addContactAsync(contact, containerId);\n}\n\nexport async function updateContactAsync(contact: Contact): Promise {\n if (!ExpoContacts.updateContactAsync) {\n throw new UnavailabilityError('Contacts', 'updateContactAsync');\n }\n return await ExpoContacts.updateContactAsync(contact);\n}\n\nexport async function removeContactAsync(contactId: string): Promise {\n if (!ExpoContacts.removeContactAsync) {\n throw new UnavailabilityError('Contacts', 'removeContactAsync');\n }\n return await ExpoContacts.removeContactAsync(contactId);\n}\n\nexport async function writeContactToFileAsync(\n contactQuery: ContactQuery = {}\n): Promise {\n if (!ExpoContacts.writeContactToFileAsync) {\n throw new UnavailabilityError('Contacts', 'writeContactToFileAsync');\n }\n return await ExpoContacts.writeContactToFileAsync(contactQuery);\n}\n\nexport async function presentFormAsync(\n contactId?: string | null,\n contact?: Contact | null,\n formOptions: FormOptions = {}\n): Promise {\n if (!ExpoContacts.presentFormAsync) {\n throw new UnavailabilityError('Contacts', 'presentFormAsync');\n }\n if (Platform.OS === 'ios') {\n let adjustedOptions = formOptions;\n\n if (contactId) {\n if (contact) {\n contact = undefined;\n console.log(\n 'Expo.Contacts.presentFormAsync: You should define either a `contact` or a `contactId` but not both.'\n );\n }\n if (adjustedOptions.isNew !== undefined) {\n console.log(\n 'Expo.Contacts.presentFormAsync: formOptions.isNew is not supported with `contactId`'\n );\n }\n }\n return await ExpoContacts.presentFormAsync(contactId, contact, adjustedOptions);\n } else {\n return await ExpoContacts.presentFormAsync(contactId, contact, formOptions);\n }\n}\n\n// iOS Only\n\nexport async function addExistingGroupToContainerAsync(\n groupId: string,\n containerId: string\n): Promise {\n if (!ExpoContacts.addExistingGroupToContainerAsync) {\n throw new UnavailabilityError('Contacts', 'addExistingGroupToContainerAsync');\n }\n\n return await ExpoContacts.addExistingGroupToContainerAsync(groupId, containerId);\n}\n\nexport async function createGroupAsync(name?: string, containerId?: string): Promise {\n if (!ExpoContacts.createGroupAsync) {\n throw new UnavailabilityError('Contacts', 'createGroupAsync');\n }\n\n name = name || UUID.create().toString();\n if (!containerId) {\n containerId = await getDefaultContainerIdAsync();\n }\n\n return await ExpoContacts.createGroupAsync(name, containerId);\n}\n\nexport async function updateGroupNameAsync(groupName: string, groupId: string): Promise {\n if (!ExpoContacts.updateGroupNameAsync) {\n throw new UnavailabilityError('Contacts', 'updateGroupNameAsync');\n }\n\n return await ExpoContacts.updateGroupNameAsync(groupName, groupId);\n}\n\nexport async function removeGroupAsync(groupId: string): Promise {\n if (!ExpoContacts.removeGroupAsync) {\n throw new UnavailabilityError('Contacts', 'removeGroupAsync');\n }\n\n return await ExpoContacts.removeGroupAsync(groupId);\n}\n\nexport async function addExistingContactToGroupAsync(\n contactId: string,\n groupId: string\n): Promise {\n if (!ExpoContacts.addExistingContactToGroupAsync) {\n throw new UnavailabilityError('Contacts', 'addExistingContactToGroupAsync');\n }\n\n return await ExpoContacts.addExistingContactToGroupAsync(contactId, groupId);\n}\n\nexport async function removeContactFromGroupAsync(\n contactId: string,\n groupId: string\n): Promise {\n if (!ExpoContacts.removeContactFromGroupAsync) {\n throw new UnavailabilityError('Contacts', 'removeContactFromGroupAsync');\n }\n\n return await ExpoContacts.removeContactFromGroupAsync(contactId, groupId);\n}\n\nexport async function getGroupsAsync(groupQuery: GroupQuery): Promise {\n if (!ExpoContacts.getGroupsAsync) {\n throw new UnavailabilityError('Contacts', 'getGroupsAsync');\n }\n\n return await ExpoContacts.getGroupsAsync(groupQuery);\n}\n\nexport async function getDefaultContainerIdAsync(): Promise {\n if (!ExpoContacts.getDefaultContainerIdentifierAsync) {\n throw new UnavailabilityError('Contacts', 'getDefaultContainerIdentifierAsync');\n }\n\n return await ExpoContacts.getDefaultContainerIdentifierAsync();\n}\n\nexport async function getContainersAsync(containerQuery: ContainerQuery): Promise {\n if (!ExpoContacts.getContainersAsync) {\n throw new UnavailabilityError('Contacts', 'getContainersAsync');\n }\n\n return await ExpoContacts.getContainersAsync(containerQuery);\n}\n\nexport async function getPermissionsAsync(): Promise {\n if (!ExpoContacts.getPermissionsAsync) {\n throw new UnavailabilityError('Contacts', 'getPermissionsAsync');\n }\n\n return ExpoContacts.getPermissionsAsync();\n}\n\nexport async function requestPermissionsAsync(): Promise {\n if (!ExpoContacts.requestPermissionsAsync) {\n throw new UnavailabilityError('Contacts', 'requestPermissionsAsync');\n }\n\n return await ExpoContacts.requestPermissionsAsync();\n}\n\n// Legacy\nexport const PHONE_NUMBERS = 'phoneNumbers';\nexport const EMAILS = 'emails';\nexport const ADDRESSES = 'addresses';\nexport const IMAGE = 'image';\nexport const RAW_IMAGE = 'rawImage';\nexport const NOTE = 'note';\nexport const BIRTHDAY = 'birthday';\nexport const NON_GREGORIAN_BIRTHDAY = 'nonGregorianBirthday';\nexport const NAME_PREFIX = 'namePrefix';\nexport const NAME_SUFFIX = 'nameSuffix';\nexport const PHONETIC_FIRST_NAME = 'phoneticFirstName';\nexport const PHONETIC_MIDDLE_NAME = 'phoneticMiddleName';\nexport const PHONETIC_LAST_NAME = 'phoneticLastName';\nexport const SOCIAL_PROFILES = 'socialProfiles';\nexport const IM_ADDRESSES = 'instantMessageAddresses';\nexport const URLS = 'urlAddresses';\nexport const DATES = 'dates';\nexport const RELATIONSHIPS = 'relationships';\n\nexport const Fields = {\n ID: 'id',\n ContactType: 'contactType',\n Name: 'name',\n FirstName: 'firstName',\n MiddleName: 'middleName',\n LastName: 'lastName',\n MaidenName: 'maidenName',\n NamePrefix: 'namePrefix',\n NameSuffix: 'nameSuffix',\n Nickname: 'nickname',\n PhoneticFirstName: 'phoneticFirstName',\n PhoneticMiddleName: 'phoneticMiddleName',\n PhoneticLastName: 'phoneticLastName',\n Birthday: 'birthday',\n NonGregorianBirthday: 'nonGregorianBirthday',\n Emails: 'emails',\n PhoneNumbers: 'phoneNumbers',\n Addresses: 'addresses',\n SocialProfiles: 'socialProfiles',\n InstantMessageAddresses: 'instantMessageAddresses',\n UrlAddresses: 'urlAddresses',\n Company: 'company',\n JobTitle: 'jobTitle',\n Department: 'department',\n ImageAvailable: 'imageAvailable',\n Image: 'image',\n RawImage: 'rawImage',\n ExtraNames: 'extraNames',\n Note: 'note',\n Dates: 'dates',\n Relationships: 'relationships',\n};\n\nexport const CalendarFormats = {\n Gregorian: 'gregorian',\n Buddhist: 'buddhist',\n Chinese: 'chinese',\n Coptic: 'coptic',\n EthiopicAmeteMihret: 'ethiopicAmeteMihret',\n EthiopicAmeteAlem: 'ethiopicAmeteAlem',\n Hebrew: 'hebrew',\n ISO8601: 'iso8601',\n Indian: 'indian',\n Islamic: 'islamic',\n IslamicCivil: 'islamicCivil',\n Japanese: 'japanese',\n Persian: 'persian',\n RepublicOfChina: 'republicOfChina',\n IslamicTabular: 'islamicTabular',\n IslamicUmmAlQura: 'islamicUmmAlQura',\n};\n\nexport const ContainerTypes = {\n Local: 'local',\n Exchange: 'exchange',\n CardDAV: 'cardDAV',\n Unassigned: 'unassigned',\n};\n\nexport const SortTypes = {\n UserDefault: 'userDefault',\n FirstName: 'firstName',\n LastName: 'lastName',\n None: 'none',\n};\n\nexport const ContactTypes = {\n Person: 'person',\n Company: 'company',\n};\n"]} \ No newline at end of file +{"version":3,"file":"Contacts.js","sourceRoot":"","sources":["../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAsB,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAsO1C,OAAO,EAAE,gBAAgB,EAAsB,CAAC;AAEhD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,SAAiB,EACjB,OAAe,EACf,eAAuB,EAAE;IAEzB,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QACzB,MAAM,GAAG,GAAG,MAAM,uBAAuB,CAAC;YACxC,EAAE,EAAE,SAAS;SACd,CAAC,CAAC;QACH,OAAO,MAAM,KAAK,CAAC,KAAK,CACtB;YACE,GAAG;YACH,OAAO;SACR,EACD,YAAY,CACb,CAAC;KACH;SAAM,IAAI,CAAC,YAAY,CAAC,iBAAiB,EAAE;QAC1C,MAAM,IAAI,mBAAmB,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;KAChE;IACD,OAAO,MAAM,YAAY,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAClE,CAAC;AAED,M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AAU,EAAE,YAAY;IACxB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,aAAa,EAAE,eAAe;CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,mBAAmB,EAAE,qBAAqB;IAC1C,iBAAiB,EAAE,mBAAmB;IACtC,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,cAAc;IAC5B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,eAAe,EAAE,iBAAiB;IAClC,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,YAAY;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CACnB,CAAC","sourcesContent":["import { UnavailabilityError } from '@unimodules/core';\nimport { PermissionResponse, PermissionStatus } from 'unimodules-permissions-interface';\nimport { Platform, Share } from 'react-native';\nimport UUID from 'uuid-js';\n\nimport ExpoContacts from './ExpoContacts';\n\nexport type CalendarFormatType =\n | typeof CalendarFormats.Gregorian\n | typeof CalendarFormats.Buddhist\n | typeof CalendarFormats.Chinese\n | typeof CalendarFormats.Coptic\n | typeof CalendarFormats.EthiopicAmeteMihret\n | typeof CalendarFormats.EthiopicAmeteAlem\n | typeof CalendarFormats.Hebrew\n | typeof CalendarFormats.ISO8601\n | typeof CalendarFormats.Indian\n | typeof CalendarFormats.Islamic\n | typeof CalendarFormats.IslamicCivil\n | typeof CalendarFormats.Japanese\n | typeof CalendarFormats.Persian\n | typeof CalendarFormats.RepublicOfChina\n | typeof CalendarFormats.IslamicTabular\n | typeof CalendarFormats.IslamicUmmAlQura;\n\nexport type ContainerType =\n | typeof ContainerTypes.Local\n | typeof ContainerTypes.Exchange\n | typeof ContainerTypes.CardDAV\n | typeof ContainerTypes.Unassigned;\n\nexport type ContactType = typeof ContactTypes.Person | typeof ContactTypes.Company;\n\nexport type FieldType =\n | typeof Fields.ID\n | typeof Fields.ContactType\n | typeof Fields.Name\n | typeof Fields.FirstName\n | typeof Fields.MiddleName\n | typeof Fields.LastName\n | typeof Fields.MaidenName\n | typeof Fields.NamePrefix\n | typeof Fields.NameSuffix\n | typeof Fields.Nickname\n | typeof Fields.PhoneticFirstName\n | typeof Fields.PhoneticMiddleName\n | typeof Fields.PhoneticLastName\n | typeof Fields.Birthday\n | typeof Fields.NonGregorianBirthday\n | typeof Fields.Emails\n | typeof Fields.PhoneNumbers\n | typeof Fields.Addresses\n | typeof Fields.SocialProfiles\n | typeof Fields.InstantMessageAddresses\n | typeof Fields.UrlAddresses\n | typeof Fields.Company\n | typeof Fields.JobTitle\n | typeof Fields.Department\n | typeof Fields.ImageAvailable\n | typeof Fields.Image\n | typeof Fields.RawImage\n | typeof Fields.ExtraNames\n | typeof Fields.Note\n | typeof Fields.Dates\n | typeof Fields.Relationships;\n\nexport type Date = {\n day?: number;\n month?: number;\n year?: number;\n id: string;\n label: string;\n format?: CalendarFormatType;\n};\n\nexport type Relationship = {\n label: string;\n name?: string;\n id: string;\n};\n\nexport type Email = {\n email?: string;\n isPrimary?: boolean;\n label: string;\n id: string;\n};\n\nexport type PhoneNumber = {\n number?: string;\n isPrimary?: boolean;\n digits?: string;\n countryCode?: string;\n label: string;\n id: string;\n};\n\nexport type Address = {\n street?: string;\n city?: string;\n country?: string;\n region?: string;\n neighborhood?: string;\n postalCode?: string;\n poBox?: string;\n isoCountryCode?: string;\n label: string;\n id: string;\n};\n\nexport type SocialProfile = {\n service?: string;\n localizedProfile?: string;\n url?: string;\n username?: string;\n userId?: string;\n label: string;\n id: string;\n};\n\nexport type InstantMessageAddress = {\n service?: string;\n username?: string;\n localizedService?: string;\n label: string;\n id: string;\n};\n\nexport type UrlAddress = {\n label: string;\n url?: string;\n id: string;\n};\n\nexport type Image = {\n uri?: string;\n width?: number;\n height?: number;\n base64?: string;\n};\n\nexport type Contact = {\n id: string;\n contactType: ContactType;\n name: string;\n firstName?: string;\n middleName?: string;\n lastName?: string;\n maidenName?: string;\n namePrefix?: string;\n nameSuffix?: string;\n nickname?: string;\n phoneticFirstName?: string;\n phoneticMiddleName?: string;\n phoneticLastName?: string;\n company?: string;\n jobTitle?: string;\n department?: string;\n note?: string;\n imageAvailable?: boolean;\n image?: Image;\n rawImage?: Image;\n birthday?: Date;\n dates?: Date[];\n relationships?: Relationship[];\n emails?: Email[];\n phoneNumbers?: PhoneNumber[];\n addresses?: Address[];\n instantMessageAddresses?: InstantMessageAddress[];\n urlAddresses?: UrlAddress[];\n\n nonGregorianBirthday?: Date;\n socialProfiles?: SocialProfile[];\n};\n\nexport type ContactResponse = {\n data: Contact[];\n hasNextPage: boolean;\n hasPreviousPage: boolean;\n};\n\nexport type ContactSort =\n | typeof SortTypes.UserDefault\n | typeof SortTypes.FirstName\n | typeof SortTypes.LastName\n | typeof SortTypes.None;\n\nexport type ContactQuery = {\n pageSize?: number;\n pageOffset?: number;\n fields?: FieldType[];\n sort?: ContactSort;\n name?: string;\n id?: string | string[];\n groupId?: string;\n containerId?: string;\n rawContacts?: boolean;\n};\n\nexport type FormOptions = {\n displayedPropertyKeys?: FieldType[];\n message?: string;\n alternateName?: string;\n allowsEditing?: boolean;\n allowsActions?: boolean;\n shouldShowLinkedContacts?: boolean;\n isNew?: boolean;\n cancelButtonTitle?: string;\n preventAnimation?: boolean;\n groupId?: string;\n};\n\nexport type GroupQuery = {\n groupId?: string;\n groupName?: string;\n containerId?: string;\n};\n\nexport type Group = {\n name?: string;\n id?: string;\n};\n\nexport type ContainerQuery = {\n contactId?: string;\n groupId?: string;\n containerId?: string | string[];\n};\n\nexport type Container = {\n name: string;\n id: string;\n type: ContainerType;\n};\n\nexport { PermissionStatus, PermissionResponse };\n\nexport async function shareContactAsync(\n contactId: string,\n message: string,\n shareOptions: object = {}\n): Promise {\n if (Platform.OS === 'ios') {\n const url = await writeContactToFileAsync({\n id: contactId,\n });\n return await Share.share(\n {\n url,\n message,\n },\n shareOptions\n );\n } else if (!ExpoContacts.shareContactAsync) {\n throw new UnavailabilityError('Contacts', 'shareContactAsync');\n }\n return await ExpoContacts.shareContactAsync(contactId, message);\n}\n\nexport async function getContactsAsync(contactQuery: ContactQuery = {}): Promise {\n if (!ExpoContacts.getContactsAsync) {\n throw new UnavailabilityError('Contacts', 'getContactsAsync');\n }\n return await ExpoContacts.getContactsAsync(contactQuery);\n}\n\nexport async function getPagedContactsAsync(\n contactQuery: ContactQuery = {}\n): Promise {\n const { pageSize, ...nOptions } = contactQuery;\n\n if (pageSize && pageSize <= 0) {\n throw new Error('Error: Contacts.getPagedContactsAsync: `pageSize` must be greater than 0');\n }\n\n return await getContactsAsync({\n ...nOptions,\n pageSize,\n });\n}\n\nexport async function getContactByIdAsync(\n id: string,\n fields?: FieldType[]\n): Promise {\n if (!ExpoContacts.getContactsAsync) {\n throw new UnavailabilityError('Contacts', 'getContactsAsync');\n }\n\n if (id == null) {\n throw new Error('Error: Contacts.getContactByIdAsync: Please pass an ID as a parameter');\n } else {\n const results = await ExpoContacts.getContactsAsync({\n pageSize: 1,\n pageOffset: 0,\n fields,\n id,\n });\n if (results && results.data && results.data.length > 0) {\n return results.data[0];\n }\n }\n return undefined;\n}\n\nexport async function addContactAsync(contact: Contact, containerId?: string): Promise {\n if (!ExpoContacts.addContactAsync) {\n throw new UnavailabilityError('Contacts', 'addContactAsync');\n }\n return await ExpoContacts.addContactAsync(contact, containerId);\n}\n\nexport async function updateContactAsync(contact: Contact): Promise {\n if (!ExpoContacts.updateContactAsync) {\n throw new UnavailabilityError('Contacts', 'updateContactAsync');\n }\n return await ExpoContacts.updateContactAsync(contact);\n}\n\nexport async function removeContactAsync(contactId: string): Promise {\n if (!ExpoContacts.removeContactAsync) {\n throw new UnavailabilityError('Contacts', 'removeContactAsync');\n }\n return await ExpoContacts.removeContactAsync(contactId);\n}\n\nexport async function writeContactToFileAsync(\n contactQuery: ContactQuery = {}\n): Promise {\n if (!ExpoContacts.writeContactToFileAsync) {\n throw new UnavailabilityError('Contacts', 'writeContactToFileAsync');\n }\n return await ExpoContacts.writeContactToFileAsync(contactQuery);\n}\n\nexport async function presentFormAsync(\n contactId?: string | null,\n contact?: Contact | null,\n formOptions: FormOptions = {}\n): Promise {\n if (!ExpoContacts.presentFormAsync) {\n throw new UnavailabilityError('Contacts', 'presentFormAsync');\n }\n if (Platform.OS === 'ios') {\n let adjustedOptions = formOptions;\n\n if (contactId) {\n if (contact) {\n contact = undefined;\n console.log(\n 'Expo.Contacts.presentFormAsync: You should define either a `contact` or a `contactId` but not both.'\n );\n }\n if (adjustedOptions.isNew !== undefined) {\n console.log(\n 'Expo.Contacts.presentFormAsync: formOptions.isNew is not supported with `contactId`'\n );\n }\n }\n return await ExpoContacts.presentFormAsync(contactId, contact, adjustedOptions);\n } else {\n return await ExpoContacts.presentFormAsync(contactId, contact, formOptions);\n }\n}\n\n// iOS Only\n\nexport async function addExistingGroupToContainerAsync(\n groupId: string,\n containerId: string\n): Promise {\n if (!ExpoContacts.addExistingGroupToContainerAsync) {\n throw new UnavailabilityError('Contacts', 'addExistingGroupToContainerAsync');\n }\n\n return await ExpoContacts.addExistingGroupToContainerAsync(groupId, containerId);\n}\n\nexport async function createGroupAsync(name?: string, containerId?: string): Promise {\n if (!ExpoContacts.createGroupAsync) {\n throw new UnavailabilityError('Contacts', 'createGroupAsync');\n }\n\n name = name || UUID.create().toString();\n if (!containerId) {\n containerId = await getDefaultContainerIdAsync();\n }\n\n return await ExpoContacts.createGroupAsync(name, containerId);\n}\n\nexport async function updateGroupNameAsync(groupName: string, groupId: string): Promise {\n if (!ExpoContacts.updateGroupNameAsync) {\n throw new UnavailabilityError('Contacts', 'updateGroupNameAsync');\n }\n\n return await ExpoContacts.updateGroupNameAsync(groupName, groupId);\n}\n\nexport async function removeGroupAsync(groupId: string): Promise {\n if (!ExpoContacts.removeGroupAsync) {\n throw new UnavailabilityError('Contacts', 'removeGroupAsync');\n }\n\n return await ExpoContacts.removeGroupAsync(groupId);\n}\n\nexport async function addExistingContactToGroupAsync(\n contactId: string,\n groupId: string\n): Promise {\n if (!ExpoContacts.addExistingContactToGroupAsync) {\n throw new UnavailabilityError('Contacts', 'addExistingContactToGroupAsync');\n }\n\n return await ExpoContacts.addExistingContactToGroupAsync(contactId, groupId);\n}\n\nexport async function removeContactFromGroupAsync(\n contactId: string,\n groupId: string\n): Promise {\n if (!ExpoContacts.removeContactFromGroupAsync) {\n throw new UnavailabilityError('Contacts', 'removeContactFromGroupAsync');\n }\n\n return await ExpoContacts.removeContactFromGroupAsync(contactId, groupId);\n}\n\nexport async function getGroupsAsync(groupQuery: GroupQuery): Promise {\n if (!ExpoContacts.getGroupsAsync) {\n throw new UnavailabilityError('Contacts', 'getGroupsAsync');\n }\n\n return await ExpoContacts.getGroupsAsync(groupQuery);\n}\n\nexport async function getDefaultContainerIdAsync(): Promise {\n if (!ExpoContacts.getDefaultContainerIdentifierAsync) {\n throw new UnavailabilityError('Contacts', 'getDefaultContainerIdentifierAsync');\n }\n\n return await ExpoContacts.getDefaultContainerIdentifierAsync();\n}\n\nexport async function getContainersAsync(containerQuery: ContainerQuery): Promise {\n if (!ExpoContacts.getContainersAsync) {\n throw new UnavailabilityError('Contacts', 'getContainersAsync');\n }\n\n return await ExpoContacts.getContainersAsync(containerQuery);\n}\n\nexport async function getPermissionsAsync(): Promise {\n if (!ExpoContacts.getPermissionsAsync) {\n throw new UnavailabilityError('Contacts', 'getPermissionsAsync');\n }\n\n return ExpoContacts.getPermissionsAsync();\n}\n\nexport async function requestPermissionsAsync(): Promise {\n if (!ExpoContacts.requestPermissionsAsync) {\n throw new UnavailabilityError('Contacts', 'requestPermissionsAsync');\n }\n\n return await ExpoContacts.requestPermissionsAsync();\n}\n\n// Legacy\nexport const PHONE_NUMBERS = 'phoneNumbers';\nexport const EMAILS = 'emails';\nexport const ADDRESSES = 'addresses';\nexport const IMAGE = 'image';\nexport const RAW_IMAGE = 'rawImage';\nexport const NOTE = 'note';\nexport const BIRTHDAY = 'birthday';\nexport const NON_GREGORIAN_BIRTHDAY = 'nonGregorianBirthday';\nexport const NAME_PREFIX = 'namePrefix';\nexport const NAME_SUFFIX = 'nameSuffix';\nexport const PHONETIC_FIRST_NAME = 'phoneticFirstName';\nexport const PHONETIC_MIDDLE_NAME = 'phoneticMiddleName';\nexport const PHONETIC_LAST_NAME = 'phoneticLastName';\nexport const SOCIAL_PROFILES = 'socialProfiles';\nexport const IM_ADDRESSES = 'instantMessageAddresses';\nexport const URLS = 'urlAddresses';\nexport const DATES = 'dates';\nexport const RELATIONSHIPS = 'relationships';\n\nexport const Fields = {\n ID: 'id',\n ContactType: 'contactType',\n Name: 'name',\n FirstName: 'firstName',\n MiddleName: 'middleName',\n LastName: 'lastName',\n MaidenName: 'maidenName',\n NamePrefix: 'namePrefix',\n NameSuffix: 'nameSuffix',\n Nickname: 'nickname',\n PhoneticFirstName: 'phoneticFirstName',\n PhoneticMiddleName: 'phoneticMiddleName',\n PhoneticLastName: 'phoneticLastName',\n Birthday: 'birthday',\n NonGregorianBirthday: 'nonGregorianBirthday',\n Emails: 'emails',\n PhoneNumbers: 'phoneNumbers',\n Addresses: 'addresses',\n SocialProfiles: 'socialProfiles',\n InstantMessageAddresses: 'instantMessageAddresses',\n UrlAddresses: 'urlAddresses',\n Company: 'company',\n JobTitle: 'jobTitle',\n Department: 'department',\n ImageAvailable: 'imageAvailable',\n Image: 'image',\n RawImage: 'rawImage',\n ExtraNames: 'extraNames',\n Note: 'note',\n Dates: 'dates',\n Relationships: 'relationships',\n};\n\nexport const CalendarFormats = {\n Gregorian: 'gregorian',\n Buddhist: 'buddhist',\n Chinese: 'chinese',\n Coptic: 'coptic',\n EthiopicAmeteMihret: 'ethiopicAmeteMihret',\n EthiopicAmeteAlem: 'ethiopicAmeteAlem',\n Hebrew: 'hebrew',\n ISO8601: 'iso8601',\n Indian: 'indian',\n Islamic: 'islamic',\n IslamicCivil: 'islamicCivil',\n Japanese: 'japanese',\n Persian: 'persian',\n RepublicOfChina: 'republicOfChina',\n IslamicTabular: 'islamicTabular',\n IslamicUmmAlQura: 'islamicUmmAlQura',\n};\n\nexport const ContainerTypes = {\n Local: 'local',\n Exchange: 'exchange',\n CardDAV: 'cardDAV',\n Unassigned: 'unassigned',\n};\n\nexport const SortTypes = {\n UserDefault: 'userDefault',\n FirstName: 'firstName',\n LastName: 'lastName',\n None: 'none',\n};\n\nexport const ContactTypes = {\n Person: 'person',\n Company: 'company',\n};\n"]} \ No newline at end of file diff --git a/packages/expo-contacts/src/Contacts.ts b/packages/expo-contacts/src/Contacts.ts index 44834c866b356..1644c85ab6286 100644 --- a/packages/expo-contacts/src/Contacts.ts +++ b/packages/expo-contacts/src/Contacts.ts @@ -303,7 +303,7 @@ export async function getContactByIdAsync( return undefined; } -export async function addContactAsync(contact: Contact, containerId: string): Promise { +export async function addContactAsync(contact: Contact, containerId?: string): Promise { if (!ExpoContacts.addContactAsync) { throw new UnavailabilityError('Contacts', 'addContactAsync'); }