Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into support-multi-user-login
Browse files Browse the repository at this point in the history
  • Loading branch information
LZRS committed Jan 26, 2024
2 parents 7895f90 + e353865 commit e08fd0e
Show file tree
Hide file tree
Showing 645 changed files with 5,869 additions and 1,840 deletions.
26 changes: 11 additions & 15 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,27 @@ import com.diffplug.gradle.spotless.SpotlessExtension
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.DokkaBaseConfiguration


// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven(url = "https://plugins.gradle.org/m2/")
maven(url = "https://oss.sonatype.org/content/repositories/snapshots/")
}

dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10")
classpath("org.jetbrains.kotlin:kotlin-serialization:1.8.10")
classpath("com.google.dagger:hilt-android-gradle-plugin:2.45")
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.5.3")
classpath("com.diffplug.spotless:spotless-plugin-gradle:6.19.0")
classpath("gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.0")
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.8.2.1")
classpath("com.android.tools.build:gradle:7.1.3")
classpath("org.jetbrains.dokka:dokka-base:1.8.20")
classpath("org.owasp:dependency-check-gradle:8.2.1")
}
}

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id("org.jetbrains.dokka") version "1.8.20"
id("org.owasp.dependencycheck") version "8.2.1"
id("com.github.kt3k.coveralls") version "2.12.0"
id("org.jetbrains.kotlin.jvm") version "1.8.10"
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.dagger.hilt.android) apply false
alias(libs.plugins.androidx.navigation.safeargs) apply false
alias(libs.plugins.org.jetbrains.dokka)
alias(libs.plugins.org.owasp.dependencycheck)
alias(libs.plugins.com.diffplug.spotless)

}

tasks.dokkaHtmlMultiModule {
Expand Down
45 changes: 13 additions & 32 deletions android/engine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ dependencies {
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.constraintlayout)
implementation(libs.constraintlayout.compose)
implementation(libs.fragment.ktx)
implementation(libs.security.crypto)
implementation(libs.cardview)
Expand Down Expand Up @@ -158,46 +157,32 @@ dependencies {
}

// Shared dependencies
api(libs.bundles.datastore.kt)
api(libs.glide)
api(libs.knowledger)
api(libs.p2p.lib)
api(libs.jjwt)
api(libs.fhir.common.utils)
api(libs.lifecycle.livedata.ktx)
api(libs.lifecycle.viewmodel.ktx)
api(libs.ui)
api(libs.ui.tooling)
api(libs.runtime.livedata)
api(libs.navigation.fragment.ktx)
api(libs.navigation.ui.ktx)
api(libs.navigation.compose)
api(libs.navigation.testing)
api(libs.material.icons.extended)
api(libs.material.icons.core)
api(libs.material3)
api(libs.foundation)
api(libs.bundles.navigation)
api(libs.bundles.materialicons)
api(libs.bundles.compose)
api(libs.hilt.navigation.compose)
api(libs.lifecycle.viewmodel.compose)
api(libs.bundles.lifecycle)
api(libs.paging.compose)
api(libs.activity.compose)
api(libs.kotlinx.serialization.json)
api(libs.accompanist.flowlayout)
api(libs.accompanist.placeholder)
api(libs.bundles.accompanist)
api(libs.work.runtime.ktx)
api(libs.prettytime)
api(libs.kotlinx.coroutines.core)
api(libs.kotlinx.coroutines.android)
api(libs.bundles.coroutines)
api(libs.kotlin.reflect)
api(libs.stax.api)
api(libs.caffeine)
api(libs.gson)
api(libs.timber)
api(libs.retrofit)
api(libs.bundles.retrofit2)
api(libs.converter.gson)
api(libs.retrofit.mock)
api(libs.retrofit2.kotlinx.serialization.converter)
api(libs.okhttp)
api(libs.okhttp.logging.interceptor)
api(libs.bundles.okhttp3)
api(libs.json.path)
api(libs.commons.jexl3) { exclude(group = "commons-logging", module = "commons-logging") }
api(libs.easy.rules.jexl) {
exclude(group = "commons-logging", module = "commons-logging")
Expand Down Expand Up @@ -247,14 +232,11 @@ dependencies {
testImplementation(libs.hilt.android.testing)
testImplementation(libs.junit.jupiter.api)
testImplementation(libs.robolectric)
testImplementation(libs.junit)
testImplementation(libs.junit.ktx)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.bundles.junit.test)
testImplementation(libs.bundles.coroutine.test)
testImplementation(libs.core.testing)
testImplementation(libs.mockk)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.json)
testImplementation(libs.kotlinx.coroutines.debug)
testImplementation(libs.navigation.testing)
testImplementation(libs.work.testing)

Expand All @@ -263,8 +245,7 @@ dependencies {
debugImplementation(libs.fragment.testing)

// Android test dependencies
androidTestImplementation(libs.junit)
androidTestImplementation(libs.junit.ktx)
androidTestImplementation(libs.bundles.junit.test)
androidTestImplementation(libs.runner)
androidTestImplementation(libs.ui.test.junit4)
androidTestImplementation(libs.hilt.android.testing)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand All @@ -26,7 +26,7 @@ import org.smartregister.fhircore.engine.configuration.navigation.NavigationMenu

class RegisterBottomSheetFragmentViewTest {

private val mockListener: (NavigationMenuConfig) -> Unit = {}
private val listener: (NavigationMenuConfig) -> Unit = {}

@get:Rule val composeRule = createComposeRule()

Expand Down Expand Up @@ -60,7 +60,7 @@ class RegisterBottomSheetFragmentViewTest {
private fun setContent(title: String) {
composeRule.setContent {
RegisterBottomSheetView(
menuClickListener = mockListener,
menuClickListener = listener,
navigationMenuConfigs = navigationMenuConfigs,
onDismiss = {},
title = title,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand All @@ -22,32 +22,21 @@ import androidx.compose.ui.test.assertTextEquals
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.test.core.app.ApplicationProvider
import kotlinx.coroutines.flow.flowOf
import org.junit.Rule
import org.junit.Test
import org.smartregister.fhircore.engine.R

class LoaderViewTest {
@get:Rule val composeRule = createComposeRule()

@Test
fun testLoaderDialogViewSyncingDown() {
composeRule.setContent { LoaderDialog() }
composeRule.onNodeWithTag(LOADER_DIALOG_PROGRESS_BAR_TAG).assertExists()
composeRule.onNodeWithTag(LOADER_DIALOG_PROGRESS_BAR_TAG).assertIsDisplayed()

composeRule.onNodeWithTag(LOADER_DIALOG_PROGRESS_MSG_TAG).assertExists()
composeRule.onNodeWithTag(LOADER_DIALOG_PROGRESS_MSG_TAG).assertIsDisplayed()
composeRule
.onNodeWithTag(LOADER_DIALOG_PROGRESS_MSG_TAG)
.assertTextEquals(
ApplicationProvider.getApplicationContext<Application>().getString(R.string.syncing_down),
)
}

@Test
fun testLoaderDialogViewSyncingUp() {
composeRule.setContent { LoaderDialog(isSyncUploadFlow = flowOf(true)) }
composeRule.setContent {
LoaderDialog(
dialogMessage =
ApplicationProvider.getApplicationContext<Application>().getString(R.string.syncing_up),
)
}
composeRule.onNodeWithTag(LOADER_DIALOG_PROGRESS_BAR_TAG).assertExists()
composeRule.onNodeWithTag(LOADER_DIALOG_PROGRESS_BAR_TAG).assertIsDisplayed()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand Down Expand Up @@ -32,15 +32,17 @@ sealed class ConfigType(
) {
object Application : ConfigType("application")

object Sync : ConfigType("sync", true)
object Sync : ConfigType(name = "sync", parseAsResource = true)

object Navigation : ConfigType("navigation")

object Register : ConfigType("register", multiConfig = true)
object Register : ConfigType(name = "register", multiConfig = true)

object MeasureReport : ConfigType("measureReport", multiConfig = true)
object MeasureReport : ConfigType(name = "measureReport", multiConfig = true)

object Profile : ConfigType("profile", multiConfig = true)
object Profile : ConfigType(name = "profile", multiConfig = true)

object GeoWidget : ConfigType("geoWidget", multiConfig = true)
object GeoWidget : ConfigType(name = "geoWidget", multiConfig = true)

object DataMigration : ConfigType(name = "dataMigration", multiConfig = true)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand Down Expand Up @@ -27,7 +27,7 @@ package org.smartregister.fhircore.engine.configuration
* RegisterViewConfigurations used in an application with two registers.
* @property resourceType Optional FHIR resource type
*/
abstract class Configuration {
abstract class Configuration : java.io.Serializable {
open lateinit var appId: String
open lateinit var configType: String
open val resourceType: String? = null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Ona Systems, Inc
* Copyright 2021-2024 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.
Expand Down Expand Up @@ -90,6 +90,9 @@ constructor(
* you are passing data across screens, then later using it in DataQueries and to retrieve
* registerConfiguration. It is necessary to check that [paramsMap] is empty to confirm that the
* params used in the DataQuery are passed when retrieving the configurations.
*
* @throws NoSuchElementException when the [configsJsonMap] doesn't contain a value for the
* specified key.
*/
inline fun <reified T : Configuration> retrieveConfiguration(
configType: ConfigType,
Expand Down Expand Up @@ -172,7 +175,8 @@ constructor(

/**
* Populate application's configurations from the composition resource. Only Binary and Parameter
* Resources are used to represent application configurations.
* Resources are used to represent application configurations. The [configCacheMap] is reset on
* every configs load.
*
* Sections in Composition with Binary or Parameter represents a valid application configuration.
* Example below is represents an application configuration uniquely identified by the
Expand Down Expand Up @@ -222,6 +226,9 @@ constructor(
context: Context,
configsLoadedCallback: (Boolean) -> Unit = {},
) {
// Reset configurations before loading new ones
configCacheMap.clear()

// For appId that ends with suffix /debug e.g. app/debug, we load configurations from assets
// extract appId by removing the suffix e.g. app from above example
val loadFromAssets = appId.endsWith(DEBUG_SUFFIX, ignoreCase = true)
Expand Down Expand Up @@ -471,7 +478,10 @@ constructor(
if (gatewayModeHeaderValue.isNullOrEmpty()) {
fhirResourceDataSource.getResource(searchPath)
} else
fhirResourceDataSource.getResourceWithGatewayModeHeader(gatewayModeHeaderValue, searchPath)
fhirResourceDataSource.getResourceWithGatewayModeHeader(
gatewayModeHeaderValue,
searchPath,
)

processResultBundleEntries(resultBundle)
}
Expand Down
Loading

0 comments on commit e08fd0e

Please sign in to comment.