From 00c730ccc39028161b4b5edaf8c92bddda8aefc4 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 14 May 2015 17:21:19 -0300 Subject: [PATCH 1/7] email prefernce for notifications --- public/views/preferences.html | 10 ++++++++++ src/js/routes.js | 14 +++++++++++++- src/js/services/profileService.js | 1 - 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/public/views/preferences.html b/public/views/preferences.html index 73f4ce9de..8770b88a0 100644 --- a/public/views/preferences.html +++ b/public/views/preferences.html @@ -31,6 +31,16 @@ Encrypt Private Key +
  • + email Notifications + + + Disabled + {{index.preferences.email}} + +
  • + +

     

  • diff --git a/src/js/routes.js b/src/js/routes.js index b407bc0e4..bae26b370 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -257,7 +257,18 @@ angular } }) - + .state('preferencesEmail', { + url: '/preferencesEmail', + templateUrl: 'views/preferencesEmail.html', + walletShouldBeComplete: true, + needProfile: true, + views: { + 'main': { + templateUrl: 'views/preferencesEmail.html' + }, + + } + }) .state('preferencesBwsUrl', { url: '/preferencesBwsUrl', templateUrl: 'views/preferencesBwsUrl.html', @@ -397,6 +408,7 @@ angular preferencesAltCurrency: 12, preferencesBwsUrl: 12, preferencesAlias: 12, + preferencesEmail: 12, about: 12, logs: 13, add: 11, diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index a1794bbfe..6b8132e8e 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -390,6 +390,5 @@ angular.module('copayApp.services') }); }; - return root; }); From bf59f0c94f5a40c9d61f8360a10f520ad5e7a525 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 14 May 2015 17:21:45 -0300 Subject: [PATCH 2/7] new form for emails --- public/views/preferencesEmail.html | 39 ++++++++++++++++++++++++++ src/js/controllers/preferencesEmail.js | 28 ++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 public/views/preferencesEmail.html create mode 100644 src/js/controllers/preferencesEmail.js diff --git a/public/views/preferencesEmail.html b/public/views/preferencesEmail.html new file mode 100644 index 000000000..dac07f5e9 --- /dev/null +++ b/public/views/preferencesEmail.html @@ -0,0 +1,39 @@ +
    +
    + + + +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    + Saving preferences... +
    +
    + + +
    +
    + + {{prefEmail.error|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. +

    +
    diff --git a/src/js/controllers/preferencesEmail.js b/src/js/controllers/preferencesEmail.js new file mode 100644 index 000000000..140c41cd0 --- /dev/null +++ b/src/js/controllers/preferencesEmail.js @@ -0,0 +1,28 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('preferencesEmailController', + function($scope, go, profileService ,gettext, $log) { + this.save = function(form) { + this.error=null; + + if (!form.$valid) { + 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; + if (err) { + $log.warn(err); + $scope.$emit('Local/ClientError', err); + return; + } + go.walletHome(); + }); + }; + + + }); From 1e7098e626fa06a1dd961d97904e8155d7f4ab1e Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 15 May 2015 11:04:37 -0300 Subject: [PATCH 3/7] fix /copayers title --- public/views/copayers.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/views/copayers.html b/public/views/copayers.html index dd6acf5c9..b8109ab15 100644 --- a/public/views/copayers.html +++ b/public/views/copayers.html @@ -1,7 +1,7 @@
    + ng-init="">
    From a8a0023e386581dce4c95375c3ad90af5e7340c0 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 15 May 2015 11:07:19 -0300 Subject: [PATCH 4/7] ignore history server errors --- src/js/controllers/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index a77aeb446..c29a1efef 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -255,7 +255,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.updatingTxHistory = false; if (err) { $log.debug('TxHistory ERROR:', err); - self.handleError(err); + // We do not should errors here, since history is usually + // fetched AFTER others requests. + //self.handleError(err); self.txHistoryError = true; } else { $log.debug('Wallet Transaction History:', txs); From 7bb6436d09b585cc7deca2260a37b01bed28de31 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 19 May 2015 12:01:11 -0300 Subject: [PATCH 5/7] update bwc --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index a924bcb97..3688bf161 100644 --- a/bower.json +++ b/bower.json @@ -16,7 +16,7 @@ "foundation-icon-fonts": "*", "ng-lodash": "~0.2.0", "angular-moment": "~0.9.0", - "angular-bitcore-wallet-client": "^0.0.21", + "angular-bitcore-wallet-client": "^0.0.22", "angular-ui-router": "~0.2.13", "qrcode-decoder-js": "*", "fastclick": "*", From 837f6fced1eca4ae7d12a1d5acd26141093d8534 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 19 May 2015 14:10:47 -0300 Subject: [PATCH 6/7] update to current BWC --- public/views/preferences.html | 19 +++++---- public/views/preferencesEmail.html | 6 +-- src/js/controllers/index.js | 54 +++++++++++--------------- src/js/controllers/preferencesEmail.js | 19 +++++---- 4 files changed, 45 insertions(+), 53 deletions(-) diff --git a/public/views/preferences.html b/public/views/preferences.html index 8770b88a0..d431d8d17 100644 --- a/public/views/preferences.html +++ b/public/views/preferences.html @@ -20,6 +20,15 @@
  • +
  • + Email Notifications + + + Disabled + {{index.preferences.email}} + +
  • +
  • Color @@ -31,16 +40,6 @@ Encrypt Private Key
  • -
  • - email Notifications - - - Disabled - {{index.preferences.email}} - -
  • - -

     

  • diff --git a/public/views/preferencesEmail.html b/public/views/preferencesEmail.html index dac07f5e9..43280ba5e 100644 --- a/public/views/preferencesEmail.html +++ b/public/views/preferencesEmail.html @@ -22,7 +22,7 @@ -
    +
    {{prefEmail.error|translate}} @@ -32,8 +32,8 @@ + ng-style="{'background-color':index.backgroundColor}" ng-disabled="emailForm.$invalid && !index.preferences.email"> -

    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. +

    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.

    diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index c29a1efef..ff69df286 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -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) { diff --git a/src/js/controllers/preferencesEmail.js b/src/js/controllers/preferencesEmail.js index 140c41cd0..783ba82ee 100644 --- a/src/js/controllers/preferencesEmail.js +++ b/src/js/controllers/preferencesEmail.js @@ -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'); + }); }); }; From 9b4e98753b8d64ffc39d9a1f13885fe6a363454f Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Tue, 19 May 2015 15:30:49 -0300 Subject: [PATCH 7/7] Fix strings for translation --- public/views/modals/confirmation.html | 4 ++-- public/views/preferencesAlias.html | 6 ++---- public/views/preferencesEmail.html | 8 ++++---- src/js/controllers/preferencesEmail.js | 8 ++------ 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/public/views/modals/confirmation.html b/public/views/modals/confirmation.html index a057c7a4e..1d56e2348 100644 --- a/public/views/modals/confirmation.html +++ b/public/views/modals/confirmation.html @@ -2,13 +2,13 @@

    {{title|translate}}

    -
    -
    diff --git a/public/views/preferencesAlias.html b/public/views/preferencesAlias.html index 6b7af95d0..ca1e90657 100644 --- a/public/views/preferencesAlias.html +++ b/public/views/preferencesAlias.html @@ -4,15 +4,13 @@ ng-init="titleSection='Wallet Alias'; goBackToState = 'preferences'">
    - -
    - +
    -

    Changing wallet alias only afects the local wallet name. +

    Changing wallet alias only afects the local wallet name.

    diff --git a/public/views/preferencesEmail.html b/public/views/preferencesEmail.html index 43280ba5e..55cac6990 100644 --- a/public/views/preferencesEmail.html +++ b/public/views/preferencesEmail.html @@ -17,7 +17,7 @@
    - Saving preferences... + Saving preferences... @@ -29,11 +29,11 @@ - + - -

    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. +

    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.

    diff --git a/src/js/controllers/preferencesEmail.js b/src/js/controllers/preferencesEmail.js index 783ba82ee..241297501 100644 --- a/src/js/controllers/preferencesEmail.js +++ b/src/js/controllers/preferencesEmail.js @@ -3,19 +3,15 @@ angular.module('copayApp.controllers').controller('preferencesEmailController', function($scope, go, profileService, gettext, $log) { this.save = function(form) { + var self = this; this.error = null; - if (!form.$valid && this.email) { - this.error = gettext('Invalid email'); - return; - } - var fc = profileService.focusedClient; this.saving = true; fc.savePreferences({ email: this.email }, function(err) { - fc.saving = false; + self.saving = false; if (err) { $log.warn(err); $scope.$emit('Local/ClientError', err);