From d6a070bb8c7ab8ad3e7c25f8bc380b3e89996cf5 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Tue, 20 Sep 2016 13:31:22 -0600 Subject: [PATCH] Improve server/connection error handling, fix issue #5 --- config.xml | 79 ++++++++++++++++++++++---------------------- www/css/main.css | 6 ++++ www/js/auth.js | 23 ++++++++----- www/servererror.html | 4 ++- 4 files changed, 64 insertions(+), 48 deletions(-) diff --git a/config.xml b/config.xml index 52cef2f..6061380 100644 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - - + + TerranQuest Augmented Reality fantasy game @@ -7,47 +7,48 @@ Netsyms Technologies - - - - - - - - - + + + + + + + + + - + - - - - - - - - - + + + + + + + + + - + - - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/www/css/main.css b/www/css/main.css index 364bf19..d190f8c 100644 --- a/www/css/main.css +++ b/www/css/main.css @@ -16,6 +16,12 @@ * limitations under the License. */ +/* iOS text-selection hacks */ +*:not(input):not(textarea) { + -webkit-user-select: none; /* disable selection/Copy of UIWebView */ + -webkit-touch-callout: none; /* disable the IOS popup when long-press on a link */ +} + body { color: #eee; } diff --git a/www/js/auth.js b/www/js/auth.js index 18eb349..fd8aaed 100644 --- a/www/js/auth.js +++ b/www/js/auth.js @@ -55,16 +55,20 @@ function checkUserHasTeamOpenChooserIfNot(username) { $.getJSON(mkApiUrl('getstats'), { user: username }, function (data) { - if (data.status === 'OK' && data.stats.teamid !== null && data.stats.teamid > 0) { - // We're all good. - userteamid = data.stats.teamid; - openscreen("home"); + if (data.status === 'OK') { + if (data.stats.teamid !== null && data.stats.teamid > 0) { + // We're all good. + userteamid = data.stats.teamid; + openscreen("home"); + } else { + // Open the team intro thingy + openscreen('chooseteam'); + } } else { - // Open the team intro thingy - openscreen('chooseteam'); + serverProblemsDialog("Got a bad answer from the server. Restart the app and try again."); } }).fail(function () { - + serverProblemsDialog("Cannot get player data from server."); }); } @@ -90,6 +94,7 @@ function dosignup() { $('#errorbase').css('display', 'block'); $('#signupBtn').html(' Sign Up'); $('#signupBtn').attr('disabled', false); + authOpInProgress = false; return; } if ($('#passwordBox').val() !== $('#passwordBox2').val()) { @@ -97,6 +102,7 @@ function dosignup() { $('#errorbase').css('display', 'block'); $('#signupBtn').html(' Sign Up'); $('#signupBtn').attr('disabled', false); + authOpInProgress = false; return; } $.post("https://sso.netsyms.com/api/adduser.php", @@ -149,11 +155,12 @@ function dologin() { $('#errorbase').css('display', 'block'); $('#loginBtn').html(' Login'); $('#loginBtn').attr('disabled', false); + authOpInProgress = false; return; } $('#loginBtn').attr('disabled', true); $('#loginBtn').html(' Logging in...'); - + $.post(mkApiUrl("login"), { user: $('#usernameBox').val(), diff --git a/www/servererror.html b/www/servererror.html index cb81767..af4c7bf 100644 --- a/www/servererror.html +++ b/www/servererror.html @@ -63,11 +63,13 @@

- We are experiencing server problems. Try again later. + There is a server problem. Try again later.

(sorry) +
+