PM-18681 - Update Showing Coach Mark Tour Logic To Only Consider User's Personal Vault (#4821)

This commit is contained in:
Phil Cappelli
2025-03-05 11:01:41 -05:00
committed by GitHub
parent 35e585a60e
commit efc3d21fde
2 changed files with 25 additions and 1 deletions

View File

@@ -311,7 +311,9 @@ class FirstTimeActionManagerImpl @Inject constructor(
flow = this,
flow2 = vaultDiskSource.getCiphers(activeUserId),
) { currentValue, ciphers ->
currentValue && ciphers.none { it.login != null }
currentValue && ciphers.none {
it.login != null && it.organizationId == null
}
}
}
.distinctUntilChanged()

View File

@@ -330,9 +330,11 @@ class FirstTimeActionManagerTest {
runTest {
val mockJsonWithNoLogin = mockk<SyncResponseJson.Cipher> {
every { login } returns null
every { organizationId } returns null
}
val mockJsonWithLogin = mockk<SyncResponseJson.Cipher> {
every { login } returns mockk()
every { organizationId } returns null
}
fakeAuthDiskSource.userState = MOCK_USER_STATE
// Enable feature flag so flow emits updates from disk.
@@ -393,9 +395,11 @@ class FirstTimeActionManagerTest {
runTest {
val mockJsonWithNoLogin = mockk<SyncResponseJson.Cipher> {
every { login } returns null
every { organizationId } returns null
}
val mockJsonWithLogin = mockk<SyncResponseJson.Cipher> {
every { login } returns mockk()
every { organizationId } returns null
}
fakeAuthDiskSource.userState = MOCK_USER_STATE
// Enable feature flag so flow emits updates from disk.
@@ -418,6 +422,24 @@ class FirstTimeActionManagerTest {
}
}
@Test
fun `if there are login ciphers attached to an organization we should show coach marks`() =
runTest {
val mockJsonWithNoLoginAndWithOrganizationId = mockk<SyncResponseJson.Cipher> {
every { login } returns mockk()
every { organizationId } returns "1234"
}
fakeAuthDiskSource.userState = MOCK_USER_STATE
// Enable feature flag so flow emits updates from disk.
mutableOnboardingFeatureFlow.update { true }
mutableCiphersListFlow.update {
listOf(mockJsonWithNoLoginAndWithOrganizationId)
}
firstTimeActionManager.shouldShowGeneratorCoachMarkFlow.test {
assertTrue(awaitItem())
}
}
@Suppress("MaxLineLength")
@Test
fun `markCoachMarkTourCompleted for the GENERATOR type sets the value to true in the disk source for should show generator coach mark`() {