Improve server/connection error handling, fix issue #5

This commit is contained in:
Skylar Ittner 2016-09-20 13:31:22 -06:00
parent c3e8553df5
commit d6a070bb8c
4 changed files with 64 additions and 48 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?> <?xml version='1.0' encoding='utf-8'?>
<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"> <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> <name>TerranQuest</name>
<description> <description>
Augmented Reality fantasy game Augmented Reality fantasy game
@ -50,4 +50,5 @@
<plugin name="com.phonegap.plugins.barcodescanner" spec="https://github.com/Telerik-Verified-Plugins/BarcodeScanner" /> <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-plugin-inapppurchase" spec="~1.0.0" />
<plugin name="cordova_app_version_plugin" spec="~0.2.6" /> <plugin name="cordova_app_version_plugin" spec="~0.2.6" />
<plugin name="cordova-plugin-ios-longpress-fix" spec="~1.1.0" />
</widget> </widget>

View File

@ -16,6 +16,12 @@
* limitations under the License. * 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 { body {
color: #eee; color: #eee;
} }

View File

@ -55,7 +55,8 @@ function checkUserHasTeamOpenChooserIfNot(username) {
$.getJSON(mkApiUrl('getstats'), { $.getJSON(mkApiUrl('getstats'), {
user: username user: username
}, function (data) { }, 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. // We're all good.
userteamid = data.stats.teamid; userteamid = data.stats.teamid;
openscreen("home"); openscreen("home");
@ -63,8 +64,11 @@ function checkUserHasTeamOpenChooserIfNot(username) {
// Open the team intro thingy // Open the team intro thingy
openscreen('chooseteam'); openscreen('chooseteam');
} }
} else {
serverProblemsDialog("Got a bad answer from the server. Restart the app and try again.");
}
}).fail(function () { }).fail(function () {
serverProblemsDialog("Cannot get player data from server.");
}); });
} }
@ -90,6 +94,7 @@ function dosignup() {
$('#errorbase').css('display', 'block'); $('#errorbase').css('display', 'block');
$('#signupBtn').html('<i class="fa fa-user-plus"></i> Sign Up'); $('#signupBtn').html('<i class="fa fa-user-plus"></i> Sign Up');
$('#signupBtn').attr('disabled', false); $('#signupBtn').attr('disabled', false);
authOpInProgress = false;
return; return;
} }
if ($('#passwordBox').val() !== $('#passwordBox2').val()) { if ($('#passwordBox').val() !== $('#passwordBox2').val()) {
@ -97,6 +102,7 @@ function dosignup() {
$('#errorbase').css('display', 'block'); $('#errorbase').css('display', 'block');
$('#signupBtn').html('<i class="fa fa-user-plus"></i> Sign Up'); $('#signupBtn').html('<i class="fa fa-user-plus"></i> Sign Up');
$('#signupBtn').attr('disabled', false); $('#signupBtn').attr('disabled', false);
authOpInProgress = false;
return; return;
} }
$.post("https://sso.netsyms.com/api/adduser.php", $.post("https://sso.netsyms.com/api/adduser.php",
@ -149,6 +155,7 @@ function dologin() {
$('#errorbase').css('display', 'block'); $('#errorbase').css('display', 'block');
$('#loginBtn').html('<i class="fa fa-sign-in"></i> Login'); $('#loginBtn').html('<i class="fa fa-sign-in"></i> Login');
$('#loginBtn').attr('disabled', false); $('#loginBtn').attr('disabled', false);
authOpInProgress = false;
return; return;
} }
$('#loginBtn').attr('disabled', true); $('#loginBtn').attr('disabled', true);

View File

@ -63,11 +63,13 @@
<div style="position: absolute; width: 100%; height: 100%; top: 0; left: 0; background-color: #324150; z-index: 9999;"> <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%;" /> <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;"> <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 /> <br />
<i class="fa fa-exclamation-triangle fa-3x"></i> <i class="fa fa-exclamation-triangle fa-3x"></i>
<br /> <br />
<span id="serverproblemmsg">(sorry)</span> <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 style="background: url(assets/mountains-simple.svg) repeat-x; background-size: auto 100%; height: 20%; position: absolute; bottom: 0; width: 100%;"></div>
</div> </div>
</div> </div>