react-native-contacts 7.0.7 → 8.0.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.
@@ -1,18 +1,37 @@
1
1
  require 'json'
2
- package_json = JSON.parse(File.read('package.json'))
2
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
3
+ folly_version = '2021.07.22.00'
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
3
5
 
4
6
  Pod::Spec.new do |s|
5
7
 
8
+ # This guard prevent to install the dependencies when we run `pod install` in the old architecture.
9
+
10
+
6
11
  s.name = "react-native-contacts"
7
- s.version = package_json["version"]
8
- s.summary = package_json["description"]
12
+ s.version = package["version"]
13
+ s.summary = package["description"]
9
14
  s.homepage = "https://github.com/geektimecoil/react-native-onesignal"
10
- s.license = package_json["license"]
11
- s.author = { package_json["author"] => package_json["author"] }
12
- s.platform = :ios, "9.0"
13
- s.source = { :git => "https://github.com/rt2zz/react-native-contacts.git" }
14
- s.source_files = 'ios/RCTContacts/*.{h,m}'
15
+ s.license = package["license"]
16
+ s.author = { package["author"] => package["author"] }
17
+ s.platform = :ios, "12.0"
18
+ s.source = { :git => "https://github.com/rt2zz/react-native-contacts.git", :tag => "v#{s.version}" }
19
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
15
20
 
16
21
  s.dependency 'React-Core'
17
22
 
23
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
24
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
25
+ s.pod_target_xcconfig = {
26
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
27
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
28
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
29
+ }
30
+ s.dependency "React-Codegen"
31
+ s.dependency "RCT-Folly", folly_version
32
+ s.dependency "RCTRequired"
33
+ s.dependency "RCTTypeSafety"
34
+ s.dependency "ReactCommon/turbomodule/core"
35
+ install_modules_dependencies(s)
36
+ end
18
37
  end
@@ -0,0 +1,27 @@
1
+ import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
2
+ import { TurboModuleRegistry } from "react-native";
3
+ import { Contact } from "../type";
4
+
5
+ export interface Spec extends TurboModule {
6
+ getAll: () => Promise<any>;
7
+ getAllWithoutPhotos: () => Promise<Contact[]>;
8
+ getContactById: (contactId: string) => Promise<Contact>;
9
+ getCount: () => Promise<number>;
10
+ getPhotoForId: (contactId: string) => Promise<string>;
11
+ addContact: (contact: Object) => Promise<any>;
12
+ openContactForm: (contact: Object) => Promise<Contact>;
13
+ openExistingContact: (contact: Object) => Promise<Contact>;
14
+ viewExistingContact: (contact: { recordID: string }) => Promise<Contact>;
15
+ editExistingContact: (contact: Object) => Promise<Contact>;
16
+ updateContact: (contact: Object) => Promise<void>;
17
+ deleteContact: (contact: Object) => Promise<void>;
18
+ getContactsMatchingString: (str: string) => Promise<Contact[]>;
19
+ getContactsByPhoneNumber: (phoneNumber: string) => Promise<Contact[]>;
20
+ getContactsByEmailAddress: (emailAddress: string) => Promise<Contact[]>;
21
+ checkPermission: () => Promise<string>;
22
+ requestPermission: () => Promise<string>;
23
+ writePhotoToPath: (contactId: string, file: string) => Promise<boolean>;
24
+ iosEnableNotesUsage: (enabled: boolean) => void;
25
+ }
26
+
27
+ export default TurboModuleRegistry.get<Spec>("RCTContacts");
package/type.ts ADDED
@@ -0,0 +1,62 @@
1
+ export interface EmailAddress {
2
+ label: string;
3
+ email: string;
4
+ }
5
+
6
+ export interface PhoneNumber {
7
+ label: string;
8
+ number: string;
9
+ }
10
+
11
+ export interface PostalAddress {
12
+ label: string;
13
+ formattedAddress: string;
14
+ street: string;
15
+ pobox: string;
16
+ neighborhood: string;
17
+ city: string;
18
+ region: string;
19
+ state: string;
20
+ postCode: string;
21
+ country: string;
22
+ }
23
+
24
+ export interface InstantMessageAddress {
25
+ username: string;
26
+ service: string;
27
+ }
28
+
29
+ export interface Birthday {
30
+ day: number;
31
+ month: number;
32
+ year: number;
33
+ }
34
+
35
+ export interface UrlAddress {
36
+ url: string;
37
+ label: string;
38
+ }
39
+
40
+ export interface Contact {
41
+ recordID: string;
42
+ backTitle: string;
43
+ company: string | null;
44
+ emailAddresses: EmailAddress[];
45
+ displayName: string;
46
+ familyName: string;
47
+ givenName: string;
48
+ middleName: string;
49
+ jobTitle: string;
50
+ phoneNumbers: PhoneNumber[];
51
+ hasThumbnail: boolean;
52
+ thumbnailPath: string;
53
+ isStarred: boolean;
54
+ postalAddresses: PostalAddress[];
55
+ prefix: string;
56
+ suffix: string;
57
+ department: string;
58
+ birthday: Birthday;
59
+ imAddresses: InstantMessageAddress[];
60
+ urlAddresses: UrlAddress[];
61
+ note: string;
62
+ }
package/index.js DELETED
@@ -1,2 +0,0 @@
1
- var ReactNative = require('react-native')
2
- module.exports = ReactNative.NativeModules.Contacts