Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MWCore] Create Dataclerk App #2630

Merged
merged 88 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
3e90564
rework auth items
sevenreup Apr 26, 2023
1d2b0e0
Merge branch 'mwcore-dev' into mwcore-migrate-auth-code
sevenreup May 26, 2023
3ed6fb2
init tagging
sevenreup Jun 5, 2023
ffff742
update register
sevenreup Jun 6, 2023
a4224b4
update
sevenreup Jun 6, 2023
6aaa2fd
update sync
sevenreup Jun 9, 2023
0b05614
Merge branch 'mwcore-dev' into mwcore-migrate-auth-code
sevenreup Jun 9, 2023
39564ac
update sync key
sevenreup Jun 9, 2023
dc34c49
fix location syncs
sevenreup Jun 18, 2023
639c7af
fix activity listener
sevenreup Jun 21, 2023
92536ca
test fixes
sevenreup Jun 26, 2023
c638406
fixes
sevenreup Jun 26, 2023
cea8e95
replace app with default
sevenreup Jun 27, 2023
7e5da06
tests fixed
sevenreup Jun 27, 2023
a72ff10
Merge branch 'mwcore-dev' into mwcore-migrate-auth-code
sevenreup Jun 27, 2023
2a34a3e
Merge branch 'mwcore-dev' into mwcore-migrate-auth-code
sevenreup Jun 27, 2023
2a28a52
stuff
sevenreup Jun 27, 2023
9991c0b
test fixes
sevenreup Jun 27, 2023
a525453
Merge branch 'mwcore-migrate-auth-code' of github.com:opensrp/fhircor…
sevenreup Jun 27, 2023
067b2ca
Update CqlContentTest.kt
sevenreup Jun 27, 2023
03cd001
init
sevenreup Jun 28, 2023
79f8267
add tests
sevenreup Jun 28, 2023
3718c03
add tests
sevenreup Jun 28, 2023
ba285ed
Merge branch 'mwcore-migrate-auth-code' into mw-dataclerk
sevenreup Jun 29, 2023
642435e
save
sevenreup Jun 29, 2023
d0c116a
update appsettings
sevenreup Jun 29, 2023
fb1f87f
Merge branch 'mwcore-migrate-auth-code' into mw-dataclerk
sevenreup Jun 29, 2023
0011d55
data clerks can log in
sevenreup Jun 29, 2023
bb10344
format
sevenreup Jul 4, 2023
cbef459
update
sevenreup Jul 4, 2023
8b3b212
Merge branch 'mwcore-migrate-auth-code' into mw-dataclerk
sevenreup Jul 4, 2023
9c2b9e9
update
sevenreup Jul 5, 2023
b2a78d1
Merge branch 'mwcore-migrate-auth-code' into mw-dataclerk
sevenreup Jul 5, 2023
de9870c
add sync status
sevenreup Jul 5, 2023
9d04875
update ui
sevenreup Jul 11, 2023
5b8c799
update QuestViewmodel
sevenreup Jul 11, 2023
0e39853
Merge branch 'mwcore-migrate-auth-code' into mw-dataclerk
sevenreup Jul 11, 2023
8a1b080
Update AppScreen.kt
sevenreup Jul 12, 2023
b99b092
Update QuestionnaireActivity.kt
sevenreup Jul 12, 2023
172c45a
Merge branch 'mwcore-migrate-auth-code' into mw-dataclerk
sevenreup Jul 12, 2023
8210974
update
sevenreup Jul 12, 2023
eee0185
Update LoginViewModel.kt
sevenreup Jul 12, 2023
f0c3163
Merge branch 'mwcore-migrate-auth-code' into mw-dataclerk
sevenreup Jul 12, 2023
c283856
update sync status
sevenreup Jul 12, 2023
f808f4f
update sync
sevenreup Jul 13, 2023
3807eb9
Update TokenAuthenticator.kt
sevenreup Jul 13, 2023
ffd4193
Merge branch 'mwcore-migrate-auth-code' into mw-dataclerk
sevenreup Jul 13, 2023
538c3a9
update icon
sevenreup Jul 13, 2023
6e676ac
format
sevenreup Jul 17, 2023
cf69b88
update auth
sevenreup Jul 17, 2023
39695d3
Update AppSettingActivityTest.kt
sevenreup Jul 17, 2023
c1de593
updates
sevenreup Jul 18, 2023
6411690
Merge branch 'mwcore-migrate-auth-code' into mw-dataclerk
sevenreup Jul 18, 2023
dfe5a5d
update create button
sevenreup Jul 18, 2023
cae4f8a
Update DataClerkConfigService.kt
sevenreup Jul 20, 2023
2d0962b
update resource tags
sevenreup Jul 20, 2023
f4c516d
Merge branch 'mwcore-migrate-auth-code' into mw-dataclerk
sevenreup Jul 20, 2023
a972110
load patients
sevenreup Jul 20, 2023
3d43c30
update data clerk
sevenreup Jul 20, 2023
7ce9c6c
update patient details
sevenreup Jul 21, 2023
0d4186c
update details
sevenreup Jul 21, 2023
902c88a
add pagination
sevenreup Jul 21, 2023
90a7fc6
add sync indicators to ui
sevenreup Jul 21, 2023
f261cb3
reload on sync on the list
sevenreup Jul 21, 2023
a9e61fb
update
sevenreup Jul 21, 2023
06f6592
Update build.gradle
sevenreup Jul 21, 2023
cd518bd
update
sevenreup Jul 26, 2023
cb62edf
block to finish saving data
sevenreup Jul 26, 2023
1c099a5
update
sevenreup Jul 26, 2023
518b38a
spotless run
sevenreup Jul 26, 2023
59d95d4
Update network_security_config.xml
sevenreup Jul 28, 2023
52d1dd4
Merge branch 'mwcore-migrate-auth-code' into mw-dataclerk
sevenreup Jul 28, 2023
1fbeee6
Update network_security_config.xml
sevenreup Jul 28, 2023
49fc301
Merge branch 'mwcore-dev' into mwcore-migrate-auth-code
LZRS Jul 28, 2023
183cc6a
Fix failed AppNotIdleException for some Compose tests
LZRS Jul 30, 2023
3c91f1b
Disable catching of non-test related exceptions
LZRS Jul 30, 2023
875eb8f
add tests
sevenreup Jul 31, 2023
0631d83
Update SharedPreferencesHelperTest.kt
sevenreup Jul 31, 2023
1002bc7
Merge branch 'mwcore-dev' into mwcore-migrate-auth-code
sevenreup Jul 31, 2023
7885fa2
Update AndroidExtensions.kt
sevenreup Jul 31, 2023
3449870
update tests
sevenreup Aug 1, 2023
b169c45
Merge branch 'mwcore-migrate-auth-code' into mw-dataclerk
sevenreup Aug 1, 2023
2ac5e58
fix merge issues
sevenreup Aug 1, 2023
b938617
Merge branch 'mwcore-dev' into mw-dataclerk
sevenreup Aug 1, 2023
c0d6bc2
add last updated
sevenreup Aug 1, 2023
501e8b8
update network
sevenreup Aug 1, 2023
8c4caae
fix pagination issues
sevenreup Aug 1, 2023
082be97
add prod config
sevenreup Aug 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/dataclerk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
185 changes: 185 additions & 0 deletions android/dataclerk/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'de.mannodermaus.android-junit5' version '1.9.3.0'
id 'org.jetbrains.dokka'
id 'org.jetbrains.kotlin.plugin.serialization'
id 'jacoco'
id 'dagger.hilt.android.plugin'
id 'org.jetbrains.kotlin.android'
id 'com.google.firebase.firebase-perf'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}

apply from: '../properties.gradle'

android {
namespace 'org.dtree.fhircore.dataclerk'
compileSdkVersion sdk_versions.compile_sdk

defaultConfig {
applicationId "org.dtree.fhircore.dataclerk"
minSdkVersion sdk_versions.min_sdk
targetSdkVersion sdk_versions.target_sdk
versionCode 3
versionName "1.0.0"
multiDexEnabled true

buildConfigField("boolean", 'SKIP_AUTH_CHECK', "false")
buildConfigField("String", 'FHIR_BASE_URL', "\"${FHIR_BASE_URL}\"")
buildConfigField("String", 'OAUTH_BASE_URL', "\"${OAUTH_BASE_URL}\"")
buildConfigField("String", 'OAUTH_CIENT_ID', "\"${OAUTH_CIENT_ID}\"")
buildConfigField("String", 'OAUTH_CLIENT_SECRET', "\"${OAUTH_CLIENT_SECRET}\"")
buildConfigField("String", 'OAUTH_SCOPE', "\"${OAUTH_SCOPE}\"")

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}

// signingConfigs {
// release {
//
// v1SigningEnabled false
// v2SigningEnabled true
//
// keyAlias System.getenv("KEYSTORE_ALIAS")?: project.KEYSTORE_ALIAS
// keyPassword System.getenv("KEY_PASSWORD") ?: project.KEY_PASSWORD
// storePassword System.getenv("KEYSTORE_PASSWORD") ?: project.KEYSTORE_PASSWORD
// storeFile file(System.getProperty("user.home") + "/fhircore.keystore.jks")
// }
// }

buildTypes {
debug {
// testCoverageEnabled true
resValue("string", "authenticator_account_type", "\"${android.defaultConfig.applicationId}\"")
}
release {
resValue("string", "authenticator_account_type", "\"${android.defaultConfig.applicationId}\"")
// minifyEnabled false
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// signingConfig signingConfigs.release
// firebaseCrashlytics {
// nativeSymbolUploadEnabled false
// }
}
}

compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
freeCompilerArgs = ['-Xjvm-default=all-compatibility', '-opt-in=kotlin.RequiresOptIn']
}

buildFeatures {
compose true
}

composeOptions {
kotlinCompilerExtensionVersion '1.4.8'
}

testOptions {
execution 'ANDROIDX_TEST_ORCHESTRATOR'
animationsDisabled true

unitTests {
includeAndroidResources = true
returnDefaultValues = true
all {
beforeTest { testDescriptor ->
println "${testDescriptor.className} > ${testDescriptor.name} STARTED"
}
}
}
}

lintOptions {
abortOnError false
}

configurations.all {
resolutionStrategy {
force "ca.uhn.hapi.fhir:org.hl7.fhir.utilities:5.5.7"
}
}

packagingOptions {
exclude 'META-INF/ASL-2.0.txt'
exclude 'META-INF/LGPL-3.0.txt'
exclude 'license.html'
exclude 'readme.html'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/license.html'
exclude 'META-INF/LICENSE.md'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE.md'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/ASL-2.0.txt'
exclude 'META-INF/LGPL-3.0.txt'
exclude 'META-INF/sun-jaxb.episode'
exclude("META-INF/*.kotlin_module")
exclude("META-INF/AL2.0")
exclude("META-INF/LGPL2.1")
}
}

dependencies {
coreLibraryDesugaring deps.desugar
implementation(project(":engine"))

implementation 'androidx.core:core-ktx:1.8.0'
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0')
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.5.1'

implementation deps.accompanist.swiperefresh

implementation platform('androidx.compose:compose-bom:2022.10.00')
implementation 'androidx.compose.ui:ui'
implementation 'androidx.compose.ui:ui-graphics'
implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.compose.material3:material3'
implementation "androidx.paging:paging-compose:3.2.0-rc01"

//Hilt - Dependency Injection
implementation "com.google.dagger:hilt-android:$hiltVersion"
kapt "com.google.dagger:hilt-compiler:$hiltVersion"

// analytics
implementation platform('com.google.firebase:firebase-bom:31.2.0')

implementation 'com.google.firebase:firebase-perf-ktx'
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation platform('androidx.compose:compose-bom:2022.10.00')
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
}

kapt {
correctErrorTypes true
}

hilt {
enableAggregatingTask = true
}
21 changes: 21 additions & 0 deletions android/dataclerk/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
20 changes: 20 additions & 0 deletions android/dataclerk/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "org.dtree.fhircore.dataclerk",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 2,
"versionName": "0.0.2",
"outputFile": "dataclerk-release.apk"
}
],
"elementType": "File"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2021 Ona Systems, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.dtree.fhircore.dataclerk

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("org.dtree.fhircore.dataclerk", appContext.packageName)
}
}
37 changes: 37 additions & 0 deletions android/dataclerk/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application android:name=".DataClerkApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme.NoActionBar"
android:largeHeap="true"
android:networkSecurityConfig="@xml/network_security_config">
<activity android:name=".ui.main.AppMainActivity"/>
<service
android:name="org.smartregister.fhircore.engine.auth.AuthAndroidService"
android:exported="false">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>

<meta-data
android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator" />
</service>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"

android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>

</manifest>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright 2021 Ona Systems, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.dtree.fhircore.dataclerk

import android.app.Application
import android.util.Log
import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import com.google.android.fhir.datacapture.DataCaptureConfig
import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase
import com.google.firebase.perf.ktx.performance
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject
import org.dtree.fhircore.dataclerk.data.QuestXFhirQueryResolver
import org.smartregister.fhircore.engine.data.remote.fhir.resource.ReferenceUrlResolver
import org.smartregister.fhircore.engine.ui.questionnaire.QuestionnaireItemViewHolderFactoryMatchersProviderFactoryImpl
import timber.log.Timber

@HiltAndroidApp
class DataClerkApplication : Application(), DataCaptureConfig.Provider, Configuration.Provider {
private var configuration: DataCaptureConfig? = null

@Inject lateinit var workerFactory: HiltWorkerFactory

@Inject lateinit var referenceUrlResolver: ReferenceUrlResolver

@Inject lateinit var xFhirQueryResolver: QuestXFhirQueryResolver

override fun onCreate() {
super.onCreate()

if (BuildConfig.DEBUG) {
Firebase.performance.isPerformanceCollectionEnabled = false
Firebase.crashlytics.setCrashlyticsCollectionEnabled(false)
Timber.plant(Timber.DebugTree())
}
}

override fun getDataCaptureConfig(): DataCaptureConfig {
configuration =
configuration
?: DataCaptureConfig(
urlResolver = referenceUrlResolver,
xFhirQueryResolver = xFhirQueryResolver,
questionnaireItemViewHolderFactoryMatchersProviderFactory =
QuestionnaireItemViewHolderFactoryMatchersProviderFactoryImpl
)
return configuration as DataCaptureConfig
}

override fun getWorkManagerConfiguration(): Configuration =
Configuration.Builder()
.setMinimumLoggingLevel(if (BuildConfig.DEBUG) Log.VERBOSE else Log.INFO)
.setWorkerFactory(workerFactory)
.build()
}
Loading