Fix for reordering wallets on new address creation
This commit is contained in:
parent
4afcad4601
commit
92869a9ce5
1 changed files with 13 additions and 7 deletions
|
|
@ -1,19 +1,23 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('ReceiveController',
|
angular.module('copayApp.controllers').controller('ReceiveController',
|
||||||
function($scope, $rootScope, $timeout, $modal, controllerUtils) {
|
function($scope, $rootScope, $timeout, $modal, controllerUtils, notification) {
|
||||||
controllerUtils.redirIfNotComplete();
|
controllerUtils.redirIfNotComplete();
|
||||||
|
|
||||||
$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;
|
||||||
|
notification.info("Info", "New Address was created");
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -26,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');
|
||||||
|
|
@ -55,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;
|
||||||
|
|
@ -89,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