Skip to content

Commit

Permalink
Merge pull request #952 from e-mission/maint_upgrade_2023
Browse files Browse the repository at this point in the history
Native code updates for early 2023
  • Loading branch information
shankari authored Apr 18, 2023
2 parents 17bc991 + 19eb8e8 commit b409bc0
Show file tree
Hide file tree
Showing 24 changed files with 233 additions and 969 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/android-automated-sdk-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ jobs:
- name: Install to a new SDK root
run: |
export JAVA_HOME=$JAVA_HOME_11_X64
export ANDROID_SDK_ROOT=$NEW_ANDROID_SDK_ROOT
echo "New SDK root $ANDROID_SDK_ROOT"
printf "Y\nY\nY\nY\nY\n" | bash setup/prereq_android_sdk_install.sh
- name: Verify that all packages are as expected
shell: bash -l {0}
run: |
export JAVA_HOME=$JAVA_HOME_11_X64
echo "Comparing $ANDROID_SDK_ROOT and $NEW_ANDROID_SDK_ROOT"
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --list_installed > /tmp/existing_packages
$NEW_ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --list_installed > /tmp/new_packages
Expand All @@ -56,6 +58,7 @@ jobs:
- name: Verify that directory structure is consistent
shell: bash -l -x {0}
run: |
export JAVA_HOME=$JAVA_HOME_11_X64
export ANDROID_SDK_ROOT=$NEW_ANDROID_SDK_ROOT
echo "New SDK root $ANDROID_SDK_ROOT"
ls -al $ANDROID_SDK_ROOT
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ name: osx-build-android
# events but only for the master branch
on:
push:
branches: [ master ]
branches:
- master
- maint_upgrade_**
pull_request:
branches: [ master ]
branches:
- master
- maint_upgrade_**
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '5 4 * * 0'
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ name: CI
# events but only for the master branch
on:
push:
branches: [ master ]
branches:
- master
- maint_upgrade_**
pull_request:
branches: [ master ]
branches:
- master
- maint_upgrade_**

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/ios-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ name: osx-build-ios
# events but only for the master branch
on:
push:
branches: [ master ]
branches:
- master
- maint_upgrade_**
pull_request:
branches: [ master ]
branches:
- master
- maint_upgrade_**
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '5 4 * * 0'
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/serve-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ name: osx-serve-install
# events but only for the master branch
on:
push:
branches: [ master ]
branches:
- master
- maint_upgrade_**
pull_request:
branches: [ master ]
branches:
- master
- maint_upgrade_**
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '5 4 * * 0'
Expand Down
13 changes: 10 additions & 3 deletions config.cordovabuild.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="48" id="edu.berkeley.eecs.emission" ios-CFBundleVersion="46" version="3.2.5" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="51" id="edu.berkeley.eecs.emission" ios-CFBundleVersion="49" version="3.2.8" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>emission</name>
<description>
A commute pattern tracker and carbon footprint estimator.
Expand Down Expand Up @@ -42,14 +42,21 @@
<preference name="WKWebViewOnly" value="true" />
<preference name="WKSuspendInBackground" value="false" />
<preference name="AutoHideSplashScreen" value="true" />
<config-file parent="NSCameraUsageDescription" target="*-Info.plist" mode="merge">
<string>To scan QR codes for the login token and the study</string>
</config-file>
</platform>
<platform name="android">
<hook src="hooks/before_build/android/android_copy_locales.js" type="before_build" />
<preference name="android-minSdkVersion" value="22" />
<preference name="android-targetSdkVersion" value="30" />
<preference name="android-minSdkVersion" value="23" />
<preference name="android-targetSdkVersion" value="32" />
<preference name="AndroidLaunchMode" value="singleInstance"/>
<preference name="AndroidXEnabled" value="true" />
<preference name="GradlePluginKotlinEnabled" value="true" />
<preference name="GradlePluginKotlinVersion" value="1.7.10" />
<resource-file src="google-services.json" target="app/google-services.json" />
<hook src="hooks/before_build/android/android_set_provider.js" type="before_build" />
<hook src="hooks/before_build/android/android_change_compile_implementation.js" type="before_build" />
<config-file parent="/manifest/application" target="AndroidManifest.xml">
<uses-library android:name="org.apache.http.legacy" android:required="false" />
</config-file>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* A hook to change provider in order to match with the application name.
*/

var fs = require('fs');
var path = require('path');
var et = require('elementtree');

const LOG_NAME = "Changing compile to implementation ";

var changeCompileToImplementation = function (file) {
if (fs.existsSync(file)) {
fs.readFile(file, 'utf8', function (err, data) {
var result = data.replace("compile", "implementation");
fs.writeFile(file, result, 'utf8', function (err) {
if (err) throw new Error(LOG_NAME + 'Unable to write into ' + file + ': ' + err);
console.log(LOG_NAME + "" + file + " updated...")
});
});
} else {
console.error("Could not find file "+file+" skipping compile -> implementation change");
}
}

module.exports = function (context) {
// If Android platform is not installed, don't even execute
if (!context.opts.platforms.includes('android')) return;

var config_xml = path.join(context.opts.projectRoot, 'config.xml');
var data = fs.readFileSync(config_xml).toString();
// If no data then no config.xml
if (data) {
var etree = et.parse(data);
console.log(LOG_NAME + "Retrieving application name...")
var applicationName = etree._root.attrib.id;
console.info(LOG_NAME + "Your application is " + applicationName);
const splitParts = applicationName.split(".")
var lastApplicationPart = splitParts[splitParts.length - 1];

var platformRoot = path.join(context.opts.projectRoot, 'platforms/android/')

console.log(LOG_NAME + "Updating barcode scanner gradle...");
var gradleFile = path.join(platformRoot, 'phonegap-plugin-barcodescanner/'+lastApplicationPart+'-barcodescanner.gradle');
changeCompileToImplementation(gradleFile);
} else {
throw new Error(LOG_NAME + "Could not retrieve application name.");
}
}
68 changes: 31 additions & 37 deletions package.cordovabuild.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "edu.berkeley.eecs.emission",
"version": "3.2.4",
"version": "3.2.8",
"displayName": "emission",
"license": "BSD-3-Clause",
"repository": {
"type": "git",
"url": "git+https://github.com/e-mission/e-mission-phone.git"
},
"devDependencies": {
"cordova": "10.0.0",
"@ionic/cli": "6.12.0",
"bower": "1.8.8"
"cordova": "11.1.0",
"@ionic/cli": "6.20.8",
"bower": "1.8.14"
},
"cordova": {
"platforms": [
Expand All @@ -19,9 +19,9 @@
],
"plugins": {
"@havesource/cordova-plugin-push": {
"ANDROID_SUPPORT_V13_VERSION": "28.0.0",
"FCM_VERSION": "18.+",
"IOS_FIREBASE_MESSAGING_VERSION": "~> 6.32.2"
"ANDROIDX_CORE_VERSION": "1.6.+",
"FCM_VERSION": "23.+",
"IOS_FIREBASE_MESSAGING_VERSION": "~> 8.1.1"
},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-app-version": {},
Expand All @@ -39,63 +39,57 @@
"PHOTO_LIBRARY_USAGE_DESCRIPTION": "This app requires photo library access to share photos on social media."
},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-local-notification": {},
"cordova-plugin-ionic": {
"APP_ID": "e0d8cdec",
"CHANNEL_NAME": "Production",
"UPDATE_METHOD": "none",
"UPDATE_API": "https://api.ionicjs.com",
"MAX_STORE": "2"
"cordova-plugin-local-notification-12": {
"ANDROID_SUPPORT_V4_VERSION": "26.+",
"ANDROIDX_VERSION": "1.2.0",
"ANDROIDX_APPCOMPAT_VERSION": "1.3.1"
},
"cordova-plugin-advanced-http": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-em-jwt-auth": {
"AUTH_VERSION": "19.2.0"
},
"cordova-plugin-em-opcodeauth": {},
"cordova-plugin-em-server-communication": {},
"cordova-plugin-em-datacollection": {
"LOCATION_VERSION": "18.0.0",
"ANDROIDX_CORE_VERSION": "1.7.0",
"LOCATION_VERSION": "21.0.1",
"ANDROIDX_CORE_VERSION": "1.8.0",
"ANDROIDX_WORK_VERSION": "2.7.1"
},
"cordova-plugin-em-serversync": {},
"cordova-plugin-em-settings": {},
"cordova-plugin-em-transition-notify": {},
"cordova-plugin-em-unifiedlogger": {},
"cordova-plugin-em-usercache": {},
"cordova-plugin-androidx-adapter": {},
"phonegap-plugin-barcodescanner": {}
"phonegap-plugin-barcodescanner": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
}
}
},
"dependencies": {
"cordova-android": "10.1.0",
"cordova-android": "11.0.0",
"cordova-ios": "6.2.0",
"cordova-plugin-advanced-http": "3.2.2",
"cordova-plugin-androidx-adapter": "git+https://github.com/dpa99c/cordova-plugin-androidx-adapter.git",
"cordova-plugin-app-version": "0.1.12",
"cordova-plugin-advanced-http": "3.3.1",
"cordova-plugin-androidx-adapter": "1.1.3",
"cordova-plugin-app-version": "0.1.14",
"cordova-plugin-customurlscheme": "5.0.2",
"cordova-plugin-device": "2.0.3",
"cordova-plugin-em-datacollection": "git+https://github.com/e-mission/e-mission-data-collection.git#v1.7.4",
"cordova-plugin-em-jwt-auth": "git+https://github.com/e-mission/cordova-jwt-auth.git#v1.6.5",
"cordova-plugin-em-server-communication": "git+https://github.com/e-mission/cordova-server-communication.git#v1.2.4",
"cordova-plugin-em-serversync": "git+https://github.com/e-mission/cordova-server-sync.git#v1.2.9",
"cordova-plugin-device": "2.1.0",
"cordova-plugin-em-datacollection": "git+https://github.com/e-mission/e-mission-data-collection.git#v1.7.7",
"cordova-plugin-em-opcodeauth": "git+https://github.com/e-mission/cordova-jwt-auth.git#v1.7.1",
"cordova-plugin-em-server-communication": "git+https://github.com/e-mission/cordova-server-communication.git#v1.2.5",
"cordova-plugin-em-serversync": "git+https://github.com/e-mission/cordova-server-sync.git#v1.3.1",
"cordova-plugin-em-settings": "git+https://github.com/e-mission/cordova-connection-settings.git#v1.2.3",
"cordova-plugin-em-transition-notify": "git+https://github.com/e-mission/e-mission-transition-notify.git#v1.2.7",
"cordova-plugin-em-unifiedlogger": "git+https://github.com/e-mission/cordova-unified-logger.git#v1.3.5",
"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.5",
"cordova-plugin-email-composer": "git+https://github.com/katzer/cordova-plugin-email-composer.git#0.10.1",
"cordova-plugin-file": "6.0.2",
"cordova-plugin-file": "7.0.0",
"cordova-plugin-inappbrowser": "5.0.0",
"cordova-plugin-ionic": "5.5.1",
"cordova-plugin-ionic-keyboard": "2.2.0",
"cordova-plugin-ionic-webview": "5.0.0",
"cordova-plugin-local-notification": "https://github.com/timkellypa/cordova-plugin-local-notifications.git#083ccca0f4eee8fbec0cde1edd32207c286d2a04",
"cordova-plugin-x-socialsharing": "6.0.3",
"cordova-plugin-local-notification-12": "0.1.4",
"cordova-plugin-x-socialsharing": "6.0.4",
"fs-extra": "^9.0.1",
"klaw-sync": "^6.0.0",
"phonegap-plugin-barcodescanner": "git+https://github.com/phonegap/phonegap-plugin-barcodescanner#v8.1.0",
"@havesource/cordova-plugin-push": "2.0.0"
"@havesource/cordova-plugin-push": "git+https://github.com/havesource/cordova-plugin-push.git#4.0.0-dev.0"
}
}
14 changes: 9 additions & 5 deletions setup/android_sdk_packages
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
build-tools;30.0.1
build-tools;30.0.2
build-tools;30.0.3
build-tools;31.0.0
build-tools;32.0.0
build-tools;33.0.2
emulator
extras;google;google_play_services
extras;intel;Hardware_Accelerated_Execution_Manager
patcher;v4
platform-tools
platforms;android-30
platforms;android-31
platforms;android-32
platforms;android-33
system-images;android-22;google_apis;x86_64
system-images;android-23;google_apis;x86_64
system-images;android-24;google_apis_playstore;x86
system-images;android-25;google_apis_playstore;x86
system-images;android-26;google_apis_playstore;x86
system-images;android-27;google_apis_playstore;x86
system-images;android-28;google_apis_playstore;x86_64
system-images;android-29;google_apis_playstore;x86
system-images;android-29;google_apis_playstore;x86_64
system-images;android-30;google_apis_playstore;x86
system-images;android-30;google_apis_playstore;x86_64
system-images;android-31;google_apis_playstore;x86_64
system-images;android-32;google_apis;x86_64
system-images;android-32;google_apis_playstore;x86_64
system-images;android-33;google_apis;x86_64
system-images;android-33;google_apis_playstore;x86_64
12 changes: 6 additions & 6 deletions setup/export_shared_dep_versions.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export NVM_VERSION=0.39.0
export NODE_VERSION=14.18.1
export NPM_VERSION=6.14.15
export NVM_VERSION=0.39.3
export NODE_VERSION=19.5.0
export NPM_VERSION=9.3.1
# make sure that this is a stable version from
# so that https://github.com/postmodern/ruby-versions
# ideally, this would be the same version as the CI
# Looks like brew supports only major and minor, not patch version
export RUBY_VERSION=2.7
export COCOAPODS_VERSION=1.11.2
export GRADLE_VERSION=7.1.1
export RUBY_VERSION=3.0
export COCOAPODS_VERSION=1.11.3
export GRADLE_VERSION=7.6
export OSX_EXP_VERSION=12

export NVM_DIR="$HOME/.nvm"
Expand Down
2 changes: 1 addition & 1 deletion setup/prereq_android_sdk_install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TOOLS_VERSION=8092744
TOOLS_VERSION=9477386
TOOLS_ZIP_FILENAME=commandlinetools-mac-${TOOLS_VERSION}_latest.zip

echo "Installing command line tools from $TOOLS_ZIP_FILENAME"
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 @@ -26,7 +26,7 @@ sed -i -e "s|/usr/bin/env node|/usr/bin/env node --unhandled-rejections=strict|"

npx cordova prepare

EXPECTED_COUNT=25
EXPECTED_COUNT=24
INSTALLED_COUNT=`npx cordova plugin list | wc -l`
echo "Found $INSTALLED_COUNT plugins, expected $EXPECTED_COUNT"
if [ $INSTALLED_COUNT -lt $EXPECTED_COUNT ];
Expand Down
14 changes: 11 additions & 3 deletions www/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"edit-demographics": "Edit Demographics",
"username": "Username {{usernamedata}}",
"tracking": "Tracking",
"enable-opgeofence": "Experimental trip start",
"app-status": "App Status",
"medium-accuracy": "Medium accuracy",
"dark-theme": "Dark theme",
Expand Down Expand Up @@ -347,7 +346,8 @@
"android-lt-6": "Enabled during app installation.",
"android-6-9": "Please select 'allow'",
"android-10": "Please select 'Allow all the time'",
"android-gte-11": "On the app settings page, choose the 'Location' permission and set it to 'Allow all the time'",
"android-11": "On the app settings page, choose the 'Location' permission and set it to 'Allow all the time'",
"android-gte-12": "On the app settings page, choose the 'Location' permission and set it to 'Allow all the time' and 'Precise'",
"ios-lt-13": "Please select 'Always allow'",
"ios-gte-13": "On the app settings page, please select 'Always' and 'Precise' and return here to continue"
}
Expand Down Expand Up @@ -378,7 +378,15 @@
"unusedapprestrict": {
"name": "Unused apps disabled",
"description": {
"android-disable": "On the app settings page, go to 'Permissions' and ensure that the app permissions will not be automatically reset.",
"android-disable-lt-12": "On the app settings page, go to 'Permissions' and ensure that the app permissions will not be automatically reset.",
"android-disable-gte-12": "On the app settings page, turn off 'Remove permissions and free up space.'",
"ios": "Please allow."
}
},
"ignorebatteryopt": {
"name": "Ignore battery optimizations",
"description": {
"android-disable": "On the optimization page, go to all apps, search for this app and turn off optimizations.",
"ios": "Please allow."
}
}
Expand Down
Loading

0 comments on commit b409bc0

Please sign in to comment.