Skip to content

Commit aa4d82a

Browse files
Merge pull request byteball#258 from kakysha/master
fixes for send-email
2 parents 934e644 + d6ee5f7 commit aa4d82a

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

public/views/modals/tx-details.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ <h4 class="title m0" translate>Details</h4>
126126
not claimed
127127
</span>
128128
<span ng-show="!btx.claimed" class="external-link">
129-
(<a href="#" ng-click="$root.$emit('claimTextcoin', btx.mnemonic.split('-').join(' '));cancel()" style="padding: 0; color: inherit;">claim back</a>)
129+
(<a href="#" ng-click="$root.$emit('claimTextcoin', btx.mnemonic.split('-').join(' '));" style="padding: 0; color: inherit;">claim back</a>)
130130
</span>
131131
<span class="label gray radius" ng-show="btx.claimed" translate>
132132
claimed by {{btx.claimedByMe?'me':'receiver'|translate}}

public/views/walletHome.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ <h4 class="title m0">
374374

375375
<div class="mtab" ng-class="{'active': mtab == 1}" ng-init="mtab = 1">
376376
<div ng-hide="home.hideAddress">
377-
<div class="row collapse">
377+
<div class="row collapse" style="padding-top: 5px;">
378378
<label for="address" class="left" ng-if="index.arrBalances.length > 0 && index.arrBalances[index.assetIndex].asset !== 'base'">
379379
<span translate>To byteball address</span>
380380
</label>

src/js/controllers/walletHome.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -525,14 +525,29 @@ angular.module('copayApp.controllers')
525525
function claimTextCoin(mnemonic, addr) {
526526
var wallet = require('byteballcore/wallet.js');
527527
wallet.receiveTextCoin(mnemonic, addr, function(err, unit) {
528+
$rootScope.$emit('closeModal');
528529
if (err)
529530
return $rootScope.$emit('Local/ShowErrorAlert', err);
530531
indexScope.updateTxHistory();
531532
$rootScope.$emit('Local/SetTab', 'history');
532533
});
533534
}
534535
$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+
}
536551
});
537552

538553
// Send
@@ -680,8 +695,8 @@ angular.module('copayApp.controllers')
680695
};
681696
};
682697

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;
685700
var subject = "Byteball user beamed you money";
686701
$rootScope.modalOpened = true;
687702
var fc = profileService.focusedClient;
@@ -994,17 +1009,18 @@ angular.module('copayApp.controllers')
9941009
var mnemonic = mnemonics[address];
9951010

9961011
if (isEmail) {
997-
self.openShareTextcoinModal(address.slice("textcoin:".length), mnemonic);
1012+
self.openShareTextcoinModal(address.slice("textcoin:".length), mnemonic, amount-constants.TEXTCOIN_CLAIM_FEE);
9981013
} else {
9991014
if (isCordova) {
10001015
if (isMobile.Android() || isMobile.Windows()) {
10011016
window.ignoreMobilePause = true;
10021017
}
10031018
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"
10051021
});
10061022
} else {
1007-
self.openShareTextcoinModal(null, mnemonic);
1023+
self.openShareTextcoinModal(null, mnemonic, amount-constants.TEXTCOIN_CLAIM_FEE);
10081024
}
10091025
}
10101026

@@ -1044,7 +1060,7 @@ angular.module('copayApp.controllers')
10441060
$scope.index.assetIndex = $scope.assetIndexSelectorValue;
10451061
this.shownForm = 'payment';
10461062
}
1047-
//$scope.$apply();
1063+
this.resetForm();
10481064
}
10491065

10501066
this.submitData = function() {
@@ -1480,10 +1496,10 @@ angular.module('copayApp.controllers')
14801496
window.ignoreMobilePause = true;
14811497
}
14821498
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"
14841500
});
14851501
} else {
1486-
self.openShareTextcoinModal(btx.textAddress, btx.mnemonic, true);
1502+
self.openShareTextcoinModal(btx.textAddress, btx.mnemonic, btx.amount-constants.TEXTCOIN_CLAIM_FEE, true);
14871503
}
14881504
}
14891505

0 commit comments

Comments
 (0)