Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
LZRS committed Mar 22, 2024
1 parent 32d3f0f commit 88cac48
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 121 deletions.
6 changes: 3 additions & 3 deletions android/buildSrc/src/main/kotlin/fhir-properties.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ val localProperties = readProperties((properties["localPropertiesFile"] ?: "${ro
fhirAuthArray.forEach { property ->
extra.set(property, localProperties.getProperty(property, when {
property.contains("URL") -> "https://sample.url/fhir/"
else -> "sample_" + property
else -> "sample_$property"
}
))
}
Expand All @@ -24,10 +24,10 @@ fhirAuthArray.forEach { property ->
val keystoreProperties = readProperties((properties["keystorePropertiesFile"] ?: "${rootProject.projectDir}/keystore.properties").toString())

keystoreAuthArray.forEach { property ->
extra.set(property, keystoreProperties.getProperty(property, "sample_" + property))
extra.set(property, keystoreProperties.getProperty(property, "sample_$property"))
}

fun Project.readProperties(file: String): Properties {
fun readProperties(file: String): Properties {
val properties = Properties()
val localProperties = File(file)
if (localProperties.isFile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject
import javax.inject.Singleton
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.serialization.json.Json
import org.hl7.fhir.r4.model.Binary
import org.smartregister.fhircore.engine.appfeature.model.AppFeatureConfig
Expand Down Expand Up @@ -59,7 +60,7 @@ constructor(
return try {
val binary = getBinary(appConfigService.getAppId()).content.decodeToString()
val config = binary.decodeJson<AppConfiguration>(jsonSerializer)
applicationConfiguration.value = config
applicationConfiguration.update { config }
true
} catch (ex: ResourceNotFoundException) {
false
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ interface ConfigService {
if (strategy.isResource.not()) {
val id = sharedPreferencesHelper.read(strategy.type, null)
if (id.isNullOrBlank()) {
strategy.tag.let { tag -> tags.add(tag.copy().apply { code = "Not defined" }) }
strategy.tag.let { tag -> tags.add(tag.copy().apply { code = code ?: "Not defined" }) }
} else {
strategy.tag.let { tag ->
tags.add(tag.copy().apply { code = id.extractLogicalIdUuid() })
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ import kotlinx.serialization.Serializable
import org.hl7.fhir.r4.model.CodeableConcept
import org.hl7.fhir.r4.model.Coding
import org.hl7.fhir.r4.model.Enumerations
import org.smartregister.fhircore.engine.configuration.Configuration

@Stable
@Serializable
class DataFiltersConfiguration(
override val appId: String = "",
override val classification: String = "",
val filters: List<SearchFilter> = listOf(),
) : Configuration

@Stable
@Serializable
Expand Down Expand Up @@ -57,10 +48,3 @@ fun Code.asCodeableConcept() =
addCoding(this@asCodeableConcept.asCoding())
text = this@asCodeableConcept.display
}

@Stable
fun dataFilterConfigurationOf(
appId: String = "",
classification: String = "form",
filters: List<SearchFilter> = listOf(),
) = DataFiltersConfiguration(appId = appId, classification = classification, filters = filters)
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ constructor(
.map { defaultRepository.loadResource(it.other) }

private fun getApplicationConfiguration(): ApplicationConfiguration {
return configurationRegistry.getAppConfigs()!!
return configurationRegistry.getAppConfigs()
}

suspend fun removePatient(patientId: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,6 @@ class LoginActivity : BaseMultiLanguageActivity() {
}
}
launchDialPad.observe(this@LoginActivity) { if (!it.isNullOrEmpty()) launchDialPad(it) }

// Check if Pin enabled and stored then move to Pin login
// val isPinEnabled = loginViewConfiguration.value?.enablePin ?: false
// val forceLoginViaUsername =
// loginViewModel.sharedPreferences.read(FORCE_LOGIN_VIA_USERNAME, false)
// val lastPinExist = !secureSharedPreference.retrieveSessionPin().isNullOrEmpty()
// if (isPinEnabled && lastPinExist && !forceLoginViaUsername) {
// loginViewModel.sharedPreferences.write(FORCE_LOGIN_VIA_USERNAME, false)
// loginService.navigateToPinLogin()
// }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,4 @@ interface LoginService {
var loginActivity: AppCompatActivity

fun navigateToHome()

fun navigateToPinLogin(goForSetup: Boolean = false) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,22 @@

package org.smartregister.fhircore.engine.ui.login

import android.content.Intent
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import io.mockk.spyk
import org.junit.After
import org.junit.Assert
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.robolectric.Robolectric
import org.robolectric.Shadows.shadowOf
import org.robolectric.shadows.ShadowIntent
import org.smartregister.fhircore.engine.app.AppLoginService
import org.smartregister.fhircore.engine.robolectric.RobolectricTest
import org.smartregister.fhircore.engine.ui.pin.PinLoginActivity
import org.smartregister.fhircore.engine.ui.pin.PinSetupActivity

@HiltAndroidTest
class LoginServiceTest : RobolectricTest() {

@get:Rule(order = 0) val hiltRule = HiltAndroidRule(this)

lateinit var loginActivity: LoginActivity
private lateinit var loginActivity: LoginActivity

private val loginService: LoginService = spyk(AppLoginService())

Expand All @@ -53,20 +46,4 @@ class LoginServiceTest : RobolectricTest() {
fun tearDown() {
loginActivity.finish()
}

@Test
fun testNavigateToPinLoginNavigateToPinLoginScreen() {
loginService.navigateToPinLogin()
val startedIntent: Intent = shadowOf(loginActivity).nextStartedActivity
val shadowIntent: ShadowIntent = shadowOf(startedIntent)
Assert.assertEquals(PinLoginActivity::class.java, shadowIntent.intentClass)
}

@Test
fun testNavigateToPinSetupNavigateToPinSetupScreen() {
loginService.navigateToPinLogin(goForSetup = true)
val startedIntent: Intent = shadowOf(loginActivity).nextStartedActivity
val shadowIntent: ShadowIntent = shadowOf(startedIntent)
Assert.assertEquals(PinSetupActivity::class.java, shadowIntent.intentClass)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ class QuestConfigService @Inject constructor(@ApplicationContext val context: Co
isResource = false,
),
ResourceTag(
type = BuildConfig.APPLICATION_ID,
type = SharedPreferenceKey.APP_ID.name,
tag =
Coding().apply {
system = context.getString(R.string.sync_strategy_appid_system)
code = BuildConfig.APP_ID
display = context.getString(R.string.application_id)
},
isResource = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ constructor(
lastSyncTime = retrieveLastSyncTimestamp() ?: "",
languages = configurationRegistry.fetchLanguages(),
enableDeviceToDeviceSync = appFeatureManager.isFeatureActive(AppFeature.DeviceToDeviceSync),
enableReports = appFeatureManager.isFeatureActive(AppFeature.InAppReporting),
// Disable in-app reporting -- Measure reports not well supported
// enableReports = appFeatureManager.isFeatureActive(AppFeature.InAppReporting),
enableReports = false,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ fun AppDrawer(
}
}
if (enableReports) {
// TODO("Measure reports not well supported, might need further work")
SideMenuItem(
iconResource = R.drawable.ic_reports,
title = stringResource(R.string.reports),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import org.smartregister.fhircore.engine.configuration.ConfigurationRegistry
import org.smartregister.fhircore.engine.configuration.view.RegisterViewConfiguration
import org.smartregister.fhircore.engine.configuration.view.registerViewConfigurationOf
import org.smartregister.fhircore.engine.task.FhirCarePlanGenerator
import org.smartregister.fhircore.engine.ui.register.BaseRegisterActivity
import org.smartregister.fhircore.engine.ui.register.model.RegisterItem
Expand All @@ -48,7 +49,7 @@ class PatientRegisterActivity : BaseRegisterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

val registerViewConfiguration = RegisterViewConfiguration()
val registerViewConfiguration = registerViewConfigurationOf()
configureViews(registerViewConfiguration)
}

Expand Down

0 comments on commit 88cac48

Please sign in to comment.