Skip to content

Commit bc73bfa

Browse files
authored
Merge pull request #17 from SEPIA-Framework/dev
v0.18.0 b1
2 parents 8a0cf2e + 891e162 commit bc73bfa

File tree

85 files changed

+6106
-837
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+6106
-837
lines changed

Cordova-Plugin-Versions.txt

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
1-
Android (tested October 2018)
1+
Android (tested April 2019)
22
-----------------------------
33
cordova version 7.1.0
44
cordova platform version [email protected]
5-
cordova-android-support-gradle-release version="1.4.4"
6-
cordova-custom-config version="5.0.2"
7-
cordova-plugin-badge version="0.8.7"
8-
cordova-plugin-cache-clear version="1.3.7"
9-
cordova-plugin-compat version="1.2.0"
10-
cordova-plugin-device version="2.0.2"
11-
cordova-plugin-file version="6.0.1"
12-
cordova-plugin-geolocation version="4.0.1"
13-
cordova-plugin-inappbrowser version="1.7.1" --- customized
14-
cordova-plugin-local-notification version="0.9.0-beta.2"
15-
cordova-plugin-nativestorage version="2.3.2"
16-
cordova-plugin-splashscreen version="5.0.2"
17-
cordova-plugin-statusbar version="2.4.2"
18-
cordova-plugin-tts version="0.2.3"
19-
cordova-plugin-whitelist version="1.3.3"
20-
cordova-universal-links-plugin version="1.2.1"
21-
es6-promise-plugin version="4.2.2"
22-
org.apache.cordova.speech.speechrecognition version="0.1.2" --- customized
23-
phonegap-plugin-media-stream version="1.2.1"
5+
cordova-plugin-inappbrowser custom version from plugin_mods folder
6+
org.apache.cordova.speech.speechrecognition custom version from plugin_mods folder
7+
8+
"dependencies": {
9+
"com-darryncampbell-cordova-plugin-intent": "^1.1.6",
10+
"cordova-android": "^6.4.0",
11+
"cordova-android-support-gradle-release": "^3.0.0",
12+
"cordova-custom-config": "^5.1.0",
13+
"cordova-plugin-badge": "^0.8.8",
14+
"cordova-plugin-ble": "^2.0.1",
15+
"cordova-plugin-cache-clear": "^1.3.8",
16+
"cordova-plugin-compat": "^1.2.0",
17+
"cordova-plugin-device": "^2.0.2",
18+
"cordova-plugin-eddystone": "^1.3.0",
19+
"cordova-plugin-file": "^6.0.1",
20+
"cordova-plugin-geolocation": "^4.0.1",
21+
"cordova-plugin-inappbrowser": "^3.0.0",
22+
"cordova-plugin-insomnia": "git+https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git",
23+
"cordova-plugin-local-notification": "^0.9.0-beta.2",
24+
"cordova-plugin-nativestorage": "^2.3.2",
25+
"cordova-plugin-navigationbar-color": "0.0.8",
26+
"cordova-plugin-splashscreen": "^5.0.2",
27+
"cordova-plugin-statusbar": "^2.4.2",
28+
"cordova-plugin-tts": "^0.2.3",
29+
"cordova-plugin-whitelist": "^1.3.3",
30+
"cordova-universal-links-plugin": "^1.2.1",
31+
"es6-promise-plugin": "^4.2.2",
32+
"phonegap-plugin-media-stream": "^1.2.1",
33+
"speechrecognition": "file:plugin_mods\\speechrecognition\\org.apache.cordova.speech.speechrecognition",
34+
"org.apache.cordova.speech.speechrecognition": "plugin_mods/speechrecognition/org.apache.cordova.speech.speechrecognition"
35+
}

TEACH-UI.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# SEPIA Teach-UI examples
2+
3+
## Client controls
4+
5+
### Set volume
6+
```
7+
Action: <set>
8+
Function: volume
9+
Data: {"number":11}
10+
```
11+
12+
### Call SEPIA Mesh-Node from client
13+
```
14+
Action: <on>
15+
Function: meshNode
16+
Data: {"url":"http://localhost:20780", "plugin":"RuntimePlugin", "data":{"command":["echo", "test"]}}
17+
```
18+
19+
### Call CLEXI
20+
```
21+
Action: <on>
22+
Function: clexi
23+
Data: {"xtension":"clexi-broadcaster", "data":{"text":"Hello", "sender":"Me"}}
24+
```
25+
26+
## Platform actions (platform_controls)
27+
28+
### Call Android Intent for certain device or browser action
29+
```
30+
Device IDs: { "a1": {"type": "androidIntent", "data": {"action": "android.media.action.MEDIA_PLAY_FROM_SEARCH", "extras": {"query": "Paradise City"} }} }
31+
Browser: { "type": "url", "data": "https://open.spotify.com/track/3YBZIN3rekqsKxbJc9FZko?si=Stqe48xYS52Gim_Lr-JEFg" }
32+
```
33+
***Some useful Android intents:***
34+
https://developer.android.com/guide/components/intents-common
35+
android.settings.VOICE_INPUT_SETTINGS
36+
android.media.action.MEDIA_PLAY_FROM_SEARCH
37+
38+
39+
## Mesh node plugin
40+
41+
### Test HelloPlugin with answer
42+
```
43+
URL: http://localhost:20780
44+
Plugin: HelloPlugin
45+
JSON: {"name":"Boss"}
46+
Success: Ok I understood <result_hello>
47+
Fail: Sorry I could not get a result
48+
```

config.xml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<widget id="org.example.sepia.app.web" version="0.17.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
2+
<widget id="org.example.sepia.app.web" version="0.18.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
33
<name>S.E.P.I.A.</name>
44
<description>
55
Prototype of S.E.P.I.A. framework client
@@ -11,10 +11,12 @@
1111
<content src="start.html" />
1212

1313
<preference name="orientation" value="portrait" />
14+
<!--<preference name="BackgroundColor" value="0xff000000"/>-->
1415

1516
<!--plugins-->
1617
<preference name="StatusBarOverlaysWebView" value="false" />
17-
<preference name="StatusBarBackgroundColor" value="#000" />
18+
<preference name="StatusBarBackgroundColor" value="#000000" />
19+
<preference name="NavigationBarBackgroundColor" value="#000000" />
1820

1921
<plugin name="cordova-plugin-whitelist" spec="1" />
2022
<access origin="*" />
@@ -24,14 +26,14 @@
2426
<allow-intent href="sms:*" />
2527
<allow-intent href="mailto:*" />
2628
<allow-intent href="geo:*" />
29+
<allow-intent href="spotify:*" />
2730

28-
<!--hooks--><!-- this hooks dont work reliably enough, at least not under windows -->
29-
<!--<hook type="before_platform_add" src="hooks/010_install_plugins.js" />-->
30-
<!--<hook type="after_platform_add" src="hooks/030_resource_files.js" />-->
31+
<!--platforms-->
3132

3233
<platform name="android">
33-
<!--more hooks-->
34+
<!--hooks-->
3435
<hook type="after_platform_add" src="hooks/add-android-intent-filters.js" />
36+
<hook type="after_prepare" src="hooks/add-android-permissions.js"/>
3537

3638
<!--one main icon-->
3739
<icon src="resources/icons/android/icon-ldpi.png" density="ldpi" /> <!-- 32px -->
@@ -61,7 +63,7 @@
6163
</platform>
6264

6365
<platform name="ios">
64-
<!--more hooks-->
66+
<!--hooks-->
6567
<hook type="after_platform_add" src="hooks/add-swift-support.js" />
6668

6769
<!--icons and splash-->
@@ -109,7 +111,7 @@
109111
<universal-links>
110112
<ios-team-id value="" />
111113
<host name="b07z.net" scheme="https">
112-
<path url="/dl/sepia/*" event="universalLinkTest"/>
114+
<path url="/dl/sepia/*" event="universalLinks"/>
113115
</host>
114116
</universal-links>
115117

create-android-project.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ cordova plugin add cordova-android-support-gradle-release
4040
cordova plugin add phonegap-plugin-media-stream
4141
cordova plugin add https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git
4242
cordova plugin add cordova-plugin-eddystone
43+
cordova plugin add cordova-plugin-navigationbar-color
44+
#NOTE: add before intent plugin if you use: plugin add cordova-plugin-camera
45+
cordova plugin add com-darryncampbell-cordova-plugin-intent
4346
#
4447
# overwrite plugin mods
4548
sleep 2
@@ -63,6 +66,9 @@ echo "#Replacing icons and theme with launch screen ..."
6366
cp -r -f "resources/icons/android/notifications/res/" "platforms/android/res/"
6467
cp -r "resources/themes/android/background_splash.xml" "platforms/android/res/drawable/background_splash.xml"
6568
cp -r "resources/themes/android/launch_screen.png" "platforms/android/res/drawable/launch_screen.png"
66-
cp -r "resources/themes/android/styles.xml" "platforms/android/res/values/styles.xml"
69+
#cp -r "resources/themes/android/styles.xml" "platforms/android/res/values/styles.xml"
70+
cp -r "resources/themes/android/values/" "platforms/android/res/values/"
71+
mkdir -p "platforms/android/res/values-v21"
72+
cp -r "resources/themes/android/values-v21/" "platforms/android/res/values-v21/"
6773
echo "#DONE"
6874
echo "If everything worked out fine the next step would be to build the app from the %APP_NAME% folder: cordova build android"

hooks/add-android-permissions.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env node
2+
3+
'use strict';
4+
5+
const fs = require('fs');
6+
const _ = require('lodash');
7+
const xml2js = require('xml2js');
8+
9+
// here add/remove permissions you need for Android app
10+
let permissions = [
11+
'com.android.alarm.permission.SET_ALARM'
12+
];
13+
14+
module.exports = function (context) {
15+
const parseString = xml2js.parseString;
16+
const builder = new xml2js.Builder();
17+
const manifestPath = context.opts.projectRoot + '/platforms/android/AndroidManifest.xml';
18+
const androidManifest = fs.readFileSync(manifestPath).toString();
19+
20+
let manifestRoot,
21+
missedPermissions;
22+
23+
if (androidManifest && permissions.length > 0) {
24+
parseString(androidManifest, (err, manifest) => {
25+
if (err) return console.error(err);
26+
27+
manifestRoot = manifest['manifest'];
28+
29+
if (!manifestRoot['uses-permission']) {
30+
manifestRoot['uses-permission'] = [];
31+
}
32+
33+
missedPermissions = _.difference(permissions, _.map(manifestRoot['uses-permission'], `$['android:name']`));
34+
35+
if (missedPermissions.length > 0) {
36+
missedPermissions.forEach(perm => manifestRoot['uses-permission'].push({'$': {'android:name': perm}}));
37+
38+
fs.writeFileSync(manifestPath, builder.buildObject(manifest));
39+
40+
console.log(`Added ${missedPermissions.length} permissions:`);
41+
missedPermissions.forEach(perm => console.log(` - ${perm}`));
42+
}
43+
});
44+
}
45+
};

0 commit comments

Comments
 (0)