2
Fork 0

Added mobile example app

This commit is contained in:
Willem 2016-01-24 21:38:21 +01:00
parent 4fbf705ae5
commit cf364fc418
26 changed files with 187 additions and 61 deletions

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<widget id="net.forwardfire.spa.loader" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>FFSpaLoaderExample</name>
<description>
A sample FFSpaLoader example application.
</description>
<author email="ffspaloader.example.2016@forwardfire.net" href="http://forwardfire.net">
FFSpaLoaderExample
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<plugin name="cordova-sqlite-storage" spec="1" />
<access origin="*" />
<icon src="www/img/ic_launcher_mdpi.png" />
<icon src="www/img/ic_launcher_mdpi.png" platform="android" density="ldpi" />
<icon src="www/img/ic_launcher_mdpi.png" platform="android" density="mdpi" />
<icon src="www/img/ic_launcher_hdpi.png" platform="android" density="hdpi" />
<icon src="www/img/ic_launcher_xhdpi.png" platform="android" density="xhdpi" />
<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:*" />
<!-- Build for lowest version of cordova 5.x -->
<preference name="android-minSdkVersion" value="14" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<!-- disable backup to ICloud of db file -->
<preference name="BackupWebStorage" value="none"/>
</platform>
<hook type="before_build" src="scripts/copy-ff-spa-loader.js" />
<hook type="after_build" src="scripts/rename-android-apk.js" />
</widget>

View file

@ -0,0 +1,3 @@
{
"android": "4.1.1"
}

View file

@ -0,0 +1,18 @@
{
"prepare_queue": {
"installed": [],
"uninstalled": []
},
"config_munge": {
"files": {}
},
"installed_plugins": {
"cordova-plugin-whitelist": {
"PACKAGE_NAME": "net.forwardfire.spa.loader"
},
"cordova-sqlite-storage": {
"PACKAGE_NAME": "net.forwardfire.spa.loader"
}
},
"dependent_plugins": {}
}

View file

@ -0,0 +1,18 @@
{
"cordova-sqlite-storage": {
"source": {
"type": "registry",
"id": "cordova-sqlite-storage"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-whitelist": {
"source": {
"type": "registry",
"id": "cordova-plugin-whitelist@1"
},
"is_top_level": true,
"variables": {}
}
}

View file

@ -0,0 +1,16 @@
var fs = require('fs');
module.exports = function(context) {
var Q = context.requireCordovaModule('q');
var deferral = new Q.defer();
console.log('copy-ff-spa-loader start');
fs.readFile('../../es5-ff-spa-loader.js',function(err,data) {
if (err) return deferral.reject(err);
fs.writeFile('www/es5-ff-spa-loader.js',data,function(err) {
if (err) return deferral.reject(err);
console.log('copy-ff-spa-loader done');
deferral.resolve();
})
});
return deferral.promise;
}

View file

@ -0,0 +1,15 @@
var fs = require('fs');
module.exports = function(context) {
var Q = context.requireCordovaModule('q');
var deferral = new Q.defer();
var nameOld = 'platforms/android/build/outputs/apk/android-debug.apk';
var nameNew = 'platforms/android/build/outputs/apk/FFSpaLoaderExample.apk';
console.log('rename-android-apk start old: '+nameOld);
fs.rename(nameOld,nameNew,function(err) {
if (err) return deferral.reject(err);
console.log('rename-android-apk done new: '+nameNew);
deferral.resolve();
});
return deferral.promise;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap:">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
</head>
<body>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="es5-ff-spa-loader.js"></script>
<script>
FFSpaLoader.options.debug.enable = true;
FFSpaLoader.options.boot.angular.modules.push('exampleUI');
FFSpaLoader.options.server.assets = '/static/spa-client-resources';
FFSpaLoader.start();
</script>
</body>
</html>