diff --git a/public/views/preferencesGlobal.html b/public/views/preferencesGlobal.html
index 2fd500373..54155c4c3 100644
--- a/public/views/preferencesGlobal.html
+++ b/public/views/preferencesGlobal.html
@@ -48,6 +48,10 @@
Use Unconfirmed Funds
+
+
+ Enable notifications
+
diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js
index dfb408a65..e79055aba 100644
--- a/src/js/controllers/index.js
+++ b/src/js/controllers/index.js
@@ -1197,6 +1197,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.updateAll();
});
+ $rootScope.$on('Local/EnableNotifications', function(event, vale) {
+ //make suscribe/unsuscribe
+ self.updateAll();
+ });
+
$rootScope.$on('Local/FeeLevelUpdated', function(event, level) {
self.setCurrentFeeLevel(level);
});
diff --git a/src/js/controllers/preferencesGlobal.js b/src/js/controllers/preferencesGlobal.js
index 741d37963..17095c002 100644
--- a/src/js/controllers/preferencesGlobal.js
+++ b/src/js/controllers/preferencesGlobal.js
@@ -2,7 +2,7 @@
angular.module('copayApp.controllers').controller('preferencesGlobalController',
function($scope, $rootScope, $log, configService, uxLanguage) {
-
+
this.init = function() {
var config = configService.getSync();
this.unitName = config.wallet.settings.unitName;
@@ -10,10 +10,11 @@ angular.module('copayApp.controllers').controller('preferencesGlobalController',
this.selectedAlternative = {
name: config.wallet.settings.alternativeName,
isoCode: config.wallet.settings.alternativeIsoCode
- };
+ };
$scope.spendUnconfirmed = config.wallet.spendUnconfirmed;
$scope.glideraEnabled = config.glidera.enabled;
$scope.glideraTestnet = config.glidera.testnet;
+ $scope.notifications = config.notifications ? config.notifications.enabled : true;
};
var unwatchSpendUnconfirmed = $scope.$watch('spendUnconfirmed', function(newVal, oldVal) {
@@ -29,6 +30,19 @@ angular.module('copayApp.controllers').controller('preferencesGlobalController',
});
});
+ var unwatchNotification = $scope.$watch('notifications', function(newVal, oldVal) {
+ if (newVal == oldVal) return;
+ var opts = {
+ notifications: {
+ enabled: newVal
+ }
+ };
+ configService.set(opts, function(err) {
+ $rootScope.$emit('Local/EnableNotifications', opts);
+ if (err) $log.debug(err);
+ });
+ });
+
var unwatchGlideraEnabled = $scope.$watch('glideraEnabled', function(newVal, oldVal) {
if (newVal == oldVal) return;
var opts = {
diff --git a/src/js/services/configService.js b/src/js/services/configService.js
index 9f391237b..3771c5e9b 100644
--- a/src/js/services/configService.js
+++ b/src/js/services/configService.js
@@ -41,6 +41,10 @@ angular.module('copayApp.services').factory('configService', function(storageSer
rates: {
url: 'https://insight.bitpay.com:443/api/rates',
},
+
+ notifications: {
+ enabled: true
+ },
};
var configCache = null;
@@ -70,7 +74,7 @@ angular.module('copayApp.services').factory('configService', function(storageSer
configCache.wallet.settings.unitCode = defaultConfig.wallet.settings.unitCode;
}
if (!configCache.glidera) {
- configCache.glidera = defaultConfig.glidera;
+ configCache.glidera = defaultConfig.glidera;
}
} else {