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
@ -7,47 +7,48 @@
<author email="admin@netsyms.com" href="https://netsyms.com">
Netsyms Technologies
</author>
<icon src="res/icon.png"/>
<preference name="SplashScreen" value="res/splash.9.png"/>
<preference name="FadeSplashScreen" value="true"/>
<preference name="FadeSplashScreenDuration" value="2000"/>
<preference name="SplashScreenDelay" value="1000"/>
<preference name="SplashMaintainAspectRatio" value="false"/>
<preference name="SplashShowOnlyFirstTime" value="true"/>
<preference name="AutoHideSplashScreen" value="false"/>
<preference name="ShowSplashScreen" value="true"/>
<icon src="res/icon.png" />
<preference name="SplashScreen" value="res/splash.9.png" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value="2000" />
<preference name="SplashScreenDelay" value="1000" />
<preference name="SplashMaintainAspectRatio" value="false" />
<preference name="SplashShowOnlyFirstTime" value="true" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="ShowSplashScreen" value="true" />
<platform name="browser">
<preference name="ShowSplashScreen" value="false"/>
<preference name="ShowSplashScreen" value="false" />
</platform>
<content src="index.html"/>
<access origin="*"/>
<allow-navigation href="*"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<allow-intent href="tel:*"/>
<allow-intent href="sms:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="geo:*"/>
<content src="index.html" />
<access origin="*" />
<allow-navigation href="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*"/>
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*"/>
<allow-intent href="itms-apps:*"/>
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<engine name="browser" spec="~4.0.0"/>
<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-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-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-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-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-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="cordova-plugin-inapppurchase" spec="~1.0.0"/>
<plugin name="cordova_app_version_plugin" spec="~0.2.6"/>
<engine name="browser" spec="~4.0.0" />
<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-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-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-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-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-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="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,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('<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,11 +155,12 @@ 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);
$('#loginBtn').html('<i class="fa fa-cog fa-spin fa-fw"></i> Logging in...');
$.post(mkApiUrl("login"),
{
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;">
<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>