Skip to content

Commit adac165

Browse files
committed
Makes contactFields optional
1 parent 0110fe7 commit adac165

3 files changed

+15
-3
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,10 @@ var app = require("application");
190190
var contacts = require("nativescript-contacts");
191191

192192
/*
193-
contactFields contains the fields to retrieve from native backend to reduce processing time
193+
Optional: contactFields contains the fields to retrieve from native backend to reduce processing time
194194
var contactFields = ['name','organization','nickname','notes','photo','urls','phoneNumbers','emailAddresses','postalAddresses']
195+
196+
If not supplied, all available contactFields will be returned.
195197
*/
196198
var contactFields = ["name", "phoneNumbers"];
197199

get-all-contacts-worker.ios.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,17 @@ function console_log(msg) { postMessage({ type: 'debug', message: msg }); }
77
function console_dump(msg) { postMessage({ type: 'dump', message: msg }); }
88

99
self.onmessage = function (event) {
10-
contactFields = event.data.contactFields;
10+
contactFields = event.data.contactFields || [
11+
'name',
12+
'organization',
13+
'nickname',
14+
'notes',
15+
'photo',
16+
'urls',
17+
'phoneNumbers',
18+
'emailAddresses',
19+
'postalAddresses',
20+
];
1121

1222
var keysToFetch = []; // All Properties that we are using in the Model
1323
if (contactFields.indexOf('name') > -1) {

nativescript-contacts.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ declare module "nativescript-contacts" {
113113
export function getContact(): Promise<GetContactResult>;
114114
export function getContactById(id: string): Promise<GetFetchResult>; // iOS Only
115115
export function getContactsByName(searchPredicate: string, contactFields: string[]): Promise<GetFetchResult>;
116-
export function getAllContacts(contactFields: string[]): Promise<GetFetchResult>;
116+
export function getAllContacts(contactFields?: string[]): Promise<GetFetchResult>;
117117
export function getContactsInGroup(group: Group): Promise<GetFetchResult>;
118118

119119
export class Group {

0 commit comments

Comments
 (0)