react-native-contacts 8.0.3 → 8.0.5
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/.tool-versions +1 -1
- package/README.md +10 -0
- package/android/src/main/java/com/rt2zz/reactnativecontacts/impl/ContactsManagerImpl.java +1336 -0
- package/android/src/newarch/com/rt2zz/reactnativecontacts/ContactsManager.java +25 -1139
- package/android/src/oldarch/com/rt2zz/reactnativecontacts/ContactsManager.java +24 -1135
- package/index.d.ts +88 -50
- package/index.ts +35 -3
- package/ios/RCTContacts/RCTContacts.mm +494 -161
- package/package.json +2 -2
- package/src/NativeContacts.ts +15 -1
- package/type.ts +6 -1
package/index.d.ts
CHANGED
|
@@ -4,79 +4,117 @@ export function getContactById(contactId: string): Promise<Contact | null>;
|
|
|
4
4
|
export function getCount(): Promise<number>;
|
|
5
5
|
export function getPhotoForId(contactId: string): Promise<string>;
|
|
6
6
|
export function addContact(contact: Partial<Contact>): Promise<Contact>;
|
|
7
|
-
export function openContactForm(
|
|
7
|
+
export function openContactForm(
|
|
8
|
+
contact: Partial<Contact>
|
|
9
|
+
): Promise<Contact | null>;
|
|
8
10
|
export function openExistingContact(contact: Contact): Promise<Contact>;
|
|
9
|
-
export function viewExistingContact(contact: {
|
|
11
|
+
export function viewExistingContact(contact: {
|
|
12
|
+
recordID: string;
|
|
13
|
+
}): Promise<Contact | void>;
|
|
10
14
|
export function editExistingContact(contact: Contact): Promise<Contact>;
|
|
11
|
-
export function updateContact(
|
|
15
|
+
export function updateContact(
|
|
16
|
+
contact: Partial<Contact> & { recordID: string }
|
|
17
|
+
): Promise<void>;
|
|
12
18
|
export function deleteContact(contact: Contact): Promise<void>;
|
|
13
19
|
export function getContactsMatchingString(str: string): Promise<Contact[]>;
|
|
14
|
-
export function getContactsByPhoneNumber(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export function
|
|
18
|
-
|
|
20
|
+
export function getContactsByPhoneNumber(
|
|
21
|
+
phoneNumber: string
|
|
22
|
+
): Promise<Contact[]>;
|
|
23
|
+
export function getContactsByEmailAddress(
|
|
24
|
+
emailAddress: string
|
|
25
|
+
): Promise<Contact[]>;
|
|
26
|
+
export function checkPermission(): Promise<
|
|
27
|
+
"authorized" | "denied" | "undefined"
|
|
28
|
+
>;
|
|
29
|
+
export function requestPermission(): Promise<
|
|
30
|
+
"authorized" | "denied" | "undefined"
|
|
31
|
+
>;
|
|
32
|
+
export function writePhotoToPath(
|
|
33
|
+
contactId: string,
|
|
34
|
+
file: string
|
|
35
|
+
): Promise<boolean>;
|
|
19
36
|
export function iosEnableNotesUsage(enabled: boolean): void;
|
|
20
37
|
|
|
38
|
+
export function getGroups(): Promise<Group[]>;
|
|
39
|
+
export function getGroup(identifier: string): Promise<Group | null>;
|
|
40
|
+
export function deleteGroup(identifier: string): Promise<boolean>;
|
|
41
|
+
export function updateGroup(
|
|
42
|
+
identifier: string,
|
|
43
|
+
groupData: Pick<Group, "name">
|
|
44
|
+
): Promise<Group>;
|
|
45
|
+
export function addGroup(group: Pick<Group, "name">): Promise<Group>;
|
|
46
|
+
export function contactsInGroup(identifier: string): Promise<Contact[]>;
|
|
47
|
+
export function addContactsToGroup(
|
|
48
|
+
groupIdentifier: string,
|
|
49
|
+
contactIdentifiers: string[]
|
|
50
|
+
): Promise<boolean>;
|
|
51
|
+
export function removeContactsFromGroup(
|
|
52
|
+
groupIdentifier: string,
|
|
53
|
+
contactIdentifiers: string[]
|
|
54
|
+
): Promise<boolean>;
|
|
55
|
+
export interface Group {
|
|
56
|
+
identifier: string;
|
|
57
|
+
name: string;
|
|
58
|
+
}
|
|
21
59
|
export interface EmailAddress {
|
|
22
|
-
|
|
23
|
-
|
|
60
|
+
label: string;
|
|
61
|
+
email: string;
|
|
24
62
|
}
|
|
25
63
|
|
|
26
64
|
export interface PhoneNumber {
|
|
27
|
-
|
|
28
|
-
|
|
65
|
+
label: string;
|
|
66
|
+
number: string;
|
|
29
67
|
}
|
|
30
68
|
|
|
31
69
|
export interface PostalAddress {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
70
|
+
label: string;
|
|
71
|
+
formattedAddress: string;
|
|
72
|
+
street: string;
|
|
73
|
+
pobox: string;
|
|
74
|
+
neighborhood: string;
|
|
75
|
+
city: string;
|
|
76
|
+
region: string;
|
|
77
|
+
state: string;
|
|
78
|
+
postCode: string;
|
|
79
|
+
country: string;
|
|
42
80
|
}
|
|
43
81
|
|
|
44
82
|
export interface InstantMessageAddress {
|
|
45
|
-
|
|
46
|
-
|
|
83
|
+
username: string;
|
|
84
|
+
service: string;
|
|
47
85
|
}
|
|
48
86
|
|
|
49
87
|
export interface Birthday {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
88
|
+
day: number;
|
|
89
|
+
month: number;
|
|
90
|
+
year?: number;
|
|
53
91
|
}
|
|
54
92
|
|
|
55
93
|
export interface UrlAddress {
|
|
56
|
-
|
|
57
|
-
|
|
94
|
+
url: string;
|
|
95
|
+
label: string;
|
|
58
96
|
}
|
|
59
97
|
|
|
60
98
|
export interface Contact {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
99
|
+
recordID: string;
|
|
100
|
+
backTitle: string;
|
|
101
|
+
company: string | null;
|
|
102
|
+
emailAddresses: EmailAddress[];
|
|
103
|
+
displayName: string | null;
|
|
104
|
+
familyName: string;
|
|
105
|
+
givenName: string | null;
|
|
106
|
+
middleName: string;
|
|
107
|
+
jobTitle: string | null;
|
|
108
|
+
phoneNumbers: PhoneNumber[];
|
|
109
|
+
hasThumbnail: boolean;
|
|
110
|
+
thumbnailPath: string;
|
|
111
|
+
isStarred: boolean;
|
|
112
|
+
postalAddresses: PostalAddress[];
|
|
113
|
+
prefix: string | null;
|
|
114
|
+
suffix: string | null;
|
|
115
|
+
department: string | null;
|
|
116
|
+
birthday?: Birthday;
|
|
117
|
+
imAddresses: InstantMessageAddress[];
|
|
118
|
+
urlAddresses: UrlAddress[];
|
|
119
|
+
note: string | null;
|
|
82
120
|
}
|
package/index.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { NativeModules } from "react-native";
|
|
2
2
|
import NativeContacts from "./src/NativeContacts";
|
|
3
|
-
import { Contact, PermissionType } from "./type";
|
|
3
|
+
import { Contact, Group, PermissionType } from "./type";
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const Contacts = isTurboModuleEnabled ? NativeContacts : NativeModules.Contacts;
|
|
5
|
+
const Contacts = NativeModules.Contacts ?? NativeContacts;
|
|
7
6
|
|
|
8
7
|
async function getAll(): Promise<Contact[]> {
|
|
9
8
|
return Contacts.getAll();
|
|
@@ -87,6 +86,31 @@ async function writePhotoToPath(
|
|
|
87
86
|
): Promise<boolean> {
|
|
88
87
|
return Contacts.writePhotoToPath(contactId, file);
|
|
89
88
|
}
|
|
89
|
+
|
|
90
|
+
async function getGroups(): Promise<Group[]> {
|
|
91
|
+
return Contacts.getGroups();
|
|
92
|
+
}
|
|
93
|
+
async function getGroup(identifier: string): Promise<Group | null> {
|
|
94
|
+
return Contacts.getGroup(identifier);
|
|
95
|
+
}
|
|
96
|
+
async function deleteGroup(identifier: string): Promise<boolean> {
|
|
97
|
+
return Contacts.deleteGroup(identifier);
|
|
98
|
+
}
|
|
99
|
+
async function updateGroup(identifier: string, groupData: Pick<Group, 'name'>): Promise<Group> {
|
|
100
|
+
return Contacts.updateGroup(identifier, groupData);
|
|
101
|
+
}
|
|
102
|
+
async function addGroup(group: Pick<Group, 'name'>): Promise<Group>{
|
|
103
|
+
return Contacts.addGroup(group);
|
|
104
|
+
}
|
|
105
|
+
async function contactsInGroup(identifier: string): Promise<Contact[]> {
|
|
106
|
+
return Contacts.contactsInGroup(identifier);
|
|
107
|
+
}
|
|
108
|
+
async function addContactsToGroup(groupIdentifier: string, contactIdentifiers: string[]): Promise<boolean> {
|
|
109
|
+
return Contacts.addContactsToGroup(groupIdentifier, contactIdentifiers);
|
|
110
|
+
}
|
|
111
|
+
async function removeContactsFromGroup(groupIdentifier: string, contactIdentifiers: string[]): Promise<boolean> {
|
|
112
|
+
return Contacts.removeContactsFromGroup(groupIdentifier, contactIdentifiers);
|
|
113
|
+
}
|
|
90
114
|
export default {
|
|
91
115
|
getAll,
|
|
92
116
|
getAllWithoutPhotos,
|
|
@@ -106,4 +130,12 @@ export default {
|
|
|
106
130
|
checkPermission,
|
|
107
131
|
requestPermission,
|
|
108
132
|
writePhotoToPath,
|
|
133
|
+
getGroups,
|
|
134
|
+
getGroup,
|
|
135
|
+
deleteGroup,
|
|
136
|
+
updateGroup,
|
|
137
|
+
addGroup,
|
|
138
|
+
contactsInGroup,
|
|
139
|
+
addContactsToGroup,
|
|
140
|
+
removeContactsFromGroup
|
|
109
141
|
};
|