fix email label

This commit is contained in:
Gabriel Bazán 2016-09-01 17:46:56 -03:00
commit 3c0bc734a4
4 changed files with 23 additions and 8 deletions

View file

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