Improve server/connection error handling, fix issue #5

master
Skylar Ittner 8 years ago
parent c3e8553df5
commit d6a070bb8c

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0" android-versionCode="105020" id="com.netsyms.terranquest.TerranQuest" version="1.5.2">
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="105020" id="com.netsyms.terranquest.TerranQuest" version="1.5.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0">
<name>TerranQuest</name>
<description>
Augmented Reality fantasy game
@ -50,4 +50,5 @@
<plugin name="com.phonegap.plugins.barcodescanner" spec="https://github.com/Telerik-Verified-Plugins/BarcodeScanner" />
<plugin name="cordova-plugin-inapppurchase" spec="~1.0.0" />
<plugin name="cordova_app_version_plugin" spec="~0.2.6" />
<plugin name="cordova-plugin-ios-longpress-fix" spec="~1.1.0" />
</widget>

@ -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;
}

@ -55,7 +55,8 @@ function checkUserHasTeamOpenChooserIfNot(username) {
$.getJSON(mkApiUrl('getstats'), {
user: username
}, function (data) {
if (data.status === 'OK' && data.stats.teamid !== null && data.stats.teamid > 0) {
if (data.status === 'OK') {
if (data.stats.teamid !== null && data.stats.teamid > 0) {
// We're all good.
userteamid = data.stats.teamid;
openscreen("home");
@ -63,8 +64,11 @@ function checkUserHasTeamOpenChooserIfNot(username) {
// Open the team intro thingy
openscreen('chooseteam');
}
} else {
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('<i class="fa fa-user-plus"></i> 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('<i class="fa fa-user-plus"></i> Sign Up');
$('#signupBtn').attr('disabled', false);
authOpInProgress = false;
return;
}
$.post("https://sso.netsyms.com/api/adduser.php",
@ -149,6 +155,7 @@ function dologin() {
$('#errorbase').css('display', 'block');
$('#loginBtn').html('<i class="fa fa-sign-in"></i> Login');
$('#loginBtn').attr('disabled', false);
authOpInProgress = false;
return;
}
$('#loginBtn').attr('disabled', true);

@ -63,11 +63,13 @@
<div style="position: absolute; width: 100%; height: 100%; top: 0; left: 0; background-color: #324150; z-index: 9999;">
<img src="assets/logonobg.svg" alt="" style="display: block; position: absolute; max-width: 90%; top: 0; left: 0; right: 0; bottom: 25%; margin: auto; max-height: 20%;" />
<p id="servererrorp" style="font-family: sans-serif; color: white; position: absolute; max-width: 90%; left: 0; right: 0; bottom: 30%; margin: auto; text-align: center;">
We are experiencing server problems. Try again later.
There is a server problem. Try again later.
<br />
<i class="fa fa-exclamation-triangle fa-3x"></i>
<br />
<span id="serverproblemmsg">(sorry)</span>
<br />
<button class="btn btn-primary" onclick="navigator.app.exitApp()">Quit game</button>
<div style="background: url(assets/mountains-simple.svg) repeat-x; background-size: auto 100%; height: 20%; position: absolute; bottom: 0; width: 100%;"></div>
</div>
</div>