Skip to content
Snippets Groups Projects
Commit 54e6639d authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] Transfer: unable to send after changing the source wallet - fix #726

[enh] Wallet list: add a icon if wallet is locked (not auth)
parent eaa1b9c0
No related branches found
No related tags found
No related merge requests found
Pipeline #2855 failed
......@@ -1977,6 +1977,15 @@ $ionicon-var-badge-editable: $ionicon-var-edit + "\00a0";
margin-right: 0px;
padding-right: 0px;
}
.item-avatar .badge.badge-avatar {
position: absolute!important;
left: 60px!important;
right: inherit!important;
top: 15px !important;
margin: 0 !important;
padding: 0px 4px !important;
font-size: 10px;
}
}
/**********
......
source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -277,7 +277,7 @@
**********/
.list .item.item-wallet .badge{
top: 28px !important;
top: 28px;
}
.list .item.item-wallet {
height: 38px;
......
......@@ -218,8 +218,8 @@ function TransferModalController($scope, $q, $translate, $timeout, $filter, $foc
$scope.convertedBalance = $scope.walletData.balance / 100;
$scope.minAmount = minQuantitativeAmount;
}
if ($scope.form) {
$scope.form.$valid = undefined;
if ($scope.form && !$scope.loading) {
$scope.form.$setPristine(true);
}
};
......@@ -344,7 +344,8 @@ function TransferModalController($scope, $q, $translate, $timeout, $filter, $foc
})
.catch(function(err) {
$scope.sending = false;
if (err == 'CANCELLED') return; // user cancelled
// Wallet auth cancelled by user
if (err === 'CANCELLED') return;
UIUtils.onError('ERROR.SEND_TX_FAILED')(err);
});
};
......
......@@ -179,8 +179,7 @@ function WalletListController($scope, $controller, $state, $timeout, $q, $transl
// continue, when plugins extension failed (just log in console)
.catch(console.error)
.then(function() {
$scope.listeners.push(wallet.api.data.on.unauth($scope, $scope.updateView));
$scope.listeners.push(wallet.api.data.on.auth($scope, $scope.updateView));
$scope.addListenersOnWallet(wallet);
csWallet.children.add(wallet);
UIUtils.loading.hide();
$scope.updateView();
......@@ -230,7 +229,7 @@ function WalletListController($scope, $controller, $state, $timeout, $q, $transl
return $q(function(resolve, reject) {
$translate(['ACCOUNT.WALLET_LIST.EDIT_POPOVER.TITLE', 'ACCOUNT.WALLET_LIST.EDIT_POPOVER.HELP', 'COMMON.BTN_OK', 'COMMON.BTN_CANCEL'])
.then(function (translations) {
$scope.formData.name = wallet.data.name || wallet.data.uid || wallet.data.pubkey.substring(0, 8);
$scope.formData.name = wallet.data.localName || wallet.data.name || wallet.data.uid || wallet.data.pubkey.substring(0, 8);
// Choose UID popup
$ionicPopup.show({
......@@ -297,11 +296,11 @@ function WalletListController($scope, $controller, $state, $timeout, $q, $transl
$scope.addListeners = function() {
var listeners = [];
$scope.listeners =[];
// Auto-update on new block
if (csSettings.data.walletHistoryAutoRefresh) {
listeners.push(
$scope.listeners.push(
csCurrency.api.data.on.newBlock($scope, function (block) {
if ($scope.loading) return;
console.debug("[wallet-list] Received new block. Will reload list.");
......@@ -312,12 +311,16 @@ function WalletListController($scope, $controller, $state, $timeout, $q, $transl
}
// Listen auth events on each wallet
$scope.listeners = ($scope.wallets||[]).reduce(function(res, wallet) {
return res.concat([
wallet.api.data.on.unauth($scope, $scope.updateView),
wallet.api.data.on.auth($scope, $scope.updateView),
]);
}, listeners);
_.forEach($scope.wallets||[], $scope.addListenersOnWallet);
};
$scope.addListenersOnWallet = function(wallet) {
if (!wallet) return;
$scope.listeners.push(wallet.api.data.on.unauth($scope, $scope.updateView));
$scope.listeners.push(wallet.api.data.on.auth($scope, function (data, deferred) {
$timeout($scope.updateView);
return deferred ? deferred.resolve() : $q.when();
}));
};
$scope.removeListeners = function() {
......
......@@ -5,7 +5,9 @@
<i ng-if="::!walletData.avatar" class="item-image icon"
ng-class=":rebind:{'ion-card': !walletData.isMember, 'ion-persion': walletData.isMember}"></i>
<i ng-if="::walletData.avatar" class="item-image avatar" style="background-image: url({{::walletData.avatar.src}})"></i>
<i ng-hide=":rebind:wallet.isAuth()" class="icon-secondary assertive ion-locked" style="top: -16px; left: 66px; font-size: 20px;"></i>
<div class="badge badge-button badge-avatar badge-assertive ion-locked " ng-hide=":rebind:wallet.isAuth()">
</div>
<h2>
<span class="text-editable" ng-click="editWallet($event, wallet)" title="{{'ACCOUNT.WALLET_LIST.BTN_RENAME'|translate}}">
<ng-if ng-if=":rebind:walletData.localName||walletData.name||walletData.uid" ng-bind-html="::walletData.localName||walletData.name||walletData.uid"></ng-if>
......
......@@ -6,6 +6,8 @@
<i ng-if="::!walletData.avatar" class="item-image icon"
ng-class=":rebind:{'ion-card': !walletData.isMember, 'ion-persion': walletData.isMember}"></i>
<i ng-if="::walletData.avatar" class="item-image avatar" style="background-image: url({{::walletData.avatar.src}})"></i>
<div class="badge badge-button badge-avatar badge-assertive ion-locked " ng-hide="::wallet.isAuth()">
</div>
<h2>
<ng-if ng-if="::walletData.localName||walletData.name||walletData.uid">{{::walletData.localName||walletData.name||walletData.uid}}</ng-if>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment