Display loading spinner on mobile devices

This commit is contained in:
Gustavo Maximiliano Cortez 2015-02-13 18:05:09 -03:00
parent 7ffd483807
commit 010f1d03c3
3 changed files with 29 additions and 1 deletions

View File

@ -112,6 +112,9 @@ if [ ! -d $PROJECT ]; then
cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git && cordova prepare cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git && cordova prepare
checkOK checkOK
cordova plugin add hu.dpal.phonegap.plugins.spinnerdialog
checkOK
fi fi
if $DBGJS if $DBGJS

View File

@ -1,6 +1,6 @@
'use strict'; '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) { $scope.openTxModal = function(tx) {
var ModalInstanceCtrl = function($scope, $modalInstance) { var ModalInstanceCtrl = function($scope, $modalInstance) {
@ -9,9 +9,15 @@ angular.module('copayApp.controllers').controller('HomeWalletController', functi
$scope.loading = null; $scope.loading = null;
$scope.sign = function(ntxid) { $scope.sign = function(ntxid) {
if (isCordova) {
window.plugins.spinnerDialog.show(null, 'Signing transaction...', true);
}
$scope.loading = true; $scope.loading = true;
$timeout(function() { $timeout(function() {
w.signAndSend(ntxid, function(err, id, status) { w.signAndSend(ntxid, function(err, id, status) {
if (isCordova) {
window.plugins.spinnerDialog.hide();
}
$scope.loading = false; $scope.loading = false;
if (err) if (err)
$scope.error = err; $scope.error = err;
@ -22,9 +28,15 @@ angular.module('copayApp.controllers').controller('HomeWalletController', functi
}; };
$scope.reject = function(ntxid) { $scope.reject = function(ntxid) {
if (isCordova) {
window.plugins.spinnerDialog.show(null, 'Rejecting transaction...', true);
}
$scope.loading = true; $scope.loading = true;
$timeout(function() { $timeout(function() {
w.reject(ntxid, function(err, status) { w.reject(ntxid, function(err, status) {
if (isCordova) {
window.plugins.spinnerDialog.hide();
}
$scope.loading = false; $scope.loading = false;
if (err) if (err)
$scope.error = err; $scope.error = err;
@ -35,9 +47,15 @@ angular.module('copayApp.controllers').controller('HomeWalletController', functi
}; };
$scope.broadcast = function(ntxid) { $scope.broadcast = function(ntxid) {
if (isCordova) {
window.plugins.spinnerDialog.show(null, 'Sending transaction...', true);
}
$scope.loading = true; $scope.loading = true;
$timeout(function() { $timeout(function() {
w.issueTx(ntxid, function(err, txid, status) { w.issueTx(ntxid, function(err, txid, status) {
if (isCordova) {
window.plugins.spinnerDialog.hide();
}
$scope.loading = false; $scope.loading = false;
if (err) if (err)
$scope.error = err; $scope.error = err;

View File

@ -185,6 +185,10 @@ angular.module('copayApp.controllers').controller('SendController',
return; return;
} }
if (isCordova) {
window.plugins.spinnerDialog.show(null, 'Creating transaction...', true);
}
$scope.loading = true; $scope.loading = true;
if ($scope.isWindowsPhoneApp) if ($scope.isWindowsPhoneApp)
$rootScope.wpInputFocused = true; $rootScope.wpInputFocused = true;
@ -204,6 +208,9 @@ angular.module('copayApp.controllers').controller('SendController',
amountSat: amount, amountSat: amount,
comment: comment, comment: comment,
}, function (err, txid, status) { }, function (err, txid, status) {
if (isCordova) {
window.plugins.spinnerDialog.hide();
}
$scope.loading = false; $scope.loading = false;
if ($scope.isWindowsPhoneApp) if ($scope.isWindowsPhoneApp)
$rootScope.wpInputFocused = false; $rootScope.wpInputFocused = false;