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"?> <?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
@ -7,47 +7,48 @@
<author email="admin@netsyms.com" href="https://netsyms.com"> <author email="admin@netsyms.com" href="https://netsyms.com">
Netsyms Technologies Netsyms Technologies
</author> </author>
<icon src="res/icon.png"/> <icon src="res/icon.png" />
<preference name="SplashScreen" value="res/splash.9.png"/> <preference name="SplashScreen" value="res/splash.9.png" />
<preference name="FadeSplashScreen" value="true"/> <preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value="2000"/> <preference name="FadeSplashScreenDuration" value="2000" />
<preference name="SplashScreenDelay" value="1000"/> <preference name="SplashScreenDelay" value="1000" />
<preference name="SplashMaintainAspectRatio" value="false"/> <preference name="SplashMaintainAspectRatio" value="false" />
<preference name="SplashShowOnlyFirstTime" value="true"/> <preference name="SplashShowOnlyFirstTime" value="true" />
<preference name="AutoHideSplashScreen" value="false"/> <preference name="AutoHideSplashScreen" value="false" />
<preference name="ShowSplashScreen" value="true"/> <preference name="ShowSplashScreen" value="true" />
<platform name="browser"> <platform name="browser">
<preference name="ShowSplashScreen" value="false"/> <preference name="ShowSplashScreen" value="false" />
</platform> </platform>
<content src="index.html"/> <content src="index.html" />
<access origin="*"/> <access origin="*" />
<allow-navigation href="*"/> <allow-navigation href="*" />
<allow-intent href="http://*/*"/> <allow-intent href="http://*/*" />
<allow-intent href="https://*/*"/> <allow-intent href="https://*/*" />
<allow-intent href="tel:*"/> <allow-intent href="tel:*" />
<allow-intent href="sms:*"/> <allow-intent href="sms:*" />
<allow-intent href="mailto:*"/> <allow-intent href="mailto:*" />
<allow-intent href="geo:*"/> <allow-intent href="geo:*" />
<platform name="android"> <platform name="android">
<allow-intent href="market:*"/> <allow-intent href="market:*" />
</platform> </platform>
<platform name="ios"> <platform name="ios">
<allow-intent href="itms:*"/> <allow-intent href="itms:*" />
<allow-intent href="itms-apps:*"/> <allow-intent href="itms-apps:*" />
</platform> </platform>
<engine name="browser" spec="~4.0.0"/> <engine name="browser" spec="~4.0.0" />
<engine name="android" spec="latest"/> <engine name="android" spec="latest" />
<plugin name="cordova-plugin-dialogs" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git"/> <plugin name="cordova-plugin-dialogs" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git" />
<plugin name="cordova-plugin-whitelist" spec="https://github.com/apache/cordova-plugin-whitelist.git"/> <plugin name="cordova-plugin-whitelist" spec="https://github.com/apache/cordova-plugin-whitelist.git" />
<plugin name="cordova-plugin-console" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git"/> <plugin name="cordova-plugin-console" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git" />
<plugin name="cordova-plugin-device" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git"/> <plugin name="cordova-plugin-device" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git" />
<plugin name="cordova-plugin-camera" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git"/> <plugin name="cordova-plugin-camera" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git" />
<plugin name="cordova-plugin-splashscreen" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git"/> <plugin name="cordova-plugin-splashscreen" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git" />
<plugin name="cordova-plugin-network-information" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git"/> <plugin name="cordova-plugin-network-information" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git" />
<plugin name="cordova-plugin-media" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git"/> <plugin name="cordova-plugin-media" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git" />
<plugin name="cordova-plugin-media-capture" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git"/> <plugin name="cordova-plugin-media-capture" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git" />
<plugin name="cordova-plugin-geolocation" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git"/> <plugin name="cordova-plugin-geolocation" spec="https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git" />
<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>

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

@ -55,16 +55,20 @@ 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') {
// We're all good. if (data.stats.teamid !== null && data.stats.teamid > 0) {
userteamid = data.stats.teamid; // We're all good.
openscreen("home"); userteamid = data.stats.teamid;
openscreen("home");
} else {
// Open the team intro thingy
openscreen('chooseteam');
}
} else { } else {
// Open the team intro thingy serverProblemsDialog("Got a bad answer from the server. Restart the app and try again.");
openscreen('chooseteam');
} }
}).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,11 +155,12 @@ 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);
$('#loginBtn').html('<i class="fa fa-cog fa-spin fa-fw"></i> Logging in...'); $('#loginBtn').html('<i class="fa fa-cog fa-spin fa-fw"></i> Logging in...');
$.post(mkApiUrl("login"), $.post(mkApiUrl("login"),
{ {
user: $('#usernameBox').val(), user: $('#usernameBox').val(),

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