fix email label
This commit is contained in:
parent
d911dd9d0b
commit
3c0bc734a4
4 changed files with 23 additions and 8 deletions
|
|
@ -1,17 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesEmailController', function($rootScope, $scope, $ionicHistory, $stateParams, $ionicNavBarDelegate, gettextCatalog, profileService, walletService) {
|
||||
angular.module('copayApp.controllers').controller('preferencesEmailController', function($scope, $ionicHistory, $stateParams, $ionicNavBarDelegate, gettextCatalog, profileService, walletService, configService) {
|
||||
$ionicNavBarDelegate.title(gettextCatalog.getString('Email Notifications'));
|
||||
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var walletId = wallet.credentials.walletId;
|
||||
|
||||
var config = configService.getSync();
|
||||
config.amailFor = config.amailFor || {};
|
||||
$scope.email = config.emailFor && config.emailFor[walletId];
|
||||
|
||||
$scope.save = function(form) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var email = $scope.email || '';
|
||||
var opts = {
|
||||
emailFor: {}
|
||||
};
|
||||
opts.emailFor[walletId] = $scope.email;
|
||||
|
||||
walletService.updateRemotePreferences(wallet, {
|
||||
email: email,
|
||||
email: $scope.email,
|
||||
}, function(err) {
|
||||
if (err) $log.warn(err);
|
||||
$ionicHistory.goBack();
|
||||
configService.set(opts, function(err) {
|
||||
if (err) $log.warn(err);
|
||||
$ionicHistory.goBack();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue