Skip to content

Commit

Permalink
PM-15412 🍒 Pull-to-refresh operations should not invoke a forced sync. (
Browse files Browse the repository at this point in the history
  • Loading branch information
dseverns-livefront authored Nov 26, 2024
1 parent 019bf8d commit 0413cdc
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class SendViewModel @Inject constructor(
mutableStateFlow.update { it.copy(isRefreshing = true) }
// The Pull-To-Refresh composable is already in the refreshing state.
// We will reset that state when sendDataStateFlow emits later on.
vaultRepo.sync(forced = true)
vaultRepo.sync(forced = false)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class VaultItemListingViewModel @Inject constructor(
mutableStateFlow.update { it.copy(isRefreshing = true) }
// The Pull-To-Refresh composable is already in the refreshing state.
// We will reset that state when sendDataStateFlow emits later on.
vaultRepository.sync(forced = true)
vaultRepository.sync(forced = false)
}

private fun handleConfirmOverwriteExistingPasskeyClick(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class VaultViewModel @Inject constructor(
mutableStateFlow.update { it.copy(isRefreshing = true) }
// The Pull-To-Refresh composable is already in the refreshing state.
// We will reset that state when sendDataStateFlow emits later on.
vaultRepository.sync(forced = true)
vaultRepository.sync(forced = false)
}

private fun handleOverflowOptionClick(action: VaultAction.OverflowOptionClick) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class VerificationCodeViewModel @Inject constructor(
mutableStateFlow.update { it.copy(isRefreshing = true) }
// The Pull-To-Refresh composable is already in the refreshing state.
// We will reset that state when sendDataStateFlow emits later on.
vaultRepository.sync(forced = true)
vaultRepository.sync(forced = false)
}

private fun handleSearchIconClick() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,13 @@ class SendViewModelTest : BaseViewModelTest() {

@Test
fun `RefreshPull should call vault repository sync`() {
every { vaultRepo.sync(forced = true) } just runs
every { vaultRepo.sync(forced = false) } just runs
val viewModel = createViewModel()

viewModel.trySendAction(SendAction.RefreshPull)

verify(exactly = 1) {
vaultRepo.sync(forced = true)
vaultRepo.sync(forced = false)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
every { vaultFilterType } returns VaultFilterType.AllVaults
every { vaultDataStateFlow } returns mutableVaultDataStateFlow
every { lockVault(any()) } just runs
every { sync(forced = true) } just runs
every { sync(forced = any()) } just runs
coEvery {
getDecryptedFido2CredentialAutofillViews(any())
} returns DecryptFido2CredentialAutofillViewResult.Error
Expand Down Expand Up @@ -2127,7 +2127,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
viewModel.trySendAction(VaultItemListingsAction.RefreshPull)

verify(exactly = 1) {
vaultRepository.sync(forced = true)
vaultRepository.sync(forced = false)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ class VaultViewModelTest : BaseViewModelTest() {
viewModel.trySendAction(VaultAction.RefreshPull)

verify(exactly = 1) {
vaultRepository.sync(forced = true)
vaultRepository.sync(forced = false)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class VerificationCodeViewModelTest : BaseViewModelTest() {
private val vaultRepository: VaultRepository = mockk {
every { vaultFilterType } returns VaultFilterType.AllVaults
every { getAuthCodesFlow() } returns mutableAuthCodeFlow.asStateFlow()
every { sync(forced = true) } just runs
every { sync(forced = any()) } just runs
}

private val environmentRepository: EnvironmentRepository = mockk {
Expand Down Expand Up @@ -456,7 +456,7 @@ class VerificationCodeViewModelTest : BaseViewModelTest() {
viewModel.trySendAction(VerificationCodeAction.RefreshPull)

verify(exactly = 1) {
vaultRepository.sync(forced = true)
vaultRepository.sync(forced = false)
}
}

Expand Down

0 comments on commit 0413cdc

Please sign in to comment.