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

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