mirror of
https://github.com/bitwarden/android.git
synced 2026-06-07 23:58:03 -05:00
Add support for retrieving a single send by ID from the VaultRepository (#564)
This commit is contained in:
committed by
Álison Fernandes
parent
75a08e72a6
commit
f8ff7c225d
@@ -93,6 +93,12 @@ interface VaultRepository : VaultLockManager {
|
||||
*/
|
||||
fun getVaultFolderStateFlow(folderId: String): StateFlow<DataState<FolderView?>>
|
||||
|
||||
/**
|
||||
* Flow that represents the data for a specific send as found by ID. This may emit `null` if
|
||||
* the send cannot be found.
|
||||
*/
|
||||
fun getSendStateFlow(sendId: String): StateFlow<DataState<SendView?>>
|
||||
|
||||
/**
|
||||
* Emits the totp code result flow to listeners.
|
||||
*/
|
||||
|
||||
@@ -263,6 +263,19 @@ class VaultRepositoryImpl(
|
||||
initialValue = DataState.Loading,
|
||||
)
|
||||
|
||||
override fun getSendStateFlow(sendId: String): StateFlow<DataState<SendView?>> =
|
||||
sendDataStateFlow
|
||||
.map { dataState ->
|
||||
dataState.map { sendData ->
|
||||
sendData.sendViewList.find { it.id == sendId }
|
||||
}
|
||||
}
|
||||
.stateIn(
|
||||
scope = unconfinedScope,
|
||||
started = SharingStarted.Lazily,
|
||||
initialValue = DataState.Loading,
|
||||
)
|
||||
|
||||
override fun emitTotpCodeResult(totpCodeResult: TotpCodeResult) {
|
||||
mutableTotpCodeResultFlow.tryEmit(totpCodeResult)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user