From 9191737f7ee3e2dcdfd73e97e18a773da9c4e8bc Mon Sep 17 00:00:00 2001
From: blavenie <benoit.lavenier@e-is.pro>
Date: Sat, 15 Sep 2018 12:14:36 +0200
Subject: [PATCH] [fix] Transfer modal: use the selected wallet as default
 wallet

---
 www/js/controllers/wallet-controllers.js | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js
index 4c53e908..8fdfa5a9 100644
--- a/www/js/controllers/wallet-controllers.js
+++ b/www/js/controllers/wallet-controllers.js
@@ -536,11 +536,11 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state,
   // Transfer
   $scope.showTransferModal = function() {
     var hasCredit = (!!$scope.formData.balance && $scope.formData.balance > 0);
-    if (!hasCredit && !wallet.children.count()) {
+    if (!hasCredit && !csWallet.children.count()) {
       UIUtils.alert.info('INFO.NOT_ENOUGH_CREDIT');
       return;
     }
-    Modals.showTransfer()
+    return Modals.showTransfer({wallet: wallet.id})
       .then(function(done){
         if (done) {
           UIUtils.toast.show('INFO.TRANSFER_SENT');
@@ -826,7 +826,14 @@ function WalletTxController($scope, $ionicPopover, $state, $timeout, $location,
       UIUtils.alert.info('INFO.NOT_ENOUGH_CREDIT');
       return;
     }
-    return Modals.showTransfer();
+    return Modals.showTransfer({wallet: wallet.id})
+      .then(function(done){
+        if (done) {
+          UIUtils.toast.show('INFO.TRANSFER_SENT');
+          $scope.$broadcast('$$rebind::' + 'balance'); // force rebind balance
+          $scope.motion.show({selector: '.item-pending'});
+        }
+      });
   };
 
   $scope.showHelpTip = function(index, isTour) {
@@ -866,7 +873,7 @@ function WalletTxController($scope, $ionicPopover, $state, $timeout, $location,
   };
 
   $scope.showSelectWalletModal = function() {
-    if (!$scope.enableSelectWallet) return;
+    if (!csWallet.children.count()) return;
 
     return Modals.showSelectWallet({
       showDefault: true,
-- 
GitLab