diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index 392800af1..25c74dcd7 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -607,7 +607,7 @@ angular.module('copayApp.controllers').controller('confirmController', function( (processName == 'sendingTx' && !$scope.wallet.canSign() && !$scope.wallet.isPrivKeyExternal()) ) && !isOn) { $scope.sendStatus = 'success'; - if ($scope.wallet.coin == 'bch') { + if (config.soundsEnabled && $scope.wallet.coin == 'bch') { var audio = new Audio('misc/bch_sent.mp3'); audio.play(); } diff --git a/src/js/controllers/preferencesNotifications.js b/src/js/controllers/preferencesNotifications.js index 3d78e98db..9b4547ea7 100644 --- a/src/js/controllers/preferencesNotifications.js +++ b/src/js/controllers/preferencesNotifications.js @@ -28,6 +28,11 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr value: isEmailEnabled && $scope.newEmail.value ? true : false }; + var isSoundEnabled = config.soundsEnabled ? config.soundsEnabled : false; + $scope.sounds = { + value: isSoundEnabled + }; + $timeout(function() { $scope.$apply(); }); @@ -72,6 +77,16 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr emailService.updateEmail(opts); }; + $scope.soundNotificationsChange = function() { + if (!$scope.sounds) return; + var opts = { + soundsEnabled: $scope.sounds.value + }; + configService.set(opts, function(err) { + if (err) $log.debug(err); + }); + }; + $scope.save = function() { emailService.updateEmail({ enabled: $scope.emailNotifications.value, diff --git a/src/js/services/configService.js b/src/js/services/configService.js index f078bac64..0a19d97e3 100644 --- a/src/js/services/configService.js +++ b/src/js/services/configService.js @@ -106,6 +106,8 @@ angular.module('copayApp.services').factory('configService', function(storageSer enabled: false, }, + soundsEnabled: false, + log: { filter: 'debug', }, diff --git a/www/views/preferencesNotifications.html b/www/views/preferencesNotifications.html index a2d7ee725..3700c19d3 100644 --- a/www/views/preferencesNotifications.html +++ b/www/views/preferencesNotifications.html @@ -29,6 +29,10 @@ Enable email notifications + + Enable sound + +