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>
</li>
<li ng-show="mobile">
<switch id="enable-notifications" name="notifications" ng-model="notifications" class="green right"></switch>
<div translate>Enable notifications</div>
<switch id="push-notifications" name="pushNotifications" ng-model="pushNotifications" class="green right"></switch>
<div translate>Enable push notifications</div>
</li>
</ul>
<h4></h4>

View file

@ -14,7 +14,7 @@ angular.module('copayApp.controllers').controller('preferencesGlobalController',
$scope.spendUnconfirmed = config.wallet.spendUnconfirmed;
$scope.glideraEnabled = config.glidera.enabled;
$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;
@ -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;
var opts = {
pushNotifications: {
@ -79,5 +79,6 @@ angular.module('copayApp.controllers').controller('preferencesGlobalController',
unwatchSpendUnconfirmed();
unwatchGlideraEnabled();
unwatchGlideraTestnet();
unwatchPushNotifications();
});
});

View file

@ -38,7 +38,7 @@ angular.module('copayApp.services')
opts.token = token;
root.subscribe(opts, wallet.id, function(err, response) {
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) {
root.unsubscribe(wallet.id, function(err, response) {
if (err) $log.warn('Error: ' + err.code);
$log.debug('Unsubscribed: ' + response);
$log.debug('Unsubscribed from push notifications service');
});
});
}