Browse Source

Added try catch for FFOS contacts manager

Trying to fix #381
master
Igor Zhukov 11 years ago
parent
commit
ec3dddf50d
  1. 14
      app/js/services.js

14
app/js/services.js

@ -331,7 +331,12 @@ angular.module('myApp.services', []) @@ -331,7 +331,12 @@ angular.module('myApp.services', [])
}
function isAvailable () {
return window.navigator && window.navigator.mozContacts && window.navigator.mozContacts.getAll;
try {
return navigator.mozContacts && navigator.mozContacts.getAll;
} catch (e) {
console.error(dT(), 'phonebook n/a', e);
return false;
}
}
function openPhonebookImport () {
@ -347,9 +352,14 @@ angular.module('myApp.services', []) @@ -347,9 +352,14 @@ angular.module('myApp.services', [])
return phonebookContactsPromise;
}
try {
var request = window.navigator.mozContacts.getAll({});
} catch (e) {
return $q.reject(e);
}
var deferred = $q.defer(),
contacts = [],
request = window.navigator.mozContacts.getAll({}),
count = 0;
request.onsuccess = function () {

Loading…
Cancel
Save