Fix spinner when sign/reject/remove/broadcast a transaction
This commit is contained in:
parent
32c4d1e472
commit
68cc09f4ab
11 changed files with 52 additions and 51 deletions
|
|
@ -1116,25 +1116,26 @@ input.ng-invalid-match, input.ng-invalid-match:focus {
|
|||
}
|
||||
|
||||
.onGoingProcess {
|
||||
left: 0;
|
||||
width: 100%;
|
||||
bottom: 90px;
|
||||
position: absolute;
|
||||
z-index: 1020;
|
||||
}
|
||||
|
||||
.onGoingProcess-content {
|
||||
background: #213140;
|
||||
text-align: center;
|
||||
max-width: 16.5rem;
|
||||
max-height: 3.5rem;
|
||||
top:auto;
|
||||
left:0;
|
||||
right:0;
|
||||
bottom:170px;
|
||||
margin: auto;
|
||||
border-radius: 3px;
|
||||
color: #fff;
|
||||
padding: 0.5rem;
|
||||
font-size: 13px;
|
||||
position: absolute;
|
||||
opacity: 0.8;
|
||||
z-index: 10;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
|
||||
/*/////////////////// SPINNER ////////////////////*/
|
||||
|
||||
.spinner {
|
||||
|
|
|
|||
|
|
@ -127,10 +127,10 @@ _:-ms-fullscreen, :root .main {
|
|||
margin-left: 26px;
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.tab-bar .text-close {
|
||||
margin-right: 10px;
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
|
@ -582,6 +582,10 @@ a.pin-button:active {
|
|||
transform: none !important;
|
||||
}
|
||||
|
||||
.popup-tx-status {
|
||||
z-index: 1030;
|
||||
}
|
||||
|
||||
.popup-txsent {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
|
|
|
|||
|
|
@ -155,26 +155,26 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
return;
|
||||
};
|
||||
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.show(null, 'Signing transaction...', true);
|
||||
}
|
||||
self.setOngoingProcess('Signing transaction');
|
||||
$scope.loading = true;
|
||||
$scope.error = null;
|
||||
$timeout(function() {
|
||||
fc.signTxProposal(txp, function(err, txpsi) {
|
||||
profileService.lockFC();
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
$scope.loading = false;
|
||||
self.setOngoingProcess();
|
||||
if (err) {
|
||||
$scope.loading = false;
|
||||
$scope.error = err.message || 'Transaction not signed. Please try again.';
|
||||
$scope.$digest();
|
||||
} else {
|
||||
//if txp has required signatures then broadcast it
|
||||
var txpHasRequiredSignatures = txpsi.status == 'accepted';
|
||||
if (txpHasRequiredSignatures) {
|
||||
self.setOngoingProcess('Broadcasting transaction');
|
||||
$scope.loading = true;
|
||||
fc.broadcastTxProposal(txpsi, function(err, txpsb) {
|
||||
self.setOngoingProcess();
|
||||
$scope.loading = false;
|
||||
if (err) {
|
||||
$scope.error = 'Transaction not broadcasted. Please try again.';
|
||||
$scope.$digest();
|
||||
|
|
@ -183,6 +183,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
}
|
||||
});
|
||||
} else {
|
||||
$scope.loading = false;
|
||||
$modalInstance.close(txpsi);
|
||||
}
|
||||
}
|
||||
|
|
@ -191,16 +192,12 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
};
|
||||
|
||||
$scope.reject = function(txp) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.show(null, 'Rejecting transaction...', true);
|
||||
}
|
||||
self.setOngoingProcess('Rejecting transaction');
|
||||
$scope.loading = true;
|
||||
$scope.error = null;
|
||||
$timeout(function() {
|
||||
fc.rejectTxProposal(txp, null, function(err, txpr) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
self.setOngoingProcess();
|
||||
$scope.loading = false;
|
||||
if (err) {
|
||||
$scope.error = err.message || 'Transaction not rejected. Please try again.';
|
||||
|
|
@ -214,16 +211,12 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
|
||||
|
||||
$scope.remove = function(txp) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.show(null, 'Deleting transaction...', true);
|
||||
}
|
||||
self.setOngoingProcess('Deleting transaction');
|
||||
$scope.loading = true;
|
||||
$scope.error = null;
|
||||
$timeout(function() {
|
||||
fc.removeTxProposal(txp, function(err, txpb) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
self.setOngoingProcess();
|
||||
$scope.loading = false;
|
||||
|
||||
// Hacky: request tries to parse an empty response
|
||||
|
|
@ -238,16 +231,12 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
};
|
||||
|
||||
$scope.broadcast = function(txp) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.show(null, 'Sending transaction...', true);
|
||||
}
|
||||
self.setOngoingProcess('Broadcasting transaction');
|
||||
$scope.loading = true;
|
||||
$scope.error = null;
|
||||
$timeout(function() {
|
||||
fc.broadcastTxProposal(txp, function(err, txpb) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
self.setOngoingProcess();
|
||||
$scope.loading = false;
|
||||
if (err) {
|
||||
$scope.error = err.message || 'Transaction not sent. Please try again.';
|
||||
|
|
@ -449,7 +438,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
$timeout(function() {
|
||||
self.onGoingProcess = name;
|
||||
$rootScope.$apply();
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -471,7 +460,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
return;
|
||||
};
|
||||
|
||||
self.setOngoingProcess('Sending transaction');
|
||||
self.setOngoingProcess('Creating transaction');
|
||||
$timeout(function() {
|
||||
var comment = form.comment.$modelValue;
|
||||
var paypro = self._paypro;
|
||||
|
|
@ -493,7 +482,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
}
|
||||
|
||||
self.signAndBroadcast(txp, function(err) {
|
||||
self.setOngoingProcess();
|
||||
profileService.lockFC();
|
||||
if (err) {
|
||||
return self.setError(err);
|
||||
|
|
@ -512,7 +500,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
profileService.lockFC();
|
||||
self.setOngoingProcess();
|
||||
|
||||
if (err) return cb(err);
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
if (signedTx.status == 'accepted') {
|
||||
self.setOngoingProcess('Broadcasting transaction');
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ angular.module('copayApp.services').factory('txStatus', function($modal, lodash,
|
|||
};
|
||||
$modal.open({
|
||||
templateUrl: 'views/modals/tx-status.html',
|
||||
windowClass: 'full',
|
||||
windowClass: 'full popup-tx-status',
|
||||
controller: ModalInstanceCtrl,
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue