fix interfase and loggin
This commit is contained in:
parent
238d36c0a7
commit
409cef4d4b
7 changed files with 32 additions and 21 deletions
|
|
@ -5,8 +5,7 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
|||
controllerUtils.redirIfLogged();
|
||||
|
||||
$scope.retreiving = true;
|
||||
|
||||
walletFactory.getWallets(function(ret) {
|
||||
walletFactory.getWallets(function(err,ret) {
|
||||
$scope.retreiving = false;
|
||||
$scope.hasWallets = (ret && ret.length > 0) ? true : false;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,16 +16,23 @@ angular.module('copayApp.controllers').controller('OpenController', function($sc
|
|||
$scope.loading = false;
|
||||
$scope.retreiving = true;
|
||||
|
||||
walletFactory.getWallets(function(wallets) {
|
||||
walletFactory.getWallets(function(err, wallets) {
|
||||
|
||||
if (!wallets || !wallets.length) {
|
||||
if (err || !wallets || !wallets.length) {
|
||||
$location.path('/');
|
||||
} else {
|
||||
$scope.retreiving = false;
|
||||
$scope.wallets = wallets.sort(cmp);
|
||||
|
||||
walletFactory.storage.getLastOpened(function(ret) {
|
||||
if (ret && _.indexOf(_.pluck($scope.wallets, 'id')) == -1)
|
||||
ret = null;
|
||||
|
||||
$scope.selectedWalletId = ret || ($scope.wallets[0] && $scope.wallets[0].id);
|
||||
$scope.retreiving = false;
|
||||
|
||||
setTimeout(function() {
|
||||
$rootScope.$digest();
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -49,9 +56,10 @@ angular.module('copayApp.controllers').controller('OpenController', function($sc
|
|||
$scope.loading = false;
|
||||
notification.error('Error', err.errMsg || 'Wrong password');
|
||||
$rootScope.$digest();
|
||||
} else {
|
||||
$rootScope.updatingBalance = true;
|
||||
controllerUtils.startNetwork(w, $scope);
|
||||
}
|
||||
$rootScope.updatingBalance = true;
|
||||
controllerUtils.startNetwork(w, $scope);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ var CryptoJS = require('node-cryptojs-aes').CryptoJS;
|
|||
var bitcore = require('bitcore');
|
||||
var preconditions = require('preconditions').instance();
|
||||
var _ = require('underscore');
|
||||
|
||||
var CACHE_DURATION = 1000 * 60 * 5;
|
||||
var id = 0;
|
||||
|
||||
function Storage(opts) {
|
||||
opts = opts || {};
|
||||
|
||||
this.wListCache = {};
|
||||
this.__uniqueid = ++id;
|
||||
if (opts.password)
|
||||
this.setPassphrase(opts.password);
|
||||
|
|
@ -211,6 +212,9 @@ Storage.prototype.getWalletIds = function(cb) {
|
|||
Storage.prototype.getWallets = function(cb) {
|
||||
preconditions.checkArgument(cb);
|
||||
|
||||
if (this.wListCache.ts > Date.now())
|
||||
return cb(this.wListCache.data)
|
||||
|
||||
var wallets = [];
|
||||
var self = this;
|
||||
|
||||
|
|
@ -228,6 +232,8 @@ Storage.prototype.getWallets = function(cb) {
|
|||
name: name,
|
||||
});
|
||||
if (++i == l) {
|
||||
self.wListCache.data = wallets;
|
||||
self.wListCache.ts = Date.now() + CACHE_DURATION;
|
||||
return cb(wallets);
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ TxProposals.prototype.getNtxidsSince = function(sinceTs) {
|
|||
if (txp.createdTs >= sinceTs)
|
||||
ret.push(ii);
|
||||
}
|
||||
console.log('[TxProposals.js.52:ret:]',ret); //TODO
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue