Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ internal class UserLogoutManagerImpl(
.shouldClearOnSoftLogout(userId = userId)
val vaultPolicyBannerDismissedDate = settingsDiskSource
.getVaultPolicyBannerDismissedDate(userId = userId)
val shouldShowPlanBadge = settingsDiskSource.getShouldShowPlanBadge(userId = userId)

clearData(userId = userId)
mutableLogoutEventFlow.tryEmit(LogoutEvent(loggedOutUserId = userId))
Expand All @@ -102,10 +103,8 @@ internal class UserLogoutManagerImpl(
userId = userId,
vaultTimeoutInMinutes = vaultTimeoutInMinutes,
)
storeVaultTimeoutAction(
userId = userId,
vaultTimeoutAction = vaultTimeoutAction,
)
storeVaultTimeoutAction(userId = userId, vaultTimeoutAction = vaultTimeoutAction)
storeShouldShowPlanBadge(userId = userId, shouldShow = shouldShowPlanBadge)
if (!shouldClearOnSoftLogout) {
// We make sure the data is preserved if it should not be cleared.
storeVaultPolicyBannerDismissedDate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class UserLogoutManagerTest {
every { storeVaultTimeoutAction(any(), any()) } just runs
every { storeAppRegisteredForExport(any()) } just runs
every { getVaultPolicyBannerDismissedDate(userId = any()) } returns null
every { getShouldShowPlanBadge(userId = any()) } returns null
every { storeShouldShowPlanBadge(userId = any(), shouldShow = any()) } just runs
every {
storeVaultPolicyBannerDismissedDate(userId = any(), dismissalRevisionDate = any())
} just runs
Expand Down Expand Up @@ -160,6 +162,7 @@ class UserLogoutManagerTest {
every {
settingsDiskSource.getVaultTimeoutAction(userId = userId)
} returns vaultTimeoutAction
every { settingsDiskSource.getShouldShowPlanBadge(userId = userId) } returns true
every {
authDiskSource.getEphemeralPinProtectedUserKeyEnvelope(userId = userId)
} returns pinProtectedUserKeyEnvelope
Expand Down Expand Up @@ -211,6 +214,7 @@ class UserLogoutManagerTest {
userId = userId,
vaultTimeoutAction = vaultTimeoutAction,
)
settingsDiskSource.storeShouldShowPlanBadge(userId = userId, shouldShow = true)
authDiskSource.storeEphemeralPinProtectedUserKeyEnvelope(
userId = userId,
pinProtectedUserKeyEnvelope = pinProtectedUserKeyEnvelope,
Expand Down Expand Up @@ -242,6 +246,7 @@ class UserLogoutManagerTest {
every {
settingsDiskSource.getVaultTimeoutAction(userId = userId)
} returns vaultTimeoutAction
every { settingsDiskSource.getShouldShowPlanBadge(userId = userId) } returns true
every {
authDiskSource.getEphemeralPinProtectedUserKeyEnvelope(userId = userId)
} returns pinProtectedUserKeyEnvelope
Expand Down Expand Up @@ -283,6 +288,7 @@ class UserLogoutManagerTest {
userId = userId,
vaultTimeoutAction = vaultTimeoutAction,
)
settingsDiskSource.storeShouldShowPlanBadge(userId = userId, shouldShow = true)
authDiskSource.storeEphemeralPinProtectedUserKeyEnvelope(
userId = userId,
pinProtectedUserKeyEnvelope = pinProtectedUserKeyEnvelope,
Expand Down Expand Up @@ -385,6 +391,20 @@ class UserLogoutManagerTest {
}
}

@Test
fun `logout should not restore the should show plan badge value`() {
val userId = USER_ID_1
every { authDiskSource.userState } returns SINGLE_USER_STATE_1

userLogoutManager.logout(userId = userId, reason = LogoutReason.Timeout)

assertDataCleared(userId = userId)
verify(exactly = 0) {
settingsDiskSource.getShouldShowPlanBadge(userId = any())
settingsDiskSource.storeShouldShowPlanBadge(userId = any(), shouldShow = any())
}
}

private fun setupSoftLogoutStubs(userId: String) {
every { settingsDiskSource.getVaultTimeoutInMinutes(userId = userId) } returns 360
every {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ class SearchScreenTest : BitwardenComposeTest() {
.assert(hasAnyAncestor(isDialog()))
.assertIsDisplayed()
composeTestRule
.onNodeWithText(text = "Upgrade to Premium")
.onNodeWithText(text = "Explore Premium")
.assert(hasAnyAncestor(isDialog()))
.performClick()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ class SendScreenTest : BitwardenComposeTest() {
}

composeTestRule
.onNodeWithText("Upgrade to Premium")
.onNodeWithText("Explore Premium")
.performClick()

verify { viewModel.trySendAction(SendAction.UpgradeToPremiumClick) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ class AddEditSendScreenTest : BitwardenComposeTest() {
}

composeTestRule
.onNodeWithText("Upgrade to Premium")
.onNodeWithText("Explore Premium")
.performClick()

verify { viewModel.trySendAction(AddEditSendAction.UpgradeToPremiumClick) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ class VaultAddEditScreenTest : BitwardenComposeTest() {
)

composeTestRule
.onNodeWithText(text = "Upgrade to Premium")
.onNodeWithText(text = "Explore Premium")
.assert(hasAnyAncestor(isDialog()))
.performClick()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class AttachmentsScreenTest : BitwardenComposeTest() {
.assertIsDisplayed()

composeTestRule
.onNodeWithText("Upgrade to Premium")
.onNodeWithText("Explore Premium")
.assert(hasAnyAncestor(isDialog()))
.performClick()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class VaultItemScreenTest : BitwardenComposeTest() {
}

composeTestRule
.onNodeWithText(text = "Upgrade to Premium")
.onNodeWithText(text = "Explore Premium")
.assert(hasAnyAncestor(isDialog()))
.performClick()

Expand Down Expand Up @@ -825,7 +825,7 @@ class VaultItemScreenTest : BitwardenComposeTest() {
.assertIsDisplayed()

composeTestRule
.onAllNodesWithText(text = "Upgrade to Premium")
.onAllNodesWithText(text = "Explore Premium")
.filterToOne(hasAnyAncestor(isDialog()))
.performClick()

Expand Down Expand Up @@ -864,7 +864,7 @@ class VaultItemScreenTest : BitwardenComposeTest() {
.performClick()

composeTestRule
.onAllNodesWithText(text = "Explore Premium")
.onAllNodesWithText(text = "Upgrade to Premium")
.filterToOne(hasAnyAncestor(isDialog()))
.performClick()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2615,7 +2615,7 @@ class VaultItemListingScreenTest : BitwardenComposeTest() {
.assert(hasAnyAncestor(isDialog()))
.assertIsDisplayed()
composeTestRule
.onNodeWithText(text = "Upgrade to Premium")
.onNodeWithText(text = "Explore Premium")
.assert(hasAnyAncestor(isDialog()))
.performClick()

Expand Down Expand Up @@ -2659,7 +2659,7 @@ class VaultItemListingScreenTest : BitwardenComposeTest() {
}

composeTestRule
.onNodeWithText(text = "Upgrade to Premium")
.onNodeWithText(text = "Explore Premium")
.assert(hasAnyAncestor(isDialog()))
.performClick()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ class VaultScreenTest : BitwardenComposeTest() {
.assert(hasAnyAncestor(isDialog()))
.assertIsDisplayed()
composeTestRule
.onNodeWithText(text = "Upgrade to Premium")
.onNodeWithText(text = "Explore Premium")
.assert(hasAnyAncestor(isDialog()))
.performClick()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ fun PremiumRequiredDialog(
message = message,
confirmButtonText = stringResource(
id = if (isInAppUpgradeAvailable) {
BitwardenString.upgrade_to_premium
} else {
BitwardenString.explore_premium
} else {
BitwardenString.upgrade_to_premium
},
Comment thread
david-livefront marked this conversation as resolved.
Resolved
),
dismissButtonText = stringResource(id = BitwardenString.cancel),
Expand Down
Loading