added option to enable and disable sound

This commit is contained in:
Kadir Sekha 2018-02-26 11:47:11 +05:00
commit f8baca943c
4 changed files with 22 additions and 1 deletions

View file

@ -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();
}

View file

@ -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,

View file

@ -106,6 +106,8 @@ angular.module('copayApp.services').factory('configService', function(storageSer
enabled: false,
},
soundsEnabled: false,
log: {
filter: 'debug',
},

View file

@ -29,6 +29,10 @@
<span class="toggle-label" translate>Enable email notifications</span>
</ion-toggle>
<ion-toggle ng-model="sounds.value" toggle-class="toggle-balanced" ng-change="soundNotificationsChange()">
<span class="toggle-label" translate>Enable sound</span>
</ion-toggle>
<div ng-if="emailNotifications.value">
<div class="settings-explanation">
<div class="settings-description" translate>