Skip to content

Commit

Permalink
Remove suspend modifier from FlowUseCases.build method
Browse files Browse the repository at this point in the history
  • Loading branch information
skywall committed Dec 12, 2019
1 parent 50b6107 commit ce274a8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ abstract class FlowUseCase<ARGS, T> {
/**
* Suspend function which should contain business logic
*/
abstract suspend fun build(args: ARGS): Flow<T>
abstract fun build(args: ARGS): Flow<T>
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import kotlinx.coroutines.flow.flow

class TestFailureFlowUseCase : FlowUseCase<Throwable, Unit>() {

override suspend fun build(args: Throwable): Flow<Unit> = flow {
override fun build(args: Throwable): Flow<Unit> = flow {
throw args
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ class TestFlowUseCase : FlowUseCase<TestFlowUseCase.Data, Int>() {
val delayBetweenEmits: Long
)

override suspend fun build(args: Data): Flow<Int> =
override fun build(args: Data): Flow<Int> =
args.listToEmit.asFlow().onEach { delay(args.delayBetweenEmits) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import javax.inject.Inject
class ObserveFormUseCase @Inject constructor(
private val formStore: FormStore
) : FlowUseCase<Unit, Pair<String, String>>() {
override suspend fun build(args: Unit): Flow<Pair<String, String>> = formStore.getFormFlow()
override fun build(args: Unit): Flow<Pair<String, String>> = formStore.getFormFlow()
}

0 comments on commit ce274a8

Please sign in to comment.