mirror of
https://github.com/bitwarden/android.git
synced 2026-08-30 17:33:42 -05:00
remove unused getAuthCodeFlow() (#215)
This commit is contained in:
-6
@@ -48,12 +48,6 @@ interface AuthenticatorRepository {
|
||||
*/
|
||||
fun getItemStateFlow(itemId: String): StateFlow<DataState<AuthenticatorItemEntity?>>
|
||||
|
||||
/**
|
||||
* Flow that represents the data for a single verification code item.
|
||||
* This may emit null if any issues arise during code generation.
|
||||
*/
|
||||
fun getAuthCodeFlow(cipherId: String): StateFlow<DataState<VerificationCodeItem?>>
|
||||
|
||||
/**
|
||||
* Flow that represents the data for the TOTP verification codes for ciphers items.
|
||||
* This may emit an empty list if any issues arise during code generation.
|
||||
|
||||
-27
@@ -33,7 +33,6 @@ import kotlinx.coroutines.flow.asSharedFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.firstOrNull
|
||||
import kotlinx.coroutines.flow.flatMapLatest
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
@@ -134,32 +133,6 @@ class AuthenticatorRepositoryImpl @Inject constructor(
|
||||
initialValue = DataState.Loading,
|
||||
)
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
override fun getAuthCodeFlow(cipherId: String): StateFlow<DataState<VerificationCodeItem?>> {
|
||||
return getItemStateFlow(cipherId)
|
||||
.flatMapLatest { cipherDataState ->
|
||||
val cipher = cipherDataState.data
|
||||
?: return@flatMapLatest flowOf(DataState.Loaded(null))
|
||||
|
||||
totpCodeManager.getTotpCodeStateFlow(item = cipher)
|
||||
.map { totpCodeDataState ->
|
||||
combineDataStates(
|
||||
totpCodeDataState,
|
||||
cipherDataState,
|
||||
) { totpCodeData, _ ->
|
||||
// Just return the verification items; we are only combining the
|
||||
// DataStates to know the overall state.
|
||||
totpCodeData
|
||||
}
|
||||
}
|
||||
}
|
||||
.stateIn(
|
||||
scope = unconfinedScope,
|
||||
started = SharingStarted.WhileSubscribed(STOP_TIMEOUT_DELAY_MS),
|
||||
initialValue = DataState.Loading,
|
||||
)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
override fun getAuthCodesFlow(): StateFlow<DataState<List<VerificationCodeItem>>> {
|
||||
return authenticatorDataFlow
|
||||
|
||||
Reference in New Issue
Block a user