Skip to content

Commit 9dd72fb

Browse files
authored
Upgrade to the latest versions of everything (#19)
* Upgrade to the latest versions of everything This is essentially a port of all the native changes included in v2.9.0 of the main e-mission-phone repo. https://github.com/e-mission/e-mission-phone/releases/tag/v2.9.0 Notably: - Upgrade to API 29 on android and iOS 13 on iOS - Upgrade to cordova-android@9.0.0 and cordova-ios@6.1.0 - Upgrade to the most recent version of all plugins - Improved robustness on both android and iOS (https://github.com/e-mission/e-mission-data-collection/releases/tag/v1.5.0) - Setup scripts to make it easy to build - Continuous integration using the setup scripts to test that everything continues to work However, it does *not* include all the javascript fixes. The javascript fixes were merged over and the conflicts resolved as follows: ``` www/css/intro.css: e-mission-base www/css/style.css: upstream www/index.html: upstream for the CSP, retain for everything else www/js/app.js: e-mission-base www/js/controllers.js: e-mission-base www/js/plugin/logger.js: upstream www/js/splash/updatecheck.js: upstream (with minor changes to remove the translation) ``` This does not include the i18n fixes. I will merge those in a separate PR. * Remove all references to the "cordovabuild" and "serve" options Since we don't really have separate serve and build options in this fork * Remove the other icon references Since they are only created by `ionic cordova resources` * Restore teardown_shared because it is called from teardown_native + fix the package name in google services
1 parent 669096b commit 9dd72fb

32 files changed

+877
-186
lines changed

.github/workflows/android-build.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: osx-ubuntu-build-android
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the master branch
7+
on:
8+
push:
9+
branches: [ master ]
10+
pull_request:
11+
branches: [ master ]
12+
schedule:
13+
# * is a special character in YAML so you have to quote this string
14+
- cron: '5 4 * * 0'
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
# This workflow contains a single job called "build"
19+
build:
20+
# The type of runner that the job will run on
21+
runs-on: macos-latest
22+
23+
# Steps represent a sequence of tasks that will be executed as part of the job
24+
steps:
25+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26+
- uses: actions/checkout@v2
27+
28+
# Runs a single command using the runners shell
29+
- name: Print the java version
30+
run: java -version
31+
32+
- name: Tries to figure out where android is installed
33+
run: |
34+
echo "Android listed at $ANDROID_HOME"
35+
ls -al /opt/
36+
37+
- name: Setup the cordova environment
38+
shell: bash -l {0}
39+
run: |
40+
bash setup/setup_android_native.sh
41+
42+
- name: Check tool versions
43+
shell: bash -l {0}
44+
run: |
45+
source setup/activate_native.sh
46+
echo "cordova version"
47+
npx cordova -version
48+
echo "ionic version"
49+
npx ionic --version
50+
which gradle
51+
echo "gradle version"
52+
gradle -version
53+
54+
- name: Build android
55+
shell: bash -l {0}
56+
run: |
57+
echo $PATH
58+
which gradle
59+
gradle -version
60+
echo "Let's rerun the activation"
61+
source setup/activate_native.sh
62+
echo $PATH
63+
which gradle
64+
gradle --version
65+
npx cordova build android

.github/workflows/ci-test.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: CI
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the master branch
7+
on:
8+
push:
9+
branches: [ master ]
10+
pull_request:
11+
branches: [ master ]
12+
13+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
14+
jobs:
15+
# This workflow contains a single job called "build"
16+
build:
17+
# The type of runner that the job will run on
18+
runs-on: ubuntu-latest
19+
20+
# Steps represent a sequence of tasks that will be executed as part of the job
21+
steps:
22+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
23+
- uses: actions/checkout@v2
24+
25+
# Runs a single command using the runners shell
26+
- name: Run a one-line script
27+
run: echo Hello, world!
28+
29+
# Runs a set of commands using the runners shell
30+
- name: Run a multi-line script
31+
run: |
32+
echo Add other actions to build,
33+
echo test, and deploy your project.

.github/workflows/ios-build.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: osx-build-ios
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the master branch
7+
on:
8+
push:
9+
branches: [ master ]
10+
pull_request:
11+
branches: [ master ]
12+
schedule:
13+
# * is a special character in YAML so you have to quote this string
14+
- cron: '5 4 * * 0'
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
# This workflow contains a single job called "build"
19+
build:
20+
# The type of runner that the job will run on
21+
runs-on: macos-latest
22+
23+
# Steps represent a sequence of tasks that will be executed as part of the job
24+
steps:
25+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26+
- uses: actions/checkout@v2
27+
28+
# Runs a single command using the runners shell
29+
- name: Print the xcode path
30+
run: xcode-select --print-path
31+
32+
- name: Print the xcode setup
33+
run: xcodebuild -version -sdk
34+
35+
- name: Print applications through dmg
36+
run: ls /Applications
37+
38+
- name: Print applications through brew
39+
run: brew list
40+
41+
- name: Setup the cordova environment
42+
shell: bash -l {0}
43+
run: |
44+
bash setup/setup_ios_native.sh
45+
46+
- name: Check tool versions
47+
shell: bash -l {0}
48+
run: |
49+
source setup/activate_native.sh
50+
echo "cordova version"
51+
npx cordova -version
52+
echo "ionic version"
53+
npx ionic --version
54+
55+
- name: Build ios
56+
shell: bash -l {0}
57+
run: |
58+
source setup/activate_native.sh
59+
npx cordova build ios
60+
61+
- name: Cleanup the cordova environment
62+
shell: bash -l {0}
63+
run: bash setup/teardown_ios_native.sh
64+

bin/conf/translate_config.json.sample

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"url": "https://github.com/e-mission/e-mission-translate"
3+
}

bin/configure_xml_and_json.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs');
4+
5+
var copyInlinedFiles = function(inlineString) {
6+
var selConfigXml = "config."+inlineString+".xml";
7+
var selPkgJson = "package."+inlineString+".json";
8+
fs.copyFileSync(selConfigXml, "config.xml");
9+
fs.copyFileSync(selPkgJson, "package.json");
10+
11+
console.log("Copied "+selConfigXml+" -> config.xml and "+
12+
selPkgJson + " -> package.json");
13+
}
14+
15+
if (process.argv.length != 3) {
16+
console.log("process.argv = "+process.argv+
17+
" with length "+process.argv.length+
18+
" expected 3");
19+
process.exit(1);
20+
} else {
21+
copyInlinedFiles(process.argv[2]);
22+
}

bin/copy_image_assets.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env node
2+
3+
var imageToCopy = process.argv[2]
4+
5+
var fs = require('fs-extra');
6+
var path = require('path');
7+
var klawSync = require('klaw-sync')
8+
9+
var androidPlatformsDir = path.resolve(__dirname, '../platforms/android/res');
10+
var notificationIconsDir = path.resolve(__dirname, '../resources/android/' + imageToCopy);
11+
var iconFileName = imageToCopy + ".png";
12+
13+
var copyAllIcons = function(iconDir) {
14+
var densityDirs = klawSync(iconDir, {nofile: true})
15+
// console.log("densityDirs = "+JSON.stringify(densityDirs));
16+
densityDirs.forEach(function(dDir) {
17+
var files = klawSync(dDir.path, {nodir: true});
18+
var fileNames = files.map(function(file) { return path.basename(file.path); });
19+
if (fileNames.indexOf(iconFileName) < 0) {
20+
console.log("No file "+iconFileName+" found in "+dDir.path+" skipping...");
21+
} else {
22+
var dirName = path.basename(dDir.path);
23+
var fileName = iconFileName;
24+
var srcName = path.join(androidPlatformsDir, dirName, fileName);
25+
var dstDirName = path.join(notificationIconsDir, dirName);
26+
fs.ensureDirSync(dstDirName);
27+
var dstName = path.join(dstDirName, fileName);
28+
console.log("About to copy file "+srcName+" -> "+dstName);
29+
fs.copySync(srcName, dstName);
30+
};
31+
});
32+
};
33+
34+
copyAllIcons(androidPlatformsDir);

bin/csv_export_add_date.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import pandas as pd
2+
import arrow
3+
import sys
4+
import datetime as pydt
5+
import argparse
6+
import subprocess
7+
import os
8+
import pytz
9+
10+
if __name__ == '__main__':
11+
parser = argparse.ArgumentParser()
12+
parser.add_argument("dbfilename",
13+
help="log file to convert to csv and add date")
14+
parser.add_argument("-o", "--output",
15+
help="the path for the final output file. Default is /tmp/<dbfilename>.withdate.log")
16+
parser.add_argument("-z", "--timezone", default="America/Los_Angeles",
17+
help="the timezone to use for the output. Default is America/Los_Angeles. Full list is at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones")
18+
19+
args = parser.parse_args()
20+
21+
db_path = args.dbfilename
22+
db_filename = os.path.basename(db_path)
23+
exported_csv_filename = "/tmp/"+db_filename+".csv"
24+
out_path = "/tmp/"+db_filename+".withdate.log"
25+
if args.output is not None:
26+
out_path = args.output
27+
28+
fp = open(exported_csv_filename, "w")
29+
print("exporting csv to "+exported_csv_filename)
30+
subprocess.call(['sqlite3', '-header', '-csv', db_path, "select * from logTable;"], stdout=fp)
31+
print("adding dates to the dataframe")
32+
log_df = pd.read_csv(exported_csv_filename)
33+
log_df['dt'] = log_df.ts.apply(lambda ts: arrow.get(ts).to(args.timezone))
34+
print("exporting csv with date to "+out_path)
35+
log_df[["ts", "dt", "message"]].to_csv(out_path)

bin/download_settings_controls.js

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env node
2+
3+
var https = require('https');
4+
var fs = require('fs');
5+
6+
var download = function(url, dest, cb) {
7+
var file = fs.createWriteStream(dest);
8+
var request = https.get(url, function(response) {
9+
response.pipe(file);
10+
file.on('finish', function() {
11+
file.close(cb); // close() is async, call cb after close completes.
12+
});
13+
}).on('error', function(err) { // Handle errors
14+
fs.unlink(dest); // Delete the file async. (But we don't check the result)
15+
if (cb) cb(err.message);
16+
});
17+
};
18+
19+
download("https://raw.githubusercontent.com/e-mission/e-mission-data-collection/master/www/ui/ionic/js/collect-settings.js", "www/js/control/collect-settings.js", function(message) {
20+
console.log("Data collection settings javascript updated");
21+
});
22+
23+
download("https://raw.githubusercontent.com/e-mission/e-mission-data-collection/master/www/ui/ionic/templates/main-collect-settings.html", "www/templates/control/main-collect-settings.html", function(message) {
24+
console.log("Data collection settings template updated");
25+
});
26+
27+
download("https://raw.githubusercontent.com/e-mission/cordova-server-sync/master/www/ui/ionic/js/sync-settings.js", "www/js/control/sync-settings.js", function(message) {
28+
console.log("Sync collection settings javascript updated");
29+
});
30+
31+
download("https://raw.githubusercontent.com/e-mission/cordova-server-sync/master/www/ui/ionic/templates/main-sync-settings.html", "www/templates/control/main-sync-settings.html", function(message) {
32+
console.log("Sync collection settings template updated");
33+
});
34+
35+
download("https://raw.githubusercontent.com/e-mission/e-mission-transition-notify/master/www/ui/ionic/js/transition-notify-settings.js", "www/js/control/transition-notify-settings.js", function(message) {
36+
console.log("Transition notify settings updated");
37+
});
38+
39+
download("https://raw.githubusercontent.com/e-mission/e-mission-transition-notify/master/www/ui/ionic/templates/transition-notify-display-detail.html", "www/templates/control/transition-notify-display-detail.html", function(message) {
40+
console.log("Transition notify settings display template updated");
41+
});
42+
43+
download("https://raw.githubusercontent.com/e-mission/e-mission-transition-notify/master/www/ui/ionic/templates/main-transition-notify-settings.html", "www/templates/control/main-transition-notify-settings.html", function(message) {
44+
console.log("Transition notify settings edit template updated");
45+
});

bin/gradle_workaround.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import fileinput
2+
import argparse
3+
import logging
4+
5+
BUILD_GRADLE = "platforms/android/build.gradle"
6+
# BUILD_GRADLE = "/tmp/build.gradle"
7+
LINE_BEFORE = "// PLUGIN GRADLE EXTENSIONS END"
8+
OUR_ADD_REMOVE_LINE = 'apply from: "cordova-plugin-crosswalk-webview/xwalk6-workaround.gradle"'
9+
10+
def add_gradle_line():
11+
for line in fileinput.input(BUILD_GRADLE, inplace=True):
12+
line = line.strip("\n")
13+
print(line)
14+
if line == LINE_BEFORE:
15+
print(OUR_ADD_REMOVE_LINE)
16+
17+
def remove_gradle_line():
18+
for line in fileinput.input(BUILD_GRADLE, inplace=True):
19+
line = line.strip("\n")
20+
if line == OUR_ADD_REMOVE_LINE:
21+
pass
22+
else:
23+
print(line)
24+
25+
if __name__ == '__main__':
26+
parser = argparse.ArgumentParser()
27+
group = parser.add_mutually_exclusive_group(required=True)
28+
29+
group.add_argument("-a", "--add", action="store_true",
30+
help="add the xwalk line to build.gradle")
31+
group.add_argument("-r", "--remove", action="store_true",
32+
help="remove the xwalk line from build.gradle")
33+
34+
args = parser.parse_args()
35+
36+
if args.add:
37+
add_gradle_line()
38+
if args.remove:
39+
remove_gradle_line()

bin/sign_and_align_keys.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
PROJECT=$1
4+
VERSION=$2
5+
6+
if [[ $# -eq 0 ]]; then
7+
echo "No arguments supplied"
8+
exit 1
9+
fi
10+
11+
# Sign and release the L+ version
12+
# Make sure the highest supported version has the biggest version code
13+
npx cordova build android --release -- --minSdkVersion=22
14+
cp platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk platforms/android/app/build/outputs/apk/app-release-signed-unaligned.apk
15+
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../config_files/production.keystore ./platforms/android/app/build/outputs/apk/app-release-signed-unaligned.apk androidproductionkey
16+
~/Library/Android/sdk/build-tools/30.0.1/zipalign -v 4 platforms/android/app/build/outputs/apk/app-release-signed-unaligned.apk $1-build-$2.apk

bin/xwalk6-workaround.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
android {
2+
flavorDimensions "default"
3+
}

build.json

-14
This file was deleted.

0 commit comments

Comments
 (0)