Skip to content

Commit 54e6639

Browse files
committed
[fix] Transfer: unable to send after changing the source wallet - fix #726
[enh] Wallet list: add a icon if wallet is locked (not auth)
1 parent eaa1b9c commit 54e6639

File tree

7 files changed

+34
-17
lines changed

7 files changed

+34
-17
lines changed

scss/ionic.app.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,6 +1977,15 @@ $ionicon-var-badge-editable: $ionicon-var-edit + "\00a0";
19771977
margin-right: 0px;
19781978
padding-right: 0px;
19791979
}
1980+
.item-avatar .badge.badge-avatar {
1981+
position: absolute!important;
1982+
left: 60px!important;
1983+
right: inherit!important;
1984+
top: 15px !important;
1985+
margin: 0 !important;
1986+
padding: 0px 4px !important;
1987+
font-size: 10px;
1988+
}
19801989
}
19811990

19821991
/**********

www/css/ionic.app.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

www/css/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@
277277
**********/
278278

279279
.list .item.item-wallet .badge{
280-
top: 28px !important;
280+
top: 28px;
281281
}
282282
.list .item.item-wallet {
283283
height: 38px;

www/js/controllers/transfer-controllers.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ function TransferModalController($scope, $q, $translate, $timeout, $filter, $foc
218218
$scope.convertedBalance = $scope.walletData.balance / 100;
219219
$scope.minAmount = minQuantitativeAmount;
220220
}
221-
if ($scope.form) {
222-
$scope.form.$valid = undefined;
221+
if ($scope.form && !$scope.loading) {
222+
$scope.form.$setPristine(true);
223223
}
224224
};
225225

@@ -344,7 +344,8 @@ function TransferModalController($scope, $q, $translate, $timeout, $filter, $foc
344344
})
345345
.catch(function(err) {
346346
$scope.sending = false;
347-
if (err == 'CANCELLED') return; // user cancelled
347+
// Wallet auth cancelled by user
348+
if (err === 'CANCELLED') return;
348349
UIUtils.onError('ERROR.SEND_TX_FAILED')(err);
349350
});
350351
};

www/js/controllers/wallets-controllers.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ function WalletListController($scope, $controller, $state, $timeout, $q, $transl
179179
// continue, when plugins extension failed (just log in console)
180180
.catch(console.error)
181181
.then(function() {
182-
$scope.listeners.push(wallet.api.data.on.unauth($scope, $scope.updateView));
183-
$scope.listeners.push(wallet.api.data.on.auth($scope, $scope.updateView));
182+
$scope.addListenersOnWallet(wallet);
184183
csWallet.children.add(wallet);
185184
UIUtils.loading.hide();
186185
$scope.updateView();
@@ -230,7 +229,7 @@ function WalletListController($scope, $controller, $state, $timeout, $q, $transl
230229
return $q(function(resolve, reject) {
231230
$translate(['ACCOUNT.WALLET_LIST.EDIT_POPOVER.TITLE', 'ACCOUNT.WALLET_LIST.EDIT_POPOVER.HELP', 'COMMON.BTN_OK', 'COMMON.BTN_CANCEL'])
232231
.then(function (translations) {
233-
$scope.formData.name = wallet.data.name || wallet.data.uid || wallet.data.pubkey.substring(0, 8);
232+
$scope.formData.name = wallet.data.localName || wallet.data.name || wallet.data.uid || wallet.data.pubkey.substring(0, 8);
234233

235234
// Choose UID popup
236235
$ionicPopup.show({
@@ -297,11 +296,11 @@ function WalletListController($scope, $controller, $state, $timeout, $q, $transl
297296

298297
$scope.addListeners = function() {
299298

300-
var listeners = [];
299+
$scope.listeners =[];
301300

302301
// Auto-update on new block
303302
if (csSettings.data.walletHistoryAutoRefresh) {
304-
listeners.push(
303+
$scope.listeners.push(
305304
csCurrency.api.data.on.newBlock($scope, function (block) {
306305
if ($scope.loading) return;
307306
console.debug("[wallet-list] Received new block. Will reload list.");
@@ -312,12 +311,16 @@ function WalletListController($scope, $controller, $state, $timeout, $q, $transl
312311
}
313312

314313
// Listen auth events on each wallet
315-
$scope.listeners = ($scope.wallets||[]).reduce(function(res, wallet) {
316-
return res.concat([
317-
wallet.api.data.on.unauth($scope, $scope.updateView),
318-
wallet.api.data.on.auth($scope, $scope.updateView),
319-
]);
320-
}, listeners);
314+
_.forEach($scope.wallets||[], $scope.addListenersOnWallet);
315+
};
316+
317+
$scope.addListenersOnWallet = function(wallet) {
318+
if (!wallet) return;
319+
$scope.listeners.push(wallet.api.data.on.unauth($scope, $scope.updateView));
320+
$scope.listeners.push(wallet.api.data.on.auth($scope, function (data, deferred) {
321+
$timeout($scope.updateView);
322+
return deferred ? deferred.resolve() : $q.when();
323+
}));
321324
};
322325

323326
$scope.removeListeners = function() {

www/templates/wallet/list/item_wallet.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
<i ng-if="::!walletData.avatar" class="item-image icon"
66
ng-class=":rebind:{'ion-card': !walletData.isMember, 'ion-persion': walletData.isMember}"></i>
77
<i ng-if="::walletData.avatar" class="item-image avatar" style="background-image: url({{::walletData.avatar.src}})"></i>
8-
<i ng-hide=":rebind:wallet.isAuth()" class="icon-secondary assertive ion-locked" style="top: -16px; left: 66px; font-size: 20px;"></i>
8+
<div class="badge badge-button badge-avatar badge-assertive ion-locked " ng-hide=":rebind:wallet.isAuth()">
9+
</div>
10+
911
<h2>
1012
<span class="text-editable" ng-click="editWallet($event, wallet)" title="{{'ACCOUNT.WALLET_LIST.BTN_RENAME'|translate}}">
1113
<ng-if ng-if=":rebind:walletData.localName||walletData.name||walletData.uid" ng-bind-html="::walletData.localName||walletData.name||walletData.uid"></ng-if>

www/templates/wallet/list/item_wallet_light.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<i ng-if="::!walletData.avatar" class="item-image icon"
77
ng-class=":rebind:{'ion-card': !walletData.isMember, 'ion-persion': walletData.isMember}"></i>
88
<i ng-if="::walletData.avatar" class="item-image avatar" style="background-image: url({{::walletData.avatar.src}})"></i>
9+
<div class="badge badge-button badge-avatar badge-assertive ion-locked " ng-hide="::wallet.isAuth()">
10+
</div>
911

1012
<h2>
1113
<ng-if ng-if="::walletData.localName||walletData.name||walletData.uid">{{::walletData.localName||walletData.name||walletData.uid}}</ng-if>

0 commit comments

Comments
 (0)