Skip to content

Commit ead1869

Browse files
Merge pull request byteball#268 from kakysha/master
erase textcoin
2 parents 75747f8 + fe3997b commit ead1869

File tree

4 files changed

+55
-15
lines changed

4 files changed

+55
-15
lines changed

public/views/modals/tx-details.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ <h4 class="title m0" translate>Details</h4>
119119
</span>
120120
</li>
121121

122-
<li ng-if="btx.textcoin" class="line-b p10 oh">
122+
<li ng-if="btx.isTextcoin" class="line-b p10 oh">
123123
<span class="text-gray" translate>Was claimed?</span>
124124
<span class="right" >
125125
<span class="text-warning" ng-show="!btx.claimed" translate>
126126
not claimed
127127
</span>
128-
<span ng-show="!btx.claimed" class="external-link">
128+
<span ng-show="!btx.claimed && btx.mnemonic" class="external-link">
129129
(<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>
@@ -135,14 +135,17 @@ <h4 class="title m0" translate>Details</h4>
135135
</span>
136136
</li>
137137

138-
<li ng-if="btx.textcoin && !btx.claimed" class="line-b p10 oh">
139-
If the recipient doesn't see your payment, you can <a class="blue-link" style="padding: 0" ng-click="shareAgain()" translate>share again</a>
138+
<li ng-if="btx.isTextcoin && !btx.claimed && btx.mnemonic" class="line-b p10 oh">
139+
<span translate>If the recipient doesn't see your payment, you can</span> <a class="blue-link" style="padding: 0" ng-click="shareAgain()" translate>share again</a>
140+
</li>
141+
<li ng-if="btx.isTextcoin && !btx.claimed && btx.mnemonic" class="line-b p10 oh">
142+
<span translate>You can erase textcoin from your wallet</span> <a class="blue-link" style="padding: 0" ng-click="eraseTextcoin()" translate>erase textcoin</a>
140143
</li>
141144
<li ng-if="btx.action == 'sent' && isPrivate" class="line-b p10 oh">
142-
If the recipient doesn't see your payment, you can <a class="blue-link" style="padding: 0" ng-click="showCorrespondentList()" translate>re-send private payloads</a>
145+
<span translate>If the recipient doesn't see your payment, you can</span> <a class="blue-link" style="padding: 0" ng-click="showCorrespondentList()" translate>re-send private payloads</a>
143146
</li>
144147
<li ng-if="n > 1 && isPrivate" class="line-b p10 oh">
145-
If any of your cosigner devices doesn't see this payment, you can <a class="blue-link" style="padding: 0" ng-click="reSendPrivateMultiSigPayment()" translate>re-send private payloads to cosigners</a>
148+
<span translate>If any of your cosigner devices doesn't see this payment, you can</span> <a class="blue-link" style="padding: 0" ng-click="reSendPrivateMultiSigPayment()" translate>re-send private payloads to cosigners</a>
146149
</li>
147150
</ul>
148151

public/views/walletHome.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ <h4 ng-class="{'enable_text_select': !index.isCordova}" class="size-12">
292292
</div>
293293
</div>
294294
<div class="m20t text-center m30b">
295-
<div class="text-center hor-link" ng-show="!home.generatingAddress && home.addr[index.walletId]">
295+
<div class="text-center hor-link" ng-show="!home.generatingAddress && home.addr[index.walletId]" ng-style="{'max-width' : (index.shared_address ? '100%' : '45%')}">
296296
<a class="size-14" ng-click="home.openCustomizedAmountModal(index.shared_address || home.addr[index.walletId])" ng-style="{'color':index.backgroundColor}">
297297
<span translate>Request a specific amount</span>
298298
</a>
@@ -408,7 +408,7 @@ <h4 class="title m0">
408408
{{index.addressbook[_address] || _address}}
409409
</div>-->
410410
<a class="postfix size-12 m0 text-gray" ng-hide="home.blockUx || home.lockAddress" ng-click="openDestinationAddressModal(index.otherWallets, _address)">
411-
<i class="icon-wallet size-18"></i>
411+
<i class="icon-wallet size-18" style="margin-right: -3px"></i>
412412
</a>
413413
</div>
414414
<div ng-if="home.deviceAddressIsKnown()" style="font-size: 11px; font-weight: bold; margin-top: -1.5rem; margin-bottom: 1.5rem">
@@ -658,6 +658,12 @@ <h4 class="title m0" style="padding:0 10px;">
658658
<div ng-show="!btx.message">
659659
<span translate>To</span>: {{index.addressbook[btx.addressTo] || btx.addressTo}}
660660
</div>
661+
<span ng-show="btx.textAddress" class="small-10">
662+
<span translate>To email</span>: {{btx.textAddress}}
663+
</span>
664+
<span ng-show="btx.isTextcoin" class="small-2 right">
665+
<span class="label tu light-gray radius">textcoin</span>
666+
</span>
661667
</div>
662668
</div>
663669

src/js/controllers/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,9 +1516,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
15161516
go.walletHome();
15171517
});
15181518

1519-
$rootScope.$on('Local/SetTab', function(event, tab, reset) {
1519+
$rootScope.$on('Local/SetTab', function(event, tab, reset, swtichToHome) {
15201520
console.log("SetTab "+tab+", reset "+reset);
1521-
self.setTab(tab, reset);
1521+
self.setTab(tab, reset, null, swtichToHome);
15221522
});
15231523

15241524
$rootScope.$on('Local/RequestTouchid', function(event, cb) {

src/js/controllers/walletHome.js

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ angular.module('copayApp.controllers')
530530
if (err)
531531
return $rootScope.$emit('Local/ShowErrorAlert', err);
532532
indexScope.updateTxHistory();
533-
$rootScope.$emit('Local/SetTab', 'history');
533+
$rootScope.$emit('Local/SetTab', 'history', null, true);
534534
});
535535
}
536536
var disableClaimTextcoinListener = $rootScope.$on('claimTextcoin', function(event, mnemonic) {
@@ -1494,10 +1494,6 @@ angular.module('copayApp.controllers')
14941494
$scope.color = fc.backgroundColor;
14951495
$scope.n = fc.credentials.n;
14961496

1497-
if (btx.textAddress) btx.textcoin = true;
1498-
if (!ValidationUtils.isValidEmail(btx.textAddress)) {
1499-
btx.textAddress = "";
1500-
}
15011497
$scope.shareAgain = function() {
15021498
if (isCordova) {
15031499
if (isMobile.Android() || isMobile.Windows()) {
@@ -1509,6 +1505,41 @@ angular.module('copayApp.controllers')
15091505
}
15101506
}
15111507

1508+
$scope.eraseTextcoin = function() {
1509+
(function(){
1510+
var wallet = require('byteballcore/wallet.js');
1511+
var ModalInstanceCtrl = function($scope, $modalInstance, $sce) {
1512+
$scope.title = $sce.trustAsHtml(gettextCatalog.getString('Deleting the textcoin will remove an ability to claim it back or to resend'));
1513+
$scope.cancel_button_class = 'light-gray outline';
1514+
$scope.loading = false;
1515+
1516+
$scope.ok = function() {
1517+
$scope.loading = true;
1518+
$modalInstance.close(gettextCatalog.getString('Yes'));
1519+
1520+
wallet.eraseTextcoin(btx.unit, btx.addressTo);
1521+
1522+
indexScope.updateTxHistory();
1523+
$rootScope.$emit('Local/SetTab', 'history');
1524+
};
1525+
$scope.cancel = function() {
1526+
$modalInstance.dismiss(gettextCatalog.getString('No'));
1527+
};
1528+
};
1529+
1530+
var modalInstance = $modal.open({
1531+
templateUrl: 'views/modals/confirmation.html',
1532+
windowClass: animationService.modalAnimated.slideUp,
1533+
controller: ModalInstanceCtrl
1534+
});
1535+
1536+
modalInstance.result.finally(function() {
1537+
var m = angular.element(document.getElementsByClassName('reveal-modal'));
1538+
m.addClass(animationService.modalAnimated.slideOutDown);
1539+
});
1540+
})();
1541+
}
1542+
15121543

15131544
$scope.getAmount = function(amount) {
15141545
return self.getAmount(amount);

0 commit comments

Comments
 (0)