Skip to content

Instantly share code, notes, and snippets.

@orcchg
Last active June 26, 2021 09:14
Show Gist options
  • Save orcchg/257a3de897384f4cf12f939d39ca7286 to your computer and use it in GitHub Desktop.
Save orcchg/257a3de897384f4cf12f939d39ca7286 to your computer and use it in GitHub Desktop.
class TrustedLoginUserUseCase @Inject constructor(
private val authTokenStorage: AuthTokenStorage,
private val repository: AuthRepository,
private val secureRandom: SecureRandom,
schedulersFactory: SchedulersFactory
) : CompletableUseCase(schedulersFactory) {
override fun sourceImpl(params: Params): Completable {
val pinCode = params.require<String>(PARAM_KEY_REG_PIN_CODE)
return step1(pinCode)
.flatMap { step2(it) }
.flatMapCompletable { step3(it) }
.doOnComplete { trustedAuthSession = null }
}
internal fun step1(pinCode: String): Single<PreLoginTrustedItem> {
// logic
}
internal fun step2(data: PreLoginTrustedItem): Single<LoginItem> {
// logic
}
internal fun step3(data: LoginItem): Completable {
// logic
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment