-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BITAU-131] Add Popup to QR Code Scan to Add Code to Bitwarden (#177)
- Loading branch information
1 parent
e50d624
commit 5a699f3
Showing
20 changed files
with
821 additions
and
49 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
AuthenticatorShared/Core/Platform/Models/Enum/DefaultSaveOption.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import Foundation | ||
|
||
// MARK: - DefaultSaveOption | ||
|
||
/// The default location for saving newly added keys via QR code scan and Manual entry. | ||
/// | ||
enum DefaultSaveOption: String, Equatable, Menuable { | ||
/// Ask where to save a code each time a QR code is scanned. | ||
case none | ||
|
||
/// Save the code locally without showing any prompt. | ||
case saveLocally | ||
|
||
/// Take the user to the Bitwarden PM app to save the code without prompt. | ||
case saveToBitwarden | ||
|
||
/// All of the cases to show in the menu, in order. | ||
public static let allCases: [Self] = [ | ||
.saveToBitwarden, | ||
.saveLocally, | ||
.none, | ||
] | ||
|
||
/// The name of the value to display in the menu. | ||
var localizedName: String { | ||
switch self { | ||
case .none: | ||
Localizations.none | ||
case .saveLocally: | ||
Localizations.saveLocally | ||
case .saveToBitwarden: | ||
Localizations.saveToBitwarden | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
AuthenticatorShared/Core/Platform/Models/Enum/DefaultSaveOptionTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import XCTest | ||
|
||
@testable import AuthenticatorShared | ||
|
||
class DefaultSaveOptionTests: AuthenticatorTestCase { | ||
// MARK: Tests | ||
|
||
/// `allCases` returns all of the cases in the correct order. | ||
func test_allCases() { | ||
XCTAssertEqual( | ||
DefaultSaveOption.allCases, | ||
[ | ||
.saveToBitwarden, | ||
.saveLocally, | ||
.none, | ||
] | ||
) | ||
} | ||
|
||
/// `localizedName` returns the correct values. | ||
func test_localizedName() { | ||
XCTAssertEqual(DefaultSaveOption.none.localizedName, Localizations.none) | ||
XCTAssertEqual(DefaultSaveOption.saveLocally.localizedName, Localizations.saveLocally) | ||
XCTAssertEqual(DefaultSaveOption.saveToBitwarden.localizedName, Localizations.saveToBitwarden) | ||
} | ||
|
||
/// `rawValue` returns the correct values. | ||
func test_rawValues() { | ||
XCTAssertEqual(DefaultSaveOption.none.rawValue, "none") | ||
XCTAssertEqual(DefaultSaveOption.saveLocally.rawValue, "saveLocally") | ||
XCTAssertEqual(DefaultSaveOption.saveToBitwarden.rawValue, "saveToBitwarden") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.