PM-15412 🍒 Pull-to-refresh operations should not invoke a forced sync. (#4389)

This commit is contained in:
Dave Severns 2024-11-26 16:00:07 -05:00 committed by GitHub
parent 019bf8d0fa
commit 0413cdc70d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 11 additions and 11 deletions

View file

@ -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)
} }
} }

View file

@ -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(

View file

@ -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) {

View file

@ -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() {

View file

@ -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)
} }
} }

View file

@ -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)
} }
} }

View file

@ -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)
} }
} }

View file

@ -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)
} }
} }