many optimizations in addresses pulling
This commit is contained in:
parent
425703c447
commit
398daf3f05
9 changed files with 183 additions and 130 deletions
|
|
@ -2,15 +2,17 @@
|
|||
|
||||
angular.module('copay.addresses').controller('AddressesController',
|
||||
function($scope, $rootScope, controllerUtils) {
|
||||
|
||||
var w = $rootScope.wallet;
|
||||
$scope.loading = false;
|
||||
|
||||
var w = $rootScope.wallet;
|
||||
$scope.newAddr = function() {
|
||||
$scope.loading = true;
|
||||
w.generateAddress();
|
||||
controllerUtils.updateBalance(function() {
|
||||
$scope.loading = false;
|
||||
$scope.loading=true;
|
||||
w.generateAddress(null, function() {
|
||||
setTimeout(function() {
|
||||
controllerUtils.setSocketHandlers();
|
||||
controllerUtils.updateAddressList();
|
||||
$scope.loading=false;
|
||||
$rootScope.$digest();
|
||||
},1);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copay.footer').controller('FooterController', function($scope, $http) {
|
||||
angular.module('copay.footer').controller('FooterController', function($rootScope, $sce, $scope, $http) {
|
||||
|
||||
if (config.themes && Array.isArray(config.themes) && config.themes[0]) {
|
||||
$scope.themes = config.themes;
|
||||
|
|
@ -15,4 +15,23 @@ angular.module('copay.footer').controller('FooterController', function($scope, $
|
|||
$scope.theme = 'css/tpl-' + name + '.css';
|
||||
};
|
||||
$scope.version = copay.version;
|
||||
|
||||
$scope.getVideoURL = function(copayer) {
|
||||
var vi = $rootScope.videoInfo[copayer]
|
||||
|
||||
console.log('[footer.js.21]', vi); //TODO
|
||||
if (!vi) return;
|
||||
|
||||
if ($rootScope.wallet.getOnlinePeerIDs().indexOf(copayer) === -1) {
|
||||
// peer disconnected, remove his video
|
||||
delete $rootScope.videoInfo[copayer]
|
||||
return;
|
||||
}
|
||||
|
||||
var encoded = vi.url;
|
||||
var url = decodeURI(encoded);
|
||||
var trusted = $sce.trustAsResourceUrl(url);
|
||||
console.log('[footer.js.31:trusted:]',trusted); //TODO
|
||||
return trusted;
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ angular.module('copay.signin').controller('SigninController',
|
|||
return v1 > v2 ? 1 : ( v1 < v2 ) ? -1 : 0;
|
||||
};
|
||||
|
||||
$rootScope.videoInfo = {};
|
||||
|
||||
$scope.loading = $scope.failure = false;
|
||||
$scope.wallets = walletFactory.getWallets().sort(cmp);
|
||||
$scope.selectedWalletId = $scope.wallets.length ? $scope.wallets[0].id : null;
|
||||
|
|
@ -20,6 +22,8 @@ angular.module('copay.signin').controller('SigninController',
|
|||
|
||||
$rootScope.walletName = form.walletName.$modelValue;
|
||||
$rootScope.walletPassword = form.createPassword.$modelValue;
|
||||
|
||||
|
||||
$location.path('setup');
|
||||
};
|
||||
|
||||
|
|
@ -31,7 +35,10 @@ angular.module('copay.signin').controller('SigninController',
|
|||
|
||||
$scope.loading = true;
|
||||
var password = form.openPassword.$modelValue;
|
||||
|
||||
console.log('## Obtaining passphrase...');
|
||||
Passphrase.getBase64Async(password, function(passphrase){
|
||||
console.log('## Done.');
|
||||
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
|
||||
if (!w) {
|
||||
$scope.loading = $scope.failure = false;
|
||||
|
|
@ -39,8 +46,8 @@ angular.module('copay.signin').controller('SigninController',
|
|||
$rootScope.$digest();
|
||||
return;
|
||||
}
|
||||
installStartupHandlers(w);
|
||||
controllerUtils.startNetwork(w);
|
||||
listenErrors(w);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -67,16 +74,20 @@ angular.module('copay.signin').controller('SigninController',
|
|||
controllerUtils.onErrorDigest();
|
||||
} else {
|
||||
controllerUtils.startNetwork(w);
|
||||
listenErrors(w);
|
||||
installStartupHandlers(w);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function listenErrors(wallet) {
|
||||
function installStartupHandlers(wallet) {
|
||||
wallet.network.on('error', function(err) {
|
||||
$scope.failure = true;
|
||||
});
|
||||
wallet.on('ready', function() {
|
||||
console.log('## RECEIVED READY2');
|
||||
$scope.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,7 +6,13 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
$scope.title = 'Transactions';
|
||||
$scope.loading = false;
|
||||
|
||||
$scope.send = function (ntxid) {
|
||||
$scope.update = function () {
|
||||
$scope.loading = false;
|
||||
controllerUtils.updateTxs();
|
||||
$rootScope.$digest();
|
||||
};
|
||||
|
||||
$scope.send = function (ntxid,cb) {
|
||||
$scope.loading = true;
|
||||
$rootScope.txAlertCount = 0;
|
||||
var w = $rootScope.wallet;
|
||||
|
|
@ -16,34 +22,32 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
? {type:'success', message: 'Transaction broadcasted. txid: ' + txid}
|
||||
: {type:'error', message: 'There was an error sending the Transaction'}
|
||||
;
|
||||
controllerUtils.updateTxs();
|
||||
$scope.loading = false;
|
||||
$rootScope.$digest();
|
||||
if (cb) return cb();
|
||||
else $scope.update();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.sign = function (ntxid) {
|
||||
$scope.loading = true;
|
||||
var w = $rootScope.wallet;
|
||||
var ret = w.sign(ntxid);
|
||||
|
||||
if (!ret) {
|
||||
$rootScope.flashMessage = {type:'error', message: 'There was an error signing the Transaction'};
|
||||
controllerUtils.updateTxs();
|
||||
$scope.loading = false;
|
||||
$rootScope.$digest();
|
||||
return;
|
||||
}
|
||||
var p = w.txProposals.getTxProposal(ntxid);
|
||||
if (p.builder.isFullySigned()) {
|
||||
$scope.send(ntxid);
|
||||
controllerUtils.updateTxs();
|
||||
}
|
||||
else {
|
||||
controllerUtils.updateTxs();
|
||||
$scope.loading = false;
|
||||
$rootScope.$digest();
|
||||
}
|
||||
w.sign(ntxid, function(ret){
|
||||
if (!ret) {
|
||||
$rootScope.flashMessage = {
|
||||
type:'error',
|
||||
message: 'There was an error signing the Transaction',
|
||||
};
|
||||
$scope.update();
|
||||
}
|
||||
else {
|
||||
var p = w.txProposals.getTxProposal(ntxid);
|
||||
if (p.builder.isFullySigned()) {
|
||||
$scope.send(ntxid, function() {
|
||||
$scope.update();
|
||||
});
|
||||
}
|
||||
else $scope.update();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getTransactions = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue