mirror of
https://github.com/bitwarden/android.git
synced 2024-12-21 08:42:39 +03:00
PM-15412 🍒 Pull-to-refresh operations should not invoke a forced sync. (#4389)
This commit is contained in:
parent
019bf8d0fa
commit
0413cdc70d
8 changed files with 11 additions and 11 deletions
|
@ -321,7 +321,7 @@ class SendViewModel @Inject constructor(
|
||||||
mutableStateFlow.update { it.copy(isRefreshing = true) }
|
mutableStateFlow.update { it.copy(isRefreshing = true) }
|
||||||
// The Pull-To-Refresh composable is already in the refreshing state.
|
// The Pull-To-Refresh composable is already in the refreshing state.
|
||||||
// We will reset that state when sendDataStateFlow emits later on.
|
// We will reset that state when sendDataStateFlow emits later on.
|
||||||
vaultRepo.sync(forced = true)
|
vaultRepo.sync(forced = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,7 +307,7 @@ class VaultItemListingViewModel @Inject constructor(
|
||||||
mutableStateFlow.update { it.copy(isRefreshing = true) }
|
mutableStateFlow.update { it.copy(isRefreshing = true) }
|
||||||
// The Pull-To-Refresh composable is already in the refreshing state.
|
// The Pull-To-Refresh composable is already in the refreshing state.
|
||||||
// We will reset that state when sendDataStateFlow emits later on.
|
// We will reset that state when sendDataStateFlow emits later on.
|
||||||
vaultRepository.sync(forced = true)
|
vaultRepository.sync(forced = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleConfirmOverwriteExistingPasskeyClick(
|
private fun handleConfirmOverwriteExistingPasskeyClick(
|
||||||
|
|
|
@ -359,7 +359,7 @@ class VaultViewModel @Inject constructor(
|
||||||
mutableStateFlow.update { it.copy(isRefreshing = true) }
|
mutableStateFlow.update { it.copy(isRefreshing = true) }
|
||||||
// The Pull-To-Refresh composable is already in the refreshing state.
|
// The Pull-To-Refresh composable is already in the refreshing state.
|
||||||
// We will reset that state when sendDataStateFlow emits later on.
|
// We will reset that state when sendDataStateFlow emits later on.
|
||||||
vaultRepository.sync(forced = true)
|
vaultRepository.sync(forced = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleOverflowOptionClick(action: VaultAction.OverflowOptionClick) {
|
private fun handleOverflowOptionClick(action: VaultAction.OverflowOptionClick) {
|
||||||
|
|
|
@ -127,7 +127,7 @@ class VerificationCodeViewModel @Inject constructor(
|
||||||
mutableStateFlow.update { it.copy(isRefreshing = true) }
|
mutableStateFlow.update { it.copy(isRefreshing = true) }
|
||||||
// The Pull-To-Refresh composable is already in the refreshing state.
|
// The Pull-To-Refresh composable is already in the refreshing state.
|
||||||
// We will reset that state when sendDataStateFlow emits later on.
|
// We will reset that state when sendDataStateFlow emits later on.
|
||||||
vaultRepository.sync(forced = true)
|
vaultRepository.sync(forced = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleSearchIconClick() {
|
private fun handleSearchIconClick() {
|
||||||
|
|
|
@ -419,13 +419,13 @@ class SendViewModelTest : BaseViewModelTest() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `RefreshPull should call vault repository sync`() {
|
fun `RefreshPull should call vault repository sync`() {
|
||||||
every { vaultRepo.sync(forced = true) } just runs
|
every { vaultRepo.sync(forced = false) } just runs
|
||||||
val viewModel = createViewModel()
|
val viewModel = createViewModel()
|
||||||
|
|
||||||
viewModel.trySendAction(SendAction.RefreshPull)
|
viewModel.trySendAction(SendAction.RefreshPull)
|
||||||
|
|
||||||
verify(exactly = 1) {
|
verify(exactly = 1) {
|
||||||
vaultRepo.sync(forced = true)
|
vaultRepo.sync(forced = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
||||||
every { vaultFilterType } returns VaultFilterType.AllVaults
|
every { vaultFilterType } returns VaultFilterType.AllVaults
|
||||||
every { vaultDataStateFlow } returns mutableVaultDataStateFlow
|
every { vaultDataStateFlow } returns mutableVaultDataStateFlow
|
||||||
every { lockVault(any()) } just runs
|
every { lockVault(any()) } just runs
|
||||||
every { sync(forced = true) } just runs
|
every { sync(forced = any()) } just runs
|
||||||
coEvery {
|
coEvery {
|
||||||
getDecryptedFido2CredentialAutofillViews(any())
|
getDecryptedFido2CredentialAutofillViews(any())
|
||||||
} returns DecryptFido2CredentialAutofillViewResult.Error
|
} returns DecryptFido2CredentialAutofillViewResult.Error
|
||||||
|
@ -2127,7 +2127,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
||||||
viewModel.trySendAction(VaultItemListingsAction.RefreshPull)
|
viewModel.trySendAction(VaultItemListingsAction.RefreshPull)
|
||||||
|
|
||||||
verify(exactly = 1) {
|
verify(exactly = 1) {
|
||||||
vaultRepository.sync(forced = true)
|
vaultRepository.sync(forced = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1365,7 +1365,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
||||||
viewModel.trySendAction(VaultAction.RefreshPull)
|
viewModel.trySendAction(VaultAction.RefreshPull)
|
||||||
|
|
||||||
verify(exactly = 1) {
|
verify(exactly = 1) {
|
||||||
vaultRepository.sync(forced = true)
|
vaultRepository.sync(forced = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ class VerificationCodeViewModelTest : BaseViewModelTest() {
|
||||||
private val vaultRepository: VaultRepository = mockk {
|
private val vaultRepository: VaultRepository = mockk {
|
||||||
every { vaultFilterType } returns VaultFilterType.AllVaults
|
every { vaultFilterType } returns VaultFilterType.AllVaults
|
||||||
every { getAuthCodesFlow() } returns mutableAuthCodeFlow.asStateFlow()
|
every { getAuthCodesFlow() } returns mutableAuthCodeFlow.asStateFlow()
|
||||||
every { sync(forced = true) } just runs
|
every { sync(forced = any()) } just runs
|
||||||
}
|
}
|
||||||
|
|
||||||
private val environmentRepository: EnvironmentRepository = mockk {
|
private val environmentRepository: EnvironmentRepository = mockk {
|
||||||
|
@ -456,7 +456,7 @@ class VerificationCodeViewModelTest : BaseViewModelTest() {
|
||||||
viewModel.trySendAction(VerificationCodeAction.RefreshPull)
|
viewModel.trySendAction(VerificationCodeAction.RefreshPull)
|
||||||
|
|
||||||
verify(exactly = 1) {
|
verify(exactly = 1) {
|
||||||
vaultRepository.sync(forced = true)
|
vaultRepository.sync(forced = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue