@hanwha-ss1/plugin 0.0.3 → 0.0.4
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/README.md +8 -12
- package/android/src/main/java/com/plugin/capture/Capture.java +33 -0
- package/android/src/main/java/com/plugin/capture/CapturePlugin.java +31 -0
- package/dist/esm/definitions.d.ts +9 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +1 -0
- package/dist/esm/web.js +3 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +3 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +3 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/ContactPlugin.swift +67 -105
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# capacitor-plugin-hanwha-openbrowser
|
|
2
|
+
|
|
3
|
+
OpenBrowser
|
|
4
|
+
|
|
2
5
|
## Install
|
|
3
6
|
|
|
4
7
|
```bash
|
|
5
|
-
npm install
|
|
8
|
+
npm install capacitor-plugin-hanwha-openbrowser
|
|
6
9
|
npx cap sync
|
|
7
10
|
```
|
|
8
11
|
|
|
9
12
|
## Example
|
|
10
13
|
|
|
11
14
|
```javascript
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
await HanwhaPlugin.addContact({
|
|
16
|
-
name: "이름님",
|
|
17
|
-
phone: "010-2222-3333",
|
|
18
|
-
email: "이메일",
|
|
19
|
-
dept: "회사",
|
|
20
|
-
ext: "내선"
|
|
21
|
-
})
|
|
15
|
+
import { OpenBrowser } from 'capacitor-plugin-hanwha-openbrowser';
|
|
16
|
+
|
|
17
|
+
await OpenBrowser.open({url: 'https://naver.com', ext: false});
|
|
22
18
|
```
|
|
23
19
|
|
|
24
20
|
## API
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
package com.plugin.capture;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.content.Intent;
|
|
5
|
+
import android.provider.ContactsContract;
|
|
6
|
+
import android.util.Log;
|
|
7
|
+
import android.view.WindowManager;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
public class Capture {
|
|
11
|
+
|
|
12
|
+
public String echo(String value) {
|
|
13
|
+
Log.i("Echo", value);
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 스크린 캡쳐 방지
|
|
19
|
+
*
|
|
20
|
+
* @param activity
|
|
21
|
+
* @param disable : 캡쳐 방지
|
|
22
|
+
*/
|
|
23
|
+
public void setScreenCaptureDisable(Activity activity, String disable) {
|
|
24
|
+
Log.i("CapturePlugin", "disabled: " + disable);
|
|
25
|
+
if(disable.equalsIgnoreCase("true")) {
|
|
26
|
+
Log.i("CapturePlugin", "setFlags: FLAG_SECURE");
|
|
27
|
+
activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
|
|
28
|
+
} else {
|
|
29
|
+
Log.i("CapturePlugin", "clearFlags: FLAG_SECURE");
|
|
30
|
+
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
package com.plugin.capture;
|
|
2
|
+
|
|
3
|
+
import com.getcapacitor.JSObject;
|
|
4
|
+
import com.getcapacitor.Plugin;
|
|
5
|
+
import com.getcapacitor.PluginCall;
|
|
6
|
+
import com.getcapacitor.PluginMethod;
|
|
7
|
+
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@CapacitorPlugin(name = "Capture")
|
|
11
|
+
public class CapturePlugin extends Plugin{
|
|
12
|
+
private Capture implementation = new Capture();
|
|
13
|
+
|
|
14
|
+
@PluginMethod
|
|
15
|
+
public void echo(PluginCall call) {
|
|
16
|
+
String value = call.getString("value");
|
|
17
|
+
|
|
18
|
+
JSObject ret = new JSObject();
|
|
19
|
+
ret.put("value", implementation.echo(value));
|
|
20
|
+
call.resolve(ret);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@PluginMethod
|
|
24
|
+
public void setScreenCaptureDisabled(PluginCall call) {
|
|
25
|
+
String disable = call.getString("disabled");
|
|
26
|
+
if(implementation == null) {
|
|
27
|
+
implementation = new Capture();
|
|
28
|
+
}
|
|
29
|
+
implementation.setScreenCaptureDisable(getActivity(), disable);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -16,4 +16,13 @@ export interface Plugin {
|
|
|
16
16
|
}): Promise<{
|
|
17
17
|
value: string;
|
|
18
18
|
}>;
|
|
19
|
+
/**
|
|
20
|
+
* 캡쳐 방지
|
|
21
|
+
* @param options disabled : 캡쳐 방지 여부 (true, false)
|
|
22
|
+
*/
|
|
23
|
+
setScreenCaptureDisabled(options: {
|
|
24
|
+
disabled: string;
|
|
25
|
+
}): Promise<{
|
|
26
|
+
value: string;
|
|
27
|
+
}>;
|
|
19
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface Plugin {\n /**\n * 연락처 저장\n * @param options name : 성명\n * @param options phone : 전화번호\n * @param options email : 이메일\n * @param options dept : 소속\n * @param options ext : 내선번호\n */\n addContact(options: {\n name: string;\n phone: string;\n email: string;\n dept: string;\n ext: string;\n }): Promise<{ value: string }>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface Plugin {\n /**\n * 연락처 저장\n * @param options name : 성명\n * @param options phone : 전화번호\n * @param options email : 이메일\n * @param options dept : 소속\n * @param options ext : 내선번호\n */\n addContact(options: {\n name: string;\n phone: string;\n email: string;\n dept: string;\n ext: string;\n }): Promise<{ value: string }>;\n\n\n /**\n * 캡쳐 방지\n * @param options disabled : 캡쳐 방지 여부 (true, false)\n */\n setScreenCaptureDisabled(options: {\n disabled: string;\n }): Promise<{ value: string }>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
package/dist/esm/web.js
CHANGED
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,SAAU,SAAQ,SAAS;IAEtC,KAAK,CAAC,UAAU;QACd,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { WebPlugin } from '@capacitor/core';\nimport type { Plugin } from './definitions';\nexport class PluginWeb extends WebPlugin implements Plugin {\n\n async addContact(): Promise<any> {\n return { results: {} };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,SAAU,SAAQ,SAAS;IAEtC,KAAK,CAAC,UAAU;QACd,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,wBAAwB;QAC5B,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { WebPlugin } from '@capacitor/core';\nimport type { Plugin } from './definitions';\nexport class PluginWeb extends WebPlugin implements Plugin {\n\n async addContact(): Promise<any> {\n return { results: {} };\n }\n\n async setScreenCaptureDisabled(): Promise<any> {\n return { results: {} };\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst HanwhaPlugin = registerPlugin('Plugin', {\n web: () => import('./web').then(m => new m.PluginWeb()),\n});\nexport * from './definitions';\nexport { HanwhaPlugin };\n//# sourceMappingURL=index.js.map","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { WebPlugin } from '@capacitor/core';\nexport class PluginWeb extends WebPlugin {\n async addContact() {\n return { results: {} };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,YAAY,GAAGA,mBAAc,CAAC,QAAQ,EAAE;AAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;AAC3D,CAAC;;ACHD;AAEO,MAAM,SAAS,SAASC,cAAS,CAAC;AACzC,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst HanwhaPlugin = registerPlugin('Plugin', {\n web: () => import('./web').then(m => new m.PluginWeb()),\n});\nexport * from './definitions';\nexport { HanwhaPlugin };\n//# sourceMappingURL=index.js.map","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { WebPlugin } from '@capacitor/core';\nexport class PluginWeb extends WebPlugin {\n async addContact() {\n return { results: {} };\n }\n async setScreenCaptureDisabled() {\n return { results: {} };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,YAAY,GAAGA,mBAAc,CAAC,QAAQ,EAAE;AAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;AAC3D,CAAC;;ACHD;AAEO,MAAM,SAAS,SAASC,cAAS,CAAC;AACzC,IAAI,MAAM,UAAU,GAAG;AACvB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL,IAAI,MAAM,wBAAwB,GAAG;AACrC,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC/B,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst HanwhaPlugin = registerPlugin('Plugin', {\n web: () => import('./web').then(m => new m.PluginWeb()),\n});\nexport * from './definitions';\nexport { HanwhaPlugin };\n//# sourceMappingURL=index.js.map","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { WebPlugin } from '@capacitor/core';\nexport class PluginWeb extends WebPlugin {\n async addContact() {\n return { results: {} };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,YAAY,GAAGA,mBAAc,CAAC,QAAQ,EAAE;IAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3D,CAAC;;ICHD;IAEO,MAAM,SAAS,SAASC,cAAS,CAAC;IACzC,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst HanwhaPlugin = registerPlugin('Plugin', {\n web: () => import('./web').then(m => new m.PluginWeb()),\n});\nexport * from './definitions';\nexport { HanwhaPlugin };\n//# sourceMappingURL=index.js.map","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { WebPlugin } from '@capacitor/core';\nexport class PluginWeb extends WebPlugin {\n async addContact() {\n return { results: {} };\n }\n async setScreenCaptureDisabled() {\n return { results: {} };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,YAAY,GAAGA,mBAAc,CAAC,QAAQ,EAAE;IAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3D,CAAC;;ICHD;IAEO,MAAM,SAAS,SAASC,cAAS,CAAC;IACzC,IAAI,MAAM,UAAU,GAAG;IACvB,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL,IAAI,MAAM,wBAAwB,GAAG;IACrC,QAAQ,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IAC/B,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
|
@@ -14,131 +14,93 @@ public class Plugin: CAPPlugin {
|
|
|
14
14
|
let phone = call.getString("phone") ?? ""
|
|
15
15
|
let email = call.getString("email") ?? ""
|
|
16
16
|
let dept = call.getString("dept") ?? ""
|
|
17
|
-
let ext = call.getString("ext") ?? ""
|
|
18
17
|
|
|
19
|
-
saveContact(name: name, phone: phone
|
|
20
|
-
if success {
|
|
21
|
-
call.resolve([
|
|
22
|
-
"result": true,
|
|
23
|
-
"message": "완료"
|
|
24
|
-
])
|
|
25
|
-
} else {
|
|
26
|
-
call.resolve([
|
|
27
|
-
"result": false,
|
|
28
|
-
"message": "존재하는 번호입니다."
|
|
29
|
-
])
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
18
|
+
saveContact(name: name, phone: phone)
|
|
33
19
|
|
|
20
|
+
call.resolve([
|
|
21
|
+
"results": "완료"
|
|
22
|
+
])
|
|
23
|
+
|
|
34
24
|
}
|
|
35
25
|
|
|
36
|
-
private func saveContact(name: String, phone: String
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
private func saveContact(name: String, phone: String) {
|
|
27
|
+
|
|
28
|
+
let store = CNContactStore()
|
|
29
|
+
|
|
30
|
+
// Permission 획득
|
|
41
31
|
store.requestAccess(for: .contacts) { (granted, error) in
|
|
42
32
|
guard granted else {
|
|
43
|
-
completion(false)
|
|
44
33
|
return
|
|
45
34
|
}
|
|
35
|
+
|
|
36
|
+
// 전화번호 중복 여부 확인
|
|
37
|
+
self.getContactsMatchingPhoneNumber(phone)
|
|
38
|
+
// if let existingContact = self.getContactWithPhoneNumber(phone) {
|
|
39
|
+
// // 이미 해당 전화번호를 가진 연락처가 있음
|
|
40
|
+
// // 여기서 원하는 작업을 수행하거나 오류 처리를 할 수 있음
|
|
41
|
+
// } else {
|
|
42
|
+
// // 해당 전화번호를 가진 연락처가 없음
|
|
43
|
+
// let contact: CNMutableContact = self.getNewContact(name, phone)
|
|
44
|
+
//
|
|
45
|
+
// let request = CNSaveRequest()
|
|
46
|
+
// request.add(contact, toContainerWithIdentifier: nil)
|
|
47
|
+
//
|
|
48
|
+
// // 저장
|
|
49
|
+
// do {
|
|
50
|
+
// try store.execute(request)
|
|
51
|
+
// } catch {
|
|
52
|
+
// // 저장 중 오류 처리
|
|
53
|
+
// }
|
|
54
|
+
// }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 새로 등록할 주소록 생성
|
|
59
|
+
private func getNewContact(_ m_name: String, _ m_phone: String) -> CNMutableContact {
|
|
60
|
+
let contact = CNMutableContact()
|
|
61
|
+
contact.givenName = m_name
|
|
62
|
+
// contact.familyName = "familyName"
|
|
46
63
|
|
|
47
|
-
|
|
64
|
+
let phone = CNLabeledValue(label:CNLabelPhoneNumberMobile,
|
|
65
|
+
value:CNPhoneNumber(stringValue:m_phone))
|
|
66
|
+
let tel = CNLabeledValue(label:CNLabelPhoneNumberMain,
|
|
67
|
+
value:CNPhoneNumber(stringValue:m_phone))
|
|
68
|
+
contact.phoneNumbers = [phone, tel]
|
|
48
69
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
do {
|
|
55
|
-
try store.execute(request)
|
|
56
|
-
completion(true)
|
|
57
|
-
} catch {
|
|
58
|
-
|
|
59
|
-
completion(false)
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
completion(false)
|
|
63
|
-
}
|
|
70
|
+
let email: NSString = "bizCard@gmail.com"
|
|
71
|
+
contact.emailAddresses = [CNLabeledValue(label:CNLabelWork, value:email)]
|
|
72
|
+
|
|
73
|
+
return contact
|
|
64
74
|
}
|
|
65
|
-
}
|
|
66
|
-
// 새로 등록할 주소록 생성
|
|
67
|
-
private func getNewContact(_ m_name: String, _ m_phone: String, _ m_email: String, _ m_dept: String, _ m_ext: String) -> CNMutableContact {
|
|
68
|
-
let contact = CNMutableContact()
|
|
69
|
-
contact.givenName = m_name
|
|
70
|
-
|
|
71
|
-
let phone = CNLabeledValue(label:CNLabelPhoneNumberMobile,
|
|
72
|
-
value:CNPhoneNumber(stringValue:m_phone))
|
|
73
|
-
let workLabel = "직장"
|
|
74
|
-
let tel = CNLabeledValue(label:workLabel,
|
|
75
|
-
value:CNPhoneNumber(stringValue:m_ext))
|
|
76
|
-
contact.phoneNumbers = [phone, tel]
|
|
77
|
-
|
|
78
|
-
contact.emailAddresses = [CNLabeledValue(label:CNLabelWork, value:m_email as NSString)]
|
|
79
|
-
contact.organizationName = m_dept
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return contact
|
|
84
|
-
}
|
|
85
75
|
|
|
86
|
-
func getContactsMatchingPhoneNumber(_
|
|
87
|
-
var
|
|
88
|
-
|
|
76
|
+
func getContactsMatchingPhoneNumber(_ phoneNumber: String) -> [CNContact] {
|
|
77
|
+
var matchingContacts: [CNContact] = []
|
|
78
|
+
|
|
89
79
|
let store = CNContactStore()
|
|
90
80
|
let keysToFetch: [CNKeyDescriptor] = [CNContactGivenNameKey as CNKeyDescriptor, CNContactFamilyNameKey as CNKeyDescriptor, CNContactPhoneNumbersKey as CNKeyDescriptor]
|
|
91
|
-
|
|
92
|
-
|
|
81
|
+
|
|
82
|
+
// 전화번호에 일치하는 연락처를 검색하기 위한 NSPredicate를 생성
|
|
83
|
+
let predicate = CNContact.predicateForContacts(withIdentifiers: [])
|
|
84
|
+
|
|
93
85
|
do {
|
|
94
|
-
|
|
95
|
-
try store.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
let
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
print("Name: \(contact.givenName) \(contact.familyName)")
|
|
105
|
-
print("\(label): \(value )")
|
|
106
|
-
result = false
|
|
86
|
+
// 모든 연락처 가져오기
|
|
87
|
+
let allContacts = try store.unifiedContacts(matching: predicate, keysToFetch: keysToFetch)
|
|
88
|
+
|
|
89
|
+
// 전화번호와 일치하는 연락처를 선택
|
|
90
|
+
for contact in allContacts {
|
|
91
|
+
for phoneNumberValue in contact.phoneNumbers {
|
|
92
|
+
let number = phoneNumberValue.value
|
|
93
|
+
if number.stringValue.contains(phoneNumber) {
|
|
94
|
+
matchingContacts.append(contact)
|
|
95
|
+
break
|
|
107
96
|
}
|
|
108
97
|
}
|
|
109
98
|
}
|
|
110
99
|
} catch {
|
|
111
|
-
|
|
100
|
+
// 검색 중 오류 처리
|
|
112
101
|
}
|
|
113
|
-
|
|
114
|
-
return
|
|
102
|
+
|
|
103
|
+
return matchingContacts
|
|
115
104
|
}
|
|
116
|
-
//
|
|
117
|
-
// let store = CNContactStore()
|
|
118
|
-
// let keysToFetch: [CNKeyDescriptor] = [CNContactGivenNameKey as CNKeyDescriptor, CNContactFamilyNameKey as CNKeyDescriptor, CNContactPhoneNumbersKey as CNKeyDescriptor]
|
|
119
|
-
//
|
|
120
|
-
// // 전화번호에 일치하는 연락처를 검색하기 위한 NSPredicate를 생성
|
|
121
|
-
// let predicate = CNContact.predicateForContacts(withIdentifiers: [phoneNumber])
|
|
122
|
-
//
|
|
123
|
-
// do {
|
|
124
|
-
// // 모든 연락처 가져오기
|
|
125
|
-
// let allContacts = try store.unifiedContacts(matching: predicate, keysToFetch: keysToFetch)
|
|
126
|
-
//
|
|
127
|
-
// // 전화번호와 일치하는 연락처를 선택
|
|
128
|
-
// for contact in allContacts {
|
|
129
|
-
// for phoneNumberValue in contact.phoneNumbers {
|
|
130
|
-
// let number = phoneNumberValue.value
|
|
131
|
-
// if number.stringValue.contains(phoneNumber) {
|
|
132
|
-
// matchingContacts.append(contact)
|
|
133
|
-
// break
|
|
134
|
-
// }
|
|
135
|
-
// }
|
|
136
|
-
// }
|
|
137
|
-
// } catch {
|
|
138
|
-
// // 검색 중 오류 처리
|
|
139
|
-
// }
|
|
140
|
-
//
|
|
141
|
-
// return matchingContacts
|
|
142
|
-
// }
|
|
143
105
|
}
|
|
144
106
|
|