From 6286789f4d74643443557c798ca180c7b8b7c07a Mon Sep 17 00:00:00 2001 From: Matias Pando Date: Tue, 4 Nov 2014 15:24:56 -0300 Subject: [PATCH 1/2] Shows the wallet on a pop up --- js/controllers/paymentIntent.js | 42 ++++++++++++++++++++++++++------- js/services/controllerUtils.js | 1 - views/home.html | 8 +++++++ views/paymentIntent.html | 16 ++++++------- 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/js/controllers/paymentIntent.js b/js/controllers/paymentIntent.js index 5b248194c..5ed73853a 100644 --- a/js/controllers/paymentIntent.js +++ b/js/controllers/paymentIntent.js @@ -2,10 +2,8 @@ var bitcore = require('bitcore'); -angular.module('copayApp.controllers').controller('PaymentIntentController', function($rootScope, $scope, $routeParams, $timeout, $location, controllerUtils) { +angular.module('copayApp.controllers').controller('PaymentIntentController', function($rootScope, $scope, $modal, controllerUtils) { - - $rootScope.title = 'Select the wallet that you will use to spend your bitcoins'; $scope.wallets = []; var wids = _.pluck($rootScope.iden.listWallets(), 'id'); @@ -13,15 +11,41 @@ angular.module('copayApp.controllers').controller('PaymentIntentController', fun var w = $rootScope.iden.getWalletById(wid); if (w && w.isReady()) { $scope.wallets.push(w); - controllerUtils.updateBalance(w, function() { - $rootScope.$digest(); - }); } }); - $scope.switchWallet = function(wid) { - //go to send page - controllerUtils.setPaymentWallet(wid); + $scope.open = function() { + var modalInstance = $modal.open({ + templateUrl: 'myModalContent.html', + controller: ModalInstanceCtrl, + resolve: { + items: function() { + return $scope.wallets; + } + } + }); + + modalInstance.result.then(function(selectedItem) {}, function() { + $rootScope.pendingPayment = null; + }); + }; + + + // Please note that $modalInstance represents a modal window (instance) dependency. + // It is not the same as the $modal service used above. + + var ModalInstanceCtrl = function($scope, $modalInstance, items, controllerUtils) { + + $scope.wallets = items; + + $scope.ok = function(selectedItem) { + controllerUtils.setPaymentWallet(selectedItem); + $modalInstance.close(); + }; + + $scope.cancel = function() { + $modalInstance.dismiss('cancel'); + }; }; }); diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index 454fb4892..eff844cfe 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -293,7 +293,6 @@ angular.module('copayApp.services') w = w || $rootScope.wallet; if (!w) return root.onErrorDigest(); if (!w.isReady()) return; - console.log('## Updating balance of:' + w.id) w.balanceInfo = {}; var scope = root.isFocusedWallet(w.id) ? $rootScope : w.balanceInfo; diff --git a/views/home.html b/views/home.html index 64535a00c..f408e7e47 100644 --- a/views/home.html +++ b/views/home.html @@ -9,6 +9,14 @@ Copay
+
+
+ +
+
+ Please sign in to make the payment +
+
diff --git a/views/paymentIntent.html b/views/paymentIntent.html index 1491055bd..eab672139 100644 --- a/views/paymentIntent.html +++ b/views/paymentIntent.html @@ -1,15 +1,14 @@ -
- - - -
    +
- - From e39959b4a400f6de13443102283283753b576bd5 Mon Sep 17 00:00:00 2001 From: Matias Pando Date: Tue, 4 Nov 2014 15:56:50 -0300 Subject: [PATCH 2/2] Added a link to test payment protocol --- js/controllers/home.js | 14 ++++++++++++++ views/home.html | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/js/controllers/home.js b/js/controllers/home.js index 1a9a85c2b..e2ee99878 100644 --- a/js/controllers/home.js +++ b/js/controllers/home.js @@ -11,6 +11,8 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc } + + if ($rootScope.fromEmailConfirmation) { $scope.confirmedEmail = true; $rootScope.fromEmailConfirmation = false; @@ -29,6 +31,18 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc identityService.open($scope, form); } + //TODO erase this function + $scope.setPayment = function() { + $rootScope.pendingPayment = { + "data": { + "amount": 20.3, + "label": "Luke-Jr", + "message": "Hola chango?" + }, + "address": "175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W" + }; + } + function getParam(sname) { var params = location.search.substr(location.search.indexOf("?") + 1); var sval = ""; diff --git a/views/home.html b/views/home.html index f408e7e47..25885a4f7 100644 --- a/views/home.html +++ b/views/home.html @@ -9,6 +9,12 @@ Copay
+ + + + Test payment + +