expo-contacts 12.3.1 → 12.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/android/build.gradle +11 -8
- package/build/Contacts.d.ts +18 -18
- package/build/Contacts.d.ts.map +1 -1
- package/build/Contacts.js +25 -3
- package/build/Contacts.js.map +1 -1
- package/package.json +2 -2
- package/src/Contacts.ts +51 -26
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,20 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 12.5.0 — 2023-09-15
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 12.4.0 — 2023-09-04
|
|
18
|
+
|
|
19
|
+
### 🎉 New features
|
|
20
|
+
|
|
21
|
+
- Added support for React Native 0.73. ([#24018](https://github.com/expo/expo/pull/24018) by [@kudo](https://github.com/kudo))
|
|
22
|
+
|
|
23
|
+
### 🐛 Bug fixes
|
|
24
|
+
|
|
25
|
+
- [Android] Fix `addContactAsync` failing when an e-mail or a phone number is provided with an id. ([#23877](https://github.com/expo/expo/pull/23877) by [@behenate](https://github.com/behenate))
|
|
26
|
+
|
|
13
27
|
## 12.3.1 — 2023-08-02
|
|
14
28
|
|
|
15
29
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '12.
|
|
6
|
+
version = '12.5.0'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
9
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -53,13 +53,16 @@ afterEvaluate {
|
|
|
53
53
|
android {
|
|
54
54
|
compileSdkVersion safeExtGet("compileSdkVersion", 33)
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
57
|
+
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
|
|
58
|
+
compileOptions {
|
|
59
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
60
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
61
|
+
}
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
kotlinOptions {
|
|
64
|
+
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
65
|
+
}
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
namespace "expo.modules.contacts"
|
|
@@ -67,7 +70,7 @@ android {
|
|
|
67
70
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
68
71
|
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
69
72
|
versionCode 29
|
|
70
|
-
versionName "12.
|
|
73
|
+
versionName "12.5.0"
|
|
71
74
|
}
|
|
72
75
|
lintOptions {
|
|
73
76
|
abortOnError false
|
package/build/Contacts.d.ts
CHANGED
|
@@ -17,9 +17,9 @@ export type Date = {
|
|
|
17
17
|
*/
|
|
18
18
|
year?: number;
|
|
19
19
|
/**
|
|
20
|
-
* Unique ID.
|
|
20
|
+
* Unique ID. This value will be generated by the OS.
|
|
21
21
|
*/
|
|
22
|
-
id
|
|
22
|
+
id?: string;
|
|
23
23
|
/**
|
|
24
24
|
* Localized display name.
|
|
25
25
|
*/
|
|
@@ -39,9 +39,9 @@ export type Relationship = {
|
|
|
39
39
|
*/
|
|
40
40
|
name?: string;
|
|
41
41
|
/**
|
|
42
|
-
* Unique ID.
|
|
42
|
+
* Unique ID. This value will be generated by the OS.
|
|
43
43
|
*/
|
|
44
|
-
id
|
|
44
|
+
id?: string;
|
|
45
45
|
};
|
|
46
46
|
export type Email = {
|
|
47
47
|
/**
|
|
@@ -57,9 +57,9 @@ export type Email = {
|
|
|
57
57
|
*/
|
|
58
58
|
label: string;
|
|
59
59
|
/**
|
|
60
|
-
* Unique ID.
|
|
60
|
+
* Unique ID. This value will be generated by the OS.
|
|
61
61
|
*/
|
|
62
|
-
id
|
|
62
|
+
id?: string;
|
|
63
63
|
};
|
|
64
64
|
export type PhoneNumber = {
|
|
65
65
|
/**
|
|
@@ -85,9 +85,9 @@ export type PhoneNumber = {
|
|
|
85
85
|
*/
|
|
86
86
|
label: string;
|
|
87
87
|
/**
|
|
88
|
-
* Unique ID.
|
|
88
|
+
* Unique ID. This value will be generated by the OS.
|
|
89
89
|
*/
|
|
90
|
-
id
|
|
90
|
+
id?: string;
|
|
91
91
|
};
|
|
92
92
|
export type Address = {
|
|
93
93
|
/**
|
|
@@ -127,9 +127,9 @@ export type Address = {
|
|
|
127
127
|
*/
|
|
128
128
|
label: string;
|
|
129
129
|
/**
|
|
130
|
-
* Unique ID.
|
|
130
|
+
* Unique ID. This value will be generated by the OS.
|
|
131
131
|
*/
|
|
132
|
-
id
|
|
132
|
+
id?: string;
|
|
133
133
|
};
|
|
134
134
|
/**
|
|
135
135
|
* @platform ios
|
|
@@ -160,9 +160,9 @@ export type SocialProfile = {
|
|
|
160
160
|
*/
|
|
161
161
|
label: string;
|
|
162
162
|
/**
|
|
163
|
-
* Unique ID.
|
|
163
|
+
* Unique ID. This value will be generated by the OS.
|
|
164
164
|
*/
|
|
165
|
-
id
|
|
165
|
+
id?: string;
|
|
166
166
|
};
|
|
167
167
|
export type InstantMessageAddress = {
|
|
168
168
|
/**
|
|
@@ -182,9 +182,9 @@ export type InstantMessageAddress = {
|
|
|
182
182
|
*/
|
|
183
183
|
label: string;
|
|
184
184
|
/**
|
|
185
|
-
* Unique ID.
|
|
185
|
+
* Unique ID. This value will be generated by the OS.
|
|
186
186
|
*/
|
|
187
|
-
id
|
|
187
|
+
id?: string;
|
|
188
188
|
};
|
|
189
189
|
export type UrlAddress = {
|
|
190
190
|
/**
|
|
@@ -196,9 +196,9 @@ export type UrlAddress = {
|
|
|
196
196
|
*/
|
|
197
197
|
url?: string;
|
|
198
198
|
/**
|
|
199
|
-
* Unique ID.
|
|
199
|
+
* Unique ID. This value will be generated by the OS.
|
|
200
200
|
*/
|
|
201
|
-
id
|
|
201
|
+
id?: string;
|
|
202
202
|
};
|
|
203
203
|
/**
|
|
204
204
|
* Information regarding thumbnail images.
|
|
@@ -226,9 +226,9 @@ export type Image = {
|
|
|
226
226
|
*/
|
|
227
227
|
export type Contact = {
|
|
228
228
|
/**
|
|
229
|
-
* Immutable identifier used for querying and indexing.
|
|
229
|
+
* Immutable identifier used for querying and indexing. This value will be generated by the OS when the contact is created.
|
|
230
230
|
*/
|
|
231
|
-
id
|
|
231
|
+
id?: string;
|
|
232
232
|
/**
|
|
233
233
|
* Denoting a person or company.
|
|
234
234
|
*/
|
package/build/Contacts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contacts.d.ts","sourceRoot":"","sources":["../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Contacts.d.ts","sourceRoot":"","sources":["../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAA6B,MAAM,mBAAmB,CAAC;AAKpG,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG,GAAG,eAAe,EAAE,CAAC;AAExE,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,GAAG,cAAc,EAAE,CAAC;AAEjE,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,GAAG,YAAY,EAAE,CAAC;AAE3D,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;AAE7C,MAAM,MAAM,IAAI,GAAG;IACjB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;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AQ,aAAa;IACrB;;OAEG;IACH,OAAO,YAAY;IACnB;;OAEG;IACH,UAAU,eAAe;CAC1B;AAED,oBAAY,SAAS;IACnB;;;OAGG;IACH,WAAW,gBAAgB;IAC3B;;OAEG;IACH,SAAS,cAAc;IACvB;;OAEG;IACH,QAAQ,aAAa;IACrB;;OAEG;IACH,IAAI,SAAS;CACd;AAED,oBAAY,YAAY;IACtB;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,OAAO,YAAY;CACpB"}
|
package/build/Contacts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PermissionStatus, UnavailabilityError,
|
|
1
|
+
import { PermissionStatus, UnavailabilityError, uuid } from 'expo-modules-core';
|
|
2
2
|
import { Platform, Share } from 'react-native';
|
|
3
3
|
import ExpoContacts from './ExpoContacts';
|
|
4
4
|
export { PermissionStatus };
|
|
@@ -110,7 +110,8 @@ export async function addContactAsync(contact, containerId) {
|
|
|
110
110
|
if (!ExpoContacts.addContactAsync) {
|
|
111
111
|
throw new UnavailabilityError('Contacts', 'addContactAsync');
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
const noIdContact = removeIds(contact);
|
|
114
|
+
return await ExpoContacts.addContactAsync(noIdContact, containerId);
|
|
114
115
|
}
|
|
115
116
|
/**
|
|
116
117
|
* Mutate the information of an existing contact. Due to an iOS bug, `nonGregorianBirthday` field cannot be modified.
|
|
@@ -235,7 +236,7 @@ export async function createGroupAsync(name, containerId) {
|
|
|
235
236
|
if (!ExpoContacts.createGroupAsync) {
|
|
236
237
|
throw new UnavailabilityError('Contacts', 'createGroupAsync');
|
|
237
238
|
}
|
|
238
|
-
name = name ||
|
|
239
|
+
name = name || uuid.v4();
|
|
239
240
|
if (!containerId) {
|
|
240
241
|
containerId = await getDefaultContainerIdAsync();
|
|
241
242
|
}
|
|
@@ -384,6 +385,27 @@ export async function requestPermissionsAsync() {
|
|
|
384
385
|
}
|
|
385
386
|
return await ExpoContacts.requestPermissionsAsync();
|
|
386
387
|
}
|
|
388
|
+
/** @private */
|
|
389
|
+
function removeIds(contact) {
|
|
390
|
+
const updatedContact = { ...contact };
|
|
391
|
+
if (contact.id && __DEV__) {
|
|
392
|
+
console.warn(`You have set an id = ${contact.id} for the contact. This value will be ignored, because the id will be generated by the OS`);
|
|
393
|
+
delete updatedContact.id;
|
|
394
|
+
}
|
|
395
|
+
for (const key of Object.keys(contact)) {
|
|
396
|
+
if (Array.isArray(contact[key])) {
|
|
397
|
+
updatedContact[key] = contact[key].map((item, index) => {
|
|
398
|
+
if (item.id) {
|
|
399
|
+
__DEV__ &&
|
|
400
|
+
console.warn(`You have set an id "${item.id}" at index "${index}" for the key "${key}" of the contact. This value will be ignored, because the id will be generated by the OS`);
|
|
401
|
+
return { ...item, id: null };
|
|
402
|
+
}
|
|
403
|
+
return item;
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return updatedContact;
|
|
408
|
+
}
|
|
387
409
|
/**
|
|
388
410
|
* Possible fields to retrieve for a contact.
|
|
389
411
|
*/
|
package/build/Contacts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contacts.js","sourceRoot":"","sources":["../src/Contacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAChB,mBAAmB,EACnB,MAAM,GACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AA+hB1C,OAAO,EAAE,gBAAgB,EAAsB,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,OAAO,CAAC,CAAC,YAAY,CAAC,gBAAgB,CAAC;AACzC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,SAAiB,EACjB,OAAe,EACf,eAAuB,EAAE;IAEzB,IAAI,QAAQ,CAAC,E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abilityError,\n uuidv4,\n} from 'expo-modules-core';\nimport { Platform, Share } from 'react-native';\n\nimport ExpoContacts from './ExpoContacts';\n\nexport type CalendarFormatType = CalendarFormats | `${CalendarFormats}`;\n\nexport type ContainerType = ContainerTypes | `${ContainerTypes}`;\n\nexport type ContactType = ContactTypes | `${ContactTypes}`;\n\nexport type FieldType = Fields | `${Fields}`;\n\nexport type Date = {\n /**\n * Day.\n */\n day?: number;\n /**\n * Month - adjusted for JavaScript `Date` which starts at `0`.\n */\n month?: number;\n /**\n * Year.\n */\n year?: number;\n /**\n * Unique ID.\n */\n id: string;\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Format for the input date.\n */\n format?: CalendarFormatType;\n};\n\nexport type Relationship = {\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Name of related contact.\n */\n name?: string;\n /**\n * Unique ID.\n */\n id: string;\n};\n\nexport type Email = {\n /**\n * Email address.\n */\n email?: string;\n /**\n * Flag signifying if it is a primary email address.\n */\n isPrimary?: boolean;\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Unique ID.\n */\n id: string;\n};\n\nexport type PhoneNumber = {\n /**\n * Phone number.\n */\n number?: string;\n /**\n * Flag signifying if it is a primary phone number.\n */\n isPrimary?: boolean;\n /**\n * Phone number without format.\n * @example `8674305`\n */\n digits?: string;\n /**\n * Country code.\n * @example `+1`\n */\n countryCode?: string;\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Unique ID.\n */\n id: string;\n};\n\nexport type Address = {\n /**\n * Street name.\n */\n street?: string;\n /**\n * City name.\n */\n city?: string;\n /**\n * Country name\n */\n country?: string;\n /**\n * Region or state name.\n */\n region?: string;\n /**\n * Neighborhood name.\n */\n neighborhood?: string;\n /**\n * Local post code.\n */\n postalCode?: string;\n /**\n * P.O. Box.\n */\n poBox?: string;\n /**\n * [Standard country code](https://www.iso.org/iso-3166-country-codes.html).\n */\n isoCountryCode?: string;\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Unique ID.\n */\n id: string;\n};\n\n/**\n * @platform ios\n */\nexport type SocialProfile = {\n /**\n * Name of social app.\n */\n service?: string;\n /**\n * Localized profile name.\n */\n localizedProfile?: string;\n /**\n * Web URL.\n */\n url?: string;\n /**\n * Username in social app.\n */\n username?: string;\n /**\n * Username ID in social app.\n */\n userId?: string;\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Unique ID.\n */\n id: string;\n};\n\nexport type InstantMessageAddress = {\n /**\n * Name of instant messaging app.\n */\n service?: string;\n /**\n * Username in IM app.\n */\n username?: string;\n /**\n * Localized name of app.\n */\n localizedService?: string;\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Unique ID.\n */\n id: string;\n};\n\nexport type UrlAddress = {\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Web URL.\n */\n url?: string;\n /**\n * Unique ID.\n */\n id: string;\n};\n\n// @needs-audit\n/**\n * Information regarding thumbnail images.\n * > On Android you can get dimensions using [`Image.getSize`](https://reactnative.dev/docs/image#getsize) method.\n */\nexport type Image = {\n uri?: string;\n /**\n * Image width.\n * @platform ios\n */\n width?: number;\n /**\n * Image height\n * @platform ios\n */\n height?: number;\n /**\n * Image as Base64 string.\n */\n base64?: string;\n};\n\n/**\n * A set of fields that define information about a single contact entity.\n */\nexport type Contact = {\n /**\n * Immutable identifier used for querying and indexing.\n */\n id: string;\n /**\n * Denoting a person or company.\n */\n contactType: ContactType;\n /**\n * Full name with proper format.\n */\n name: string;\n /**\n * Given name.\n */\n firstName?: string;\n /**\n * Middle name\n */\n middleName?: string;\n /**\n * Last name.\n */\n lastName?: string;\n /**\n * Maiden name.\n */\n maidenName?: string;\n /**\n * Dr. Mr. Mrs. ect…\n */\n namePrefix?: string;\n /**\n * Jr. Sr. ect…\n */\n nameSuffix?: string;\n /**\n * An alias to the proper name.\n */\n nickname?: string;\n /**\n * Pronunciation of the first name.\n */\n phoneticFirstName?: string;\n /**\n * Pronunciation of the middle name.\n */\n phoneticMiddleName?: string;\n /**\n * Pronunciation of the last name.\n */\n phoneticLastName?: string;\n /**\n * Organization the entity belongs to.\n */\n company?: string;\n /**\n * Job description.\n */\n jobTitle?: string;\n /**\n * Job department.\n */\n department?: string;\n /**\n * Additional information.\n * > On iOS 13+, the `note` field [requires your app to request additional entitlements](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_contacts_notes).\n * > The Expo Go app does not contain those entitlements, so in order to test this feature you will need to [request the entitlement from Apple](https://developer.apple.com/contact/request/contact-note-field),\n * > set the [`ios.accessesContactNotes`](./config/app.mdx#accessescontactnotes) field in app.json to `true`, and [create your development build](/develop/development-builds/create-a-build/).\n */\n note?: string;\n /**\n * Used for efficient retrieval of images.\n */\n imageAvailable?: boolean;\n /**\n * Thumbnail image. On iOS it size is set to 320×320px, on Android it may vary.\n */\n image?: Image;\n /**\n * Raw image without cropping, usually large.\n */\n rawImage?: Image;\n /**\n * Birthday information in Gregorian format.\n */\n birthday?: Date;\n /**\n * A labeled list of other relevant user dates in Gregorian format.\n */\n dates?: Date[];\n /**\n * Names of other relevant user connections.\n */\n relationships?: Relationship[];\n /**\n * Email addresses.\n */\n emails?: Email[];\n /**\n * Phone numbers.\n */\n phoneNumbers?: PhoneNumber[];\n /**\n * Locations.\n */\n addresses?: Address[];\n /**\n * Instant messaging connections.\n */\n instantMessageAddresses?: InstantMessageAddress[];\n /**\n * Associated web URLs.\n */\n urlAddresses?: UrlAddress[];\n /**\n * Birthday that doesn't conform to the Gregorian calendar format, interpreted based on the [calendar `format`](#date) setting.\n * @platform ios\n */\n nonGregorianBirthday?: Date;\n /**\n * Social networks.\n * @platform ios\n */\n socialProfiles?: SocialProfile[];\n};\n\n/**\n * The return value for queried contact operations like `getContactsAsync`.\n */\nexport type ContactResponse = {\n /**\n * An array of contacts that match a particular query.\n */\n data: Contact[];\n /**\n * This will be `true` if there are more contacts to retrieve beyond what is returned.\n */\n hasNextPage: boolean;\n /**\n * This will be `true if there are previous contacts that weren't retrieved due to `pageOffset` limit.\n */\n hasPreviousPage: boolean;\n};\n\nexport type ContactSort = `${SortTypes}`;\n\n/**\n * Used to query contacts from the user's device.\n */\nexport type ContactQuery = {\n /**\n * The max number of contacts to return. If skipped or set to `0` all contacts will be returned.\n */\n pageSize?: number;\n /**\n * The number of contacts to skip before gathering contacts.\n */\n pageOffset?: number;\n /**\n * If specified, the defined fields will be returned. If skipped, all fields will be returned.\n */\n fields?: FieldType[];\n /**\n * Sort method used when gathering contacts.\n */\n sort?: ContactSort;\n /**\n * Get all contacts whose name contains the provided string (not case-sensitive).\n */\n name?: string;\n /**\n * Get contacts with a matching ID or array of IDs.\n */\n id?: string | string[];\n /**\n * Get all contacts that belong to the group matching this ID.\n * @platform ios\n */\n groupId?: string;\n /**\n * Get all contacts that belong to the container matching this ID.\n * @platform ios\n */\n containerId?: string;\n /**\n * Prevent unification of contacts when gathering.\n * @default false\n * @platform ios\n */\n rawContacts?: boolean;\n};\n\n/**\n * Denotes the functionality of a native contact form.\n */\nexport type FormOptions = {\n /**\n * The properties that will be displayed. On iOS those properties does nothing while in editing mode.\n */\n displayedPropertyKeys?: FieldType[];\n /**\n * Controller title.\n */\n message?: string;\n /**\n * Used if contact doesn't have a name defined.\n */\n alternateName?: string;\n /**\n * Allows for contact mutation.\n */\n allowsEditing?: boolean;\n /**\n * Actions like share, add, create.\n */\n allowsActions?: boolean;\n /**\n * Show or hide the similar contacts.\n */\n shouldShowLinkedContacts?: boolean;\n /**\n * Present the new contact controller. If set to `false` the unknown controller will be shown.\n */\n isNew?: boolean;\n /**\n * The name of the left bar button.\n */\n cancelButtonTitle?: string;\n /**\n * Prevents the controller from animating in.\n */\n preventAnimation?: boolean;\n /**\n * The parent group for a new contact.\n */\n groupId?: string;\n};\n\n/**\n * Used to query native contact groups.\n * @platform ios\n */\nexport type GroupQuery = {\n /**\n * Query the group with a matching ID.\n */\n groupId?: string;\n /**\n * Query all groups matching a name.\n */\n groupName?: string;\n /**\n * Query all groups that belong to a certain container.\n */\n containerId?: string;\n};\n\n/**\n * A parent to contacts. A contact can belong to multiple groups. Here are some query operations you can perform:\n * - Child Contacts: `getContactsAsync({ groupId })`\n * - Groups From Container: `getGroupsAsync({ containerId })`\n * - Groups Named: `getContainersAsync({ groupName })`\n * @platform ios\n */\nexport type Group = {\n /**\n * Immutable id representing the group.\n */\n name?: string;\n /**\n * The editable name of a group.\n */\n id?: string;\n};\n\n/**\n * Used to query native contact containers.\n * @platform ios\n */\nexport type ContainerQuery = {\n /**\n * Query all the containers that parent a contact.\n */\n contactId?: string;\n /**\n * Query all the containers that parent a group.\n */\n groupId?: string;\n /**\n * Query all the containers that matches ID or an array od IDs.\n */\n containerId?: string | string[];\n};\n\nexport type Container = {\n name: string;\n id: string;\n type: ContainerType;\n};\n\nexport { PermissionStatus, PermissionResponse };\n\n/**\n * Returns whether the Contacts API is enabled on the current device. This method does not check the app permissions.\n * @returns A promise that fulfills with a `boolean`, indicating whether the Contacts API is available on the current device. It always resolves to `false` on web.\n */\nexport async function isAvailableAsync(): Promise<boolean> {\n return !!ExpoContacts.getContactsAsync;\n}\n\nexport async function shareContactAsync(\n contactId: string,\n message: string,\n shareOptions: object = {}\n): Promise<any> {\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\n/**\n * Return a list of contacts that fit a given criteria. You can get all of the contacts by passing no criteria.\n * @param contactQuery Object used to query contacts.\n * @return A promise that fulfills with `ContactResponse` object returned from the query.\n * @example\n * ```js\n * const { data } = await Contacts.getContactsAsync({\n * fields: [Contacts.Fields.Emails],\n * });\n *\n * if (data.length > 0) {\n * const contact = data[0];\n * console.log(contact);\n * }\n * ```\n */\nexport async function getContactsAsync(contactQuery: ContactQuery = {}): Promise<ContactResponse> {\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<ContactResponse> {\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\n/**\n * Used for gathering precise data about a contact. Returns a contact matching the given `id`.\n * @param id The ID of a system contact.\n * @param fields If specified, the fields defined will be returned. When skipped, all fields will be returned.\n * @return A promise that fulfills with `Contact` object with ID matching the input ID, or `undefined` if there is no match.\n * @example\n * ```js\n * const contact = await Contacts.getContactByIdAsync('161A368D-D614-4A15-8DC6-665FDBCFAE55');\n * if (contact) {\n * console.log(contact);\n * }\n * ```\n */\nexport async function getContactByIdAsync(\n id: string,\n fields?: FieldType[]\n): Promise<Contact | undefined> {\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\n/**\n * Creates a new contact and adds it to the system.\n * > **Note**: For Android users, the Expo Go app does not have the required `WRITE_CONTACTS` permission to write to Contacts.\n * > You will need to create a [development build](/develop/development-builds/create-a-build/) and add permission in there manually to use this method.\n * @param contact A contact with the changes you wish to persist. The `id` parameter will not be used.\n * @param containerId @tag-ios The container that will parent the contact.\n * @return A promise that fulfills with ID of the new system contact.\n * @example\n * ```js\n * const contact = {\n * [Contacts.Fields.FirstName]: 'Bird',\n * [Contacts.Fields.LastName]: 'Man',\n * [Contacts.Fields.Company]: 'Young Money',\n * };\n * const contactId = await Contacts.addContactAsync(contact);\n * ```\n */\nexport async function addContactAsync(contact: Contact, containerId?: string): Promise<string> {\n if (!ExpoContacts.addContactAsync) {\n throw new UnavailabilityError('Contacts', 'addContactAsync');\n }\n return await ExpoContacts.addContactAsync(contact, containerId);\n}\n\n/**\n * Mutate the information of an existing contact. Due to an iOS bug, `nonGregorianBirthday` field cannot be modified.\n * > **info** On Android, you can use [`presentFormAsync`](#contactspresentformasynccontactid-contact-formoptions) to make edits to contacts.\n * @param contact A contact object including the wanted changes.\n * @return A promise that fulfills with ID of the updated system contact if mutation was successful.\n * @example\n * ```js\n * const contact = {\n * id: '161A368D-D614-4A15-8DC6-665FDBCFAE55',\n * [Contacts.Fields.FirstName]: 'Drake',\n * [Contacts.Fields.Company]: 'Young Money',\n * };\n * await Contacts.updateContactAsync(contact);\n * ```\n * @platform ios\n */\nexport async function updateContactAsync(contact: Contact): Promise<string> {\n if (!ExpoContacts.updateContactAsync) {\n throw new UnavailabilityError('Contacts', 'updateContactAsync');\n }\n return await ExpoContacts.updateContactAsync(contact);\n}\n\n// @needs-audit\n/**\n * Delete a contact from the system.\n * @param contactId ID of the contact you want to delete.\n * @example\n * ```js\n * await Contacts.removeContactAsync('161A368D-D614-4A15-8DC6-665FDBCFAE55');\n * ```\n * @platform ios\n */\nexport async function removeContactAsync(contactId: string): Promise<any> {\n if (!ExpoContacts.removeContactAsync) {\n throw new UnavailabilityError('Contacts', 'removeContactAsync');\n }\n return await ExpoContacts.removeContactAsync(contactId);\n}\n\n/**\n * Query a set of contacts and write them to a local URI that can be used for sharing.\n * @param contactQuery Used to query contact you want to write.\n * @return A promise that fulfills with shareable local URI, or `undefined` if there was no match.\n * @example\n * ```js\n * const localUri = await Contacts.writeContactToFileAsync({\n * id: '161A368D-D614-4A15-8DC6-665FDBCFAE55',\n * });\n * Share.share({ url: localUri, message: 'Call me!' });\n * ```\n */\nexport async function writeContactToFileAsync(\n contactQuery: ContactQuery = {}\n): Promise<string | undefined> {\n if (!ExpoContacts.writeContactToFileAsync) {\n throw new UnavailabilityError('Contacts', 'writeContactToFileAsync');\n }\n return await ExpoContacts.writeContactToFileAsync(contactQuery);\n}\n\n// @needs-audit\n/**\n * Present a native form for manipulating contacts.\n * @param contactId The ID of a system contact.\n * @param contact A contact with the changes you want to persist.\n * @param formOptions Options for the native editor.\n * @example\n * ```js\n * await Contacts.presentFormAsync('161A368D-D614-4A15-8DC6-665FDBCFAE55');\n * ```\n */\nexport async function presentFormAsync(\n contactId?: string | null,\n contact?: Contact | null,\n formOptions: FormOptions = {}\n): Promise<any> {\n if (!ExpoContacts.presentFormAsync) {\n throw new UnavailabilityError('Contacts', 'presentFormAsync');\n }\n if (Platform.OS === 'ios') {\n const 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\n/**\n * Add a group to a container.\n * @param groupId The group you want to target.\n * @param containerId The container you want to add membership to.\n * @example\n * ```js\n * await Contacts.addExistingGroupToContainerAsync(\n * '161A368D-D614-4A15-8DC6-665FDBCFAE55',\n * '665FDBCFAE55-D614-4A15-8DC6-161A368D'\n * );\n * ```\n * @platform ios\n */\nexport async function addExistingGroupToContainerAsync(\n groupId: string,\n containerId: string\n): Promise<any> {\n if (!ExpoContacts.addExistingGroupToContainerAsync) {\n throw new UnavailabilityError('Contacts', 'addExistingGroupToContainerAsync');\n }\n\n return await ExpoContacts.addExistingGroupToContainerAsync(groupId, containerId);\n}\n\n/**\n * Create a group with a name, and add it to a container. If the container is undefined, the default container will be targeted.\n * @param name Name of the new group.\n * @param containerId The container you to add membership to.\n * @return A promise that fulfills with ID of the new group.\n * @example\n * ```js\n * const groupId = await Contacts.createGroupAsync('Sailor Moon');\n * ```\n * @platform ios\n */\nexport async function createGroupAsync(name?: string, containerId?: string): Promise<string> {\n if (!ExpoContacts.createGroupAsync) {\n throw new UnavailabilityError('Contacts', 'createGroupAsync');\n }\n\n name = name || uuidv4();\n if (!containerId) {\n containerId = await getDefaultContainerIdAsync();\n }\n\n return await ExpoContacts.createGroupAsync(name, containerId);\n}\n\n/**\n * Change the name of an existing group.\n * @param groupName New name for an existing group.\n * @param groupId ID of the group you want to edit.\n * @example\n * ```js\n * await Contacts.updateGroupName('Expo Friends', '161A368D-D614-4A15-8DC6-665FDBCFAE55');\n * ```\n * @platform ios\n */\nexport async function updateGroupNameAsync(groupName: string, groupId: string): Promise<any> {\n if (!ExpoContacts.updateGroupNameAsync) {\n throw new UnavailabilityError('Contacts', 'updateGroupNameAsync');\n }\n\n return await ExpoContacts.updateGroupNameAsync(groupName, groupId);\n}\n\n// @needs-audit\n/**\n * Delete a group from the device.\n * @param groupId ID of the group you want to remove.\n * @example\n * ```js\n * await Contacts.removeGroupAsync('161A368D-D614-4A15-8DC6-665FDBCFAE55');\n * ```\n * @platform ios\n */\nexport async function removeGroupAsync(groupId: string): Promise<any> {\n if (!ExpoContacts.removeGroupAsync) {\n throw new UnavailabilityError('Contacts', 'removeGroupAsync');\n }\n\n return await ExpoContacts.removeGroupAsync(groupId);\n}\n\n// @needs-audit\n/**\n * Add a contact as a member to a group. A contact can be a member of multiple groups.\n * @param contactId ID of the contact you want to edit.\n * @param groupId ID for the group you want to add membership to.\n * @example\n * ```js\n * await Contacts.addExistingContactToGroupAsync(\n * '665FDBCFAE55-D614-4A15-8DC6-161A368D',\n * '161A368D-D614-4A15-8DC6-665FDBCFAE55'\n * );\n * ```\n * @platform ios\n */\nexport async function addExistingContactToGroupAsync(\n contactId: string,\n groupId: string\n): Promise<any> {\n if (!ExpoContacts.addExistingContactToGroupAsync) {\n throw new UnavailabilityError('Contacts', 'addExistingContactToGroupAsync');\n }\n\n return await ExpoContacts.addExistingContactToGroupAsync(contactId, groupId);\n}\n\n// @needs-audit\n/**\n * Remove a contact's membership from a given group. This will not delete the contact.\n * @param contactId ID of the contact you want to remove.\n * @param groupId ID for the group you want to remove membership of.\n * @example\n * ```js\n * await Contacts.removeContactFromGroupAsync(\n * '665FDBCFAE55-D614-4A15-8DC6-161A368D',\n * '161A368D-D614-4A15-8DC6-665FDBCFAE55'\n * );\n * ```\n * @platform ios\n */\nexport async function removeContactFromGroupAsync(\n contactId: string,\n groupId: string\n): Promise<any> {\n if (!ExpoContacts.removeContactFromGroupAsync) {\n throw new UnavailabilityError('Contacts', 'removeContactFromGroupAsync');\n }\n\n return await ExpoContacts.removeContactFromGroupAsync(contactId, groupId);\n}\n\n// @needs-audit\n/**\n * Query and return a list of system groups.\n * @param groupQuery Information regarding which groups you want to get.\n * @example\n * ```js\n * const groups = await Contacts.getGroupsAsync({ groupName: 'sailor moon' });\n * const allGroups = await Contacts.getGroupsAsync({});\n * ```\n * @return A promise that fulfills with array of groups that fit the query.\n * @platform ios\n */\nexport async function getGroupsAsync(groupQuery: GroupQuery): Promise<Group[]> {\n if (!ExpoContacts.getGroupsAsync) {\n throw new UnavailabilityError('Contacts', 'getGroupsAsync');\n }\n\n return await ExpoContacts.getGroupsAsync(groupQuery);\n}\n\n/**\n * Get the default container's ID.\n * @return A promise that fulfills with default container ID.\n * @example\n * ```js\n * const containerId = await Contacts.getDefaultContainerIdAsync();\n * ```\n * @platform ios\n */\nexport async function getDefaultContainerIdAsync(): Promise<string> {\n if (!ExpoContacts.getDefaultContainerIdentifierAsync) {\n throw new UnavailabilityError('Contacts', 'getDefaultContainerIdentifierAsync');\n }\n\n return await ExpoContacts.getDefaultContainerIdentifierAsync();\n}\n\n/**\n * Query a list of system containers.\n * @param containerQuery Information used to gather containers.\n * @return A promise that fulfills with array of containers that fit the query.\n * @example\n * ```js\n * const allContainers = await Contacts.getContainersAsync({\n * contactId: '665FDBCFAE55-D614-4A15-8DC6-161A368D',\n * });\n * ```\n * @platform ios\n */\nexport async function getContainersAsync(containerQuery: ContainerQuery): Promise<Container[]> {\n if (!ExpoContacts.getContainersAsync) {\n throw new UnavailabilityError('Contacts', 'getContainersAsync');\n }\n\n return await ExpoContacts.getContainersAsync(containerQuery);\n}\n\n/**\n * Checks user's permissions for accessing contacts data.\n * @return A promise that resolves to a [PermissionResponse](#permissionresponse) object.\n */\nexport async function getPermissionsAsync(): Promise<PermissionResponse> {\n if (!ExpoContacts.getPermissionsAsync) {\n throw new UnavailabilityError('Contacts', 'getPermissionsAsync');\n }\n\n return await ExpoContacts.getPermissionsAsync();\n}\n\n/**\n * Asks the user to grant permissions for accessing contacts data.\n * @return A promise that resolves to a [PermissionResponse](#permissionresponse) object.\n */\nexport async function requestPermissionsAsync(): Promise<PermissionResponse> {\n if (!ExpoContacts.requestPermissionsAsync) {\n throw new UnavailabilityError('Contacts', 'requestPermissionsAsync');\n }\n\n return await ExpoContacts.requestPermissionsAsync();\n}\n\n/**\n * Possible fields to retrieve for a contact.\n */\nexport enum 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 /**\n * @platform ios\n */\n NonGregorianBirthday = 'nonGregorianBirthday',\n Emails = 'emails',\n PhoneNumbers = 'phoneNumbers',\n Addresses = 'addresses',\n /**\n * @platform ios\n */\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\n/**\n * This format denotes the common calendar format used to specify how a date is calculated in `nonGregorianBirthday` fields.\n */\nexport enum CalendarFormats {\n Gregorian = 'gregorian',\n /**\n * @platform ios\n */\n Buddhist = 'buddhist',\n /**\n * @platform ios\n */\n Chinese = 'chinese',\n /**\n * @platform ios\n */\n Coptic = 'coptic',\n /**\n * @platform ios\n */\n EthiopicAmeteMihret = 'ethiopicAmeteMihret',\n /**\n * @platform ios\n */\n EthiopicAmeteAlem = 'ethiopicAmeteAlem',\n /**\n * @platform ios\n */\n Hebrew = 'hebrew',\n /**\n * @platform ios\n */\n ISO8601 = 'iso8601',\n /**\n * @platform ios\n */\n Indian = 'indian',\n /**\n * @platform ios\n */\n Islamic = 'islamic',\n /**\n * @platform ios\n */\n IslamicCivil = 'islamicCivil',\n /**\n * @platform ios\n */\n Japanese = 'japanese',\n /**\n * @platform ios\n */\n Persian = 'persian',\n /**\n * @platform ios\n */\n RepublicOfChina = 'republicOfChina',\n /**\n * @platform ios\n */\n IslamicTabular = 'islamicTabular',\n /**\n * @platform ios\n */\n IslamicUmmAlQura = 'islamicUmmAlQura',\n}\n\n/**\n * @platform ios\n */\nexport enum ContainerTypes {\n /**\n * A local non-iCloud container.\n */\n Local = 'local',\n /**\n * In association with email server.\n */\n Exchange = 'exchange',\n /**\n * With cardDAV protocol used for sharing.\n */\n CardDAV = 'cardDAV',\n /**\n * Unknown container.\n */\n Unassigned = 'unassigned',\n}\n\nexport enum SortTypes {\n /**\n * The user default method of sorting.\n * @platform android\n */\n UserDefault = 'userDefault',\n /**\n * Sort by first name in ascending order.\n */\n FirstName = 'firstName',\n /**\n * Sort by last name in ascending order.\n */\n LastName = 'lastName',\n /**\n * No sorting should be applied.\n */\n None = 'none',\n}\n\nexport enum ContactTypes {\n /**\n * Contact is a human.\n */\n Person = 'person',\n /**\n * Contact is group or company.\n */\n Company = 'company',\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Contacts.js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X;AATD,WAAY,YAAY;IACtB;;OAEG;IACH,iCAAiB,CAAA;IACjB;;OAEG;IACH,mCAAmB,CAAA;AACrB,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB","sourcesContent":["import { PermissionResponse, PermissionStatus, UnavailabilityError, uuid } from 'expo-modules-core';\nimport { Platform, Share } from 'react-native';\n\nimport ExpoContacts from './ExpoContacts';\n\nexport type CalendarFormatType = CalendarFormats | `${CalendarFormats}`;\n\nexport type ContainerType = ContainerTypes | `${ContainerTypes}`;\n\nexport type ContactType = ContactTypes | `${ContactTypes}`;\n\nexport type FieldType = Fields | `${Fields}`;\n\nexport type Date = {\n /**\n * Day.\n */\n day?: number;\n /**\n * Month - adjusted for JavaScript `Date` which starts at `0`.\n */\n month?: number;\n /**\n * Year.\n */\n year?: number;\n /**\n * Unique ID. This value will be generated by the OS.\n */\n id?: string;\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Format for the input date.\n */\n format?: CalendarFormatType;\n};\n\nexport type Relationship = {\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Name of related contact.\n */\n name?: string;\n /**\n * Unique ID. This value will be generated by the OS.\n */\n id?: string;\n};\n\nexport type Email = {\n /**\n * Email address.\n */\n email?: string;\n /**\n * Flag signifying if it is a primary email address.\n */\n isPrimary?: boolean;\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Unique ID. This value will be generated by the OS.\n */\n id?: string;\n};\n\nexport type PhoneNumber = {\n /**\n * Phone number.\n */\n number?: string;\n /**\n * Flag signifying if it is a primary phone number.\n */\n isPrimary?: boolean;\n /**\n * Phone number without format.\n * @example `8674305`\n */\n digits?: string;\n /**\n * Country code.\n * @example `+1`\n */\n countryCode?: string;\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Unique ID. This value will be generated by the OS.\n */\n id?: string;\n};\n\nexport type Address = {\n /**\n * Street name.\n */\n street?: string;\n /**\n * City name.\n */\n city?: string;\n /**\n * Country name\n */\n country?: string;\n /**\n * Region or state name.\n */\n region?: string;\n /**\n * Neighborhood name.\n */\n neighborhood?: string;\n /**\n * Local post code.\n */\n postalCode?: string;\n /**\n * P.O. Box.\n */\n poBox?: string;\n /**\n * [Standard country code](https://www.iso.org/iso-3166-country-codes.html).\n */\n isoCountryCode?: string;\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Unique ID. This value will be generated by the OS.\n */\n id?: string;\n};\n\n/**\n * @platform ios\n */\nexport type SocialProfile = {\n /**\n * Name of social app.\n */\n service?: string;\n /**\n * Localized profile name.\n */\n localizedProfile?: string;\n /**\n * Web URL.\n */\n url?: string;\n /**\n * Username in social app.\n */\n username?: string;\n /**\n * Username ID in social app.\n */\n userId?: string;\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Unique ID. This value will be generated by the OS.\n */\n id?: string;\n};\n\nexport type InstantMessageAddress = {\n /**\n * Name of instant messaging app.\n */\n service?: string;\n /**\n * Username in IM app.\n */\n username?: string;\n /**\n * Localized name of app.\n */\n localizedService?: string;\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Unique ID. This value will be generated by the OS.\n */\n id?: string;\n};\n\nexport type UrlAddress = {\n /**\n * Localized display name.\n */\n label: string;\n /**\n * Web URL.\n */\n url?: string;\n /**\n * Unique ID. This value will be generated by the OS.\n */\n id?: string;\n};\n\n// @needs-audit\n/**\n * Information regarding thumbnail images.\n * > On Android you can get dimensions using [`Image.getSize`](https://reactnative.dev/docs/image#getsize) method.\n */\nexport type Image = {\n uri?: string;\n /**\n * Image width.\n * @platform ios\n */\n width?: number;\n /**\n * Image height\n * @platform ios\n */\n height?: number;\n /**\n * Image as Base64 string.\n */\n base64?: string;\n};\n\n/**\n * A set of fields that define information about a single contact entity.\n */\nexport type Contact = {\n /**\n * Immutable identifier used for querying and indexing. This value will be generated by the OS when the contact is created.\n */\n id?: string;\n /**\n * Denoting a person or company.\n */\n contactType: ContactType;\n /**\n * Full name with proper format.\n */\n name: string;\n /**\n * Given name.\n */\n firstName?: string;\n /**\n * Middle name\n */\n middleName?: string;\n /**\n * Last name.\n */\n lastName?: string;\n /**\n * Maiden name.\n */\n maidenName?: string;\n /**\n * Dr. Mr. Mrs. ect…\n */\n namePrefix?: string;\n /**\n * Jr. Sr. ect…\n */\n nameSuffix?: string;\n /**\n * An alias to the proper name.\n */\n nickname?: string;\n /**\n * Pronunciation of the first name.\n */\n phoneticFirstName?: string;\n /**\n * Pronunciation of the middle name.\n */\n phoneticMiddleName?: string;\n /**\n * Pronunciation of the last name.\n */\n phoneticLastName?: string;\n /**\n * Organization the entity belongs to.\n */\n company?: string;\n /**\n * Job description.\n */\n jobTitle?: string;\n /**\n * Job department.\n */\n department?: string;\n /**\n * Additional information.\n * > On iOS 13+, the `note` field [requires your app to request additional entitlements](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_contacts_notes).\n * > The Expo Go app does not contain those entitlements, so in order to test this feature you will need to [request the entitlement from Apple](https://developer.apple.com/contact/request/contact-note-field),\n * > set the [`ios.accessesContactNotes`](./config/app.mdx#accessescontactnotes) field in app.json to `true`, and [create your development build](/develop/development-builds/create-a-build/).\n */\n note?: string;\n /**\n * Used for efficient retrieval of images.\n */\n imageAvailable?: boolean;\n /**\n * Thumbnail image. On iOS it size is set to 320×320px, on Android it may vary.\n */\n image?: Image;\n /**\n * Raw image without cropping, usually large.\n */\n rawImage?: Image;\n /**\n * Birthday information in Gregorian format.\n */\n birthday?: Date;\n /**\n * A labeled list of other relevant user dates in Gregorian format.\n */\n dates?: Date[];\n /**\n * Names of other relevant user connections.\n */\n relationships?: Relationship[];\n /**\n * Email addresses.\n */\n emails?: Email[];\n /**\n * Phone numbers.\n */\n phoneNumbers?: PhoneNumber[];\n /**\n * Locations.\n */\n addresses?: Address[];\n /**\n * Instant messaging connections.\n */\n instantMessageAddresses?: InstantMessageAddress[];\n /**\n * Associated web URLs.\n */\n urlAddresses?: UrlAddress[];\n /**\n * Birthday that doesn't conform to the Gregorian calendar format, interpreted based on the [calendar `format`](#date) setting.\n * @platform ios\n */\n nonGregorianBirthday?: Date;\n /**\n * Social networks.\n * @platform ios\n */\n socialProfiles?: SocialProfile[];\n};\n\n/**\n * The return value for queried contact operations like `getContactsAsync`.\n */\nexport type ContactResponse = {\n /**\n * An array of contacts that match a particular query.\n */\n data: Contact[];\n /**\n * This will be `true` if there are more contacts to retrieve beyond what is returned.\n */\n hasNextPage: boolean;\n /**\n * This will be `true if there are previous contacts that weren't retrieved due to `pageOffset` limit.\n */\n hasPreviousPage: boolean;\n};\n\nexport type ContactSort = `${SortTypes}`;\n\n/**\n * Used to query contacts from the user's device.\n */\nexport type ContactQuery = {\n /**\n * The max number of contacts to return. If skipped or set to `0` all contacts will be returned.\n */\n pageSize?: number;\n /**\n * The number of contacts to skip before gathering contacts.\n */\n pageOffset?: number;\n /**\n * If specified, the defined fields will be returned. If skipped, all fields will be returned.\n */\n fields?: FieldType[];\n /**\n * Sort method used when gathering contacts.\n */\n sort?: ContactSort;\n /**\n * Get all contacts whose name contains the provided string (not case-sensitive).\n */\n name?: string;\n /**\n * Get contacts with a matching ID or array of IDs.\n */\n id?: string | string[];\n /**\n * Get all contacts that belong to the group matching this ID.\n * @platform ios\n */\n groupId?: string;\n /**\n * Get all contacts that belong to the container matching this ID.\n * @platform ios\n */\n containerId?: string;\n /**\n * Prevent unification of contacts when gathering.\n * @default false\n * @platform ios\n */\n rawContacts?: boolean;\n};\n\n/**\n * Denotes the functionality of a native contact form.\n */\nexport type FormOptions = {\n /**\n * The properties that will be displayed. On iOS those properties does nothing while in editing mode.\n */\n displayedPropertyKeys?: FieldType[];\n /**\n * Controller title.\n */\n message?: string;\n /**\n * Used if contact doesn't have a name defined.\n */\n alternateName?: string;\n /**\n * Allows for contact mutation.\n */\n allowsEditing?: boolean;\n /**\n * Actions like share, add, create.\n */\n allowsActions?: boolean;\n /**\n * Show or hide the similar contacts.\n */\n shouldShowLinkedContacts?: boolean;\n /**\n * Present the new contact controller. If set to `false` the unknown controller will be shown.\n */\n isNew?: boolean;\n /**\n * The name of the left bar button.\n */\n cancelButtonTitle?: string;\n /**\n * Prevents the controller from animating in.\n */\n preventAnimation?: boolean;\n /**\n * The parent group for a new contact.\n */\n groupId?: string;\n};\n\n/**\n * Used to query native contact groups.\n * @platform ios\n */\nexport type GroupQuery = {\n /**\n * Query the group with a matching ID.\n */\n groupId?: string;\n /**\n * Query all groups matching a name.\n */\n groupName?: string;\n /**\n * Query all groups that belong to a certain container.\n */\n containerId?: string;\n};\n\n/**\n * A parent to contacts. A contact can belong to multiple groups. Here are some query operations you can perform:\n * - Child Contacts: `getContactsAsync({ groupId })`\n * - Groups From Container: `getGroupsAsync({ containerId })`\n * - Groups Named: `getContainersAsync({ groupName })`\n * @platform ios\n */\nexport type Group = {\n /**\n * Immutable id representing the group.\n */\n name?: string;\n /**\n * The editable name of a group.\n */\n id?: string;\n};\n\n/**\n * Used to query native contact containers.\n * @platform ios\n */\nexport type ContainerQuery = {\n /**\n * Query all the containers that parent a contact.\n */\n contactId?: string;\n /**\n * Query all the containers that parent a group.\n */\n groupId?: string;\n /**\n * Query all the containers that matches ID or an array od IDs.\n */\n containerId?: string | string[];\n};\n\nexport type Container = {\n name: string;\n id: string;\n type: ContainerType;\n};\n\nexport { PermissionStatus, PermissionResponse };\n\n/**\n * Returns whether the Contacts API is enabled on the current device. This method does not check the app permissions.\n * @returns A promise that fulfills with a `boolean`, indicating whether the Contacts API is available on the current device. It always resolves to `false` on web.\n */\nexport async function isAvailableAsync(): Promise<boolean> {\n return !!ExpoContacts.getContactsAsync;\n}\n\nexport async function shareContactAsync(\n contactId: string,\n message: string,\n shareOptions: object = {}\n): Promise<any> {\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\n/**\n * Return a list of contacts that fit a given criteria. You can get all of the contacts by passing no criteria.\n * @param contactQuery Object used to query contacts.\n * @return A promise that fulfills with `ContactResponse` object returned from the query.\n * @example\n * ```js\n * const { data } = await Contacts.getContactsAsync({\n * fields: [Contacts.Fields.Emails],\n * });\n *\n * if (data.length > 0) {\n * const contact = data[0];\n * console.log(contact);\n * }\n * ```\n */\nexport async function getContactsAsync(contactQuery: ContactQuery = {}): Promise<ContactResponse> {\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<ContactResponse> {\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\n/**\n * Used for gathering precise data about a contact. Returns a contact matching the given `id`.\n * @param id The ID of a system contact.\n * @param fields If specified, the fields defined will be returned. When skipped, all fields will be returned.\n * @return A promise that fulfills with `Contact` object with ID matching the input ID, or `undefined` if there is no match.\n * @example\n * ```js\n * const contact = await Contacts.getContactByIdAsync('161A368D-D614-4A15-8DC6-665FDBCFAE55');\n * if (contact) {\n * console.log(contact);\n * }\n * ```\n */\nexport async function getContactByIdAsync(\n id: string,\n fields?: FieldType[]\n): Promise<Contact | undefined> {\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\n/**\n * Creates a new contact and adds it to the system.\n * > **Note**: For Android users, the Expo Go app does not have the required `WRITE_CONTACTS` permission to write to Contacts.\n * > You will need to create a [development build](/develop/development-builds/create-a-build/) and add permission in there manually to use this method.\n * @param contact A contact with the changes you wish to persist. The `id` parameter will not be used.\n * @param containerId @tag-ios The container that will parent the contact.\n * @return A promise that fulfills with ID of the new system contact.\n * @example\n * ```js\n * const contact = {\n * [Contacts.Fields.FirstName]: 'Bird',\n * [Contacts.Fields.LastName]: 'Man',\n * [Contacts.Fields.Company]: 'Young Money',\n * };\n * const contactId = await Contacts.addContactAsync(contact);\n * ```\n */\nexport async function addContactAsync(contact: Contact, containerId?: string): Promise<string> {\n if (!ExpoContacts.addContactAsync) {\n throw new UnavailabilityError('Contacts', 'addContactAsync');\n }\n\n const noIdContact = removeIds(contact);\n\n return await ExpoContacts.addContactAsync(noIdContact, containerId);\n}\n\n/**\n * Mutate the information of an existing contact. Due to an iOS bug, `nonGregorianBirthday` field cannot be modified.\n * > **info** On Android, you can use [`presentFormAsync`](#contactspresentformasynccontactid-contact-formoptions) to make edits to contacts.\n * @param contact A contact object including the wanted changes.\n * @return A promise that fulfills with ID of the updated system contact if mutation was successful.\n * @example\n * ```js\n * const contact = {\n * id: '161A368D-D614-4A15-8DC6-665FDBCFAE55',\n * [Contacts.Fields.FirstName]: 'Drake',\n * [Contacts.Fields.Company]: 'Young Money',\n * };\n * await Contacts.updateContactAsync(contact);\n * ```\n * @platform ios\n */\nexport async function updateContactAsync(contact: Contact): Promise<string> {\n if (!ExpoContacts.updateContactAsync) {\n throw new UnavailabilityError('Contacts', 'updateContactAsync');\n }\n return await ExpoContacts.updateContactAsync(contact);\n}\n\n// @needs-audit\n/**\n * Delete a contact from the system.\n * @param contactId ID of the contact you want to delete.\n * @example\n * ```js\n * await Contacts.removeContactAsync('161A368D-D614-4A15-8DC6-665FDBCFAE55');\n * ```\n * @platform ios\n */\nexport async function removeContactAsync(contactId: string): Promise<any> {\n if (!ExpoContacts.removeContactAsync) {\n throw new UnavailabilityError('Contacts', 'removeContactAsync');\n }\n return await ExpoContacts.removeContactAsync(contactId);\n}\n\n/**\n * Query a set of contacts and write them to a local URI that can be used for sharing.\n * @param contactQuery Used to query contact you want to write.\n * @return A promise that fulfills with shareable local URI, or `undefined` if there was no match.\n * @example\n * ```js\n * const localUri = await Contacts.writeContactToFileAsync({\n * id: '161A368D-D614-4A15-8DC6-665FDBCFAE55',\n * });\n * Share.share({ url: localUri, message: 'Call me!' });\n * ```\n */\nexport async function writeContactToFileAsync(\n contactQuery: ContactQuery = {}\n): Promise<string | undefined> {\n if (!ExpoContacts.writeContactToFileAsync) {\n throw new UnavailabilityError('Contacts', 'writeContactToFileAsync');\n }\n return await ExpoContacts.writeContactToFileAsync(contactQuery);\n}\n\n// @needs-audit\n/**\n * Present a native form for manipulating contacts.\n * @param contactId The ID of a system contact.\n * @param contact A contact with the changes you want to persist.\n * @param formOptions Options for the native editor.\n * @example\n * ```js\n * await Contacts.presentFormAsync('161A368D-D614-4A15-8DC6-665FDBCFAE55');\n * ```\n */\nexport async function presentFormAsync(\n contactId?: string | null,\n contact?: Contact | null,\n formOptions: FormOptions = {}\n): Promise<any> {\n if (!ExpoContacts.presentFormAsync) {\n throw new UnavailabilityError('Contacts', 'presentFormAsync');\n }\n if (Platform.OS === 'ios') {\n const 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\n/**\n * Add a group to a container.\n * @param groupId The group you want to target.\n * @param containerId The container you want to add membership to.\n * @example\n * ```js\n * await Contacts.addExistingGroupToContainerAsync(\n * '161A368D-D614-4A15-8DC6-665FDBCFAE55',\n * '665FDBCFAE55-D614-4A15-8DC6-161A368D'\n * );\n * ```\n * @platform ios\n */\nexport async function addExistingGroupToContainerAsync(\n groupId: string,\n containerId: string\n): Promise<any> {\n if (!ExpoContacts.addExistingGroupToContainerAsync) {\n throw new UnavailabilityError('Contacts', 'addExistingGroupToContainerAsync');\n }\n\n return await ExpoContacts.addExistingGroupToContainerAsync(groupId, containerId);\n}\n\n/**\n * Create a group with a name, and add it to a container. If the container is undefined, the default container will be targeted.\n * @param name Name of the new group.\n * @param containerId The container you to add membership to.\n * @return A promise that fulfills with ID of the new group.\n * @example\n * ```js\n * const groupId = await Contacts.createGroupAsync('Sailor Moon');\n * ```\n * @platform ios\n */\nexport async function createGroupAsync(name?: string, containerId?: string): Promise<string> {\n if (!ExpoContacts.createGroupAsync) {\n throw new UnavailabilityError('Contacts', 'createGroupAsync');\n }\n\n name = name || uuid.v4();\n if (!containerId) {\n containerId = await getDefaultContainerIdAsync();\n }\n\n return await ExpoContacts.createGroupAsync(name, containerId);\n}\n\n/**\n * Change the name of an existing group.\n * @param groupName New name for an existing group.\n * @param groupId ID of the group you want to edit.\n * @example\n * ```js\n * await Contacts.updateGroupName('Expo Friends', '161A368D-D614-4A15-8DC6-665FDBCFAE55');\n * ```\n * @platform ios\n */\nexport async function updateGroupNameAsync(groupName: string, groupId: string): Promise<any> {\n if (!ExpoContacts.updateGroupNameAsync) {\n throw new UnavailabilityError('Contacts', 'updateGroupNameAsync');\n }\n\n return await ExpoContacts.updateGroupNameAsync(groupName, groupId);\n}\n\n// @needs-audit\n/**\n * Delete a group from the device.\n * @param groupId ID of the group you want to remove.\n * @example\n * ```js\n * await Contacts.removeGroupAsync('161A368D-D614-4A15-8DC6-665FDBCFAE55');\n * ```\n * @platform ios\n */\nexport async function removeGroupAsync(groupId: string): Promise<any> {\n if (!ExpoContacts.removeGroupAsync) {\n throw new UnavailabilityError('Contacts', 'removeGroupAsync');\n }\n\n return await ExpoContacts.removeGroupAsync(groupId);\n}\n\n// @needs-audit\n/**\n * Add a contact as a member to a group. A contact can be a member of multiple groups.\n * @param contactId ID of the contact you want to edit.\n * @param groupId ID for the group you want to add membership to.\n * @example\n * ```js\n * await Contacts.addExistingContactToGroupAsync(\n * '665FDBCFAE55-D614-4A15-8DC6-161A368D',\n * '161A368D-D614-4A15-8DC6-665FDBCFAE55'\n * );\n * ```\n * @platform ios\n */\nexport async function addExistingContactToGroupAsync(\n contactId: string,\n groupId: string\n): Promise<any> {\n if (!ExpoContacts.addExistingContactToGroupAsync) {\n throw new UnavailabilityError('Contacts', 'addExistingContactToGroupAsync');\n }\n\n return await ExpoContacts.addExistingContactToGroupAsync(contactId, groupId);\n}\n\n// @needs-audit\n/**\n * Remove a contact's membership from a given group. This will not delete the contact.\n * @param contactId ID of the contact you want to remove.\n * @param groupId ID for the group you want to remove membership of.\n * @example\n * ```js\n * await Contacts.removeContactFromGroupAsync(\n * '665FDBCFAE55-D614-4A15-8DC6-161A368D',\n * '161A368D-D614-4A15-8DC6-665FDBCFAE55'\n * );\n * ```\n * @platform ios\n */\nexport async function removeContactFromGroupAsync(\n contactId: string,\n groupId: string\n): Promise<any> {\n if (!ExpoContacts.removeContactFromGroupAsync) {\n throw new UnavailabilityError('Contacts', 'removeContactFromGroupAsync');\n }\n\n return await ExpoContacts.removeContactFromGroupAsync(contactId, groupId);\n}\n\n// @needs-audit\n/**\n * Query and return a list of system groups.\n * @param groupQuery Information regarding which groups you want to get.\n * @example\n * ```js\n * const groups = await Contacts.getGroupsAsync({ groupName: 'sailor moon' });\n * const allGroups = await Contacts.getGroupsAsync({});\n * ```\n * @return A promise that fulfills with array of groups that fit the query.\n * @platform ios\n */\nexport async function getGroupsAsync(groupQuery: GroupQuery): Promise<Group[]> {\n if (!ExpoContacts.getGroupsAsync) {\n throw new UnavailabilityError('Contacts', 'getGroupsAsync');\n }\n\n return await ExpoContacts.getGroupsAsync(groupQuery);\n}\n\n/**\n * Get the default container's ID.\n * @return A promise that fulfills with default container ID.\n * @example\n * ```js\n * const containerId = await Contacts.getDefaultContainerIdAsync();\n * ```\n * @platform ios\n */\nexport async function getDefaultContainerIdAsync(): Promise<string> {\n if (!ExpoContacts.getDefaultContainerIdentifierAsync) {\n throw new UnavailabilityError('Contacts', 'getDefaultContainerIdentifierAsync');\n }\n\n return await ExpoContacts.getDefaultContainerIdentifierAsync();\n}\n\n/**\n * Query a list of system containers.\n * @param containerQuery Information used to gather containers.\n * @return A promise that fulfills with array of containers that fit the query.\n * @example\n * ```js\n * const allContainers = await Contacts.getContainersAsync({\n * contactId: '665FDBCFAE55-D614-4A15-8DC6-161A368D',\n * });\n * ```\n * @platform ios\n */\nexport async function getContainersAsync(containerQuery: ContainerQuery): Promise<Container[]> {\n if (!ExpoContacts.getContainersAsync) {\n throw new UnavailabilityError('Contacts', 'getContainersAsync');\n }\n\n return await ExpoContacts.getContainersAsync(containerQuery);\n}\n\n/**\n * Checks user's permissions for accessing contacts data.\n * @return A promise that resolves to a [PermissionResponse](#permissionresponse) object.\n */\nexport async function getPermissionsAsync(): Promise<PermissionResponse> {\n if (!ExpoContacts.getPermissionsAsync) {\n throw new UnavailabilityError('Contacts', 'getPermissionsAsync');\n }\n\n return await ExpoContacts.getPermissionsAsync();\n}\n\n/**\n * Asks the user to grant permissions for accessing contacts data.\n * @return A promise that resolves to a [PermissionResponse](#permissionresponse) object.\n */\nexport async function requestPermissionsAsync(): Promise<PermissionResponse> {\n if (!ExpoContacts.requestPermissionsAsync) {\n throw new UnavailabilityError('Contacts', 'requestPermissionsAsync');\n }\n\n return await ExpoContacts.requestPermissionsAsync();\n}\n\n/** @private */\nfunction removeIds(contact: Contact): Contact {\n const updatedContact = { ...contact };\n if (contact.id && __DEV__) {\n console.warn(\n `You have set an id = ${contact.id} for the contact. This value will be ignored, because the id will be generated by the OS`\n );\n delete updatedContact.id;\n }\n\n for (const key of Object.keys(contact)) {\n if (Array.isArray(contact[key])) {\n updatedContact[key] = contact[key].map((item, index) => {\n if (item.id) {\n __DEV__ &&\n console.warn(\n `You have set an id \"${item.id}\" at index \"${index}\" for the key \"${key}\" of the contact. This value will be ignored, because the id will be generated by the OS`\n );\n return { ...item, id: null };\n }\n return item;\n });\n }\n }\n return updatedContact;\n}\n\n/**\n * Possible fields to retrieve for a contact.\n */\nexport enum 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 /**\n * @platform ios\n */\n NonGregorianBirthday = 'nonGregorianBirthday',\n Emails = 'emails',\n PhoneNumbers = 'phoneNumbers',\n Addresses = 'addresses',\n /**\n * @platform ios\n */\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\n/**\n * This format denotes the common calendar format used to specify how a date is calculated in `nonGregorianBirthday` fields.\n */\nexport enum CalendarFormats {\n Gregorian = 'gregorian',\n /**\n * @platform ios\n */\n Buddhist = 'buddhist',\n /**\n * @platform ios\n */\n Chinese = 'chinese',\n /**\n * @platform ios\n */\n Coptic = 'coptic',\n /**\n * @platform ios\n */\n EthiopicAmeteMihret = 'ethiopicAmeteMihret',\n /**\n * @platform ios\n */\n EthiopicAmeteAlem = 'ethiopicAmeteAlem',\n /**\n * @platform ios\n */\n Hebrew = 'hebrew',\n /**\n * @platform ios\n */\n ISO8601 = 'iso8601',\n /**\n * @platform ios\n */\n Indian = 'indian',\n /**\n * @platform ios\n */\n Islamic = 'islamic',\n /**\n * @platform ios\n */\n IslamicCivil = 'islamicCivil',\n /**\n * @platform ios\n */\n Japanese = 'japanese',\n /**\n * @platform ios\n */\n Persian = 'persian',\n /**\n * @platform ios\n */\n RepublicOfChina = 'republicOfChina',\n /**\n * @platform ios\n */\n IslamicTabular = 'islamicTabular',\n /**\n * @platform ios\n */\n IslamicUmmAlQura = 'islamicUmmAlQura',\n}\n\n/**\n * @platform ios\n */\nexport enum ContainerTypes {\n /**\n * A local non-iCloud container.\n */\n Local = 'local',\n /**\n * In association with email server.\n */\n Exchange = 'exchange',\n /**\n * With cardDAV protocol used for sharing.\n */\n CardDAV = 'cardDAV',\n /**\n * Unknown container.\n */\n Unassigned = 'unassigned',\n}\n\nexport enum SortTypes {\n /**\n * The user default method of sorting.\n * @platform android\n */\n UserDefault = 'userDefault',\n /**\n * Sort by first name in ascending order.\n */\n FirstName = 'firstName',\n /**\n * Sort by last name in ascending order.\n */\n LastName = 'lastName',\n /**\n * No sorting should be applied.\n */\n None = 'none',\n}\n\nexport enum ContactTypes {\n /**\n * Contact is a human.\n */\n Person = 'person',\n /**\n * Contact is group or company.\n */\n Company = 'company',\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-contacts",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.5.0",
|
|
4
4
|
"description": "Provides access to the phone's system contacts.",
|
|
5
5
|
"main": "build/Contacts.js",
|
|
6
6
|
"types": "build/Contacts.d.ts",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"expo": "*"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "ee2c866ba3c7fbc35ff2a3e896041cf15d3bd7c5"
|
|
47
47
|
}
|
package/src/Contacts.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PermissionResponse,
|
|
3
|
-
PermissionStatus,
|
|
4
|
-
UnavailabilityError,
|
|
5
|
-
uuidv4,
|
|
6
|
-
} from 'expo-modules-core';
|
|
1
|
+
import { PermissionResponse, PermissionStatus, UnavailabilityError, uuid } from 'expo-modules-core';
|
|
7
2
|
import { Platform, Share } from 'react-native';
|
|
8
3
|
|
|
9
4
|
import ExpoContacts from './ExpoContacts';
|
|
@@ -30,9 +25,9 @@ export type Date = {
|
|
|
30
25
|
*/
|
|
31
26
|
year?: number;
|
|
32
27
|
/**
|
|
33
|
-
* Unique ID.
|
|
28
|
+
* Unique ID. This value will be generated by the OS.
|
|
34
29
|
*/
|
|
35
|
-
id
|
|
30
|
+
id?: string;
|
|
36
31
|
/**
|
|
37
32
|
* Localized display name.
|
|
38
33
|
*/
|
|
@@ -53,9 +48,9 @@ export type Relationship = {
|
|
|
53
48
|
*/
|
|
54
49
|
name?: string;
|
|
55
50
|
/**
|
|
56
|
-
* Unique ID.
|
|
51
|
+
* Unique ID. This value will be generated by the OS.
|
|
57
52
|
*/
|
|
58
|
-
id
|
|
53
|
+
id?: string;
|
|
59
54
|
};
|
|
60
55
|
|
|
61
56
|
export type Email = {
|
|
@@ -72,9 +67,9 @@ export type Email = {
|
|
|
72
67
|
*/
|
|
73
68
|
label: string;
|
|
74
69
|
/**
|
|
75
|
-
* Unique ID.
|
|
70
|
+
* Unique ID. This value will be generated by the OS.
|
|
76
71
|
*/
|
|
77
|
-
id
|
|
72
|
+
id?: string;
|
|
78
73
|
};
|
|
79
74
|
|
|
80
75
|
export type PhoneNumber = {
|
|
@@ -101,9 +96,9 @@ export type PhoneNumber = {
|
|
|
101
96
|
*/
|
|
102
97
|
label: string;
|
|
103
98
|
/**
|
|
104
|
-
* Unique ID.
|
|
99
|
+
* Unique ID. This value will be generated by the OS.
|
|
105
100
|
*/
|
|
106
|
-
id
|
|
101
|
+
id?: string;
|
|
107
102
|
};
|
|
108
103
|
|
|
109
104
|
export type Address = {
|
|
@@ -144,9 +139,9 @@ export type Address = {
|
|
|
144
139
|
*/
|
|
145
140
|
label: string;
|
|
146
141
|
/**
|
|
147
|
-
* Unique ID.
|
|
142
|
+
* Unique ID. This value will be generated by the OS.
|
|
148
143
|
*/
|
|
149
|
-
id
|
|
144
|
+
id?: string;
|
|
150
145
|
};
|
|
151
146
|
|
|
152
147
|
/**
|
|
@@ -178,9 +173,9 @@ export type SocialProfile = {
|
|
|
178
173
|
*/
|
|
179
174
|
label: string;
|
|
180
175
|
/**
|
|
181
|
-
* Unique ID.
|
|
176
|
+
* Unique ID. This value will be generated by the OS.
|
|
182
177
|
*/
|
|
183
|
-
id
|
|
178
|
+
id?: string;
|
|
184
179
|
};
|
|
185
180
|
|
|
186
181
|
export type InstantMessageAddress = {
|
|
@@ -201,9 +196,9 @@ export type InstantMessageAddress = {
|
|
|
201
196
|
*/
|
|
202
197
|
label: string;
|
|
203
198
|
/**
|
|
204
|
-
* Unique ID.
|
|
199
|
+
* Unique ID. This value will be generated by the OS.
|
|
205
200
|
*/
|
|
206
|
-
id
|
|
201
|
+
id?: string;
|
|
207
202
|
};
|
|
208
203
|
|
|
209
204
|
export type UrlAddress = {
|
|
@@ -216,9 +211,9 @@ export type UrlAddress = {
|
|
|
216
211
|
*/
|
|
217
212
|
url?: string;
|
|
218
213
|
/**
|
|
219
|
-
* Unique ID.
|
|
214
|
+
* Unique ID. This value will be generated by the OS.
|
|
220
215
|
*/
|
|
221
|
-
id
|
|
216
|
+
id?: string;
|
|
222
217
|
};
|
|
223
218
|
|
|
224
219
|
// @needs-audit
|
|
@@ -249,9 +244,9 @@ export type Image = {
|
|
|
249
244
|
*/
|
|
250
245
|
export type Contact = {
|
|
251
246
|
/**
|
|
252
|
-
* Immutable identifier used for querying and indexing.
|
|
247
|
+
* Immutable identifier used for querying and indexing. This value will be generated by the OS when the contact is created.
|
|
253
248
|
*/
|
|
254
|
-
id
|
|
249
|
+
id?: string;
|
|
255
250
|
/**
|
|
256
251
|
* Denoting a person or company.
|
|
257
252
|
*/
|
|
@@ -677,7 +672,10 @@ export async function addContactAsync(contact: Contact, containerId?: string): P
|
|
|
677
672
|
if (!ExpoContacts.addContactAsync) {
|
|
678
673
|
throw new UnavailabilityError('Contacts', 'addContactAsync');
|
|
679
674
|
}
|
|
680
|
-
|
|
675
|
+
|
|
676
|
+
const noIdContact = removeIds(contact);
|
|
677
|
+
|
|
678
|
+
return await ExpoContacts.addContactAsync(noIdContact, containerId);
|
|
681
679
|
}
|
|
682
680
|
|
|
683
681
|
/**
|
|
@@ -824,7 +822,7 @@ export async function createGroupAsync(name?: string, containerId?: string): Pro
|
|
|
824
822
|
throw new UnavailabilityError('Contacts', 'createGroupAsync');
|
|
825
823
|
}
|
|
826
824
|
|
|
827
|
-
name = name ||
|
|
825
|
+
name = name || uuid.v4();
|
|
828
826
|
if (!containerId) {
|
|
829
827
|
containerId = await getDefaultContainerIdAsync();
|
|
830
828
|
}
|
|
@@ -999,6 +997,33 @@ export async function requestPermissionsAsync(): Promise<PermissionResponse> {
|
|
|
999
997
|
return await ExpoContacts.requestPermissionsAsync();
|
|
1000
998
|
}
|
|
1001
999
|
|
|
1000
|
+
/** @private */
|
|
1001
|
+
function removeIds(contact: Contact): Contact {
|
|
1002
|
+
const updatedContact = { ...contact };
|
|
1003
|
+
if (contact.id && __DEV__) {
|
|
1004
|
+
console.warn(
|
|
1005
|
+
`You have set an id = ${contact.id} for the contact. This value will be ignored, because the id will be generated by the OS`
|
|
1006
|
+
);
|
|
1007
|
+
delete updatedContact.id;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
for (const key of Object.keys(contact)) {
|
|
1011
|
+
if (Array.isArray(contact[key])) {
|
|
1012
|
+
updatedContact[key] = contact[key].map((item, index) => {
|
|
1013
|
+
if (item.id) {
|
|
1014
|
+
__DEV__ &&
|
|
1015
|
+
console.warn(
|
|
1016
|
+
`You have set an id "${item.id}" at index "${index}" for the key "${key}" of the contact. This value will be ignored, because the id will be generated by the OS`
|
|
1017
|
+
);
|
|
1018
|
+
return { ...item, id: null };
|
|
1019
|
+
}
|
|
1020
|
+
return item;
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
return updatedContact;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1002
1027
|
/**
|
|
1003
1028
|
* Possible fields to retrieve for a contact.
|
|
1004
1029
|
*/
|