Skip to content

Commit

Permalink
PM-11158: Add import logins step 3 (#1046)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-livefront authored Oct 15, 2024
1 parent 25ba342 commit c0b6360
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1020,9 +1020,14 @@
"ExportYourSavedLogins" = "Export your saved logins";
"OnYourComputerLogInToYourCurrentBrowserOrPasswordManager" = "On your computer, **log in to your current browser or password manager.**";
"ExportYourPasswordsThisOptionIsUsuallyFoundInYourSettings" = "**Export your passwords.** This option is usually found in your settings.";
"SelectImportDataInTheWebAppThenDoneToFinishSyncing" = "**Select Import data** in the web app, then Done to finish syncing.";
"SaveTheExportedFileSomewhereOnYourComputerYouCanFindEasily" = "**Save the exported file** somewhere on your computer you can find easily.";
"YoullDeleteThisFileAfterImportIsComplete" = "You’ll delete this file after import is complete.";
"NeedHelpCheckOutImportHelp" = "Need help? Check out **[import help](%1$@)**";
"LogInToBitwarden" = "Log in to Bitwarden";
"OnYourComputerOpenANewBrowserTabAndGoTo" = "On your computer, open a new browser tab and **go to %1$@**";
"LogInToTheBitwardenWebApp" = "**Log in to the Bitwarden web app.**";
"ImportLoginsToBitwarden" = "Import logins to Bitwarden";
"InTheBitwardenNavigationFindTheToolsOptionAndSelectImportData" = "In the Bitwarden navigation, **find the Tools option** and **select Import data.**";
"FillOutTheFormAndImportYourSavedPasswordFile" = "Fill out the form and **import your saved password file.**";
"SelectImportDataInTheWebAppThenDoneToFinishSyncing" = "**Select Import data** in the web app, then **Done** to finish syncing.";
"ForYourSecurityBeSureToDeleteYourSavedPasswordFile" = "For your security, be sure to **delete your saved password file.**";
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,21 @@ class ImportLoginsProcessorTests: BitwardenTestCase {
subject.receive(.advanceNextPage)
XCTAssertEqual(subject.state.page, .step2)

subject.receive(.advanceNextPage)
XCTAssertEqual(subject.state.page, .step3)

// TODO: PM-11159 Sync vault
subject.receive(.advanceNextPage)
XCTAssertEqual(subject.state.page, .step2)
XCTAssertEqual(subject.state.page, .step3)
}

/// `receive(_:)` with `.advancePreviousPage` advances to the previous page.
@MainActor
func test_receive_advancePreviousPage() {
subject.state.page = .step2
subject.state.page = .step3

subject.receive(.advancePreviousPage)
XCTAssertEqual(subject.state.page, .step2)

subject.receive(.advancePreviousPage)
XCTAssertEqual(subject.state.page, .step1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct ImportLoginsState: Equatable, Sendable {
case intro
case step1
case step2
case step3

/// The page before the current one.
var previous: Page? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct ImportLoginsView: View {
case .intro: intro()
case .step1: step1()
case .step2: step2()
case .step3: step3()
}
}
.transition(.opacity)
Expand Down Expand Up @@ -72,7 +73,7 @@ struct ImportLoginsView: View {
NumberedListRow(title: Localizations.onYourComputerLogInToYourCurrentBrowserOrPasswordManager)
NumberedListRow(title: Localizations.exportYourPasswordsThisOptionIsUsuallyFoundInYourSettings)
NumberedListRow(
title: Localizations.selectImportDataInTheWebAppThenDoneToFinishSyncing,
title: Localizations.saveTheExportedFileSomewhereOnYourComputerYouCanFindEasily,
subtitle: Localizations.youllDeleteThisFileAfterImportIsComplete
)
}
Expand All @@ -87,6 +88,17 @@ struct ImportLoginsView: View {
}
}

/// The step 3 page view.
@ViewBuilder
private func step3() -> some View {
stepView(step: 3, title: Localizations.importLoginsToBitwarden) {
NumberedListRow(title: Localizations.inTheBitwardenNavigationFindTheToolsOptionAndSelectImportData)
NumberedListRow(title: Localizations.fillOutTheFormAndImportYourSavedPasswordFile)
NumberedListRow(title: Localizations.selectImportDataInTheWebAppThenDoneToFinishSyncing)
NumberedListRow(title: Localizations.forYourSecurityBeSureToDeleteYourSavedPasswordFile)
}
}

/// Returns a scroll view for displaying the instructions for a step.
///
/// - Parameters:
Expand Down Expand Up @@ -154,4 +166,9 @@ struct ImportLoginsView: View {
ImportLoginsView(store: Store(processor: StateProcessor(state: ImportLoginsState(page: .step2))))
.navStackWrapped
}

#Preview("Step 3") {
ImportLoginsView(store: Store(processor: StateProcessor(state: ImportLoginsState(page: .step3))))
.navStackWrapped
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,14 @@ class ImportLoginsViewTests: BitwardenTestCase {
as: [.defaultPortrait, .defaultPortraitDark, .tallPortraitAX5(heightMultiple: 2), .defaultLandscape]
)
}

/// The import logins step 3 page renders correctly.
@MainActor
func test_snapshot_importLoginsStep3() {
processor.state.page = .step3
assertSnapshots(
of: subject.navStackWrapped,
as: [.defaultPortrait, .defaultPortraitDark, .tallPortraitAX5(heightMultiple: 2.5), .defaultLandscape]
)
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c0b6360

Please sign in to comment.