send working. Refactor paypro and payment intents
This commit is contained in:
parent
7f42d60d5d
commit
2fe6ec4c6a
21 changed files with 426 additions and 493 deletions
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('go', function($window, $location) {
|
||||
angular.module('copayApp.services').factory('go', function($window, $rootScope, $location) {
|
||||
var root = {};
|
||||
|
||||
var hideSidebars = function() {
|
||||
|
|
@ -44,7 +44,7 @@ angular.module('copayApp.services').factory('go', function($window, $location) {
|
|||
var ref = window.open(url, '_blank', 'location=no');
|
||||
};
|
||||
|
||||
root.go = function(path) {
|
||||
root.path = function(path) {
|
||||
var parts = path.split('#');
|
||||
$location.path(parts[0]);
|
||||
if (parts[1])
|
||||
|
|
@ -56,5 +56,35 @@ angular.module('copayApp.services').factory('go', function($window, $location) {
|
|||
toggleSidebar(invert);
|
||||
};
|
||||
|
||||
root.walletHome = function() {
|
||||
console.log('[go.js.25:walletHome:]'); //TODO
|
||||
var w = $rootScope.wallet;
|
||||
preconditions.checkState(w);
|
||||
$rootScope.starting = false;
|
||||
if (!w.isComplete()) {
|
||||
root.path('copayers');
|
||||
} else {
|
||||
if ($rootScope.pendingPayment) {
|
||||
root.path('selectWalletForPayment');
|
||||
} else {
|
||||
|
||||
console.log('[go.js.36]'); //TODO
|
||||
root.path('homeWallet');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
root.home = function() {
|
||||
if ($rootScope.iden)
|
||||
root.walletHome();
|
||||
else
|
||||
root.path('/');
|
||||
};
|
||||
|
||||
|
||||
root.send = function() {
|
||||
$location.path('send');
|
||||
};
|
||||
|
||||
return root;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -27,23 +27,6 @@ angular.module('copayApp.services')
|
|||
});
|
||||
};
|
||||
|
||||
// TODO should be on 'walletService' or 'go'
|
||||
root.goWalletHome = function() {
|
||||
var w = $rootScope.wallet;
|
||||
if (w) {
|
||||
$rootScope.starting = false;
|
||||
if (!w.isComplete()) {
|
||||
go.go('copayers');
|
||||
} else {
|
||||
if ($rootScope.pendingPayment) {
|
||||
go.go('paymentIntent');
|
||||
} else {
|
||||
go.go('homeWallet');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
root.create = function(email, password, cb) {
|
||||
copay.Identity.create({
|
||||
email: email,
|
||||
|
|
@ -133,10 +116,6 @@ angular.module('copayApp.services')
|
|||
$rootScope.iden = iden;
|
||||
};
|
||||
|
||||
root.setPaymentWallet = function(w) {
|
||||
root.setFocusedWallet(w);
|
||||
$location.path('/send');
|
||||
};
|
||||
|
||||
root.noFocusedWallet = function() {
|
||||
$rootScope.wallet = null;
|
||||
|
|
@ -296,7 +275,7 @@ angular.module('copayApp.services')
|
|||
if (wid == iden.getLastFocusedWalletId()) {
|
||||
copay.logger.debug('GOT Focused wallet:', w.getName());
|
||||
root.setFocusedWallet(w, true);
|
||||
root.goWalletHome();
|
||||
go.walletHome();
|
||||
}
|
||||
|
||||
// At the end (after all handlers are in place)...start the wallet.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue