diff --git a/config.cordovabuild.xml b/config.cordovabuild.xml index 18e08aa21..212485757 100644 --- a/config.cordovabuild.xml +++ b/config.cordovabuild.xml @@ -1,5 +1,5 @@ - + emission A commute pattern tracker and carbon footprint estimator. @@ -45,12 +45,14 @@ - - + + + + + - diff --git a/hooks/before_build/android/android_change_compile_implementation.js b/hooks/before_build/android/android_change_compile_implementation.js deleted file mode 100755 index b77d16175..000000000 --- a/hooks/before_build/android/android_change_compile_implementation.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 PROVIDER = "edu.berkeley.eecs.emission.provider"; -const ACCOUNT_TYPE = "eecs.berkeley.edu"; -const LOG_NAME = "Changing Providers: "; - -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); - - console.log(LOG_NAME + "Updating badge gradle..."); - var gradleFile = path.join(platformRoot, 'cordova-plugin-badge/'+lastApplicationPart+'-badge.gradle'); - changeCompileToImplementation(gradleFile); - } else { - throw new Error(LOG_NAME + "Could not retrieve application name."); - } -} diff --git a/package.cordovabuild.json b/package.cordovabuild.json index ea6ebb691..16ae81301 100644 --- a/package.cordovabuild.json +++ b/package.cordovabuild.json @@ -1,6 +1,6 @@ { "name": "edu.berkeley.eecs.emission", - "version": "3.2.6", + "version": "3.2.7", "displayName": "emission", "license": "BSD-3-Clause", "repository": { @@ -20,8 +20,8 @@ "plugins": { "@havesource/cordova-plugin-push": { "ANDROIDX_CORE_VERSION": "1.6.+", - "FCM_VERSION": "18.+", - "IOS_FIREBASE_MESSAGING_VERSION": "~> 6.32.2" + "FCM_VERSION": "23.+", + "IOS_FIREBASE_MESSAGING_VERSION": "~> 8.1.1" }, "cordova-plugin-ionic-keyboard": {}, "cordova-plugin-app-version": {}, @@ -39,7 +39,11 @@ "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-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.+" @@ -47,8 +51,8 @@ "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": {}, @@ -56,7 +60,7 @@ "cordova-plugin-em-unifiedlogger": {}, "cordova-plugin-em-usercache": {}, "cordova-plugin-androidx-adapter": {}, - "phonegap-plugin-barcodescanner": {} + "cordova-plugin-barcode-qrscanner": {} } }, "dependencies": { @@ -67,23 +71,23 @@ "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.7.5", + "cordova-plugin-em-datacollection": "git+https://github.com/e-mission/e-mission-data-collection.git#v1.7.6", "cordova-plugin-em-opcodeauth": "git+https://github.com/e-mission/cordova-jwt-auth.git#v1.7.0", "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.0", + "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-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": "7.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": "https://github.com/levanax/cordova-plugin-local-notifications.git#0362bc731a3f2241acadcc6a0cc63776806e851c", + "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": "3.0.1" + "cordova-plugin-barcode-qrscanner": "^3.0.12", + "@havesource/cordova-plugin-push": "git+https://github.com/havesource/cordova-plugin-push.git#4.0.0-dev.0" } } diff --git a/setup/android_sdk_packages b/setup/android_sdk_packages index e6237520c..5d3f6737b 100644 --- a/setup/android_sdk_packages +++ b/setup/android_sdk_packages @@ -20,5 +20,7 @@ system-images;android-28;google_apis_playstore;x86_64 system-images;android-29;google_apis_playstore;x86_64 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 diff --git a/setup/setup_shared_native.sh b/setup/setup_shared_native.sh index 382289001..22f7ca72a 100644 --- a/setup/setup_shared_native.sh +++ b/setup/setup_shared_native.sh @@ -26,7 +26,7 @@ sed -i -e "s|/usr/bin/env node|/usr/bin/env node --unhandled-rejections=strict|" npx cordova prepare -EXPECTED_COUNT=23 +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 ]; diff --git a/www/i18n/en.json b/www/i18n/en.json index 08732d04d..c2a793e0c 100644 --- a/www/i18n/en.json +++ b/www/i18n/en.json @@ -347,7 +347,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" } @@ -378,7 +379,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." } } diff --git a/www/js/appstatus/permissioncheck.js b/www/js/appstatus/permissioncheck.js index dfe136343..f39b4af82 100644 --- a/www/js/appstatus/permissioncheck.js +++ b/www/js/appstatus/permissioncheck.js @@ -171,13 +171,15 @@ controller("PermissionCheckControl", function($scope, $element, $attrs, if (version < 9) { androidSettingsDescTag = "intro.appstatus.locsettings.description.android-lt-9"; } - var androidPermDescTag = "intro.appstatus.locperms.description.android-gte-11"; + var androidPermDescTag = "intro.appstatus.locperms.description.android-gte-12"; if($scope.osver < 6) { androidPermDescTag = 'intro.appstatus.locperms.description.android-lt-6'; } else if ($scope.osver < 10) { androidPermDescTag = "intro.appstatus.locperms.description.android-6-9"; } else if ($scope.osver < 11) { androidPermDescTag= "intro.appstatus.locperms.description.android-10"; + } else if ($scope.osver < 12) { + androidPermDescTag= "intro.appstatus.locperms.description.android-11"; } console.log("description tags are "+androidSettingsDescTag+" "+androidPermDescTag); // location settings @@ -327,13 +329,33 @@ controller("PermissionCheckControl", function($scope, $element, $attrs, return checkOrFix(unusedAppsUnrestrictedCheck, $window.cordova.plugins.BEMDataCollection.isUnusedAppUnrestricted, $scope.recomputeBackgroundRestrictionStatus, showError=false); }; + let fixBatteryOpt = function() { + console.log("fix and refresh battery optimization permissions"); + return checkOrFix(ignoreBatteryOptCheck, $window.cordova.plugins.BEMDataCollection.fixIgnoreBatteryOptimizations, + $scope.recomputeBackgroundRestrictionStatus, showError=true); + }; + let checkBatteryOpt = function() { + console.log("fix and refresh battery optimization permissions"); + return checkOrFix(ignoreBatteryOptCheck, $window.cordova.plugins.BEMDataCollection.isIgnoreBatteryOptimizations, + $scope.recomputeBackgroundRestrictionStatus, showError=false); + }; + var androidUnusedDescTag = "intro.appstatus.unusedapprestrict.description.android-disable-gte-12"; + if ($scope.osver < 12) { + androidUnusedDescTag= "intro.appstatus.unusedapprestrict.description.android-disable-lt-12"; + } let unusedAppsUnrestrictedCheck = { name: $translate.instant("intro.appstatus.unusedapprestrict.name"), - desc: $translate.instant("intro.appstatus.unusedapprestrict.description.android-disable"), + desc: $translate.instant(androidUnusedDescTag), fix: fixPerms, refresh: checkPerms } - $scope.backgroundRestrictionChecks = [unusedAppsUnrestrictedCheck]; + let ignoreBatteryOptCheck = { + name: $translate.instant("intro.appstatus.ignorebatteryopt.name"), + desc: $translate.instant("intro.appstatus.ignorebatteryopt.description.android-disable"), + fix: fixBatteryOpt, + refresh: checkBatteryOpt + } + $scope.backgroundRestrictionChecks = [unusedAppsUnrestrictedCheck, ignoreBatteryOptCheck]; refreshChecks($scope.backgroundRestrictionChecks, $scope.recomputeBackgroundRestrictionStatus); }