Added lastOpened to list of all wallets

This commit is contained in:
Ivan Socolsky 2014-09-24 10:47:19 -03:00
commit cfa00590a6
3 changed files with 45 additions and 13 deletions

View file

@ -23,17 +23,14 @@ angular.module('copayApp.controllers').controller('OpenController', function($sc
} 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);
setTimeout(function() {
$rootScope.$digest();
}, 0);
var lastOpened = _.findWhere($scope.wallets, {
lastOpened: true
});
$scope.selectedWalletId = lastOpened ? lastOpened.id : ($scope.wallets[0] && $scope.wallets[0].id);
setTimeout(function() {
$rootScope.$digest();
}, 0);
}
});