Give better feedback when a plan was selected

This commit is contained in:
Johannes Zellner
2017-06-09 14:26:28 +02:00
parent eba79cd859
commit eb3ae2c34f
2 changed files with 25 additions and 5 deletions

View File

@@ -32,9 +32,29 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
window.location.href = '/error.html';
};
$scope.showUpdateModalFromVersion1Modal = function () {
$('#version1Modal').modal('hide');
$('#updateModal').modal('show');
$scope.waitingForPlanSelection = false;
$('#version1Modal').on('hide.bs.modal', function () {
$scope.waitingForPlanSelection = false;
});
$scope.waitForPlanSelection = function () {
if ($scope.waitingForPlanSelection) return;
$scope.waitingForPlanSelection = true;
function checkPlan() {
if (!$scope.waitingForPlanSelection) return;
if ($scope.currentSubscription.plan.id !== 'undecided') {
$scope.waitingForPlanSelection = false;
$('#version1Modal').modal('hide');
$('#updateModal').modal('show');
} else {
$timeout(checkPlan, 1000);
}
}
checkPlan();
};
$scope.showUpdateModal = function (form) {
@@ -142,7 +162,7 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
$scope.currentSubscription = result;
// check again to give more immediate feedback once a subscription was setup
if (result.plan.id === 'undecided') $timeout(getSubscription, 10000);
if (result.plan.id === 'undecided') $timeout(getSubscription, 5000);
});
});
}