|
|
@ -351,8 +351,6 @@ angular.module('myApp.services', []) |
|
|
|
|
|
|
|
|
|
|
|
.service('PhonebookContactsService', function ($q, $modal, $sce, FileManager) { |
|
|
|
.service('PhonebookContactsService', function ($q, $modal, $sce, FileManager) { |
|
|
|
|
|
|
|
|
|
|
|
var phonebookContactsPromise; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
isAvailable: isAvailable, |
|
|
|
isAvailable: isAvailable, |
|
|
|
openPhonebookImport: openPhonebookImport, |
|
|
|
openPhonebookImport: openPhonebookImport, |
|
|
@ -380,10 +378,6 @@ angular.module('myApp.services', []) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getPhonebookContacts () { |
|
|
|
function getPhonebookContacts () { |
|
|
|
if (phonebookContactsPromise) { |
|
|
|
|
|
|
|
return phonebookContactsPromise; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
var request = window.navigator.mozContacts.getAll({}); |
|
|
|
var request = window.navigator.mozContacts.getAll({}); |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
@ -435,7 +429,7 @@ angular.module('myApp.services', []) |
|
|
|
deferred.reject(e); |
|
|
|
deferred.reject(e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return phonebookContactsPromise = deferred.promise; |
|
|
|
return deferred.promise; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
@ -3489,10 +3483,7 @@ var regexAlphaNumericChars = "0-9\.\_" + regexAlphaChars; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function notify (data) { |
|
|
|
function notify (data) { |
|
|
|
// console.log('notify', $rootScope.idle.isIDLE, notificationsUiSupport);
|
|
|
|
console.log('notify', $rootScope.idle.isIDLE, notificationsUiSupport); |
|
|
|
if (!$rootScope.idle.isIDLE) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FFOS Notification blob src bug workaround
|
|
|
|
// FFOS Notification blob src bug workaround
|
|
|
|
if (Config.Navigator.ffos) { |
|
|
|
if (Config.Navigator.ffos) { |
|
|
@ -3558,6 +3549,9 @@ var regexAlphaNumericChars = "0-9\.\_" + regexAlphaChars; |
|
|
|
notificationsClear(); |
|
|
|
notificationsClear(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (notification.show) { |
|
|
|
|
|
|
|
notification.show(); |
|
|
|
|
|
|
|
} |
|
|
|
notificationsShown[key] = notification; |
|
|
|
notificationsShown[key] = notification; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -3598,6 +3592,8 @@ var regexAlphaNumericChars = "0-9\.\_" + regexAlphaChars; |
|
|
|
notificationsCount = 0; |
|
|
|
notificationsCount = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var registerDevicePeriod = 1000, |
|
|
|
|
|
|
|
registerDeviceTO; |
|
|
|
function registerDevice () { |
|
|
|
function registerDevice () { |
|
|
|
if (registeredDevice) { |
|
|
|
if (registeredDevice) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -3606,6 +3602,8 @@ var regexAlphaNumericChars = "0-9\.\_" + regexAlphaChars; |
|
|
|
var req = navigator.push.register(); |
|
|
|
var req = navigator.push.register(); |
|
|
|
|
|
|
|
|
|
|
|
req.onsuccess = function(e) { |
|
|
|
req.onsuccess = function(e) { |
|
|
|
|
|
|
|
clearTimeout(registerDeviceTO); |
|
|
|
|
|
|
|
console.log(dT(), 'Push registered', req.result); |
|
|
|
registeredDevice = req.result; |
|
|
|
registeredDevice = req.result; |
|
|
|
MtpApiManager.invokeApi('account.registerDevice', { |
|
|
|
MtpApiManager.invokeApi('account.registerDevice', { |
|
|
|
token_type: 4, |
|
|
|
token_type: 4, |
|
|
@ -3619,7 +3617,9 @@ var regexAlphaNumericChars = "0-9\.\_" + regexAlphaChars; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
req.onerror = function(e) { |
|
|
|
req.onerror = function(e) { |
|
|
|
console.error('Push register error', e); |
|
|
|
console.error('Push register error', e, e.toString()); |
|
|
|
|
|
|
|
registerDeviceTO = setTimeout(registerDevice, registerDevicePeriod); |
|
|
|
|
|
|
|
registerDevicePeriod = Math.min(30000, registerDevicePeriod * 1.5); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|