Skip to content

Commit

Permalink
Merge pull request betaflight#1946 from WalcoFPV/cordova
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeller committed Jul 6, 2020
1 parent eb4cc0f commit 71a3010
Show file tree
Hide file tree
Showing 99 changed files with 9,117 additions and 3,037 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ debug/
release/
testresults/

# Cordova
cordova/www/
cordova/platforms/
cordova/plugins/
cordova/resources/
cordova/package-lock.json

# OSX
.DS_store

Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ Unstable testing versions of the lates builds of the configurator for most platf

**Be aware that these versions are intended for testing / feedback only, and may be buggy or broken, and can cause flight controller settings to be corrupted. Caution is advised when using these versions.**

## Native app build via NW.js
## Native app build via NW.js (windows/linux/macos) or Cordova (android)

### Development

1. Install node.js (version 10 required)
2. Install yarn: `npm install yarn -g`
3. Change to project folder and run `yarn install`.
4. Run `yarn start`.
3. (For Android platform only) Install Java JDK 8, Gradle and Android Studio (Android SDK at least level 19)
4. Change to project folder and run `yarn install`.
5. Run `yarn start`.

### Running tests

Expand All @@ -69,12 +70,14 @@ yarn gulp <taskname> [[platform] [platform] ...]
```

List of possible values of `<task-name>`:
* **dist** copies all the JS and CSS files in the `./dist` folder.
* **dist** copies all the JS and CSS files in the `./dist` folder [2].
* **apps** builds the apps in the `./apps` folder [1].
* **debug** builds debug version of the apps in the `./debug` folder [1].
* **debug** builds debug version of the apps in the `./debug` folder [1][3].
* **release** zips up the apps into individual archives in the `./release` folder [1].

[1] Running this task on macOS or Linux requires Wine, since it's needed to set the icon for the Windows app (build for specific platform to avoid errors).
[2] For Android platform, **dist** task will generate the `./cordova` folder
[3] For Android platform, you need to configure an emulator or to plug an Android device with USB debugging enabled

#### Build or release app for one specific platform
To build or release only for one specific platform you can append the plaform after the `task-name`.
Expand All @@ -84,6 +87,7 @@ If no platform is provided, all the platforms will be done in sequence.
* **Linux** use `yarn gulp <task-name> --linux64`
* **Windows** use `yarn gulp <task-name> --win32`
* **ChromeOS** use `yarn gulp <task-name> --chromeos`
* **Android** use `yarn gulp <task-name> --android`

You can also use multiple platforms e.g. `yarn gulp <taskname> --osx64 --linux64`.

Expand Down
Binary file added assets/android/icon/drawable-hdpi-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/android/icon/drawable-ldpi-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/android/icon/drawable-mdpi-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/android/icon/drawable-xhdpi-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/android/icon/drawable-xxhdpi-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/android/icon/drawable-xxxhdpi-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions cordova/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"android": {
"release": {
"keystore": "release.keystore",
"storePassword": "betaflight",
"alias": "betaflight",
"password" : "betaflight"
}
}
}
52 changes: 52 additions & 0 deletions cordova/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="com.betaflight.betaflightconfigurator" version="[INJECTED_BY_GULPFILE]">
<name>[INJECTED_BY_GULPFILE]</name>
<description>[INJECTED_BY_GULPFILE]</description>
<author href="https://betaflight.com">[INJECTED_BY_GULPFILE]</author>
<content src="main_cordova.html"/>
<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:*"/>
<preference name="Orientation" value="default"/>
<preference name="ShowSplashScreenSpinner" value="false"/>
<preference name="AutoHideSplashScreen" value="false"/>
<platform name="android">
<allow-intent href="market:*"/>
<icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
<icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
<icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/>
<icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/>
<icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/>
<icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
<splash src="resources/android/splash/drawable-land-hdpi-screen.png" density="land-hdpi"/>
<splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/>
<splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/>
<splash src="resources/android/splash/drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
<splash src="resources/android/splash/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
<splash src="resources/android/splash/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
<splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
<splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
<splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
<splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
<splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
<splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
<preference name="SplashMaintainAspectRatio" value="true"/>
<preference name="SplashShowOnlyFirstTime" value="true"/>
<preference name="android-minSdkVersion" value="19"/>
<config-file parent="/manifest/application/activity" target="AndroidManifest.xml">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/>
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/usb_device_filter"/>
</config-file>
<resource-file src="usb_device_filter.xml" target="app/src/main/res/xml/usb_device_filter.xml"/>
</platform>
<platform name="ios">
<allow-intent href="itms:*"/>
<allow-intent href="itms-apps:*"/>
</platform>
</widget>
54 changes: 54 additions & 0 deletions cordova/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "[INJECTED_BY_GULPFILE]",
"displayName": "Betaflight Configurator",
"version": "[INJECTED_BY_GULPFILE]",
"description": "[INJECTED_BY_GULPFILE]",
"main": "index.js",
"scripts": {},
"author": "[INJECTED_BY_GULPFILE]",
"license": "[INJECTED_BY_GULPFILE]",
"dependencies": {
"cordova": "^9.0.0",
"cordova-android": "^8.1.0",
"cordova-clipboard": "^1.3.0",
"bf-cordova-open-native-settings": "^2.0.4",
"bf-cordova-plugin-appavailability": "^1.0.3",
"cordova-plugin-chrome-apps-common": "^1.0.7",
"cordova-plugin-chrome-apps-runtime": "^2.0.0",
"cordova-plugin-chrome-apps-storage": "^1.0.4",
"bf-cordova-plugin-chrome-apps-usb": "^2.0.1",
"cordova-plugin-dialogs": "^2.0.2",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-filechooser": "^1.2.0",
"cordova-plugin-market": "^1.2.0",
"cordova-plugin-permission": "^0.1.0",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-usb-event": "^1.0.2",
"cordova-plugin-whitelist": "^1.3.4",
"bf-cordovarduino": "^1.0.0"
},
"cordova": {
"platforms": [
"android"
],
"plugins": {
"cordova-plugin-chrome-apps-common": {},
"cordova-plugin-chrome-apps-runtime": {},
"cordova-plugin-chrome-apps-storage": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-permission": {},
"cordova-plugin-usb-event": {},
"cordova-plugin-dialogs": {},
"bf-cordovarduino": {},
"cordova-plugin-file": {},
"cordova-plugin-filechooser": {},
"bf-cordova-plugin-chrome-apps-usb": {},
"cordova-clipboard": {},
"cordova-plugin-screen-orientation": {},
"cordova-plugin-market": {},
"bf-cordova-open-native-settings": {},
"bf-cordova-plugin-appavailability": {}
}
}
}
Binary file added cordova/release.keystore
Binary file not shown.
4 changes: 4 additions & 0 deletions cordova/usb_device_filter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<usb-device vendor-id="1155" product-id="22336" /> <!--STMicroelectronics / Virtual COM Port -->
</resources>
Loading

0 comments on commit 71a3010

Please sign in to comment.