disable email notifications
This commit is contained in:
parent
68d3195f7f
commit
2a390760bc
3 changed files with 14 additions and 8 deletions
|
|
@ -2,23 +2,25 @@
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('preferencesEmailController', function($scope, $ionicHistory, $stateParams, gettextCatalog, profileService, walletService, configService) {
|
angular.module('copayApp.controllers').controller('preferencesEmailController', function($scope, $ionicHistory, $stateParams, gettextCatalog, profileService, walletService, configService) {
|
||||||
|
|
||||||
var wallet = profileService.getWallet($stateParams.walletId);
|
$scope.wallet = profileService.getWallet($stateParams.walletId);
|
||||||
var walletId = wallet.credentials.walletId;
|
var walletId = $scope.wallet.credentials.walletId;
|
||||||
|
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
config.emailFor = config.emailFor || {};
|
config.emailFor = config.emailFor || {};
|
||||||
|
$scope.emailForExist = config.emailFor && config.emailFor[walletId];
|
||||||
$scope.email = {
|
$scope.email = {
|
||||||
value: config.emailFor && config.emailFor[walletId]
|
value: config.emailFor && config.emailFor[walletId]
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.save = function() {
|
|
||||||
|
$scope.save = function(val) {
|
||||||
var opts = {
|
var opts = {
|
||||||
emailFor: {}
|
emailFor: {}
|
||||||
};
|
};
|
||||||
opts.emailFor[walletId] = $scope.email.value;
|
opts.emailFor[walletId] = val;
|
||||||
|
|
||||||
walletService.updateRemotePreferences(wallet, {
|
walletService.updateRemotePreferences($scope.wallet, {
|
||||||
email: $scope.email.value,
|
email: val,
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
if (err) $log.warn(err);
|
if (err) $log.warn(err);
|
||||||
configService.set(opts, function(err) {
|
configService.set(opts, function(err) {
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,9 @@
|
||||||
color: $mid-gray;
|
color: $mid-gray;
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
}
|
}
|
||||||
|
&-description-disabled {
|
||||||
|
color: cadetblue;
|
||||||
|
}
|
||||||
.setting-title, .setting-value {
|
.setting-title, .setting-value {
|
||||||
display: block;
|
display: block;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,11 @@
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<div class="settings-explaination">
|
<div class="settings-explaination">
|
||||||
<div class="settings-description" translate>
|
<div class="settings-description" translate>
|
||||||
You'll receive email notifications about payments sent and received from this wallet.
|
You'll receive email notifications about payments sent and received from {{wallet.name}}.
|
||||||
</div>
|
</div>
|
||||||
|
<span ng-if="emailForExist" class="settings-description-disabled" ng-click="save(null)" translate>Disable notifications</span>
|
||||||
</div>
|
</div>
|
||||||
<form name="emailForm" ng-submit="save(emailForm)" novalidate>
|
<form name="emailForm" ng-submit="save(email.value)" novalidate>
|
||||||
<div class="list settings-input-group">
|
<div class="list settings-input-group">
|
||||||
<label class="item item-input item-stacked-label">
|
<label class="item item-input item-stacked-label">
|
||||||
<span class="input-label" translate>Email Address</span>
|
<span class="input-label" translate>Email Address</span>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue