Merge pull request #1618 from ssotomayor/fix1592
Fix for reordering wallets on new address creation
This commit is contained in:
commit
9e0b7d64cb
1 changed files with 11 additions and 6 deletions
|
|
@ -7,14 +7,17 @@ angular.module('copayApp.controllers').controller('ReceiveController',
|
||||||
$rootScope.title = 'Receive';
|
$rootScope.title = 'Receive';
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
$scope.showAll = false;
|
$scope.showAll = false;
|
||||||
|
$scope.isNewAddr = false;
|
||||||
|
|
||||||
$scope.newAddr = function() {
|
$scope.newAddr = function() {
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
|
$scope.isNewAddr = false;
|
||||||
w.generateAddress(null, function() {
|
w.generateAddress(null, function() {
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
controllerUtils.updateAddressList();
|
controllerUtils.updateAddressList();
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
|
$scope.isNewAddr = true;
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -27,7 +30,7 @@ angular.module('copayApp.controllers').controller('ReceiveController',
|
||||||
$scope.mobileCopy = function(address) {
|
$scope.mobileCopy = function(address) {
|
||||||
window.cordova.plugins.clipboard.copy(address);
|
window.cordova.plugins.clipboard.copy(address);
|
||||||
window.plugins.toast.showShortBottom('Copied to clipboard');
|
window.plugins.toast.showShortBottom('Copied to clipboard');
|
||||||
}
|
};
|
||||||
|
|
||||||
$scope.cancel = function() {
|
$scope.cancel = function() {
|
||||||
$modalInstance.dismiss('cancel');
|
$modalInstance.dismiss('cancel');
|
||||||
|
|
@ -56,11 +59,13 @@ angular.module('copayApp.controllers').controller('ReceiveController',
|
||||||
$scope.addressList();
|
$scope.addressList();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.limitAddress = function(elements) {
|
$scope.limitAddress = function(elements, isNewAddr) {
|
||||||
|
|
||||||
elements = elements.sort(function(a, b) {
|
if(!isNewAddr){
|
||||||
return (+a.isChange - +b.isChange);
|
elements = elements.sort(function(a, b) {
|
||||||
});
|
return (+a.isChange - +b.isChange);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (elements.length <= 1 || $scope.showAll) {
|
if (elements.length <= 1 || $scope.showAll) {
|
||||||
return elements;
|
return elements;
|
||||||
|
|
@ -90,7 +95,7 @@ angular.module('copayApp.controllers').controller('ReceiveController',
|
||||||
'owned': addrinfo.owned
|
'owned': addrinfo.owned
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$scope.addresses = $scope.limitAddress($scope.addresses);
|
$scope.addresses = $scope.limitAddress($scope.addresses, $scope.isNewAddr);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue