@livx.cc/native-kit 0.19.0 → 0.20.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/package.json +1 -1
- package/src/core/web-adapter.ts +3 -0
- package/src/modules/contacts.ts +11 -0
package/package.json
CHANGED
package/src/core/web-adapter.ts
CHANGED
|
@@ -297,6 +297,9 @@ export class WebAdapter implements NativeKitAdapter {
|
|
|
297
297
|
return { picked: true, name: c.name?.[0], phones: c.tel, emails: c.email } as T;
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
+
case 'contacts.getAll':
|
|
301
|
+
throw new KitError('UNSUPPORTED', 'No bulk contacts read on web — use contacts.pick');
|
|
302
|
+
|
|
300
303
|
case 'calendar.createEvent':
|
|
301
304
|
throw new KitError('UNSUPPORTED', 'No calendar access on web');
|
|
302
305
|
|
package/src/modules/contacts.ts
CHANGED
|
@@ -7,6 +7,12 @@ export interface PickedContact {
|
|
|
7
7
|
emails?: string[];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export interface Contact {
|
|
11
|
+
name?: string;
|
|
12
|
+
phones?: string[];
|
|
13
|
+
emails?: string[];
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
/** Contact picker — native: CNContactPicker (no permission needed); web: Contact Picker API where present. */
|
|
11
17
|
export class ContactsModule {
|
|
12
18
|
constructor(private kit: NativeKit) {}
|
|
@@ -19,4 +25,9 @@ export class ContactsModule {
|
|
|
19
25
|
pick(): Promise<PickedContact> {
|
|
20
26
|
return this.kit.invoke('contacts.pick', undefined, { timeoutMs: 120_000 });
|
|
21
27
|
}
|
|
28
|
+
|
|
29
|
+
/** Read the full address book; native-only (requires permission), unsupported on web. */
|
|
30
|
+
getAll(): Promise<{ contacts: Contact[] }> {
|
|
31
|
+
return this.kit.invoke('contacts.getAll', undefined, { timeoutMs: 120_000 });
|
|
32
|
+
}
|
|
22
33
|
}
|