From 7028f6f1c53b0e1c4b34bcdf0b46cca9f4590e15 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 27 Apr 2015 02:07:26 -0300 Subject: [PATCH 1/6] fix timming in modal --- src/js/controllers/index.js | 2 +- src/js/controllers/walletHome.js | 20 ++++++++------------ src/js/routes.js | 8 ++++++-- src/js/services/txStatus.js | 15 +++++++-------- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 71edde1f4..82c5cfb63 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -649,7 +649,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.updateAll(); $timeout(function() { self.updateTxHistory(); - }, 5000); + }, 3000); }); }); diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index e01f78f91..072571759 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -486,10 +486,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi } self.signAndBroadcast(txp, function(err) { - profileService.lockFC(); - if (err) { + if (err) return self.setError(err); - } + self.resetForm(); }); }); @@ -504,9 +503,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi profileService.lockFC(); self.setOngoingProcess(); - if (err) { + if (err) return cb(err); - } if (signedTx.status == 'accepted') { self.setOngoingProcess('Broadcasting transaction'); @@ -515,16 +513,14 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi if (err) { $scope.error = 'Transaction not broadcasted. Please try again.'; $scope.$digest(); - } else { - txStatus.notify(btx); - $scope.$emit('Local/TxProposalAction'); - } - return cb(); + return; + } + $scope.$emit('Local/TxProposalAction'); + txStatus.notify(btx, cb); }); } else { - txStatus.notify(signedTx); $scope.$emit('Local/TxProposalAction'); - return cb(); + txStatus.notify(signedTx, cb); } }); }; diff --git a/src/js/routes.js b/src/js/routes.js index b03013a13..3c42ffcd5 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -28,11 +28,15 @@ angular var orig = $delegate[level]; $delegate[level] = function() { var args = [].slice.call(arguments); + if (!Array.isArray(args)) args = [args]; args = args.map(function(v) { try { if (typeof v == 'undefined') v = 'undefined'; if (typeof v == 'object') { - v = JSON.stringify(v); + if (v.message) + v = v.message; + else + v = JSON.stringify(v); } v = v.toString(); if (v.length > 200) @@ -46,7 +50,7 @@ angular try { if (window.cordova) console.log(args.join(' ')); - orig.apply(null, args) + orig.apply(null, args); historicLog.add(level, args.join(' ')); } catch (e) { console.log('Error at log decorator:', e); diff --git a/src/js/services/txStatus.js b/src/js/services/txStatus.js index 9f048dce3..3e76a8933 100644 --- a/src/js/services/txStatus.js +++ b/src/js/services/txStatus.js @@ -1,18 +1,17 @@ 'use strict'; -angular.module('copayApp.services').factory('txStatus', function($modal, lodash, profileService) { +angular.module('copayApp.services').factory('txStatus', function($modal, lodash, profileService, $timeout) { var root = {}; - root.notify = function(txp) { + root.notify = function(txp, cb) { var fc = profileService.focusedClient; var msg; var status = txp.status; - + if (status == 'broadcasted') { msg = 'Transaction broadcasted'; - } - else { + } else { var action = lodash.find(txp.actions, { copayerId: fc.credentials.copayerId }); @@ -25,16 +24,16 @@ angular.module('copayApp.services').factory('txStatus', function($modal, lodash, } } - if (msg) - root.openModal(msg); + root.openModal(msg, cb); }; - root.openModal = function(statusStr) { + root.openModal = function(statusStr, cb) { var ModalInstanceCtrl = function($scope, $modalInstance) { $scope.statusStr = statusStr; $scope.cancel = function() { $modalInstance.dismiss('cancel'); }; + if (cb) $timeout(cb, 100); }; $modal.open({ templateUrl: 'views/modals/tx-status.html', From ccc22145b01ab81156b5a560f587dee8a3eaf889 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 27 Apr 2015 02:25:35 -0300 Subject: [PATCH 2/6] do not hide form when sending tx --- public/views/walletHome.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/views/walletHome.html b/public/views/walletHome.html index 6f9a6c7c2..7a0f5055c 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -265,7 +265,7 @@
-
+
{{home.error|translate}} From 405e4cc75c5e4abe27a5cabfb882cf43e61afbaa Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 27 Apr 2015 02:38:48 -0300 Subject: [PATCH 3/6] fix timming / display issues --- src/js/controllers/join.js | 7 +++---- src/js/controllers/walletHome.js | 35 ++++++++++++++++---------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/js/controllers/join.js b/src/js/controllers/join.js index 870d1af43..8099d2a63 100644 --- a/src/js/controllers/join.js +++ b/src/js/controllers/join.js @@ -145,14 +145,13 @@ angular.module('copayApp.controllers').controller('joinController', extendedPrivateKey: form.privateKey.$modelValue, myName: form.myName.$modelValue }, function(err) { - self.loading = false; if (err) { + self.loading = false; self.error = 'Could not join wallet: ' + (err.message ? err.message : err); $rootScope.$apply(); + return } - else { - go.walletHome(); - } + go.walletHome(); }); }, 100); } diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 072571759..e703b47fe 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -479,15 +479,17 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi message: comment, payProUrl: paypro ? paypro.url : null, }, function(err, txp) { - self.setOngoingProcess(); if (err) { + self.setOngoingProcess(); profileService.lockFC(); return self.setError(err); } self.signAndBroadcast(txp, function(err) { - if (err) + if (err) { + self.setOngoingProcess(); return self.setError(err); + } self.resetForm(); }); @@ -501,40 +503,37 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi self.setOngoingProcess('Signing transaction'); fc.signTxProposal(txp, function(err, signedTx) { profileService.lockFC(); - self.setOngoingProcess(); - if (err) + if (err) { + self.setOngoingProcess(); return cb(err); + } if (signedTx.status == 'accepted') { self.setOngoingProcess('Broadcasting transaction'); fc.broadcastTxProposal(signedTx, function(err, btx) { - self.setOngoingProcess(); if (err) { + self.setOngoingProcess(); $scope.error = 'Transaction not broadcasted. Please try again.'; $scope.$digest(); return; - } + } $scope.$emit('Local/TxProposalAction'); - txStatus.notify(btx, cb); + txStatus.notify(btx, function() { + self.setOngoingProcess(); + return cb(); + }); }); } else { $scope.$emit('Local/TxProposalAction'); - txStatus.notify(signedTx, cb); + txStatus.notify(signedTx, function() { + self.setOngoingProcess(); + return cb(); + }); } }); }; - this.setTopAmount = function() { - throw new Error('todo: setTopAmount'); - var form = $scope.sendForm; - if (form) { - form.amount.$setViewValue(w.balanceInfo.topAmount); - form.amount.$render(); - form.amount.$isValid = true; - } - }; - this.setForm = function(to, amount, comment) { var form = $scope.sendForm; if (to) { From 2f7f593ad69a1347174aff8f134e99b5ee6f9f94 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 27 Apr 2015 03:03:08 -0300 Subject: [PATCH 4/6] do not hice create/join forms with working / no color on global pages --- public/views/create.html | 2 +- public/views/includes/topbar.html | 2 +- public/views/join.html | 2 +- src/js/controllers/join.js | 4 +++- src/js/routes.js | 19 +++++++++++++------ 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/public/views/create.html b/public/views/create.html index 35267fb1b..62ca0fcf0 100644 --- a/public/views/create.html +++ b/public/views/create.html @@ -14,7 +14,7 @@
- +
diff --git a/public/views/includes/topbar.html b/public/views/includes/topbar.html index 32ca8ce47..13028d226 100644 --- a/public/views/includes/topbar.html +++ b/public/views/includes/topbar.html @@ -19,7 +19,7 @@
-

+

{{(titleSection|translate) || index.walletName}}

diff --git a/public/views/join.html b/public/views/join.html index b7f3a4872..a682c1e9a 100644 --- a/public/views/join.html +++ b/public/views/join.html @@ -12,7 +12,7 @@
-
+
diff --git a/src/js/controllers/join.js b/src/js/controllers/join.js index 8099d2a63..2a24a46c1 100644 --- a/src/js/controllers/join.js +++ b/src/js/controllers/join.js @@ -151,7 +151,9 @@ angular.module('copayApp.controllers').controller('joinController', $rootScope.$apply(); return } - go.walletHome(); + $timeout(function() { + go.walletHome(); + }, 2000); }); }, 100); } diff --git a/src/js/routes.js b/src/js/routes.js index 3c42ffcd5..23c225885 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -98,6 +98,7 @@ angular templateUrl: 'views/createProfile.html', controller: function($scope) { $scope.mainDark = true; + $scope.noColor = true; } } } @@ -122,6 +123,7 @@ angular templateUrl: 'views/includes/topbar.html', controller: function($scope) { $scope.goBackToState = 'walletHome'; + $scope.noColor = true; } } }, @@ -144,6 +146,7 @@ angular controller: function($scope) { $scope.titleSection = 'Join shared wallet'; $scope.goBackToState = 'add'; + $scope.noColor = true; } } } @@ -160,6 +163,7 @@ angular controller: function($scope) { $scope.titleSection = 'Import wallet'; $scope.goBackToState = 'add'; + $scope.noColor = true; } } } @@ -181,6 +185,7 @@ angular controller: function($scope) { $scope.titleSection = 'Import legacy wallet'; $scope.goBackToState = 'add'; + $scope.noColor = true; } } } @@ -199,6 +204,7 @@ angular controller: function($scope) { $scope.titleSection = 'Create new wallet'; $scope.goBackToState = 'add'; + $scope.noColor = true; } } } @@ -215,12 +221,6 @@ angular } } }) - .state('profile', { - url: '/profile', - controller: 'profileController', - templateUrl: 'views/profile.html', - needProfile: true - }) .state('preferences', { url: '/preferences', templateUrl: 'views/preferences.html', @@ -252,6 +252,7 @@ angular controller: function($scope) { $scope.titleSection = 'Language'; $scope.goBackToState = 'preferences'; + $scope.noColor = true; } } } @@ -270,6 +271,7 @@ angular controller: function($scope) { $scope.titleSection = 'Unit'; $scope.goBackToState = 'preferences'; + $scope.noColor = true; } } } @@ -307,6 +309,7 @@ angular controller: function($scope) { $scope.titleSection = 'Alternative Currency'; $scope.goBackToState = 'preferences'; + $scope.noColor = true; } } } @@ -325,6 +328,7 @@ angular controller: function($scope) { $scope.titleSection = 'Bitcore Wallet Service'; $scope.goBackToState = 'preferences'; + $scope.noColor = true; } } } @@ -361,6 +365,7 @@ angular controller: function($scope) { $scope.titleSection = 'About'; $scope.goBackToState = 'preferences'; + $scope.noColor = true; } } } @@ -379,6 +384,7 @@ angular controller: function($scope) { $scope.titleSection = 'Logs'; $scope.goBackToState = 'about'; + $scope.noColor = true; } } } @@ -426,6 +432,7 @@ angular controller: function($scope) { $scope.titleSection = 'Add wallet'; $scope.closeToHome = true; + $scope.noColor = true; } } } From 4ec42310f501ae995c9a9b55880de947da7e1da9 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 27 Apr 2015 03:33:57 -0300 Subject: [PATCH 5/6] fix gen addr animation in ios --- public/views/walletHome.html | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/public/views/walletHome.html b/public/views/walletHome.html index 7a0f5055c..263d000fd 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -189,32 +189,29 @@

My Bitcoin address

-
+
-
-

{{home.addr}}

-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
- -
-

...

+
+

+ {{home.generatingAddress ? '...' : home.addr}} + +

- +
From 520e4b2b8521149d581fd56c231248775f02c53b Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 27 Apr 2015 09:59:20 -0300 Subject: [PATCH 6/6] add condition to local notif --- public/views/walletHome.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/views/walletHome.html b/public/views/walletHome.html index 263d000fd..7e551fd4c 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -39,7 +39,7 @@
-
+