Fix if push is not available

This commit is contained in:
Gustavo Maximiliano Cortez 2016-10-10 13:45:43 -03:00
commit cd0e5df447
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
3 changed files with 16 additions and 4 deletions

View file

@ -13,9 +13,13 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr
$scope.PNEnabledByUser = true;
$scope.isIOSApp = isIOS && isCordova;
if ($scope.isIOSApp) {
PushNotification.hasPermission(function(data) {
$scope.PNEnabledByUser = data.isEnabled;
});
try {
PushNotification.hasPermission(function(data) {
$scope.PNEnabledByUser = data.isEnabled;
});
} catch(e) {
$log.error(e);
};
}
$scope.pushNotifications = {
@ -24,6 +28,7 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr
};
$scope.pushNotificationsChange = function() {
if (!$scope.pushNotifications) return;
var opts = {
pushNotifications: {
enabled: $scope.pushNotifications.value