mirror of https://github.com/BTCPrivate/copay.git
fix walletID list
This commit is contained in:
parent
e28be27bf3
commit
a51ed6c66d
|
@ -74,7 +74,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<div ng-show="walletIds.length === 0">
|
<div ng-show="!walletIds.length">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="large-6 columns">
|
<div class="large-6 columns">
|
||||||
<h3>Create a New Wallet</h3>
|
<h3>Create a New Wallet</h3>
|
||||||
|
|
|
@ -10,7 +10,8 @@ angular.module('copay.signin').controller('SigninController',
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
|
|
||||||
$scope.walletIds = walletFactory.getWalletIds();
|
$scope.walletIds = walletFactory.getWalletIds();
|
||||||
$scope.selectedWalletId = $scope.walletIds?$scope.walletIds.shift():null;
|
|
||||||
|
$scope.selectedWalletId = $scope.walletIds.length ? $scope.walletIds[0]:null;
|
||||||
|
|
||||||
$scope.create = function() {
|
$scope.create = function() {
|
||||||
$location.path('setup');
|
$location.path('setup');
|
||||||
|
|
|
@ -54,13 +54,17 @@ Storage.prototype.remove = function(walletId, k) {
|
||||||
|
|
||||||
Storage.prototype.getWalletIds = function() {
|
Storage.prototype.getWalletIds = function() {
|
||||||
var walletIds = [];
|
var walletIds = [];
|
||||||
|
var uniq = {};
|
||||||
|
|
||||||
for (var i = 0; i < localStorage.length; i++) {
|
for (var i = 0; i < localStorage.length; i++) {
|
||||||
var key = localStorage.key(i);
|
var key = localStorage.key(i);
|
||||||
var split = key.split('::');
|
var split = key.split('::');
|
||||||
if (split.length == 2) {
|
if (split.length == 2) {
|
||||||
var walletId = split[0];
|
var walletId = split[0];
|
||||||
|
if (typeof uniq[walletId] === 'undefined' ) {
|
||||||
walletIds.push(walletId);
|
walletIds.push(walletId);
|
||||||
|
uniq[walletId] = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue