From e6c64af226be3a11b77081845e7a24ab2a07ef8d Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 23 Aug 2023 10:02:19 +0300 Subject: [PATCH] API access for data in the LocalChangeEntity table - https://github.com/google/android-fhir/issues/2048 --- engine/src/main/java/com/google/android/fhir/FhirEngine.kt | 2 +- .../main/java/com/google/android/fhir/impl/FhirEngineImpl.kt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt index 376ff3b327..59ab1f3991 100644 --- a/engine/src/main/java/com/google/android/fhir/FhirEngine.kt +++ b/engine/src/main/java/com/google/android/fhir/FhirEngine.kt @@ -97,7 +97,7 @@ interface FhirEngine { * an empty list. */ suspend fun getLocalChanges(type: ResourceType, id: String): List - + suspend fun getUnsyncedLocalChanges(): List /** * Purges a resource from the database based on resource type and id without any deletion of data * from the server. diff --git a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt index de35675a0b..e3a913990d 100644 --- a/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt +++ b/engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt @@ -79,6 +79,9 @@ internal class FhirEngineImpl(private val database: Database, private val contex override suspend fun getLocalChanges(type: ResourceType, id: String): List { return database.getLocalChanges(type, id) } + // FhirEngineImpl.kt + override suspend fun getUnsyncedLocalChanges(): List = + database.getAllLocalChanges() override suspend fun purge(type: ResourceType, id: String, forcePurge: Boolean) { database.purge(type, id, forcePurge)