update to current BWC

This commit is contained in:
Matias Alejo Garcia 2015-05-19 14:10:47 -03:00
parent 7bb6436d09
commit 837f6fced1
4 changed files with 45 additions and 53 deletions

View File

@ -20,6 +20,15 @@
</span>
</li>
<li class="line-b p20" ng-click="$root.go('preferencesEmail')">
<span translate>Email Notifications</span>
<span class="right text-gray">
<i class="icon-arrow-right3 size-24 right"></i>
<span ng-if="!index.preferences.email" translate>Disabled</span>
<span ng-if="index.preferences.email">{{index.preferences.email}}</span>
</span>
</li>
<li class="line-b p20" ng-click="$root.go('preferencesColor')">
<span translate>Color</span>
<span class="right text-gray">
@ -31,16 +40,6 @@
<span translate>Encrypt Private Key</span>
<switch id="network-name" name="encrypt" ng-model="encrypt" class="green right"></switch>
</li>
<li class="line-b p20" ng-click="$root.go('preferencesEmail')">
<span translate>email Notifications</span>
<span class="right text-gray">
<i class="icon-arrow-right3 size-24 right"></i>
<span ng-if="!index.preferences.email" translate>Disabled</span>
<span ng-if="index.preferences.email">{{index.preferences.email}}</span>
</span>
</li>
<h4 class="title m0">&nbsp;</h4>
<li class="line-b p20" ng-click="$root.go('backup')">

View File

@ -22,7 +22,7 @@
</div>
<form name="emailForm" ng-submit="prefEmail.save(emailForm)" class="columns" novalidate>
<form name="emailForm" ng-submit="prefEmail.save(emailForm)" class="columns" novalidate ng-init="prefEmail.email = index.preferences.email">
<div class="box-notification" ng-show="prefEmail.error">
<span class="text-warning size-14">
{{prefEmail.error|translate}}
@ -32,8 +32,8 @@
<label>email for wallet notifications:</i></label>
<input type="email" id="email" name="email" ng-model="prefEmail.email" required>
<input type="submit" class="button expand black radius" value="{{'Save'|translate}}"
ng-style="{'background-color':index.backgroundColor}" ng-disabled="emailForm.$invalid">
ng-style="{'background-color':index.backgroundColor}" ng-disabled="emailForm.$invalid && !index.preferences.email">
</form>
<p class="text-gray text-center columns size-14" translate> Setting up email notifications could weaken your privacy, if the wallet service provider is compromised. Information available to an attacker would include be the positive confirmation of a bitcoin wallet and its balance, but no more.
<p class="text-gray text-center columns size-14" translate> Setting up email notifications could weaken your privacy, if the wallet service provider is compromised. Information available to an attacker would include your wallet addresses and its balance, but no more.
</div>
<div class="extra-margin-bottom"></div>

View File

@ -145,6 +145,20 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$rootScope.$emit('Local/TabChanged', tab);
};
self.updatePreferences = function(cb) {
var fc = profileService.focusedClient;
fc.getPreferences(function(err, preferences) {
if (err) {
self.handleError(err);
return cb(err);
}
self.preferences = preferences;
return cb(err, preferences);
});
};
self.updateAll = function(walletStatus, untilItChanges, initBalance, tries) {
tries = tries || 0;
if (untilItChanges && lodash.isUndefined(initBalance)) {
@ -192,6 +206,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.walletStatus = walletStatus.wallet.status;
self.walletScanStatus = walletStatus.wallet.scanStatus;
self.copayers = walletStatus.wallet.copayers;
self.preferences = walletStatus.preferences;
self.setBalance(walletStatus.balance);
$rootScope.$apply();
});
@ -345,7 +360,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
lodash.each(txs, function(tx) {
tx.ts = tx.minedTs || tx.sentTs;
// no future transaction...
if (tx.ts > now)
if (tx.ts > now)
ts.ts = now;
tx.rateTs = Math.floor((tx.ts || now) / 1000);
tx.amountStr = profileService.formatAmount(tx.amount); //$filter('noFractionNumber')(
@ -579,13 +594,16 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
});
$rootScope.$on('Local/UnitSettingUpdated', function(event) {
self.updateAll();
self.updateTxHistory();
});
$rootScope.$on('Local/EmailUpdated', function(event, cb) {
self.updatePreferences(cb);
});
$rootScope.$on('Local/BWSUpdated', function(event) {
profileService.applyConfig();
});
@ -665,7 +683,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
var msg = 'Error at Wallet Service: ';
if (err.message) msg = msg + err.message;
else if (err.error) msg = msg + err.error;
else msg = msg + err;
else msg = msg + (lodash.isObject(err) ? JSON.stringify(err) : err);
self.clientError(msg);
}
$rootScope.$apply();
@ -684,31 +702,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.setDefaultLanguage(setLang);
});
$rootScope.$on('Animation/Disable', function(event) {
$timeout(function() {
self.slideLeft = false;
self.slideRight = false;
self.slideUp = false;
self.slideDown = false;
}, 400);
});
$rootScope.$on('Animation/SlideLeft', function(event) {
self.slideLeft = true;
});
$rootScope.$on('Animation/SlideRight', function(event) {
self.slideRight = true;
});
$rootScope.$on('Animation/SlideUp', function(event) {
self.slideUp = true;
});
$rootScope.$on('Animation/SlideDown', function(event) {
self.slideDown = true;
});
$rootScope.$on('NewIncomingTx', function() {
self.updateBalance();
$timeout(function() {
@ -716,10 +709,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}, 5000);
});
// remove transactionProposalRemoved (only for compat)
lodash.each(['NewOutgoingTx', 'NewTxProposal', 'TxProposalFinallyRejected', 'transactionProposalRemoved', 'TxProposalRemoved',
lodash.each(['NewOutgoingTx', 'NewTxProposal', 'TxProposalFinallyRejected', 'TxProposalRemoved',
'Local/NewTxProposal', 'Local/TxProposalAction', 'ScanFinished'
], function(eventName) {
$rootScope.$on(eventName, function(event, untilItChanges) {

View File

@ -1,26 +1,29 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesEmailController',
function($scope, go, profileService ,gettext, $log) {
function($scope, go, profileService, gettext, $log) {
this.save = function(form) {
this.error=null;
this.error = null;
if (!form.$valid) {
if (!form.$valid && this.email) {
this.error = gettext('Invalid email');
return;
}
console.log('[preferencesEmail.js.12]', this.email); //TODO
var fc = profileService.focusedClient;
this.saving =true;
fc.savePreferences({email:this.email}, function(err) {
fc.saving =false;
this.saving = true;
fc.savePreferences({
email: this.email
}, function(err) {
fc.saving = false;
if (err) {
$log.warn(err);
$scope.$emit('Local/ClientError', err);
return;
}
go.walletHome();
$scope.$emit('Local/EmailUpdated', function(err){
go.path('preferences');
});
});
};