Merge pull request #3786 from tanojaja/feat/push-notifications-02

rename push notifications variables - fix log when enable/disable not…
This commit is contained in:
Matias Alejo Garcia 2016-01-20 15:25:41 -03:00
commit 0d1392c499
3 changed files with 7 additions and 6 deletions

View file

@ -49,8 +49,8 @@
<div translate>Use Unconfirmed Funds</div> <div translate>Use Unconfirmed Funds</div>
</li> </li>
<li ng-show="mobile"> <li ng-show="mobile">
<switch id="enable-notifications" name="notifications" ng-model="notifications" class="green right"></switch> <switch id="push-notifications" name="pushNotifications" ng-model="pushNotifications" class="green right"></switch>
<div translate>Enable notifications</div> <div translate>Enable push notifications</div>
</li> </li>
</ul> </ul>
<h4></h4> <h4></h4>

View file

@ -14,7 +14,7 @@ angular.module('copayApp.controllers').controller('preferencesGlobalController',
$scope.spendUnconfirmed = config.wallet.spendUnconfirmed; $scope.spendUnconfirmed = config.wallet.spendUnconfirmed;
$scope.glideraEnabled = config.glidera.enabled; $scope.glideraEnabled = config.glidera.enabled;
$scope.glideraTestnet = config.glidera.testnet; $scope.glideraTestnet = config.glidera.testnet;
$scope.notifications = config.notifications ? config.notifications.enabled : true; $scope.pushNotifications = config.pushNotifications.enabled;
}; };
if (isMobile.Android() || isMobile.iOS()) $scope.mobile = true; if (isMobile.Android() || isMobile.iOS()) $scope.mobile = true;
@ -33,7 +33,7 @@ angular.module('copayApp.controllers').controller('preferencesGlobalController',
}); });
}); });
var unwatchNotification = $scope.$watch('notifications', function(newVal, oldVal) { var unwatchPushNotifications = $scope.$watch('pushNotifications', function(newVal, oldVal) {
if (newVal == oldVal) return; if (newVal == oldVal) return;
var opts = { var opts = {
pushNotifications: { pushNotifications: {
@ -79,5 +79,6 @@ angular.module('copayApp.controllers').controller('preferencesGlobalController',
unwatchSpendUnconfirmed(); unwatchSpendUnconfirmed();
unwatchGlideraEnabled(); unwatchGlideraEnabled();
unwatchGlideraTestnet(); unwatchGlideraTestnet();
unwatchPushNotifications();
}); });
}); });

View file

@ -38,7 +38,7 @@ angular.module('copayApp.services')
opts.token = token; opts.token = token;
root.subscribe(opts, wallet.id, function(err, response) { root.subscribe(opts, wallet.id, function(err, response) {
if (err) $log.warn('Error: ' + err.code); if (err) $log.warn('Error: ' + err.code);
$log.debug('Suscribed: ' + JSON.stringify(response)); $log.debug('Suscribed to push notifications service: ' + JSON.stringify(response));
}); });
}); });
}); });
@ -48,7 +48,7 @@ angular.module('copayApp.services')
lodash.forEach(profileService.getWallets('testnet'), function(wallet) { lodash.forEach(profileService.getWallets('testnet'), function(wallet) {
root.unsubscribe(wallet.id, function(err, response) { root.unsubscribe(wallet.id, function(err, response) {
if (err) $log.warn('Error: ' + err.code); if (err) $log.warn('Error: ' + err.code);
$log.debug('Unsubscribed: ' + response); $log.debug('Unsubscribed from push notifications service');
}); });
}); });
} }