Last active
June 26, 2021 09:14
-
-
Save orcchg/257a3de897384f4cf12f939d39ca7286 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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