Skip to content

Commit

Permalink
Merge branch 'main' into translations_android-quest-src-main-res-valu…
Browse files Browse the repository at this point in the history
…es-strings-xml--main_fr
  • Loading branch information
Lentumunai-Mark authored Dec 19, 2024
2 parents ed88f0a + b97dd66 commit 8404c6a
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 41 deletions.
8 changes: 5 additions & 3 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx6144m
org.gradle.jvmargs=-Xmx10g -XX:MaxMetaspaceSize=4g

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

org.gradle.daemon=true
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.suppressUnsupportedCompileSdk=34
android.jetifier.ignorelist=jackson-core
#org.gradle.daemon.max-idle-time=10800000 // 3 hours in milliseconds

org.gradle.warning.mode=all
org.gradle.configuration-cache=true
org.gradle.caching=false
org.gradle.parallel=true
org.gradle.configureondemand=true

android.enableR8.fullMode=true
android.enableR8.fullMode=false
2 changes: 1 addition & 1 deletion android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ androidx-test= "1.6.2"
appcompat = "1.7.0"
benchmark-junit = "1.3.3"
cardview = "1.0.0"
common-utils = "1.0.0-SNAPSHOT"
common-utils = "1.0.1-SNAPSHOT"
compose-ui = "1.6.8"
compressor = "3.0.1"
constraintlayout = "2.1.4"
Expand Down
9 changes: 6 additions & 3 deletions android/quest/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ android {
}

getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
isMinifyEnabled = false
isShrinkResources = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
Expand Down Expand Up @@ -199,7 +199,10 @@ android {

testCoverage { jacocoVersion = BuildConfigs.jacocoVersion }

lint { abortOnError = false }
lint {
checkReleaseBuilds = true
abortOnError = false
}

flavorDimensions += "apps"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,14 @@ class QuestionnaireActivity : BaseMultiLanguageActivity() {
lifecycleScope.launch {
retrieveQuestionnaireResponse()?.let { questionnaireResponse ->
viewModel.saveDraftQuestionnaire(questionnaireResponse, questionnaireConfig)
setResult(
Activity.RESULT_OK,
Intent().apply {
putExtra(QUESTIONNAIRE_RESPONSE, questionnaireResponse as Serializable)
putExtra(QUESTIONNAIRE_CONFIG, questionnaireConfig as Parcelable)
putExtra(ON_RESULT_TYPE, ActivityOnResultType.QUESTIONNAIRE.name)
},
)
finish()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import org.smartregister.fhircore.engine.domain.model.ActionParameter
import org.smartregister.fhircore.engine.domain.model.ActionParameterType
import org.smartregister.fhircore.engine.domain.model.isEditable
import org.smartregister.fhircore.engine.domain.model.isReadOnly
import org.smartregister.fhircore.engine.domain.model.isSummary
import org.smartregister.fhircore.engine.rulesengine.RulesExecutor
import org.smartregister.fhircore.engine.task.FhirCarePlanGenerator
import org.smartregister.fhircore.engine.util.DispatcherProvider
Expand Down Expand Up @@ -706,42 +707,40 @@ constructor(
* This function saves [QuestionnaireResponse] as draft if any of the [QuestionnaireResponse.item]
* has an answer.
*/
fun saveDraftQuestionnaire(
suspend fun saveDraftQuestionnaire(
questionnaireResponse: QuestionnaireResponse,
questionnaireConfig: QuestionnaireConfig,
) {
viewModelScope.launch {
val hasPages = questionnaireResponse.item.any { it.hasItem() }
val questionnaireHasAnswer =
questionnaireResponse.item.any {
if (!hasPages) {
it.answer.any { answerComponent -> answerComponent.hasValue() }
} else {
questionnaireResponse.item.any { page ->
page.item.any { pageItem ->
pageItem.answer.any { answerComponent -> answerComponent.hasValue() }
}
val hasPages = questionnaireResponse.item.any { it.hasItem() }
val questionnaireHasAnswer =
questionnaireResponse.item.any {
if (!hasPages) {
it.answer.any { answerComponent -> answerComponent.hasValue() }
} else {
questionnaireResponse.item.any { page ->
page.item.any { pageItem ->
pageItem.answer.any { answerComponent -> answerComponent.hasValue() }
}
}
}
questionnaireResponse.questionnaire =
questionnaireConfig.id.asReference(ResourceType.Questionnaire).reference
if (
!questionnaireConfig.resourceIdentifier.isNullOrBlank() &&
questionnaireConfig.resourceType != null
) {
questionnaireResponse.subject =
questionnaireConfig.resourceIdentifier!!.asReference(
questionnaireConfig.resourceType!!,
)
}
if (questionnaireHasAnswer) {
questionnaireResponse.status = QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS
defaultRepository.addOrUpdate(
addMandatoryTags = true,
resource = questionnaireResponse,
questionnaireResponse.questionnaire =
questionnaireConfig.id.asReference(ResourceType.Questionnaire).reference
if (
!questionnaireConfig.resourceIdentifier.isNullOrBlank() &&
questionnaireConfig.resourceType != null
) {
questionnaireResponse.subject =
questionnaireConfig.resourceIdentifier!!.asReference(
questionnaireConfig.resourceType!!,
)
}
}
if (questionnaireHasAnswer) {
questionnaireResponse.status = QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS
defaultRepository.addOrUpdate(
addMandatoryTags = true,
resource = questionnaireResponse,
)
}
}

Expand Down Expand Up @@ -1138,6 +1137,7 @@ constructor(
!resourceIdentifier.isNullOrEmpty() &&
(questionnaireConfig.isEditable() ||
questionnaireConfig.isReadOnly() ||
questionnaireConfig.isSummary() ||
questionnaireConfig.saveDraft)
) {
defaultRepository
Expand Down
7 changes: 4 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5990,9 +5990,9 @@ multicast-dns@^7.2.5:
thunky "^1.0.2"

nanoid@^3.3.7:
version "3.3.7"
resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz"
integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==
version "3.3.8"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.8.tgz#b1be3030bee36aaff18bacb375e5cce521684baf"
integrity sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==

[email protected]:
version "0.6.3"
Expand Down

0 comments on commit 8404c6a

Please sign in to comment.