Merge pull request #2414 from cmgustavo/bug/ux-loading-01
Fixes loading message after press a button
This commit is contained in:
commit
3eab8ab8e5
11 changed files with 110 additions and 85 deletions
|
|
@ -127,7 +127,9 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
|||
return;
|
||||
}
|
||||
|
||||
$scope.open(form.email.$modelValue, form.password.$modelValue);
|
||||
$timeout(function() {
|
||||
$scope.open(form.email.$modelValue, form.password.$modelValue);
|
||||
}, 100);
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -165,7 +167,6 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
|
|||
} else {
|
||||
$scope.error = 'Unknown error';
|
||||
}
|
||||
$rootScope.starting = false;
|
||||
$timeout(function() {
|
||||
$rootScope.$digest();
|
||||
}, 1)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('HomeWalletController', function($scope, $rootScope, $timeout, $filter, $modal, rateService, notification, txStatus, identityService) {
|
||||
angular.module('copayApp.controllers').controller('HomeWalletController', function($scope, $rootScope, $timeout, $filter, $modal, rateService, notification, txStatus, identityService, isCordova) {
|
||||
|
||||
$scope.openTxModal = function(tx) {
|
||||
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
||||
|
|
@ -16,10 +16,16 @@ angular.module('copayApp.controllers').controller('HomeWalletController', functi
|
|||
};
|
||||
|
||||
$scope.sign = function(ntxid) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.show(null, 'Signing transaction...', true);
|
||||
}
|
||||
$scope.loading = true;
|
||||
$scope.error = null;
|
||||
$timeout(function() {
|
||||
w.signAndSend(ntxid, function(err, id, status) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
$scope.loading = false;
|
||||
if (err) {
|
||||
$scope.error = 'Transaction could not send. Please try again.';
|
||||
|
|
@ -33,10 +39,16 @@ angular.module('copayApp.controllers').controller('HomeWalletController', functi
|
|||
};
|
||||
|
||||
$scope.reject = function(ntxid) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.show(null, 'Rejecting transaction...', true);
|
||||
}
|
||||
$scope.loading = true;
|
||||
$scope.error = null;
|
||||
$timeout(function() {
|
||||
w.reject(ntxid, function(err, status) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
$scope.loading = false;
|
||||
if (err) {
|
||||
$scope.error = err;
|
||||
|
|
@ -50,10 +62,16 @@ angular.module('copayApp.controllers').controller('HomeWalletController', functi
|
|||
};
|
||||
|
||||
$scope.broadcast = function(ntxid) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.show(null, 'Sending transaction...', true);
|
||||
}
|
||||
$scope.loading = true;
|
||||
$scope.error = null;
|
||||
$timeout(function() {
|
||||
w.issueTx(ntxid, function(err, txid, status) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
$scope.loading = false;
|
||||
if (err) {
|
||||
$scope.error = 'Transaction could not send. Please try again.';
|
||||
|
|
|
|||
|
|
@ -70,33 +70,36 @@ angular.module('copayApp.controllers').controller('ImportController',
|
|||
|
||||
$rootScope.starting = true;
|
||||
|
||||
$scope.importOpts = {};
|
||||
$timeout(function() {
|
||||
|
||||
var skipFields = [];
|
||||
$scope.importOpts = {};
|
||||
|
||||
if ($scope.skipPublicKeyRing)
|
||||
skipFields.push('publicKeyRing');
|
||||
var skipFields = [];
|
||||
|
||||
if ($scope.skipTxProposals)
|
||||
skipFields.push('txProposals');
|
||||
if ($scope.skipPublicKeyRing)
|
||||
skipFields.push('publicKeyRing');
|
||||
|
||||
if (skipFields)
|
||||
$scope.importOpts.skipFields = skipFields;
|
||||
if ($scope.skipTxProposals)
|
||||
skipFields.push('txProposals');
|
||||
|
||||
if (backupFile) {
|
||||
reader.readAsBinaryString(backupFile);
|
||||
} else {
|
||||
updateStatus('Importing wallet - Procesing backup...');
|
||||
identityService.importWallet(backupText, $scope.password, $scope.importOpts, function(err) {
|
||||
if (err) {
|
||||
$rootScope.starting = false;
|
||||
$scope.error = 'Could not read wallet. Please check your password';
|
||||
$timeout(function() {
|
||||
$rootScope.$digest();
|
||||
}, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (skipFields)
|
||||
$scope.importOpts.skipFields = skipFields;
|
||||
|
||||
if (backupFile) {
|
||||
reader.readAsBinaryString(backupFile);
|
||||
} else {
|
||||
updateStatus('Importing wallet - Procesing backup...');
|
||||
identityService.importWallet(backupText, $scope.password, $scope.importOpts, function(err) {
|
||||
if (err) {
|
||||
$rootScope.starting = false;
|
||||
$scope.error = 'Could not read wallet. Please check your password';
|
||||
$timeout(function() {
|
||||
$rootScope.$digest();
|
||||
}, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -70,10 +70,13 @@ angular.module('copayApp.controllers').controller('ImportProfileController',
|
|||
|
||||
$rootScope.starting = true;
|
||||
|
||||
if (backupFile) {
|
||||
reader.readAsBinaryString(backupFile);
|
||||
} else {
|
||||
_importBackup(backupText);
|
||||
}
|
||||
$timeout(function() {
|
||||
|
||||
if (backupFile) {
|
||||
reader.readAsBinaryString(backupFile);
|
||||
} else {
|
||||
_importBackup(backupText);
|
||||
}
|
||||
}, 100);
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -163,6 +163,9 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
if (msg.match('expired'))
|
||||
msg = 'The payment request has expired';
|
||||
|
||||
if (msg.match('XMLHttpRequest'))
|
||||
msg = 'Error when sending to the blockchain. Resend it from Home';
|
||||
|
||||
var message = 'The transaction' + ($scope.requiresMultipleSignatures ? ' proposal' : '') +
|
||||
' could not be created: ' + msg;
|
||||
|
||||
|
|
@ -182,37 +185,45 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
return;
|
||||
}
|
||||
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.show(null, 'Creating transaction...', true);
|
||||
}
|
||||
|
||||
$scope.loading = true;
|
||||
$scope.creatingTX = true;
|
||||
if ($scope.isWindowsPhoneApp)
|
||||
$rootScope.wpInputFocused = true;
|
||||
$rootScope.wpInputFocused = true;
|
||||
|
||||
$timeout(function () {
|
||||
var comment = form.comment.$modelValue;
|
||||
var merchantData = $scope._merchantData;
|
||||
var address, amount;
|
||||
if (!merchantData) {
|
||||
address = form.address.$modelValue;
|
||||
amount = parseInt((form.amount.$modelValue * unitToSat).toFixed(0));
|
||||
var comment = form.comment.$modelValue;
|
||||
var merchantData = $scope._merchantData;
|
||||
var address, amount;
|
||||
if (!merchantData) {
|
||||
address = form.address.$modelValue;
|
||||
amount = parseInt((form.amount.$modelValue * unitToSat).toFixed(0));
|
||||
}
|
||||
|
||||
w.spend({
|
||||
merchantData: merchantData,
|
||||
toAddress: address,
|
||||
amountSat: amount,
|
||||
comment: comment,
|
||||
}, function (err, txid, status) {
|
||||
if (isCordova) {
|
||||
window.plugins.spinnerDialog.hide();
|
||||
}
|
||||
$scope.loading = false;
|
||||
if ($scope.isWindowsPhoneApp)
|
||||
$rootScope.wpInputFocused = false;
|
||||
|
||||
w.spend({
|
||||
merchantData: merchantData,
|
||||
toAddress: address,
|
||||
amountSat: amount,
|
||||
comment: comment,
|
||||
}, function (err, txid, status) {
|
||||
$scope.loading = false;
|
||||
$scope.creatingTX = false;
|
||||
if ($scope.isWindowsPhoneApp)
|
||||
$rootScope.wpInputFocused = false;
|
||||
|
||||
if (err)
|
||||
return $scope.setError(err);
|
||||
txStatus.notify(status);
|
||||
$scope.resetForm();
|
||||
});
|
||||
}, 1);
|
||||
if (err) {
|
||||
$scope.setError(err);
|
||||
}
|
||||
else {
|
||||
txStatus.notify(status);
|
||||
$scope.resetForm();
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
||||
// QR code Scanner
|
||||
|
|
|
|||
|
|
@ -1651,6 +1651,7 @@ Wallet.prototype.broadcastToBitcoinNetwork = function(ntxid, cb) {
|
|||
log.debug('Wallet:' + self.getName() + ' Send failed:' + err);
|
||||
|
||||
self._checkIfTxIsSent(ntxid, function(err, txid) {
|
||||
self.emitAndKeepAlive('balanceUpdated');
|
||||
return cb(err, txid);
|
||||
});
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue