fix spinner in windows phone

This commit is contained in:
Gabriel 2017-03-30 21:37:12 +02:00
commit f677d4bd75
3 changed files with 43 additions and 38 deletions

View file

@ -211,6 +211,6 @@ angular.module('copayApp.controllers').controller('createController',
}, 100);
} else $state.go('tabs.home');
});
}, 100);
}, 300);
}
});

View file

@ -43,38 +43,40 @@ angular.module('copayApp.controllers').controller('tourController',
var retryCount = 0;
$scope.createDefaultWallet = function() {
ongoingProcess.set('creatingWallet', true);
profileService.createDefaultWallet(function(err, walletClient) {
if (err) {
$log.warn(err);
$timeout(function() {
profileService.createDefaultWallet(function(err, walletClient) {
if (err) {
$log.warn(err);
return $timeout(function() {
$log.warn('Retrying to create default wallet.....:' + ++retryCount);
if (retryCount > 3) {
ongoingProcess.set('creatingWallet', false);
popupService.showAlert(
gettextCatalog.getString('Cannot Create Wallet'), err,
function() {
retryCount = 0;
return $scope.createDefaultWallet();
}, gettextCatalog.getString('Retry'));
} else {
return $scope.createDefaultWallet();
}
}, 2000);
};
ongoingProcess.set('creatingWallet', false);
var wallet = walletClient;
var walletId = wallet.credentials.walletId;
if (!usePushNotifications) {
$state.go('onboarding.backupRequest', {
walletId: walletId
});
} else {
$state.go('onboarding.notifications', {
walletId: walletId
});
}
});
return $timeout(function() {
$log.warn('Retrying to create default wallet.....:' + ++retryCount);
if (retryCount > 3) {
ongoingProcess.set('creatingWallet', false);
popupService.showAlert(
gettextCatalog.getString('Cannot Create Wallet'), err,
function() {
retryCount = 0;
return $scope.createDefaultWallet();
}, gettextCatalog.getString('Retry'));
} else {
return $scope.createDefaultWallet();
}
}, 2000);
};
ongoingProcess.set('creatingWallet', false);
var wallet = walletClient;
var walletId = wallet.credentials.walletId;
if (!usePushNotifications) {
$state.go('onboarding.backupRequest', {
walletId: walletId
});
} else {
$state.go('onboarding.notifications', {
walletId: walletId
});
}
});
}, 300);
};
$scope.goBack = function() {

View file

@ -3,6 +3,7 @@
angular.module('copayApp.services').factory('ongoingProcess', function($log, $timeout, $filter, lodash, $ionicLoading, gettext, platformInfo) {
var root = {};
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
var ongoingProcess = {};
@ -49,7 +50,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
root.clear = function() {
ongoingProcess = {};
if (isCordova) {
if (isCordova && !isWP) {
window.plugins.spinnerDialog.hide();
} else {
$ionicLoading.hide();
@ -79,21 +80,23 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
if (customHandler) {
customHandler(processName, showName, isOn);
} else if (root.onGoingProcessName) {
if (isCordova) {
if (isCordova && !isWP) {
window.plugins.spinnerDialog.show(null, showName, root.clear);
} else {
var tmpl = '<div class="item-icon-left">' + showName + '<ion-spinner class="spinner-stable" icon="lines"></ion-spinner></div>';
var tmpl;
if (isWP) tmpl = '<div>' + showName +'</div>';
else tmpl = '<div class="item-icon-left">' + showName + '<ion-spinner class="spinner-stable" icon="lines"></ion-spinner></div>';
$ionicLoading.show({
template: tmpl
});
}
} else {
if (isCordova) {
if (isCordova && !isWP) {
window.plugins.spinnerDialog.hide();
} else {
$ionicLoading.hide();
}
$ionicLoading.hide();
}
}
};