Webserver: -fix: appcrash if a given server is not reachable

-add: scan a qrcode to insert server address (in app)
-mod: own folder for phonegap build + created config.xml
This commit is contained in:
lukeIam committed 2013-12-13 18:03:10 +01:00
1 parent 4019cc1dcf
commit 3550b4eeb1
5 files changed
+111 -4

No files matched your search

+61
View File
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "net.sourceforge.vocaluxe"
version = "0.1.0">
<name>Vocaluxe</name>
<description>
Interact with Vocaluxe via your mobile device.
</description>
<author href="http://vocaluxe.sourceforge.net">
Vocaluxe Team
</author>
<!--
Enable individual API permissions here.
-->
<feature name="http://api.phonegap.com/1.0/device" />
<feature name="http://api.phonegap.com/1.0/camera" />
<feature name="http://api.phonegap.com/1.0/file" />
<!-- Customize your app and platform with the preference element. -->
<preference name="phonegap-version" value="2.9.0" />
<!-- Plugins can also be added here. -->
<gap:plugin name="com.phonegap.plugins.barcodescanner" />
<!-- Define app icon for each platform. -->
<icon src="icon.png" />
<!--<icon src="res/icon/cordova_android_36.png" gap:platform="android" gap:density="ldpi" />
<icon src="res/icon/cordova_android_48.png" gap:platform="android" gap:density="mdpi" />
<icon src="res/icon/cordova_android_72.png" gap:platform="android" gap:density="hdpi" />
<icon src="res/icon/android/cordova_android_96.png" gap:platform="android" gap:density="xhdpi" />
<icon src="res/icon/cordova_bb_80.png" gap:platform="blackberry" />
<icon src="res/icon/cordova_bb_80.png" gap:platform="blackberry" gap:state="hover"/>
<icon src="res/icon/cordova_ios_57.png" gap:platform="ios" width="57" height="57" />
<icon src="res/icon/cordova_ios_72.png" gap:platform="ios" width="72" height="72" />
<icon src="res/icon/cordova_ios_114.png" gap:platform="ios" width="114" height="114" />
<icon src="res/icon/cordova_ios_144.png" gap:platform="ios" width="144" height="144" />
<icon src="res/icon/cordova_64.png" gap:platform="webos" />
<icon src="res/icon/cordova_48.png" gap:platform="winphone" />
<icon src="res/icon/cordova_128.png" gap:platform="winphone" gap:role="background" /> -->
<!-- Define app splash screen for each platform. -->
<!--<gap:splash src="res/screen/android_ldpi_portrait.png" gap:platform="android" gap:density="ldpi" />
<gap:splash src="res/screen/android_mdpi_portrait.png" gap:platform="android" gap:density="mdpi" />
<gap:splash src="res/screen/android_hdpi_portrait.png" gap:platform="android" gap:density="hdpi" />
<gap:splash src="res/screen/android_xhdpi_portrait.png" gap:platform="android" gap:density="xhdpi" />
<gap:splash src="res/screen/blackberry_transparent_300.png" gap:platform="blackberry" />
<gap:splash src="res/screen/iphone_portrait.png" gap:platform="ios" width="320" height="480" />
<gap:splash src="res/screen/iphone_retina_portrait.png" gap:platform="ios" width="640" height="960" />
<gap:splash src="res/screen/ipad_portrait.png" gap:platform="ios" width="768" height="1024" />
<gap:splash src="res/screen/ipad_landscape.png" gap:platform="ios" width="1024" height="768" />
<gap:splash src="res/screen/windows_phone_portrait.jpg" gap:platform="winphone" /> -->
<access origin="*" />
</widget>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

+3
View File
@@ -441,6 +441,9 @@
<Folder Include="Website\html\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy /E /D /Y "$(ProjectDir)\Website" "$(SolutionDir)\PhoneGap"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
+5
View File
@@ -7,6 +7,7 @@
<link rel="stylesheet" href="css/style.css" />
<script src="js/jquery-1.9.1.min.js"></script>
<script src="phonegap.js"></script>
<script src="barcodescanner.js"></script>
<script>
if (document.location.protocol == "file:") {
if (typeof (window.deviceAndJqmLoaded) == "undefined") {
@@ -47,6 +48,10 @@
<label for="discoverServerAddress" class="input" data-i18n="discoverConnectServerAddress"></label>
<input type="text" id="discoverServerAddress" name="discoverServerAddress" data-mini="true">
<a data-role="button" id="discoverConnect" data-i18n="discoverConnectButton"></a>
<br />
<hr />
<br />
<a data-role="button" id="discoverReadQr" data-i18n="discoverReadQrButton"></a>
</div>
<!-- /content -->
</div>
+42 -4
View File
@@ -721,16 +721,27 @@ function pagebeforeshowDiscover() {
var address = window.localStorage.getItem("VocaluxeServerAddress");
if (address != null) {
serverBaseAddress = "";
var prom = request({ url: address + "isServerOnline" }, "Checking...").done(function () {
var prom = request({
url: address + "isServerOnline",
timeout: 10000
}, "Checking...").done(function () {
serverBaseAddress = address;
window.localStorage.setItem("VocaluxeServerAddress", address);
$.mobile.changePage("#login", { transition: "none" });
}).fail(function () {
if (typeof window.BarcodeScanner != "undefined") {
$('#discoverReadQr').show();
}
});
$(this).data('promise', prom);
return;
}
if (typeof window.BarcodeScanner != "undefined") {
$('#discoverReadQr').show();
}
}
} else {
$('#discoverReadQr').hide();
$.mobile.changePage("#login", { transition: "none" });
}
}
@@ -915,8 +926,7 @@ function initDiscoverPageHandler() {
$('#discoverServerAddress').keypress(keyPressed);
$('#discoverConnect').click(function () {
var address = $('#discoverServerAddress').prop("value");
function handleAddress(address) {
if (address != null && address != "") {
if (address.indexOf("http") != 0) {
address = "http://" + address;
@@ -925,7 +935,10 @@ function initDiscoverPageHandler() {
address = address + '/';
}
serverBaseAddress = "";
request({ url: address + "isServerOnline" }, "Checking...")
request({
url: address + "isServerOnline",
timeout: 10000
}, "Checking...")
.done(function () {
serverBaseAddress = address;
window.localStorage.setItem("VocaluxeServerAddress", address);
@@ -933,8 +946,31 @@ function initDiscoverPageHandler() {
})
.fail(function () {
$('#discoverServerAddress').prop("value", "");
if (document.location.protocol == "file:"
&& typeof window.BarcodeScanner != "undefined") {
$('#discoverReadQr').show();
}
});
}
}
$('#discoverConnect').click(function () {
handleAddress($('#discoverServerAddress').prop("value"));
});
try {
window.BarcodeScanner = cordova.require("cordova/plugin/BarcodeScanner");
} catch (e) { }
$('#discoverReadQr').hide().click(function () {
window.BarcodeScanner.scan(
function (result) {
handleAddress(result.text);
},
function () {
showError("Scan faild");
}
);
});
//Fire pageLoadHandler for discover (first page shown after start)
@@ -1195,6 +1231,7 @@ function initTranslation() {
'loginPassword': 'Password:',
'loginButton': 'Login',
'registerButton': 'Create Profile',
'discoverReadQrButton': 'Scan QRCode',
'mainPageYourProfileLink': 'Your Profile',
'mainPageYourProfileLinkDesc': 'Edit your profile',
'mainPageCurrentSongLink': 'Current Song',
@@ -1274,6 +1311,7 @@ function initTranslation() {
'loginPassword': 'Passwort:',
'loginButton': 'Einloggen',
'registerButton': 'Erstelle Profil',
'discoverReadQrButton': 'Fotografiere QRCode',
'mainPageYourProfileLink': 'Dein Profil',
'mainPageYourProfileLinkDesc': 'Bearbeite dein Profil',
'mainPageCurrentSongLink': 'Aktuelles Lied',