Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/e-mission/e-mission-phone
Browse files Browse the repository at this point in the history
…into experimental-expo
  • Loading branch information
JGreenlee committed Aug 14, 2024
1 parent 19a7b35 commit 727382b
Show file tree
Hide file tree
Showing 94 changed files with 4,106 additions and 1,278 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/android-automated-sdk-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ on:
push:
paths:
- 'setup/prereq_android_sdk_install.sh'
- 'setup/android_sdk_packages'
- '.github/workflows/android-automated-sdk-install.yml'
pull_request:
paths:
- 'setup/prereq_android_sdk_install.sh'
- 'setup/android_sdk_packages'
- '.github/workflows/android-automated-sdk-install.yml'
schedule:
# * is a special character in YAML so you have to quote this string
Expand Down Expand Up @@ -64,7 +66,6 @@ jobs:
ls -al $ANDROID_SDK_ROOT
if [ ! -d $ANDROID_SDK_ROOT/emulator ]; then exit 1; fi
if [ ! -d $ANDROID_SDK_ROOT/build-tools ]; then exit 1; fi
if [ ! -d $ANDROID_SDK_ROOT/patcher ]; then exit 1; fi
if [ ! -d $ANDROID_SDK_ROOT/extras ]; then exit 1; fi
if [ ! -d $ANDROID_SDK_ROOT/platforms ]; then exit 1; fi
if [ ! -d $ANDROID_SDK_ROOT/platform-tools ]; then exit 1; fi
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,24 @@ jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: macos-latest
runs-on: macos-14

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Runs a single command using the runners shell
- name: Prints related environment variables so that we can know what to set
run: env | egrep "JAVA|PATH|ANDROID"

# Runs a single command using the runners shell
- name: Print the java and gradle versions
run: |
echo "Default java version"
java -version
echo "Setting to Java 11 instead"
export JAVA_HOME=$JAVA_HOME_11_X64
export JAVA_HOME=$JAVA_HOME_17_arm64
java -version
echo "Checking gradle"
which gradle
Expand All @@ -49,13 +53,13 @@ jobs:
- name: Setup the cordova environment
shell: bash -l {0}
run: |
export JAVA_HOME=$JAVA_HOME_11_X64
export JAVA_HOME=$JAVA_HOME_17_arm64
bash setup/setup_android_native.sh
- name: Check tool versions
shell: bash -l {0}
run: |
export JAVA_HOME=$JAVA_HOME_11_X64
export JAVA_HOME=$JAVA_HOME_17_arm64
source setup/activate_native.sh
echo "cordova version"
npx cordova -version
Expand All @@ -73,7 +77,7 @@ jobs:
gradle -version
echo "Let's rerun the activation"
source setup/activate_native.sh
export JAVA_HOME=$JAVA_HOME_11_X64
export JAVA_HOME=$JAVA_HOME_17_arm64
echo $PATH
which gradle
gradle --version
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ jobs:
npx jest
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage-final.json
flags: unit
fail_ci_if_error: ${{ github.repository == 'e-mission/e-mission-phone' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: macos-latest
runs-on: macos-14

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ https://github.com/e-mission/e-mission-docs/tree/master/docs/e-mission-phone

Updating the UI only
---
[![osx-serve-install](https://github.com/e-mission/e-mission-phone/workflows/osx-serve-install/badge.svg)](https://github.com/e-mission/e-mission-phone/actions?query=workflow%3Aosx-serve-install)
[![osx-serve-install](https://github.com/e-mission/e-mission-phone/workflows/osx-serve-install/badge.svg?branch=master&event=push)](https://github.com/e-mission/e-mission-phone/actions?query=workflow%3Aosx-serve-install)

If you want to make only UI changes, (as opposed to modifying the existing plugins, adding new plugins, etc), you can use the **new and improved** (as of June 2018) [e-mission dev app](https://github.com/e-mission/e-mission-devapp/) and install the most recent version from [releases](https://github.com/e-mission/e-mission-devapp/releases).

Expand Down Expand Up @@ -87,9 +87,9 @@ If you wish to connect to a different server, create your own config file accord

Updating the e-mission-\* plugins or adding new plugins
---
[![osx-build-ios](https://github.com/e-mission/e-mission-phone/actions/workflows/ios-build.yml/badge.svg)](https://github.com/e-mission/e-mission-phone/actions/workflows/ios-build.yml)
[![osx-build-android](https://github.com/e-mission/e-mission-phone/actions/workflows/android-build.yml/badge.svg)](https://github.com/e-mission/e-mission-phone/actions/workflows/android-build.yml)
[![osx-android-prereq-sdk-install](https://github.com/e-mission/e-mission-phone/actions/workflows/android-automated-sdk-install.yml/badge.svg)](https://github.com/e-mission/e-mission-phone/actions/workflows/android-automated-sdk-install.yml)
[![osx-build-ios](https://github.com/e-mission/e-mission-phone/actions/workflows/ios-build.yml/badge.svg?branch=master&event=push)](https://github.com/e-mission/e-mission-phone/actions/workflows/ios-build.yml?event-push)
[![osx-build-android](https://github.com/e-mission/e-mission-phone/actions/workflows/android-build.yml/badge.svg?branch=master&event=push)](https://github.com/e-mission/e-mission-phone/actions/workflows/android-build.yml?event=push)
[![osx-android-prereq-sdk-install](https://github.com/e-mission/e-mission-phone/actions/workflows/android-automated-sdk-install.yml/badge.svg?branch=master&event=push)](https://github.com/e-mission/e-mission-phone/actions/workflows/android-automated-sdk-install.yml?event=push)

Pre-requisites
---
Expand Down
2 changes: 2 additions & 0 deletions config.cordovabuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
<param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
<platform name="ios">
<preference name="deployment-target" value="13.0"/>
<hook src="hooks/before_build/ios/ios_change_deployment.js" type="before_build" />
<hook src="hooks/after_platform_add/ios/ios_copy_locales.js" type="after_platform_add" />
<resource-file src="GoogleService-Info.plist" />
<preference name="WKWebViewOnly" value="true" />
Expand Down
37 changes: 37 additions & 0 deletions hooks/before_build/ios/ios_change_deployment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const fs = require('fs');
const path = require('path');

function findFilePathsByFilename(directory, filename) {
const files = fs.readdirSync(directory);
const filePaths = [];

for (const file of files) {
const filePath = path.join(directory, file);
const stats = fs.statSync(filePath);

if (stats.isDirectory()) {
// Recursively search in subdirectories
const subdirectoryFilePaths = findFilePathsByFilename(filePath, filename);
filePaths.push(...subdirectoryFilePaths);
} else if (stats.isFile() && file === filename) {
// If the file matches the filename, add its path to the result
filePaths.push(filePath);
}
}
return filePaths;
}


const paths1 = findFilePathsByFilename('.', 'project.pbxproj');
const paths2 = findFilePathsByFilename('.', 'Pods.xcodeproj');
const paths = paths1.concat(paths2)

console.log('Apply patch to', paths);

for (let path of paths) {
let content = fs.readFileSync(path, { encoding: 'utf-8' });
content = content.replace(/IPHONEOS_DEPLOYMENT_TARGET = [0-9]+.0;/g, 'IPHONEOS_DEPLOYMENT_TARGET = 13.0;');
fs.writeFileSync(path, content);
}

console.log('Done setting IPHONEOS_DEPLOYMENT_TARGET');
9 changes: 8 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ module.exports = {
"^.+\\.(ts|tsx|js|jsx)$": "babel-jest"
},
transformIgnorePatterns: [
"node_modules/(?!((enketo-transformer/dist/enketo-transformer/web)|(jest-)?react-native(-.*)?|@react-native(-community)?)/)",
"node_modules/(?!((enketo-transformer/dist/enketo-transformer/web)|(jest-)?react-native(-.*)?|@react-native(-community)?|e-mission-common)/)"
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
moduleDirectories: ["node_modules", "src"],
globals: {"__DEV__": false},
collectCoverage: true,
collectCoverageFrom: [
"www/js/**/*.{ts,tsx,js,jsx}",
"!www/js/**/index.{ts,tsx,js,jsx}",
"!www/js/types/**/*.{ts,tsx,js,jsx}",
],
// several functions in commHelper do not have unit tests; see note in commHelper.test.ts
coveragePathIgnorePatterns: ['www/js/services/commHelper.ts'],
};
23 changes: 14 additions & 9 deletions package.cordovabuild.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@babel/preset-typescript": "^7.21.4",
"@ionic/cli": "6.20.8",
"@types/luxon": "^3.3.0",
"@types/react": "^18.2.20",
"@types/react": "~18.2.0",
"babel-loader": "^9.1.2",
"babel-plugin-optional-require": "^0.3.1",
"concurrently": "^8.0.1",
Expand Down Expand Up @@ -67,7 +67,6 @@
"ANDROID_HOST": " ",
"ANDROID_PATHPREFIX": "/"
},
"cordova-plugin-email-composer": {},
"cordova-plugin-x-socialsharing": {
"PHOTO_LIBRARY_ADD_USAGE_DESCRIPTION": "This app requires photo library access to share photos on social media.",
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "This app requires photo library access to share photos on social media."
Expand Down Expand Up @@ -96,7 +95,10 @@
"cordova-plugin-androidx-adapter": {},
"phonegap-plugin-barcodescanner": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
}
},
"cordova-plugin-bluetooth-classic-serial-port": {},
"cordova-custom-config": {},
"cordova-plugin-ibeacon": {}
}
},
"dependencies": {
Expand All @@ -118,21 +120,24 @@
"cordova-plugin-app-version": "0.1.14",
"cordova-plugin-customurlscheme": "5.0.2",
"cordova-plugin-device": "2.1.0",
"cordova-plugin-em-datacollection": "git+https://github.com/e-mission/e-mission-data-collection.git#v1.8.2",
"cordova-plugin-em-datacollection": "git+https://github.com/e-mission/e-mission-data-collection.git#v1.8.8",
"cordova-plugin-em-opcodeauth": "git+https://github.com/e-mission/cordova-jwt-auth.git#v1.7.2",
"cordova-plugin-em-server-communication": "git+https://github.com/e-mission/cordova-server-communication.git#v1.2.6",
"cordova-plugin-em-serversync": "git+https://github.com/e-mission/cordova-server-sync.git#v1.3.2",
"cordova-plugin-em-settings": "git+https://github.com/e-mission/cordova-connection-settings.git#v1.2.3",
"cordova-plugin-em-unifiedlogger": "git+https://github.com/e-mission/cordova-unified-logger.git#v1.3.6",
"cordova-plugin-em-usercache": "git+https://github.com/e-mission/cordova-usercache.git#v1.1.8",
"cordova-plugin-email-composer": "git+https://github.com/katzer/cordova-plugin-email-composer.git#0.10.1",
"cordova-plugin-em-usercache": "git+https://github.com/e-mission/cordova-usercache.git#v1.1.9",
"cordova-plugin-file": "8.0.0",
"cordova-plugin-inappbrowser": "5.0.0",
"cordova-plugin-ionic-keyboard": "2.2.0",
"cordova-plugin-ionic-webview": "5.0.0",
"cordova-plugin-local-notification-12": "github:e-mission/cordova-plugin-local-notification-12#v0.1.4-fix-android-action",
"cordova-plugin-x-socialsharing": "6.0.4",
"cordova-plugin-bluetooth-classic-serial-port": "git+https://github.com/louisg1337/cordova-plugin-bluetooth-classic-serial-port.git",
"cordova-custom-config": "^5.1.1",
"cordova-plugin-ibeacon": "git+https://github.com/louisg1337/cordova-plugin-ibeacon.git",
"core-js": "^2.5.7",
"e-mission-common": "github:JGreenlee/e-mission-common#semver:0.5.1",
"enketo-core": "^6.1.7",
"enketo-transformer": "^4.0.0",
"fast-xml-parser": "^4.2.2",
Expand All @@ -144,11 +149,11 @@
"leaflet": "^1.9.4",
"luxon": "^3.3.0",
"npm": "^9.6.3",
"phonegap-plugin-barcodescanner": "git+https://github.com/phonegap/phonegap-plugin-barcodescanner#v8.1.0",
"phonegap-plugin-barcodescanner": "git+https://github.com/e-mission/phonegap-plugin-barcodescanner.git",
"prop-types": "^15.8.1",
"react": "^18.2.*",
"react": "~18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.*",
"react-dom": "~18.2.0",
"react-i18next": "^13.5.0",
"react-native-paper": "^5.11.0",
"react-native-paper-dates": "^0.18.12",
Expand Down
23 changes: 18 additions & 5 deletions package.expo.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,52 @@
"@react-navigation/native": "^6.1.7",
"@react-navigation/stack": "^6.3.17",
"@shopify/flash-list": "^1.3.1",
"@types/react": "~18.2.45",
"@types/jest": "^29.5.5",
"@types/leaflet": "^1.9.4",
"@types/react": "~18.2.45",
"bottleneck": "^2.19.5",
"chart.js": "^4.3.0",
"chartjs-adapter-luxon": "^1.3.1",
"chartjs-plugin-annotation": "^3.0.1",
"e-mission-common": "github:JGreenlee/e-mission-common#semver:0.5.1",
"em-connection-settings": "file:modules/em-connection-settings",
"em-data-collection": "file:modules/em-data-collection",
"em-opcodeauth": "file:modules/em-opcodeauth",
"em-servercomm": "file:modules/em-servercomm",
"em-serversync": "file:modules/em-serversync",
"em-unified-logger": "file:modules/em-unified-logger",
"em-usercache": "file:modules/em-usercache",
"enketo-core": "^6.1.7",
"enketo-transformer": "^4.0.0",
"fast-xml-parser": "^4.2.2",
"expo": "~50.0.8",
"expo-dev-client": "~3.3.9",
"expo-device": "^6.0.2",
"expo-status-bar": "~1.11.1",
"fast-xml-parser": "^4.2.2",
"humanize-duration": "^3.31.0",
"i18next": "^23.7.6",
"leaflet": "^1.9.4",
"luxon": "^3.3.0",
"react": "18.2.0",
"react": "~18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "18.2.0",
"react-dom": "~18.2.0",
"react-i18next": "^13.5.0",
"react-native": "0.73.4",
"react-native-html-parser": "^0.1.0",
"react-native-paper": "^5.12.3",
"react-native-paper-dates": "^0.18.12",
"react-native-safe-area-context": "^4.6.3",
"react-native-svg": "14.1.0",
"react-native-vector-icons": "^9.2.0",
"react-native-web": "^0.19.10",
"react-qr-code": "^2.0.11",
"typescript": "^5.3.0"
"typescript": "^5.3.0",
"your-module": "file:modules/your-module"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"expo-build-properties": "^0.12.5",
"expo-gradle-ext-vars": "^0.1.2",
"sass": "^1.71.1"
}
}
8 changes: 5 additions & 3 deletions package.serve.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@ionic/cli": "6.20.8",
"@testing-library/react-native": "^12.3.0",
"@types/luxon": "^3.3.0",
"@types/react": "^18.2.20",
"@types/react": "~18.2.0",
"babel-jest": "^29.7.0",
"babel-loader": "^9.1.2",
"babel-plugin-optional-require": "^0.3.1",
Expand All @@ -40,6 +40,7 @@
"jest-environment-jsdom": "^29.7.0",
"phonegap": "9.0.0+cordova.9.0.0",
"process": "^0.11.10",
"react-test-renderer": "~18.2.0",
"sass": "^1.62.1",
"sass-loader": "^13.3.1",
"style-loader": "^3.3.3",
Expand All @@ -64,6 +65,7 @@
"chartjs-adapter-luxon": "^1.3.1",
"chartjs-plugin-annotation": "^3.0.1",
"core-js": "^2.5.7",
"e-mission-common": "github:JGreenlee/e-mission-common#semver:0.5.1",
"enketo-core": "^6.1.7",
"enketo-transformer": "^4.0.0",
"fast-xml-parser": "^4.2.2",
Expand All @@ -76,9 +78,9 @@
"luxon": "^3.3.0",
"npm": "^9.6.3",
"prop-types": "^15.8.1",
"react": "^18.2.*",
"react": "~18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.*",
"react-dom": "~18.2.0",
"react-i18next": "^13.5.0",
"react-native-paper": "^5.11.0",
"react-native-paper-dates": "^0.18.12",
Expand Down
1 change: 0 additions & 1 deletion setup/android_sdk_packages
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ build-tools;33.0.2
build-tools;34.0.0
emulator
extras;google;google_play_services
patcher;v4
platform-tools
platforms;android-30
platforms;android-31
Expand Down
1 change: 1 addition & 0 deletions setup/autoreload/macos-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const os = require('os');

const nameMap = new Map([
[23, ['Sonoma', '14.3.1']],
[22, ['Ventura', '13']],
[21, ['Monterey', '12']],
[20, ['Big Sur', '11']],
Expand Down
2 changes: 1 addition & 1 deletion setup/export_shared_dep_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export NPM_VERSION=9.3.1
# ideally, this would be the same version as the CI
# Looks like brew supports only major and minor, not patch version
export RUBY_VERSION=3.0
export COCOAPODS_VERSION=1.11.3
export COCOAPODS_VERSION=1.12.1
export GRADLE_VERSION=7.6
export OSX_EXP_VERSION=12

Expand Down
2 changes: 1 addition & 1 deletion setup/setup_shared_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sed -i -e "s|/usr/bin/env node|/usr/bin/env node --unhandled-rejections=strict|"

npx cordova prepare

EXPECTED_COUNT=23
EXPECTED_COUNT=26
INSTALLED_COUNT=`npx cordova plugin list | wc -l`
echo "Found $INSTALLED_COUNT plugins, expected $EXPECTED_COUNT"
if [ $INSTALLED_COUNT -lt $EXPECTED_COUNT ];
Expand Down
Loading

0 comments on commit 727382b

Please sign in to comment.