Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking โ€œSign up for GitHubโ€, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PM-16153: Draw new login action card #1238

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
address feedbacks
ezimet-livefront committed Jan 7, 2025
commit d7f951176a1363c18af19e388c15d30f023ed1d6
1 change: 0 additions & 1 deletion BitwardenShared/Core/Auth/Services/AuthServiceTests.swift
Original file line number Diff line number Diff line change
@@ -452,7 +452,6 @@ class AuthServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body_
XCTAssertEqual(stateService.accountSetupAutofill["13512467-9cfe-43b0-969f-07534084764b"], .incomplete)
XCTAssertEqual(stateService.accountSetupImportLogins["13512467-9cfe-43b0-969f-07534084764b"], .incomplete)
XCTAssertEqual(stateService.accountSetupVaultUnlock["13512467-9cfe-43b0-969f-07534084764b"], .incomplete)
XCTAssertEqual(stateService.learnNewLoginActionCardStatus, .incomplete)
XCTAssertEqual(
stateService.masterPasswordHashes,
["13512467-9cfe-43b0-969f-07534084764b": "hashed password"]
Original file line number Diff line number Diff line change
@@ -694,9 +694,9 @@ class StateServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body
}

/// `getLearnNewLoginActionCardStatus()` returns the status of the learn new login action card.
func test_getLearnNewLoginActionCardShown() async {
func test_getLearnNewLoginActionCardStatus() async {
var learnNewLoginActionCardStatus = await subject.getLearnNewLoginActionCardStatus()
XCTAssertNil(learnNewLoginActionCardStatus)
XCTAssertEqual(learnNewLoginActionCardStatus, .incomplete)

appSettingsStore.learnNewLoginActionCardStatus = .complete
learnNewLoginActionCardStatus = await subject.getLearnNewLoginActionCardStatus()
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ protocol AppSettingsStore: AnyObject {
var lastUserShouldConnectToWatch: Bool { get set }

/// The status of the learn new login action card.
var learnNewLoginActionCardStatus: AccountSetupProgress? { get set }
var learnNewLoginActionCardStatus: AccountSetupProgress { get set }

/// The login request information received from a push notification.
var loginRequest: LoginRequestNotification? { get set }
@@ -882,8 +882,8 @@ extension DefaultAppSettingsStore: AppSettingsStore {
set { store(newValue, for: .introCarouselShown) }
}

var learnNewLoginActionCardStatus: AccountSetupProgress? {
get { fetch(for: .learnNewLoginActionCardStatus) }
var learnNewLoginActionCardStatus: AccountSetupProgress {
get { fetch(for: .learnNewLoginActionCardStatus) ?? .incomplete }
set { store(newValue, for: .learnNewLoginActionCardStatus) }
}

Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ class MockAppSettingsStore: AppSettingsStore { // swiftlint:disable:this type_bo
var disableWebIcons = false
var introCarouselShown = false
var lastUserShouldConnectToWatch = false
var learnNewLoginActionCardStatus: AccountSetupProgress?
var learnNewLoginActionCardStatus: AccountSetupProgress = .incomplete
var loginRequest: LoginRequestNotification?
var migrationVersion = 0
var overrideDebugFeatureFlagCalled = false
6 changes: 2 additions & 4 deletions BitwardenShared/UI/Vault/Vault/VaultCoordinator.swift
Original file line number Diff line number Diff line change
@@ -155,10 +155,8 @@ final class VaultCoordinator: Coordinator, HasStackNavigator {
case let .addItem(allowTypeSelection, group, newCipherOptions):
Task {
let hasPremium = try? await services.vaultRepository.doesActiveAccountHavePremium()
let learnNewLoginActionCardStatus = await services.stateService.getLearnNewLoginActionCardStatus()
let accountCount = try? await services.stateService.getAccounts().count
let isVaultEmpty = try? await services.vaultRepository.isVaultEmpty()
let shouldShowLearnNewLoginActionCard = learnNewLoginActionCardStatus == .incomplete && isVaultEmpty == true && accountCount == 1
let loginActionCardStatus = await services.stateService.getLearnNewLoginActionCardStatus()
let shouldShowLearnNewLoginActionCard = loginActionCardStatus == .incomplete
showVaultItem(
route: .addItem(
allowTypeSelection: allowTypeSelection,