remove unused getAuthCodeFlow() (#215)

This commit is contained in:
Andrew Haisting
2024-10-01 15:33:21 -05:00
committed by GitHub
parent b0edb7cf3b
commit 9f4a85d373
2 changed files with 0 additions and 33 deletions
@@ -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.
@@ -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