diff --git a/androidshared/src/main/java/org/odk/collect/androidshared/data/Data.kt b/androidshared/src/main/java/org/odk/collect/androidshared/data/Data.kt index bb966ace614..465dff344c9 100644 --- a/androidshared/src/main/java/org/odk/collect/androidshared/data/Data.kt +++ b/androidshared/src/main/java/org/odk/collect/androidshared/data/Data.kt @@ -4,7 +4,7 @@ import kotlinx.coroutines.flow.StateFlow import kotlin.reflect.KProperty class Data(private val appState: AppState, private val key: String, private val default: T) { - fun get(qualifier: String? = null): StateFlow { + fun flow(qualifier: String? = null): StateFlow { return appState.getFlow("$qualifier:$key", default) } diff --git a/collect_app/src/main/java/org/odk/collect/android/formmanagement/FormsDataService.kt b/collect_app/src/main/java/org/odk/collect/android/formmanagement/FormsDataService.kt index 19e23b2eb03..8114da10abe 100644 --- a/collect_app/src/main/java/org/odk/collect/android/formmanagement/FormsDataService.kt +++ b/collect_app/src/main/java/org/odk/collect/android/formmanagement/FormsDataService.kt @@ -37,19 +37,19 @@ class FormsDataService( private val diskError by data(DataKeys.DISK_ERROR, null) fun getForms(projectId: String): Flow> { - return forms.get(projectId) + return forms.flow(projectId) } fun isSyncing(projectId: String): LiveData { - return syncing.get(projectId).asLiveData() + return syncing.flow(projectId).asLiveData() } fun getServerError(projectId: String): LiveData { - return serverError.get(projectId).asLiveData() + return serverError.flow(projectId).asLiveData() } fun getDiskError(projectId: String): LiveData { - return diskError.get(projectId).asLiveData() + return diskError.flow(projectId).asLiveData() } fun clear(projectId: String) { diff --git a/collect_app/src/main/java/org/odk/collect/android/instancemanagement/InstancesDataService.kt b/collect_app/src/main/java/org/odk/collect/android/instancemanagement/InstancesDataService.kt index ffab185a4a5..b8b18d94d17 100644 --- a/collect_app/src/main/java/org/odk/collect/android/instancemanagement/InstancesDataService.kt +++ b/collect_app/src/main/java/org/odk/collect/android/instancemanagement/InstancesDataService.kt @@ -68,12 +68,12 @@ class InstancesDataService( instancesRepository.all } - fun getEditableCount(projectId: String): StateFlow = editableCount.get(projectId) - fun getSendableCount(projectId: String): StateFlow = sendableCount.get(projectId) - fun getSentCount(projectId: String): StateFlow = sentCount.get(projectId) + fun getEditableCount(projectId: String): StateFlow = editableCount.flow(projectId) + fun getSendableCount(projectId: String): StateFlow = sendableCount.flow(projectId) + fun getSentCount(projectId: String): StateFlow = sentCount.flow(projectId) fun getInstances(projectId: String): StateFlow> { - return instances.get(projectId) + return instances.flow(projectId) } fun finalizeAllDrafts(projectId: String): FinalizeAllResult { diff --git a/collect_app/src/main/java/org/odk/collect/android/projects/ProjectsDataService.kt b/collect_app/src/main/java/org/odk/collect/android/projects/ProjectsDataService.kt index 36380ceaced..eeaed7af174 100644 --- a/collect_app/src/main/java/org/odk/collect/android/projects/ProjectsDataService.kt +++ b/collect_app/src/main/java/org/odk/collect/android/projects/ProjectsDataService.kt @@ -29,7 +29,7 @@ class ProjectsDataService( } fun getCurrentProjectFlow(): StateFlow { - return currentProject.get() + return currentProject.flow() } fun getCurrentProject(): Project.Saved {