@@ -28,7 +28,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
28
28
function refresh ( ) {
29
29
$timeout ( function ( ) {
30
30
$scope . $apply ( ) ;
31
- } , 1 ) ;
31
+ } , 10 ) ;
32
32
}
33
33
34
34
@@ -119,11 +119,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
119
119
} ) ;
120
120
} ;
121
121
122
- // TODO: Default fee level for BCH
123
- if ( data . stateParams . coin == 'bch' ) {
124
- configFeeLevel = 'normal' ;
125
- }
126
-
127
122
// Setup $scope
128
123
129
124
// Grab stateParams
@@ -147,6 +142,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
147
142
txp : { } ,
148
143
} ;
149
144
145
+ if ( tx . coin && tx . coin == 'bch' ) tx . feeLevel = 'normal' ;
146
+
150
147
// Other Scope vars
151
148
$scope . isCordova = isCordova ;
152
149
$scope . isWindowsPhoneApp = isWindowsPhoneApp ;
@@ -230,6 +227,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
230
227
} ;
231
228
232
229
function updateTx ( tx , wallet , opts , cb ) {
230
+ ongoingProcess . set ( 'calculatingFee' , true ) ;
233
231
234
232
if ( opts . clearCache ) {
235
233
tx . txp = { } ;
@@ -253,19 +251,23 @@ angular.module('copayApp.controllers').controller('confirmController', function(
253
251
refresh ( ) ;
254
252
255
253
// End of quick refresh, before wallet is selected.
256
- if ( ! wallet ) return cb ( ) ;
254
+ if ( ! wallet ) {
255
+ ongoingProcess . set ( 'calculatingFee' , false ) ;
256
+ return cb ( ) ;
257
+ }
257
258
258
259
feeService . getFeeRate ( wallet . coin , tx . network , tx . feeLevel , function ( err , feeRate ) {
259
- if ( err ) return cb ( err ) ;
260
+ if ( err ) {
261
+ ongoingProcess . set ( 'calculatingFee' , false ) ;
262
+ return cb ( err ) ;
263
+ }
260
264
261
265
if ( ! usingCustomFee ) tx . feeRate = feeRate ;
262
266
tx . feeLevelName = feeService . feeOpts [ tx . feeLevel ] ;
263
267
264
- if ( ! wallet )
265
- return cb ( ) ;
266
-
267
268
getSendMaxInfo ( lodash . clone ( tx ) , wallet , function ( err , sendMaxInfo ) {
268
269
if ( err ) {
270
+ ongoingProcess . set ( 'calculatingFee' , false ) ;
269
271
var msg = gettextCatalog . getString ( 'Error getting SendMax information' ) ;
270
272
return setSendError ( msg ) ;
271
273
}
@@ -275,6 +277,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
275
277
$log . debug ( 'Send max info' , sendMaxInfo ) ;
276
278
277
279
if ( tx . sendMax && sendMaxInfo . amount == 0 ) {
280
+ ongoingProcess . set ( 'calculatingFee' , false ) ;
278
281
setNoWallet ( gettextCatalog . getString ( 'Insufficient funds' ) ) ;
279
282
popupService . showAlert ( gettextCatalog . getString ( 'Error' ) , gettextCatalog . getString ( 'Not enough funds for fee' ) ) ;
280
283
return cb ( 'no_funds' ) ;
@@ -283,17 +286,22 @@ angular.module('copayApp.controllers').controller('confirmController', function(
283
286
tx . sendMaxInfo = sendMaxInfo ;
284
287
tx . toAmount = tx . sendMaxInfo . amount ;
285
288
updateAmount ( ) ;
289
+ ongoingProcess . set ( 'calculatingFee' , false ) ;
286
290
showSendMaxWarning ( wallet , sendMaxInfo ) ;
287
291
}
288
292
289
293
// txp already generated for this wallet?
290
294
if ( tx . txp [ wallet . id ] ) {
295
+ ongoingProcess . set ( 'calculatingFee' , false ) ;
291
296
refresh ( ) ;
292
297
return cb ( ) ;
293
298
}
294
299
295
300
getTxp ( lodash . clone ( tx ) , wallet , opts . dryRun , function ( err , txp ) {
296
- if ( err ) return cb ( err ) ;
301
+ ongoingProcess . set ( 'calculatingFee' , false ) ;
302
+ if ( err ) {
303
+ return cb ( err ) ;
304
+ }
297
305
298
306
txp . feeStr = txFormatService . formatAmountStr ( wallet . coin , txp . fee ) ;
299
307
txFormatService . formatAlternativeStr ( wallet . coin , txp . fee , function ( v ) {
@@ -425,6 +433,11 @@ angular.module('copayApp.controllers').controller('confirmController', function(
425
433
426
434
$scope . wallet = wallet ;
427
435
436
+ // If select another wallet
437
+ tx . coin = wallet . coin ;
438
+ tx . feeLevel = wallet . coin == 'bch' ? 'normal' : configFeeLevel ;
439
+ usingCustomFee = null ;
440
+
428
441
setButtonText ( wallet . credentials . m > 1 , ! ! tx . paypro ) ;
429
442
430
443
if ( tx . paypro )
0 commit comments