Skip to content

Commit

Permalink
Rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
seadowg committed Dec 5, 2024
1 parent 02cfd1e commit 4c0bce3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import kotlinx.coroutines.flow.StateFlow
import kotlin.reflect.KProperty

class Data<T>(private val appState: AppState, private val key: String, private val default: T) {
fun get(qualifier: String? = null): StateFlow<T> {
fun flow(qualifier: String? = null): StateFlow<T> {
return appState.getFlow("$qualifier:$key", default)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ class FormsDataService(
private val diskError by data<String?>(DataKeys.DISK_ERROR, null)

fun getForms(projectId: String): Flow<List<Form>> {
return forms.get(projectId)
return forms.flow(projectId)
}

fun isSyncing(projectId: String): LiveData<Boolean> {
return syncing.get(projectId).asLiveData()
return syncing.flow(projectId).asLiveData()
}

fun getServerError(projectId: String): LiveData<FormSourceException?> {
return serverError.get(projectId).asLiveData()
return serverError.flow(projectId).asLiveData()
}

fun getDiskError(projectId: String): LiveData<String?> {
return diskError.get(projectId).asLiveData()
return diskError.flow(projectId).asLiveData()
}

fun clear(projectId: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ class InstancesDataService(
instancesRepository.all
}

fun getEditableCount(projectId: String): StateFlow<Int> = editableCount.get(projectId)
fun getSendableCount(projectId: String): StateFlow<Int> = sendableCount.get(projectId)
fun getSentCount(projectId: String): StateFlow<Int> = sentCount.get(projectId)
fun getEditableCount(projectId: String): StateFlow<Int> = editableCount.flow(projectId)
fun getSendableCount(projectId: String): StateFlow<Int> = sendableCount.flow(projectId)
fun getSentCount(projectId: String): StateFlow<Int> = sentCount.flow(projectId)

fun getInstances(projectId: String): StateFlow<List<Instance>> {
return instances.get(projectId)
return instances.flow(projectId)
}

fun finalizeAllDrafts(projectId: String): FinalizeAllResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ProjectsDataService(
}

fun getCurrentProjectFlow(): StateFlow<Project.Saved?> {
return currentProject.get()
return currentProject.flow()
}

fun getCurrentProject(): Project.Saved {
Expand Down

0 comments on commit 4c0bce3

Please sign in to comment.