Skip to content

Commit

Permalink
'P4' client code submit for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
fquirin committed May 6, 2018
1 parent 4dc541c commit 301cbc7
Show file tree
Hide file tree
Showing 210 changed files with 36,696 additions and 0 deletions.
108 changes: 108 additions & 0 deletions config.xml
@@ -0,0 +1,108 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="de.bytemind.sepia.app.web" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>S.E.P.I.A.</name>
<description>
Prototype of S.E.P.I.A. framework client
</description>
<author email="info@bytemind.de" href="http://bytemind.de">
Florian Quirin - Bytemind
</author>

<content src="start.html" />

<preference name="orientation" value="portrait" />

<!--plugins-->
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#000" />

<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />

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

<platform name="android">
<!--more hooks-->
<hook type="after_platform_add" src="hooks/add-android-intent-filters.js" />

<!--one main icon-->
<icon src="resources/icons/android/icon-ldpi.png" density="ldpi" /> <!-- 32px -->
<icon src="resources/icons/android/icon-mdpi.png" density="mdpi" /> <!-- 48px -->
<icon src="resources/icons/android/icon-hdpi.png" density="hdpi" /> <!-- 72px -->
<icon src="resources/icons/android/icon-xhdpi.png" density="xhdpi" /> <!-- 96px -->
<icon src="resources/icons/android/icon-xxhdpi.png" density="xxhdpi" /> <!-- 144px -->
<icon src="resources/icons/android/icon-xxxhdpi.png" density="xxxhdpi" /> <!-- 192px -->

<splash src="resources/splashs/android/port-xhdpi.9.png" density="port-xhdpi"/>
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="SplashScreenDelay" value="10000" />

<!--config stuff-->
<preference name="AndroidLaunchMode" value="singleTask" />
<preference name="android-minSdkVersion" value="19" /><!-- Android 4.4+ -->
<preference name="android-targetSdkVersion" value="23" /><!-- TODO: remove asap! its only a fix for broken local notifications in Android 8.0 (due to file:// -> content://) -->
<preference name="android-windowSoftInputMode" value="adjustSize" />
<!-- custom manifest changes -->
<custom-preference name="android-manifest/application/activity/@android:theme" value="@style/SplashTheme"/> <!-- Theme mainly for splash screen or background colors -->

<!--intents-->
<allow-intent href="market:*" />
</platform>

<platform name="ios">
<!--more hooks-->
<hook type="after_platform_add" src="hooks/add-swift-support.js" />

<!--icons and splash-->
<icon src="resources/icons/ios/icon.png" width="57" height="57" />
<icon src="resources/icons/ios/icon@2x.png" width="114" height="114" />
<icon src="resources/icons/ios/icon-40.png" width="40" height="40" />
<icon src="resources/icons/ios/icon-40@2x.png" width="80" height="80" />
<icon src="resources/icons/ios/icon-50.png" width="50" height="50" />
<icon src="resources/icons/ios/icon-50@2x.png" width="100" height="100" />
<icon src="resources/icons/ios/icon-60.png" width="60" height="60" />
<icon src="resources/icons/ios/icon-60@2x.png" width="120" height="120" />
<icon src="resources/icons/ios/icon-60@3x.png" width="180" height="180" />
<icon src="resources/icons/ios/icon-72.png" width="72" height="72" />
<icon src="resources/icons/ios/icon-72@2x.png" width="144" height="144" />
<icon src="resources/icons/ios/icon-76.png" width="76" height="76" />
<icon src="resources/icons/ios/icon-76@2x.png" width="152" height="152" />
<icon src="resources/icons/ios/icon-83.5@2x.png" width="167" height="167" />
<icon src="resources/icons/ios/icon-small.png" width="29" height="29" />
<icon src="resources/icons/ios/icon-small@2x.png" width="58" height="58" />
<icon src="resources/icons/ios/icon-small@3x.png" width="87" height="87" />

<splash src="resources/splashs/ios/Default@2x~iphone~anyany.png" />
<splash src="resources/splashs/ios/Default@3x~iphone~anyany.png" />
<splash src="resources/splashs/ios/Default@2x~ipad~anyany.png" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="SplashScreenDelay" value="10000" />

<!--config stuff-->
<preference name="deployment-target" value="10.0" /><!-- iOS 10+ -->
<preference name="DisallowOverscroll" value="true" />
<preference name="SuppressesLongPressGesture" value="true" />

<!--intents-->
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>

<universal-links>
<ios-team-id value="" />
<host name="b07z.net" scheme="https">
<path url="/sepia/*" event="universalLinkTest"/>
</host>
</universal-links>

</widget>
60 changes: 60 additions & 0 deletions create-android-project.sh
@@ -0,0 +1,60 @@
#!/bin/sh
#
APP_NAME="SepiaFW-P4"
# create project
sleep 2
echo "#Creating '$APP_NAME' ..."
cordova create $APP_NAME de.bytemind.sepia.app.web $APP_NAME
#
# copy folders
sleep 2
echo "#Transfering code ..."
cp -r www $APP_NAME
cp -r plugin_mods $APP_NAME
cp -r resources $APP_NAME
cp -r hooks $APP_NAME
cp config.xml $APP_NAME/config.xml
cd $APP_NAME
#
# add plugins
sleep 2
echo "#Adding plugins ..."
cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-geolocation
cordova plugin add cordova-plugin-inappbrowser
cordova plugin add cordova-plugin-tts
cordova plugin add cordova-plugin-whitelist
cordova plugin add cordova-universal-links-plugin
cordova plugin add cordova-plugin-statusbar
cordova plugin add cordova-plugin-splashscreen
cordova plugin add cordova-plugin-cache-clear
cordova plugin add cordova-custom-config
cordova plugin add plugin_mods/speechrecognition/org.apache.cordova.speech.speechrecognition
#cordova plugin add de.appplant.cordova.plugin.local-notification
cordova plugin add plugin_mods/localnotifications/de.appplant.cordova.plugin.local-notification
cordova plugin add cordova-android-support-gradle-release
#
# overwrite plugin mods
sleep 2
echo "#Updating plugins ..."
cp -f "plugin_mods/inappbrowser/android/InAppBrowser.java" "plugins/cordova-plugin-inappbrowser/src/android/"
cp -r -f "plugin_mods/inappbrowser/plugin.xml" "plugins/cordova-plugin-inappbrowser/plugin.xml"
cp -r -f "plugin_mods/inappbrowser/android/res/" "plugins/cordova-plugin-inappbrowser/src/android/res/"
#cp -r -f "resources/icons/android/notifications/res/" "plugins/de.appplant.cordova.plugin.local-notification/src/android/res/"
#
# add android platform
sleep 2
echo "#Adding platform ..."
cordova platform add android@6.4.0
#
# prepare build
echo "#Preparing build ..."
cordova prepare android
# overwrite icons (this will be replaced with a proper implementation)
sleep 2
echo "#Replacing icons and theme with launch screen ..."
cp -r -f "resources/icons/android/notifications/res/" "platforms/android/res/"
cp -r "resources/themes/android/background_splash.xml" "platforms/android/res/drawable/background_splash.xml"
cp -r "resources/themes/android/launch_screen.png" "platforms/android/res/drawable/launch_screen.png"
cp -r "resources/themes/android/styles.xml" "platforms/android/res/values/styles.xml"
echo "#DONE"
59 changes: 59 additions & 0 deletions create-ios-project-uiwebview.sh
@@ -0,0 +1,59 @@
#!/bin/bash
#
APP_NAME="SepiaFW-P4"
# create project
echo "#Creating '$APP_NAME' ..."
cordova create $APP_NAME de.bytemind.sepia.app.web $APP_NAME
#
# copy folders
sleep 2
echo "#Transfering code ..."
cp -r www $APP_NAME
cp -r plugin_mods $APP_NAME
cp -r resources $APP_NAME
cp -r hooks $APP_NAME
cp config.xml $APP_NAME/config.xml
cd $APP_NAME
#
# add plugins
sleep 2
echo "#Adding plugins ..."
cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-geolocation
cordova plugin add cordova-plugin-inappbrowser
cordova plugin add cordova-plugin-tts
cordova plugin add cordova-plugin-whitelist
cordova plugin add cordova-universal-links-plugin
cordova plugin add cordova-plugin-statusbar
cordova plugin add cordova-plugin-splashscreen
cordova plugin add cordova-plugin-cache-clear
cordova plugin add plugin_mods/speechrecognition/org.apache.cordova.speech.speechrecognition
#cordova plugin add de.appplant.cordova.plugin.local-notification
cordova plugin add plugin_mods/localnotifications/de.appplant.cordova.plugin.local-notification
cordova plugin add plugin_mods/iosbackgroundaudio/nl.kingsquare.cordova.background-audio
#
# overwrite plugin mods
sleep 2
echo "#Updating plugins ..."
cp "plugin_mods/universallinks/xcodePreferences.js" "plugins/cordova-universal-links-plugin/hooks/lib/ios/xcodePreferences.js"
cp "plugin_mods/inappbrowser/ios/CDVInAppBrowser_uiwv.m" "plugins/cordova-plugin-inappbrowser/src/ios/CDVInAppBrowser.m"
cp "plugin_mods/tts/ios/CDVTTS.m" "plugins/cordova-plugin-tts/src/ios/CDVTTS.m"
#
# install xcode node package
sleep 2
echo "#Checking node xcode package ... "
npm install xcode
#
# add ios platform
sleep 2
echo "#Adding platform ..."
cordova platform add ios@4.5.3
#
# prepare build
echo "#Preparing build ..."
cordova prepare ios
echo "#DONE"
echo "#Please open $APP_NAME/platforms/ios/$APP_NAME.xcodeproj in Xcode and set some extra stuff:"
echo "# - provisioning profile for signing"
echo "# - Build settings -> Always Embed Swift Standard Libraries = yes"
echo "# - If you are using a 'free' account for signing: Capabilities -> Associated Domains -> delete entry"
63 changes: 63 additions & 0 deletions create-ios-project-wkwebview.sh
@@ -0,0 +1,63 @@
#!/bin/bash
#
APP_NAME="SepiaFW-P4"
# create project
echo "#Creating '$APP_NAME' ..."
cordova create $APP_NAME de.bytemind.sepia.app.web $APP_NAME
#
# copy folders
sleep 2
echo "#Transfering code ..."
cp -r www $APP_NAME
cp -r plugin_mods $APP_NAME
cp -r resources $APP_NAME
cp -r hooks $APP_NAME
cp config.xml $APP_NAME/config.xml
cd $APP_NAME
#
# add plugins
sleep 2
echo "#Adding plugins ..."
cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-geolocation
#cordova plugin add cordova-plugin-inappbrowser
cordova plugin add cordova-plugin-inappbrowser-wkwebview
cordova plugin add cordova-plugin-wkwebview-engine
cordova plugin add cordova-plugin-tts
cordova plugin add cordova-plugin-whitelist
cordova plugin add cordova-universal-links-plugin
cordova plugin add cordova-plugin-statusbar
cordova plugin add cordova-plugin-splashscreen
cordova plugin add cordova-plugin-cache-clear
cordova plugin add plugin_mods/speechrecognition/org.apache.cordova.speech.speechrecognition
#cordova plugin add de.appplant.cordova.plugin.local-notification
cordova plugin add plugin_mods/localnotifications/de.appplant.cordova.plugin.local-notification
cordova plugin add plugin_mods/iosbackgroundaudio/nl.kingsquare.cordova.background-audio
#
# overwrite plugin mods
sleep 2
echo "#Updating plugins ..."
cp "plugin_mods/universallinks/xcodePreferences.js" "plugins/cordova-universal-links-plugin/hooks/lib/ios/xcodePreferences.js"
cp "plugin_mods/inappbrowser/ios/CDVInAppBrowser_wkwv.m" "plugins/cordova-plugin-inappbrowser-wkwebview/src/ios/CDVInAppBrowser.m"
cp "plugin_mods/inappbrowser/ios/CDVInAppBrowser_wkwv.h" "plugins/cordova-plugin-inappbrowser-wkwebview/src/ios/CDVInAppBrowser.h"
cp "plugin_mods/cacheclear/ios/CacheClear.m" "plugins/cordova-plugin-cache-clear/src/ios/CacheClear.m"
cp "plugin_mods/tts/ios/CDVTTS.m" "plugins/cordova-plugin-tts/src/ios/CDVTTS.m"
#
# install xcode node package
sleep 2
echo "#Checking node xcode package ... "
npm install xcode
#
# add ios platform
sleep 2
echo "#Adding platform ..."
cordova platform add ios@4.5.3
#
# prepare build
echo "#Preparing build ..."
cordova prepare ios
echo "#DONE"
echo "#Please open $APP_NAME/platforms/ios/$APP_NAME.xcodeproj in Xcode and set some extra stuff:"
echo "# - provisioning profile for signing"
echo "# - Build settings -> Always Embed Swift Standard Libraries = yes"
echo "# - If you are using a 'free' account for signing: Capabilities -> Associated Domains -> delete entry"
23 changes: 23 additions & 0 deletions hooks/README.md
@@ -0,0 +1,23 @@
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
-->
# Cordova Hooks

Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. See Hooks Guide for more details: http://cordova.apache.org/docs/en/edge/guide_appdev_hooks_index.md.html#Hooks%20Guide.
24 changes: 24 additions & 0 deletions hooks/add-android-intent-filters.js
@@ -0,0 +1,24 @@
module.exports = function (context) {
const fs = require('fs');
const _ = require('lodash');

const scheme = 'flowkey';
const insertIntent = `
<intent-filter>
<action android:name="android.intent.action.ASSIST" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VOICE_COMMAND" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
`;
const manifestPath = context.opts.projectRoot + '/platforms/android/AndroidManifest.xml';
const androidManifest = fs.readFileSync(manifestPath).toString();
if (!androidManifest.includes(`android:scheme="${scheme}"`)) {
const manifestLines = androidManifest.split(/\r?\n/);
const lineNo = _.findIndex(manifestLines, (line) => line.includes('@string/activity_name'));
manifestLines.splice(lineNo + 1, 0, insertIntent);
fs.writeFileSync(manifestPath, manifestLines.join('\n'));
}
};

0 comments on commit 301cbc7

Please sign in to comment.