Skip to content

Commit

Permalink
Merge branch 'master' into include_loggeduser_in_data_update_broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
avazirna authored Oct 3, 2023
2 parents beba3c2 + fa55951 commit 58de647
Show file tree
Hide file tree
Showing 89 changed files with 1,933 additions and 716 deletions.
20 changes: 15 additions & 5 deletions app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,27 @@
android:name="android.permission.INTERNET"/>
<uses-permission
xmlns:android="http://schemas.android.com/apk/res/android"
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<!-- required to ensure app compatibility -->
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32"/>
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES"
android:usesPermissionFlags="neverForLocation"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<uses-feature
android:name="android.hardware.telephony"
Expand Down Expand Up @@ -105,7 +114,8 @@
android:label="@string/application_name"
android:hardwareAccelerated="true"
android:usesCleartextTraffic="true"
android:theme="@style/AppBaseTheme">
android:theme="@style/AppBaseTheme"
android:enableOnBackInvokedCallback="false">

<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
Expand All @@ -121,7 +131,7 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="${applicationId}.action.CommCareSession"/>
<action android:name="org.commcare.dalvik.action.CommCareSession"/>

<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
Expand Down
16 changes: 15 additions & 1 deletion app/assets/locales/android_translatable_strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ option.yes=YES
option.no=NO
option.cancel=CANCEL
dialog.ok=OK
dialog.do.not.show=Don't show again

updates.found=Updates found! Downloading new resource ${0} done of ${1}
updates.success=App is up to date
Expand Down Expand Up @@ -814,6 +815,9 @@ wifi.direct.status.receive.message=This will allow you to receive forms on this
wifi.direct.status.submit.header=You are in Submit Form Mode
wifi.direct.status.submit.count=Device has ${0} unsubmitted forms.
wifi.direct.status.submit.message=This mode will allow you to submit forms to the CommCare Server if you have an internet connection.
wifi.direct.permission.nearby.wifi.title=Permission to access nearby Wi-Fi Devices
wifi.direct.permission.nearby.wifi.message=In order to exchange data with nearby devices via Wi-Fi, CommCare needs access to Wi-Fi capabilities.
wifi.direct.permission.nearby.wifi.denial=CommCare doesn't have permission to connect with nearby devices via Wi-Fi. Please enable via Android's settings.

form.transfer.no.forms=No forms to send.

Expand All @@ -834,7 +838,7 @@ odk_perfect_match_color=\#87D13E
odk_fuzzy_match_color=\#FFE88F

permission.all.title=CommCare Permissions
permission.all.message=CommCare needs permissions to read/write forms to memory, call/message from the case list, and provide location data during form entry.
permission.all.message=CommCare needs permissions to read/write forms to memory, call/message from the case list, provide location data during form entry and notify the user about important events.
permission.all.denial.message=CommCare doesn't have the necessary permissions. Please enable via Android's settings.
permission.case.callout.title=Permissions for calling & messaging
permission.case.callout.message=CommCare needs call & messaging permissions to enable communication with cases.
Expand Down Expand Up @@ -864,6 +868,9 @@ intent.callout.unable.to.process=Unable to process callout result
intent.callout.activity.missing=Couldn't find intent for callout!
intent.callout.not.supported=This intent callout is not supported on this device
fingerprints.scanned=Fingerprints scanned: ${0}
intent.callout.biometrics.capture.result.success=All data stored successfully
intent.callout.biometrics.capture.result.fail=No data was stored
intent.callout.biometrics.capture.result.partialfail=Failed to store some data

settings.developer.options=Developer Options
settings.developer.title=Developer Options
Expand Down Expand Up @@ -967,6 +974,13 @@ tts.speak.failed=Couldn't speak now. Please try again!
file.oversize.error.title=File Too Large
file.oversize.error.message=Selected file exceeds the file size limit of 15 MB. Please select a file whose size is less than 15 MB.

background.sync.pending.form.entry.title=Pending Sync
background.sync.pending.form.entry.detail=There are new cases available but the Sync can't run while a form is open. A Sync will be triggered upon form submission!
background.sync.logout.attempt.during.sync=Can't log out while a Sync is underway!
background.sync.user.sync.attempt.during.sync=Can't trigger a Sync while another is underway!
background.sync.form.entry.attempt.during.sync=A Form can't be open while a Sync is underway!
background.sync.fail=Background sync failed. Please try to trigger a normal Sync

android.package.name.org.commcare.dalvik.reminders=CommCare Reminders
android.package.name.callout.commcare.org.sendussd=Commcare USSD
android.package.name.org.commcare.dalvik.abha=CommCare ABHA
39 changes: 5 additions & 34 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ dependencies {
implementation 'org.jsoup:jsoup:1.15.3'
implementation 'com.scottyab:rootbeer-lib:0.1.0'

// crashes on update - https://developers.google.com/admob/android/quick-start#update_your_androidmanifestxml
// We need to update consumer apps script to inject the right admob id to be able to update this
implementation 'com.google.firebase:firebase-ads:16.0.1'

implementation 'com.carrotsearch:hppc:0.9.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
Expand All @@ -104,7 +100,7 @@ dependencies {
implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'
implementation 'com.duolingo.open:rtl-viewpager:2.0.0'
implementation ("com.github.bumptech.glide:glide:4.9.0") {
implementation("com.github.bumptech.glide:glide:4.9.0") {
exclude group: "com.android.support"
}

Expand All @@ -116,7 +112,7 @@ dependencies {
implementation "io.noties.markwon:ext-tables:$markwon_version"
implementation "io.noties.markwon:ext-strikethrough:$markwon_version"

implementation ('io.ona.kujaku:library:0.9.0'){
implementation('io.ona.kujaku:library:0.9.0') {
exclude module: 'xpp3'
}
implementation "androidx.work:work-runtime:2.7.1"
Expand Down Expand Up @@ -192,19 +188,6 @@ def runDownloadScripts = project.hasProperty('run_download_scripts') ? run_downl
def ccDomainSafe = ccDomain.replaceAll("-", "")
def consumerAppUsername = getConsumerAppUsername(isConsumerApp)
def consumerAppPassword = getConsumerAppPassword(isConsumerApp)
def usingAdmob = isConsumerApp && project.hasProperty('admob_id') && allAdUnitIdsPresent()
def admobId = usingAdmob ? admob_id : ""
def entityDetailAdUnitId = usingAdmob ? entity_detail_ad_id : ""
def entitySelectAdUnitId = usingAdmob ? entity_select_ad_id : ""
def menuListAdUnitId = usingAdmob ? menu_list_ad_id : ""
def menuGridAdUnitId = usingAdmob ? menu_grid_ad_id : ""

def allAdUnitIdsPresent() {
return (project.hasProperty("entity_detail_ad_id") &&
project.hasProperty("entity_select_ad_id") &&
project.hasProperty("menu_list_ad_id") &&
project.hasProperty("menu_grid_ad_id"))
}

/**
* Get the version code from command line param
Expand All @@ -224,7 +207,7 @@ static def getDate() {
}

android {
compileSdkVersion 31
compileSdkVersion 33

lintOptions {
abortOnError false
Expand All @@ -247,7 +230,7 @@ android {

defaultConfig {
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 33
multiDexEnabled true
applicationId "org.commcare.dalvik"
testNamespace "org.commcare.dalvik.test"
Expand Down Expand Up @@ -281,12 +264,6 @@ android {
buildConfigField "String", "ANALYTICS_TRACKING_ID_DEV", "\"${project.ext.ANALYTICS_TRACKING_ID_DEV}\""
buildConfigField "String", "MAPBOX_SDK_API_KEY", "\"${project.ext.MAPBOX_SDK_API_KEY}\""

buildConfigField "String", "ADMOB_ID", "\"\""
buildConfigField "String", "ENTITY_DETAIL_AD_UNIT_ID", "\"\""
buildConfigField "String", "ENTITY_SELECT_AD_UNIT_ID", "\"\""
buildConfigField "String", "MENU_LIST_AD_UNIT_ID", "\"\""
buildConfigField "String", "MENU_GRID_AD_UNIT_ID", "\"\""

buildConfigField "String", "HQ_API_USERNAME", "\"${project.ext.HQ_API_USERNAME}\""
buildConfigField "String", "HQ_API_PASSWORD", "\"${project.ext.HQ_API_PASSWORD}\""

Expand Down Expand Up @@ -394,7 +371,7 @@ android {
def applicationName = "CommCare LTS"
resValue "string", "application_name", applicationName
}

standalone {
// Builds commcare w/ ccz app packaged in the apk.
// Must be invoked from command-line w/ args pointing to app domain &
Expand All @@ -415,12 +392,6 @@ android {
// include this again so that the value get reloaded
buildConfigField "String", "CC_AUTHORITY", "\"${applicationId}\""
buildConfigField "String", "ODK_AUTHORITY", "\"${odkProviderStr}\""

buildConfigField "String", "ADMOB_ID", "\"${admobId}\""
buildConfigField "String", "ENTITY_DETAIL_AD_UNIT_ID", "\"${entityDetailAdUnitId}\""
buildConfigField "String", "ENTITY_SELECT_AD_UNIT_ID", "\"${entitySelectAdUnitId}\""
buildConfigField "String", "MENU_LIST_AD_UNIT_ID", "\"${menuListAdUnitId}\""
buildConfigField "String", "MENU_GRID_AD_UNIT_ID", "\"${menuGridAdUnitId}\""
}
}

Expand Down
35 changes: 25 additions & 10 deletions app/instrumentation-tests/src/org/commcare/androidTests/BaseTest.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.commcare.androidTests

import android.Manifest
import android.os.Build
import androidx.test.espresso.Espresso
import androidx.test.espresso.intent.rule.IntentsTestRule
import androidx.test.ext.junit.runners.AndroidJUnit4
Expand All @@ -22,16 +23,7 @@ abstract class BaseTest {

@Rule
@JvmField
var permissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.CALL_PHONE,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.RECORD_AUDIO,
Manifest.permission.CAMERA
)
var permissionRule: GrantPermissionRule = GrantPermissionRule.grant(*getAppPermissions())

protected open fun installApp(appName: String, ccz: String, force: Boolean = false) {
if (CommCareApplication.instance().currentApp == null) {
Expand All @@ -44,4 +36,27 @@ abstract class BaseTest {
Espresso.pressBack()
}
}

private fun getAppPermissions(): Array<String> {
var appPermissions = mutableListOf(
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.CALL_PHONE,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.RECORD_AUDIO,
Manifest.permission.CAMERA)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
appPermissions.addAll(arrayOf(
Manifest.permission.READ_MEDIA_IMAGES,
Manifest.permission.READ_MEDIA_AUDIO,
Manifest.permission.READ_MEDIA_VIDEO,
Manifest.permission.POST_NOTIFICATIONS))
} else {
appPermissions.addAll(arrayOf(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE))
}
return appPermissions.toTypedArray()
}
}
Loading

0 comments on commit 58de647

Please sign in to comment.