Skip to content

Commit

Permalink
fix(contacts): handle cordova_not_found errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ihadeed committed Mar 28, 2017
1 parent 9c30a1d commit 961727e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/@ionic-native/plugins/contacts/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability } from '@ionic-native/core';
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability, CordovaCheck } from '@ionic-native/core';

declare var window: any,
navigator: any;
Expand Down Expand Up @@ -309,6 +309,7 @@ export class Contacts {
* @param options {IContactFindOptions} Optional options for the query
* @returns {Promise<Contact[]>} Returns a Promise that resolves with the search results (an array of Contact objects)
*/
@CordovaCheck()
find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
return getPromise((resolve, reject) => {
navigator.contacts.find(fields, (contacts) => {
Expand All @@ -321,6 +322,7 @@ export class Contacts {
* Select a single Contact.
* @returns {Promise<Contact>} Returns a Promise that resolves with the selected Contact
*/
@CordovaCheck()
pickContact(): Promise<Contact> {
return getPromise((resolve, reject) => {
navigator.contacts.pickContact((contact) => resolve(processContact(contact)), reject);
Expand Down

0 comments on commit 961727e

Please sign in to comment.