@@ -525,14 +525,29 @@ angular.module('copayApp.controllers')
525
525
function claimTextCoin ( mnemonic , addr ) {
526
526
var wallet = require ( 'byteballcore/wallet.js' ) ;
527
527
wallet . receiveTextCoin ( mnemonic , addr , function ( err , unit ) {
528
+ $rootScope . $emit ( 'closeModal' ) ;
528
529
if ( err )
529
530
return $rootScope . $emit ( 'Local/ShowErrorAlert' , err ) ;
530
531
indexScope . updateTxHistory ( ) ;
531
532
$rootScope . $emit ( 'Local/SetTab' , 'history' ) ;
532
533
} ) ;
533
534
}
534
535
$rootScope . $on ( 'claimTextcoin' , function ( event , mnemonic ) {
535
- claimTextCoin ( mnemonic , self . addr [ profileService . focusedClient . credentials . walletId ] ) ;
536
+ var addr = self . addr [ profileService . focusedClient . credentials . walletId ] ;
537
+ if ( addr ) {
538
+ claimTextCoin ( mnemonic , addr ) ;
539
+ } else {
540
+ addressService . getAddress ( profileService . focusedClient . credentials . walletId , false , function ( err , addr ) {
541
+ if ( addr ) {
542
+ self . addr [ profileService . focusedClient . credentials . walletId ] = addr ;
543
+ claimTextCoin ( mnemonic , addr ) ;
544
+ }
545
+
546
+ $timeout ( function ( ) {
547
+ $scope . $digest ( ) ;
548
+ } ) ;
549
+ } ) ;
550
+ }
536
551
} ) ;
537
552
538
553
// Send
@@ -680,8 +695,8 @@ angular.module('copayApp.controllers')
680
695
} ;
681
696
} ;
682
697
683
- this . openShareTextcoinModal = function ( addr , mnemonic , isResend ) {
684
- var text = "Your link: https://byteball.org/openapp.html#textcoin?" + mnemonic ;
698
+ this . openShareTextcoinModal = function ( addr , mnemonic , amount , isResend ) {
699
+ var text = "Your link to claim " + amount + " bytes : https://byteball.org/openapp.html#textcoin?" + mnemonic ;
685
700
var subject = "Byteball user beamed you money" ;
686
701
$rootScope . modalOpened = true ;
687
702
var fc = profileService . focusedClient ;
@@ -994,17 +1009,18 @@ angular.module('copayApp.controllers')
994
1009
var mnemonic = mnemonics [ address ] ;
995
1010
996
1011
if ( isEmail ) {
997
- self . openShareTextcoinModal ( address . slice ( "textcoin:" . length ) , mnemonic ) ;
1012
+ self . openShareTextcoinModal ( address . slice ( "textcoin:" . length ) , mnemonic , amount - constants . TEXTCOIN_CLAIM_FEE ) ;
998
1013
} else {
999
1014
if ( isCordova ) {
1000
1015
if ( isMobile . Android ( ) || isMobile . Windows ( ) ) {
1001
1016
window . ignoreMobilePause = true ;
1002
1017
}
1003
1018
window . plugins . socialsharing . shareWithOptions ( {
1004
- message : "Here is your link to receive bytes https://byteball.org/openapp.html#textcoin?" + mnemonic , subject : "Byteball user beamed you money"
1019
+
1020
+ message : "Here is your link to receive " + ( amount - constants . TEXTCOIN_CLAIM_FEE ) + " bytes https://byteball.org/openapp.html#textcoin?" + mnemonic , subject : "Byteball user beamed you money"
1005
1021
} ) ;
1006
1022
} else {
1007
- self . openShareTextcoinModal ( null , mnemonic ) ;
1023
+ self . openShareTextcoinModal ( null , mnemonic , amount - constants . TEXTCOIN_CLAIM_FEE ) ;
1008
1024
}
1009
1025
}
1010
1026
@@ -1044,7 +1060,7 @@ angular.module('copayApp.controllers')
1044
1060
$scope . index . assetIndex = $scope . assetIndexSelectorValue ;
1045
1061
this . shownForm = 'payment' ;
1046
1062
}
1047
- //$scope.$apply ();
1063
+ this . resetForm ( ) ;
1048
1064
}
1049
1065
1050
1066
this . submitData = function ( ) {
@@ -1480,10 +1496,10 @@ angular.module('copayApp.controllers')
1480
1496
window . ignoreMobilePause = true ;
1481
1497
}
1482
1498
window . plugins . socialsharing . shareWithOptions ( {
1483
- message : "Here is your link to receive bytes: https://byteball.org/openapp.html#textcoin?" + btx . mnemonic , subject : "Byteball user beamed you money"
1499
+ message : "Here is your link to receive " + ( btx . amount - constants . TEXTCOIN_CLAIM_FEE ) + " bytes: https://byteball.org/openapp.html#textcoin?" + btx . mnemonic , subject : "Byteball user beamed you money"
1484
1500
} ) ;
1485
1501
} else {
1486
- self . openShareTextcoinModal ( btx . textAddress , btx . mnemonic , true ) ;
1502
+ self . openShareTextcoinModal ( btx . textAddress , btx . mnemonic , btx . amount - constants . TEXTCOIN_CLAIM_FEE , true ) ;
1487
1503
}
1488
1504
}
1489
1505
0 commit comments