From 2cf02939e37bbedf709748474e824e0f0f523f36 Mon Sep 17 00:00:00 2001 From: Katherine Bertelsen Date: Tue, 7 Oct 2025 08:52:49 -0500 Subject: [PATCH] [PM-26064] Move BitwardenMenuField to BitwardenKit (#2012) --- .../Core/Platform/Models/Enum/AppTheme.swift | 5 +- .../Models/Enum/ClearClipboardValue.swift | 1 + .../Models/Enum/DefaultSaveOption.swift | 1 + .../Models/Enum/SessionTimeoutValue.swift | 2 +- .../Vault/Models/Enum/ExportFormatType.swift | 2 + .../Vault/Models/Enum/ImportFormatType.swift | 2 + .../TOTP/TOTPCryptoHashAlgorithm.swift | 2 + .../Views/BitwardenMenuField.swift | 200 ------------------ .../Views/BitwardenMenuFieldTests.swift | 57 ----- .../Views/FormFields/FormMenuFieldView.swift | 1 + .../Application/Views/SettingsMenuField.swift | 1 + .../Views/SettingsMenuFieldTests.swift | 1 + .../ExportItems/ExportItemsView.swift | 1 + .../ImportItems/ImportItemsView.swift | 1 + .../AuthenticatorItemState.swift | 1 + .../Extensions/View+OnSizeChanged.swift | 2 +- .../Views/BitwardenMenuField.swift | 20 +- .../Views/BitwardenMenuFieldTests.swift | 3 +- .../Models/Domain/DefaultableType.swift | 1 + .../Core/Platform/Models/Enum/AppTheme.swift | 5 +- .../Models/Enum/ClearClipboardValue.swift | 1 + .../Models/Enum/ExportFormatType.swift | 2 + .../Enum/FlightRecorderLoggingDuration.swift | 1 + .../Enum/ForwardedEmailServiceType.swift | 1 + .../Models/Enum/PasswordGeneratorType.swift | 1 + .../Models/Enum/SendDeletionDateType.swift | 1 + .../Core/Tools/Models/Enum/SendType.swift | 3 +- .../Tools/Models/Enum/UsernameEmailType.swift | 1 + .../Models/Enum/UsernameGeneratorType.swift | 1 + .../Vault/Extensions/BitwardenSdk+Vault.swift | 4 +- .../Vault/Models/Domain/CipherOwner.swift | 4 +- .../Core/Vault/Models/Enum/CipherType.swift | 3 +- .../Core/Vault/Models/Enum/FieldType.swift | 1 + .../Core/Vault/Models/Enum/TitleType.swift | 1 + .../Core/Vault/Models/Enum/UriMatchType.swift | 1 + .../Extensions/View+GuidedTourStep.swift | 1 + .../Views/BitwardenSegmentedControl.swift | 1 + .../BitwardenSegmentedControlTests.swift | 1 + .../Views/FormFields/FormMenuFieldView.swift | 1 + .../Application/Views/SettingsMenuField.swift | 1 + .../Views/SettingsMenuFieldTests.swift | 1 + .../EnableFlightRecorderView.swift | 1 + .../AccountSecurityState.swift | 6 +- .../Settings/Appearance/AppearanceView.swift | 1 + .../Generator/Generator/GeneratorState.swift | 3 +- .../AddEditCardItem/CardComponent.swift | 1 + .../Extensions/InspectableView.swift | 2 +- .../Extensions/InspectableView.swift | 2 +- 48 files changed, 71 insertions(+), 286 deletions(-) delete mode 100644 AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuField.swift delete mode 100644 AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift rename {BitwardenShared => BitwardenKit}/UI/Platform/Application/Extensions/View+OnSizeChanged.swift (99%) rename {BitwardenShared => BitwardenKit}/UI/Platform/Application/Views/BitwardenMenuField.swift (98%) rename {BitwardenShared => BitwardenKit}/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift (97%) diff --git a/AuthenticatorShared/Core/Platform/Models/Enum/AppTheme.swift b/AuthenticatorShared/Core/Platform/Models/Enum/AppTheme.swift index c3ed1c6b7..9d9b1c98f 100644 --- a/AuthenticatorShared/Core/Platform/Models/Enum/AppTheme.swift +++ b/AuthenticatorShared/Core/Platform/Models/Enum/AppTheme.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import UIKit @@ -23,10 +24,10 @@ public enum AppTheme: String, Menuable { // MARK: Properties /// Specify the text for the default option. - static var defaultValueLocalizedName: String { Localizations.defaultSystem } + public static var defaultValueLocalizedName: String { Localizations.defaultSystem } /// The name of the type to display in the dropdown menu. - var localizedName: String { + public var localizedName: String { switch self { case .dark: Localizations.dark diff --git a/AuthenticatorShared/Core/Platform/Models/Enum/ClearClipboardValue.swift b/AuthenticatorShared/Core/Platform/Models/Enum/ClearClipboardValue.swift index 575b72f3a..9347a331e 100644 --- a/AuthenticatorShared/Core/Platform/Models/Enum/ClearClipboardValue.swift +++ b/AuthenticatorShared/Core/Platform/Models/Enum/ClearClipboardValue.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import Foundation diff --git a/AuthenticatorShared/Core/Platform/Models/Enum/DefaultSaveOption.swift b/AuthenticatorShared/Core/Platform/Models/Enum/DefaultSaveOption.swift index 027b6df9c..9cc16a495 100644 --- a/AuthenticatorShared/Core/Platform/Models/Enum/DefaultSaveOption.swift +++ b/AuthenticatorShared/Core/Platform/Models/Enum/DefaultSaveOption.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import Foundation diff --git a/AuthenticatorShared/Core/Platform/Models/Enum/SessionTimeoutValue.swift b/AuthenticatorShared/Core/Platform/Models/Enum/SessionTimeoutValue.swift index 461b8cb58..f969ecc30 100644 --- a/AuthenticatorShared/Core/Platform/Models/Enum/SessionTimeoutValue.swift +++ b/AuthenticatorShared/Core/Platform/Models/Enum/SessionTimeoutValue.swift @@ -21,7 +21,7 @@ extension SessionTimeoutValue: @retroactive CaseIterable, Menuable { ] /// The localized string representation of a `SessionTimeoutValue`. - var localizedName: String { + public var localizedName: String { switch self { case .immediately: Localizations.immediately diff --git a/AuthenticatorShared/Core/Vault/Models/Enum/ExportFormatType.swift b/AuthenticatorShared/Core/Vault/Models/Enum/ExportFormatType.swift index fe4dc6e3d..79f50d379 100644 --- a/AuthenticatorShared/Core/Vault/Models/Enum/ExportFormatType.swift +++ b/AuthenticatorShared/Core/Vault/Models/Enum/ExportFormatType.swift @@ -1,3 +1,5 @@ +import BitwardenKit + // MARK: - ExportFormatType /// An enum describing the format of the items export. diff --git a/AuthenticatorShared/Core/Vault/Models/Enum/ImportFormatType.swift b/AuthenticatorShared/Core/Vault/Models/Enum/ImportFormatType.swift index d7c3574ce..44b170f3e 100644 --- a/AuthenticatorShared/Core/Vault/Models/Enum/ImportFormatType.swift +++ b/AuthenticatorShared/Core/Vault/Models/Enum/ImportFormatType.swift @@ -1,3 +1,5 @@ +import BitwardenKit + // MARK: - ImportFormatType /// An enum describing the format of the imported items file by provider. diff --git a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPCryptoHashAlgorithm.swift b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPCryptoHashAlgorithm.swift index c0c2eebbb..93c5065b4 100644 --- a/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPCryptoHashAlgorithm.swift +++ b/AuthenticatorShared/Core/Vault/Services/TOTP/TOTPCryptoHashAlgorithm.swift @@ -1,3 +1,5 @@ +import BitwardenKit + /// Defines the hash algorithms supported for TOTP. /// enum TOTPCryptoHashAlgorithm: String, Menuable, CaseIterable { diff --git a/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuField.swift b/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuField.swift deleted file mode 100644 index 69d7eb6ef..000000000 --- a/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuField.swift +++ /dev/null @@ -1,200 +0,0 @@ -import BitwardenResources -import SwiftUI - -// MARK: - Menuable - -/// A protocol that defines an object that can be represented and selected in -/// a `BitwardenMenuField`. -protocol Menuable: Equatable, Hashable { - /// The custom localizable title value for this default case, defaults to `Default`. - static var defaultValueLocalizedName: String { get } - - /// A localized name value. This value is displayed in the Menu when the user - /// is making a selection between multiple options. - var localizedName: String { get } -} - -extension Menuable { - static var defaultValueLocalizedName: String { - Localizations.default - } -} - -// MARK: - BitwardenMenuField - -/// A standard input field that allows the user to select between a predefined set of -/// options. This view is identical to `BitwardenTextField`, but uses a `Menu` -/// instead of a `TextField` as the input mechanism. -/// -struct BitwardenMenuField: View where T: Menuable { - // MARK: Properties - - /// The selection chosen from the menu. - @Binding var selection: T - - /// The accessibility identifier for the view. - let accessibilityIdentifier: String? - - /// The options displayed in the menu. - let options: [T] - - /// The footer text displayed below the menu field. - let footer: String? - - /// The title of the menu field. - let title: String? - - /// Optional content view that is displayed on the trailing edge of the menu value. - let trailingContent: TrailingContent? - - // MARK: View - - var body: some View { - BitwardenField(title: title, footer: footer) { - menu - } accessoryContent: { - if let trailingContent { - trailingContent - } - } - } - - // MARK: Private views - - /// The menu that displays the list of options. - private var menu: some View { - Menu { - Picker(selection: $selection) { - ForEach(options, id: \.hashValue) { option in - Text(option.localizedName).tag(option) - } - } label: { - Text("") - } - .accessibilityIdentifier(accessibilityIdentifier ?? "") - } label: { - HStack { - Text(selection.localizedName) - Spacer() - } - .contentShape(Rectangle()) - .transaction { transaction in - // Prevents any downstream animations from rendering a fade animation - // on this label. - transaction.animation = nil - } - } - .styleGuide(.body) - .foregroundColor(Asset.Colors.textPrimary.swiftUIColor) - } - - // MARK: Initialization - - /// Initializes a new `BitwardenMenuField`. - /// - /// - Parameters: - /// - title: The title of the text field. - /// - footer: The footer text displayed below the menu field. - /// - accessibilityIdentifier: The accessibility identifier for the view. - /// - options: The options that the user can choose between. - /// - selection: A `Binding` for the currently selected option. - /// - init( - title: String? = nil, - footer: String? = nil, - accessibilityIdentifier: String? = nil, - options: [T], - selection: Binding, - ) where TrailingContent == EmptyView { - self.accessibilityIdentifier = accessibilityIdentifier - self.footer = footer - self.options = options - _selection = selection - self.title = title - trailingContent = nil - } - - /// Initializes a new `BitwardenMenuField`. - /// - /// - Parameters: - /// - title: The title of the text field. - /// - footer: The footer text displayed below the menu field. - /// - accessibilityIdentifier: The accessibility identifier for the view. - /// - options: The options that the user can choose between. - /// - selection: A `Binding` for the currently selected option. - /// - trailingContent: Optional content view that is displayed to the right of the menu value. - /// - init( - title: String? = nil, - footer: String? = nil, - accessibilityIdentifier: String? = nil, - options: [T], - selection: Binding, - trailingContent: () -> TrailingContent, - ) { - self.accessibilityIdentifier = accessibilityIdentifier - self.footer = footer - self.options = options - _selection = selection - self.title = title - self.trailingContent = trailingContent() - } -} - -// MARK: Previews - -#if DEBUG -private enum MenuPreviewOptions: CaseIterable, Menuable { - case bear, bird, dog - - var localizedName: String { - switch self { - case .bear: "🧸" - case .bird: "🪿" - case .dog: "🐕" - } - } -} - -#Preview("CipherType") { - VStack { - BitwardenMenuField( - title: "Animals", - options: MenuPreviewOptions.allCases, - selection: .constant(.dog), - ) - .padding() - } - .background(Color(.systemGroupedBackground)) -} - -#Preview("Trailing Button") { - Group { - BitwardenMenuField( - title: "Animals", - options: MenuPreviewOptions.allCases, - selection: .constant(.dog), - ) { - Button {} label: { - SharedAsset.Icons.camera16.swiftUIImage - } - .buttonStyle(.accessory) - } - .padding() - } - .background(Color(.systemGroupedBackground)) -} - -#Preview("Footer") { - Group { - BitwardenMenuField( - title: "Animals", - footer: "Select your favorite animal", - options: MenuPreviewOptions.allCases, - selection: .constant(.dog), - ) - .padding() - } - .background(Color(.systemGroupedBackground)) -} -#endif diff --git a/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift b/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift deleted file mode 100644 index 04e018b49..000000000 --- a/AuthenticatorShared/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift +++ /dev/null @@ -1,57 +0,0 @@ -import SwiftUI -import ViewInspector -import XCTest - -@testable import AuthenticatorShared - -class BitwardenMenuFieldTests: BitwardenTestCase { - // MARK: Types - - enum TestValue: String, CaseIterable, Menuable { - case value1 - case value2 - - var localizedName: String { - rawValue - } - } - - // MARK: Properties - - var selection: TestValue! - var subject: BitwardenMenuField! - - // MARK: Setup & Teardown - - override func setUp() { - super.setUp() - selection = .value1 - let binding = Binding { - self.selection! - } set: { newValue in - self.selection = newValue - } - subject = BitwardenMenuField( - options: TestValue.allCases, - selection: binding, - ) - } - - override func tearDown() { - super.tearDown() - selection = nil - subject = nil - } - - // MARK: Tests - - func test_newSelection() throws { - let picker = try subject.inspect().find(ViewType.Picker.self) - try picker.select(value: TestValue.value2) - XCTAssertEqual(selection, .value2) - - let menu = try subject.inspect().find(ViewType.Menu.self) - let label = try menu.labelView().find(ViewType.Text.self).string() - XCTAssertEqual(label, "value2") - } -} diff --git a/AuthenticatorShared/UI/Platform/Application/Views/FormFields/FormMenuFieldView.swift b/AuthenticatorShared/UI/Platform/Application/Views/FormFields/FormMenuFieldView.swift index 9097da835..b4b984b13 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/FormFields/FormMenuFieldView.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/FormFields/FormMenuFieldView.swift @@ -1,3 +1,4 @@ +import BitwardenKit import SwiftUI // MARK: - FormMenuField diff --git a/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuField.swift b/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuField.swift index a46b9087d..fd391d2b4 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuField.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuField.swift @@ -1,3 +1,4 @@ +import BitwardenKit import SwiftUI // MARK: - SettingsMenuField diff --git a/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuFieldTests.swift b/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuFieldTests.swift index 4ab8b113c..0d328a9ee 100644 --- a/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuFieldTests.swift +++ b/AuthenticatorShared/UI/Platform/Application/Views/SettingsMenuFieldTests.swift @@ -1,3 +1,4 @@ +import BitwardenKit import SwiftUI import ViewInspector import XCTest diff --git a/AuthenticatorShared/UI/Platform/Settings/Settings/ExportItems/ExportItemsView.swift b/AuthenticatorShared/UI/Platform/Settings/Settings/ExportItems/ExportItemsView.swift index 403ccd736..e7655afba 100644 --- a/AuthenticatorShared/UI/Platform/Settings/Settings/ExportItems/ExportItemsView.swift +++ b/AuthenticatorShared/UI/Platform/Settings/Settings/ExportItems/ExportItemsView.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import SwiftUI diff --git a/AuthenticatorShared/UI/Platform/Settings/Settings/ImportItems/ImportItemsView.swift b/AuthenticatorShared/UI/Platform/Settings/Settings/ImportItems/ImportItemsView.swift index 4849829a1..6492e75c3 100644 --- a/AuthenticatorShared/UI/Platform/Settings/Settings/ImportItems/ImportItemsView.swift +++ b/AuthenticatorShared/UI/Platform/Settings/Settings/ImportItems/ImportItemsView.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import SwiftUI diff --git a/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemState.swift b/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemState.swift index b5c3c0f83..2e4648e02 100644 --- a/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemState.swift +++ b/AuthenticatorShared/UI/Vault/AuthenticatorItem/AuthenticatorItemState.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import BitwardenSdk import Foundation diff --git a/BitwardenShared/UI/Platform/Application/Extensions/View+OnSizeChanged.swift b/BitwardenKit/UI/Platform/Application/Extensions/View+OnSizeChanged.swift similarity index 99% rename from BitwardenShared/UI/Platform/Application/Extensions/View+OnSizeChanged.swift rename to BitwardenKit/UI/Platform/Application/Extensions/View+OnSizeChanged.swift index 7da98e7ad..4a686f68a 100644 --- a/BitwardenShared/UI/Platform/Application/Extensions/View+OnSizeChanged.swift +++ b/BitwardenKit/UI/Platform/Application/Extensions/View+OnSizeChanged.swift @@ -1,6 +1,6 @@ import SwiftUI -extension View { +public extension View { /// A view modifier that calculates the size of the containing view. /// /// - Parameter perform: A closure called when the size of the view changes. diff --git a/BitwardenShared/UI/Platform/Application/Views/BitwardenMenuField.swift b/BitwardenKit/UI/Platform/Application/Views/BitwardenMenuField.swift similarity index 98% rename from BitwardenShared/UI/Platform/Application/Views/BitwardenMenuField.swift rename to BitwardenKit/UI/Platform/Application/Views/BitwardenMenuField.swift index 023a41980..bd16d51d1 100644 --- a/BitwardenShared/UI/Platform/Application/Views/BitwardenMenuField.swift +++ b/BitwardenKit/UI/Platform/Application/Views/BitwardenMenuField.swift @@ -5,7 +5,7 @@ import SwiftUI /// A protocol that defines an object that can be represented and selected in /// a `BitwardenMenuField`. -protocol Menuable: Equatable, Hashable { +public protocol Menuable: Equatable, Hashable { /// The custom localizable title value for this default case, defaults to `Default`. static var defaultValueLocalizedName: String { get } @@ -17,7 +17,7 @@ protocol Menuable: Equatable, Hashable { var localizedName: String { get } } -extension Menuable { +public extension Menuable { static var defaultValueLocalizedName: String { Localizations.default } @@ -33,7 +33,7 @@ extension Menuable { /// options. This view is identical to `BitwardenTextField`, but uses a `Menu` /// instead of a `TextField` as the input mechanism. /// -struct BitwardenMenuField< +public struct BitwardenMenuField< T, AdditionalMenu: View, TitleAccessory: View, @@ -74,7 +74,7 @@ struct BitwardenMenuField< // MARK: View - var body: some View { + public var body: some View { VStack(alignment: .leading, spacing: 0) { menu @@ -175,7 +175,7 @@ struct BitwardenMenuField< /// - options: The options that the user can choose between. /// - selection: A `Binding` for the currently selected option. /// - init( + public init( title: String? = nil, footer: String? = nil, accessibilityIdentifier: String? = nil, @@ -205,7 +205,7 @@ struct BitwardenMenuField< /// - options: The options that the user can choose between. /// - selection: A `Binding` for the currently selected option. /// - init( + public init( title: String, accessibilityIdentifier: String? = nil, options: [T], @@ -233,7 +233,7 @@ struct BitwardenMenuField< /// - titleAccessoryContent: Optional title accessory view that is displayed on the trailing edge of the title. /// - trailingContent: Optional content view that is displayed to the right of the menu value. /// - init( + public init( title: String? = nil, footer: String? = nil, accessibilityIdentifier: String? = nil, @@ -262,7 +262,7 @@ struct BitwardenMenuField< /// - selection: A `Binding` for the currently selected option. /// - trailingContent: Optional content view that is displayed to the right of the menu value. /// - init( + public init( title: String? = nil, footer: String? = nil, accessibilityIdentifier: String? = nil, @@ -290,7 +290,7 @@ struct BitwardenMenuField< /// - selection: A `Binding` for the currently selected option. /// - titleAccessoryContent: Optional title accessory view that is displayed on the trailing edge of the title. /// - init( + public init( title: String? = nil, footer: String? = nil, accessibilityIdentifier: String? = nil, @@ -319,7 +319,7 @@ struct BitwardenMenuField< /// - additionalMenu: Additional menu options to display at the bottom of the menu. /// @_disfavoredOverload - init( + public init( title: String? = nil, footer: String? = nil, accessibilityIdentifier: String? = nil, diff --git a/BitwardenShared/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift b/BitwardenKit/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift similarity index 97% rename from BitwardenShared/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift rename to BitwardenKit/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift index fb41ad2ee..71396cabf 100644 --- a/BitwardenShared/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift +++ b/BitwardenKit/UI/Platform/Application/Views/BitwardenMenuFieldTests.swift @@ -1,9 +1,8 @@ +import BitwardenKit import SwiftUI import ViewInspector import XCTest -@testable import BitwardenShared - class BitwardenMenuFieldTests: BitwardenTestCase { // MARK: Types diff --git a/BitwardenShared/Core/Platform/Models/Domain/DefaultableType.swift b/BitwardenShared/Core/Platform/Models/Domain/DefaultableType.swift index 8f2c925b3..82b32b2ff 100644 --- a/BitwardenShared/Core/Platform/Models/Domain/DefaultableType.swift +++ b/BitwardenShared/Core/Platform/Models/Domain/DefaultableType.swift @@ -1,3 +1,4 @@ +import BitwardenKit import Foundation // MARK: - DefaultableType diff --git a/BitwardenShared/Core/Platform/Models/Enum/AppTheme.swift b/BitwardenShared/Core/Platform/Models/Enum/AppTheme.swift index 05e3a51b6..ed5757a2a 100644 --- a/BitwardenShared/Core/Platform/Models/Enum/AppTheme.swift +++ b/BitwardenShared/Core/Platform/Models/Enum/AppTheme.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import UIKit @@ -23,10 +24,10 @@ public enum AppTheme: String, Menuable, Sendable { // MARK: Properties /// Specify the text for the default option. - static var defaultValueLocalizedName: String { Localizations.defaultSystem } + public static var defaultValueLocalizedName: String { Localizations.defaultSystem } /// The name of the type to display in the dropdown menu. - var localizedName: String { + public var localizedName: String { switch self { case .dark: Localizations.dark diff --git a/BitwardenShared/Core/Platform/Models/Enum/ClearClipboardValue.swift b/BitwardenShared/Core/Platform/Models/Enum/ClearClipboardValue.swift index 575b72f3a..9347a331e 100644 --- a/BitwardenShared/Core/Platform/Models/Enum/ClearClipboardValue.swift +++ b/BitwardenShared/Core/Platform/Models/Enum/ClearClipboardValue.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import Foundation diff --git a/BitwardenShared/Core/Platform/Models/Enum/ExportFormatType.swift b/BitwardenShared/Core/Platform/Models/Enum/ExportFormatType.swift index 3c4b8b76c..da4acd673 100644 --- a/BitwardenShared/Core/Platform/Models/Enum/ExportFormatType.swift +++ b/BitwardenShared/Core/Platform/Models/Enum/ExportFormatType.swift @@ -1,3 +1,5 @@ +import BitwardenKit + // MARK: - ExportFormatType /// An enum describing the format of the vault export. diff --git a/BitwardenShared/Core/Platform/Models/Enum/FlightRecorderLoggingDuration.swift b/BitwardenShared/Core/Platform/Models/Enum/FlightRecorderLoggingDuration.swift index c6c8917e9..48295c02b 100644 --- a/BitwardenShared/Core/Platform/Models/Enum/FlightRecorderLoggingDuration.swift +++ b/BitwardenShared/Core/Platform/Models/Enum/FlightRecorderLoggingDuration.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import Foundation diff --git a/BitwardenShared/Core/Tools/Models/Enum/ForwardedEmailServiceType.swift b/BitwardenShared/Core/Tools/Models/Enum/ForwardedEmailServiceType.swift index 070dab200..4d1ed0176 100644 --- a/BitwardenShared/Core/Tools/Models/Enum/ForwardedEmailServiceType.swift +++ b/BitwardenShared/Core/Tools/Models/Enum/ForwardedEmailServiceType.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources /// The service used to generate a forwarded email alias. diff --git a/BitwardenShared/Core/Tools/Models/Enum/PasswordGeneratorType.swift b/BitwardenShared/Core/Tools/Models/Enum/PasswordGeneratorType.swift index a758ba2e9..75d107999 100644 --- a/BitwardenShared/Core/Tools/Models/Enum/PasswordGeneratorType.swift +++ b/BitwardenShared/Core/Tools/Models/Enum/PasswordGeneratorType.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources /// The type of password to generate. diff --git a/BitwardenShared/Core/Tools/Models/Enum/SendDeletionDateType.swift b/BitwardenShared/Core/Tools/Models/Enum/SendDeletionDateType.swift index 934ec0478..c88545651 100644 --- a/BitwardenShared/Core/Tools/Models/Enum/SendDeletionDateType.swift +++ b/BitwardenShared/Core/Tools/Models/Enum/SendDeletionDateType.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import Foundation diff --git a/BitwardenShared/Core/Tools/Models/Enum/SendType.swift b/BitwardenShared/Core/Tools/Models/Enum/SendType.swift index 02947bbec..8da814f76 100644 --- a/BitwardenShared/Core/Tools/Models/Enum/SendType.swift +++ b/BitwardenShared/Core/Tools/Models/Enum/SendType.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import BitwardenSdk @@ -18,7 +19,7 @@ public enum SendType: Int, CaseIterable, Codable, Equatable, Identifiable, Menua // MARK: Properties - var accessibilityId: String { + public var accessibilityId: String { switch self { case .text: "SendTextButton" case .file: "SendFileButton" diff --git a/BitwardenShared/Core/Tools/Models/Enum/UsernameEmailType.swift b/BitwardenShared/Core/Tools/Models/Enum/UsernameEmailType.swift index 7842df8f5..47e605293 100644 --- a/BitwardenShared/Core/Tools/Models/Enum/UsernameEmailType.swift +++ b/BitwardenShared/Core/Tools/Models/Enum/UsernameEmailType.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources /// The value to use when generating a plus-addressed or catch-all email. diff --git a/BitwardenShared/Core/Tools/Models/Enum/UsernameGeneratorType.swift b/BitwardenShared/Core/Tools/Models/Enum/UsernameGeneratorType.swift index d0cc28646..dc81af330 100644 --- a/BitwardenShared/Core/Tools/Models/Enum/UsernameGeneratorType.swift +++ b/BitwardenShared/Core/Tools/Models/Enum/UsernameGeneratorType.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources /// The type of username to generate. diff --git a/BitwardenShared/Core/Vault/Extensions/BitwardenSdk+Vault.swift b/BitwardenShared/Core/Vault/Extensions/BitwardenSdk+Vault.swift index c8204bb0c..482aec1e8 100644 --- a/BitwardenShared/Core/Vault/Extensions/BitwardenSdk+Vault.swift +++ b/BitwardenShared/Core/Vault/Extensions/BitwardenSdk+Vault.swift @@ -737,11 +737,11 @@ extension BitwardenSdk.Folder { } extension BitwardenSdk.FolderView: Menuable, @unchecked @retroactive Sendable, TreeNodeModel { - static var defaultValueLocalizedName: String { + public static var defaultValueLocalizedName: String { Localizations.folderNone } - var localizedName: String { + public var localizedName: String { name } } diff --git a/BitwardenShared/Core/Vault/Models/Domain/CipherOwner.swift b/BitwardenShared/Core/Vault/Models/Domain/CipherOwner.swift index 3b4dc1792..a83c6eeb1 100644 --- a/BitwardenShared/Core/Vault/Models/Domain/CipherOwner.swift +++ b/BitwardenShared/Core/Vault/Models/Domain/CipherOwner.swift @@ -1,3 +1,5 @@ +import BitwardenKit + // MARK: - CipherOwner /// A type to describe the owner of a cipher. @@ -15,7 +17,7 @@ public enum CipherOwner: Equatable, Hashable, Menuable, Sendable { return true } - var localizedName: String { + public var localizedName: String { switch self { case let .organization(_, name): name diff --git a/BitwardenShared/Core/Vault/Models/Enum/CipherType.swift b/BitwardenShared/Core/Vault/Models/Enum/CipherType.swift index c042c805d..3f09a1125 100644 --- a/BitwardenShared/Core/Vault/Models/Enum/CipherType.swift +++ b/BitwardenShared/Core/Vault/Models/Enum/CipherType.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources /// An enum describing the type of data contained in a cipher. @@ -51,7 +52,7 @@ extension CipherType: CaseIterable { } extension CipherType: Menuable { - var localizedName: String { + public var localizedName: String { switch self { case .card: Localizations.typeCard case .identity: Localizations.typeIdentity diff --git a/BitwardenShared/Core/Vault/Models/Enum/FieldType.swift b/BitwardenShared/Core/Vault/Models/Enum/FieldType.swift index b4dfe6f7c..655dcbbe9 100644 --- a/BitwardenShared/Core/Vault/Models/Enum/FieldType.swift +++ b/BitwardenShared/Core/Vault/Models/Enum/FieldType.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources /// The type of data stored in a cipher custom field. diff --git a/BitwardenShared/Core/Vault/Models/Enum/TitleType.swift b/BitwardenShared/Core/Vault/Models/Enum/TitleType.swift index 79ac0e04e..1a2854574 100644 --- a/BitwardenShared/Core/Vault/Models/Enum/TitleType.swift +++ b/BitwardenShared/Core/Vault/Models/Enum/TitleType.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources /// An enum that describes how a Identity title should be matched. diff --git a/BitwardenShared/Core/Vault/Models/Enum/UriMatchType.swift b/BitwardenShared/Core/Vault/Models/Enum/UriMatchType.swift index 1cb14839c..5ce39eda2 100644 --- a/BitwardenShared/Core/Vault/Models/Enum/UriMatchType.swift +++ b/BitwardenShared/Core/Vault/Models/Enum/UriMatchType.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources /// An enum that describes how a URI should be matched for autofill to occur. diff --git a/BitwardenShared/UI/Platform/Application/Extensions/View+GuidedTourStep.swift b/BitwardenShared/UI/Platform/Application/Extensions/View+GuidedTourStep.swift index b2b94aebe..bd877de02 100644 --- a/BitwardenShared/UI/Platform/Application/Extensions/View+GuidedTourStep.swift +++ b/BitwardenShared/UI/Platform/Application/Extensions/View+GuidedTourStep.swift @@ -1,3 +1,4 @@ +import BitwardenKit import SwiftUI extension View { diff --git a/BitwardenShared/UI/Platform/Application/Views/BitwardenSegmentedControl.swift b/BitwardenShared/UI/Platform/Application/Views/BitwardenSegmentedControl.swift index b82c8c2de..2d2762a09 100644 --- a/BitwardenShared/UI/Platform/Application/Views/BitwardenSegmentedControl.swift +++ b/BitwardenShared/UI/Platform/Application/Views/BitwardenSegmentedControl.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import SwiftUI diff --git a/BitwardenShared/UI/Platform/Application/Views/BitwardenSegmentedControlTests.swift b/BitwardenShared/UI/Platform/Application/Views/BitwardenSegmentedControlTests.swift index 061c033bf..da9a06f8e 100644 --- a/BitwardenShared/UI/Platform/Application/Views/BitwardenSegmentedControlTests.swift +++ b/BitwardenShared/UI/Platform/Application/Views/BitwardenSegmentedControlTests.swift @@ -1,3 +1,4 @@ +import BitwardenKit import SwiftUI import ViewInspector import XCTest diff --git a/BitwardenShared/UI/Platform/Application/Views/FormFields/FormMenuFieldView.swift b/BitwardenShared/UI/Platform/Application/Views/FormFields/FormMenuFieldView.swift index 60039fca5..b4bc75f43 100644 --- a/BitwardenShared/UI/Platform/Application/Views/FormFields/FormMenuFieldView.swift +++ b/BitwardenShared/UI/Platform/Application/Views/FormFields/FormMenuFieldView.swift @@ -1,3 +1,4 @@ +import BitwardenKit import SwiftUI // MARK: - FormMenuField diff --git a/BitwardenShared/UI/Platform/Application/Views/SettingsMenuField.swift b/BitwardenShared/UI/Platform/Application/Views/SettingsMenuField.swift index 4f2ded212..ca5f0180c 100644 --- a/BitwardenShared/UI/Platform/Application/Views/SettingsMenuField.swift +++ b/BitwardenShared/UI/Platform/Application/Views/SettingsMenuField.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import SwiftUI diff --git a/BitwardenShared/UI/Platform/Application/Views/SettingsMenuFieldTests.swift b/BitwardenShared/UI/Platform/Application/Views/SettingsMenuFieldTests.swift index a43270e13..1ee09a6ba 100644 --- a/BitwardenShared/UI/Platform/Application/Views/SettingsMenuFieldTests.swift +++ b/BitwardenShared/UI/Platform/Application/Views/SettingsMenuFieldTests.swift @@ -1,3 +1,4 @@ +import BitwardenKit import SwiftUI import ViewInspector import XCTest diff --git a/BitwardenShared/UI/Platform/Settings/Settings/About/EnableFlightRecorder/EnableFlightRecorderView.swift b/BitwardenShared/UI/Platform/Settings/Settings/About/EnableFlightRecorder/EnableFlightRecorderView.swift index fb5c4ee4f..06e7afd3d 100644 --- a/BitwardenShared/UI/Platform/Settings/Settings/About/EnableFlightRecorder/EnableFlightRecorderView.swift +++ b/BitwardenShared/UI/Platform/Settings/Settings/About/EnableFlightRecorder/EnableFlightRecorderView.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import SwiftUI diff --git a/BitwardenShared/UI/Platform/Settings/Settings/AccountSecurity/AccountSecurityState.swift b/BitwardenShared/UI/Platform/Settings/Settings/AccountSecurity/AccountSecurityState.swift index a8ce39c1e..b0cd8b72d 100644 --- a/BitwardenShared/UI/Platform/Settings/Settings/AccountSecurity/AccountSecurityState.swift +++ b/BitwardenShared/UI/Platform/Settings/Settings/AccountSecurity/AccountSecurityState.swift @@ -21,7 +21,7 @@ public enum UnlockMethod { /// An enumeration of session timeout values to choose from. /// -extension SessionTimeoutValue: @retroactive CaseIterable, Menuable { +extension SessionTimeoutValue: @retroactive CaseIterable, @retroactive Menuable { /// All of the cases to show in the menu. public static let allCases: [Self] = [ .immediately, @@ -37,7 +37,7 @@ extension SessionTimeoutValue: @retroactive CaseIterable, Menuable { ] /// The localized string representation of a `SessionTimeoutValue`. - var localizedName: String { + public var localizedName: String { switch self { case .immediately: Localizations.immediately @@ -77,7 +77,7 @@ public enum SessionTimeoutAction: Int, CaseIterable, Codable, Equatable, Menuabl /// All of the cases to show in the menu. public static let allCases: [SessionTimeoutAction] = [.lock, .logout] - var localizedName: String { + public var localizedName: String { switch self { case .lock: Localizations.lock diff --git a/BitwardenShared/UI/Platform/Settings/Settings/Appearance/AppearanceView.swift b/BitwardenShared/UI/Platform/Settings/Settings/Appearance/AppearanceView.swift index ce15857a8..d3072ba09 100644 --- a/BitwardenShared/UI/Platform/Settings/Settings/Appearance/AppearanceView.swift +++ b/BitwardenShared/UI/Platform/Settings/Settings/Appearance/AppearanceView.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources import SwiftUI diff --git a/BitwardenShared/UI/Tools/Generator/Generator/GeneratorState.swift b/BitwardenShared/UI/Tools/Generator/Generator/GeneratorState.swift index 93fa8a1b4..2f9f6b8ec 100644 --- a/BitwardenShared/UI/Tools/Generator/Generator/GeneratorState.swift +++ b/BitwardenShared/UI/Tools/Generator/Generator/GeneratorState.swift @@ -1,3 +1,4 @@ +import BitwardenKit import BitwardenResources // swiftlint:disable file_length @@ -23,7 +24,7 @@ public enum GeneratorType: CaseIterable, Equatable, Identifiable, Menuable, Send localizedName } - var localizedName: String { + public var localizedName: String { switch self { case .passphrase: Localizations.passphrase diff --git a/BitwardenShared/UI/Vault/VaultItem/AddEditItem/AddEditCardItem/CardComponent.swift b/BitwardenShared/UI/Vault/VaultItem/AddEditItem/AddEditCardItem/CardComponent.swift index b7614e27a..9427bc501 100644 --- a/BitwardenShared/UI/Vault/VaultItem/AddEditItem/AddEditCardItem/CardComponent.swift +++ b/BitwardenShared/UI/Vault/VaultItem/AddEditItem/AddEditCardItem/CardComponent.swift @@ -1,5 +1,6 @@ // MARK: - CardComponent +import BitwardenKit import BitwardenResources import Foundation diff --git a/GlobalTestHelpers-bwa/Extensions/InspectableView.swift b/GlobalTestHelpers-bwa/Extensions/InspectableView.swift index 95278cd93..0f1d07741 100644 --- a/GlobalTestHelpers-bwa/Extensions/InspectableView.swift +++ b/GlobalTestHelpers-bwa/Extensions/InspectableView.swift @@ -31,7 +31,7 @@ struct BitwardenMenuFieldType: BaseViewType { static var typePrefix: String = "BitwardenMenuField" static var namespacedPrefixes: [String] = [ - "AuthenticatorShared.BitwardenMenuField", + "BitwardenKit.BitwardenMenuField", ] } diff --git a/GlobalTestHelpers/Extensions/InspectableView.swift b/GlobalTestHelpers/Extensions/InspectableView.swift index 78ff15e0f..45eb28623 100644 --- a/GlobalTestHelpers/Extensions/InspectableView.swift +++ b/GlobalTestHelpers/Extensions/InspectableView.swift @@ -67,7 +67,7 @@ struct BitwardenMenuFieldType: BaseViewType { static var typePrefix: String = "BitwardenMenuField" static var namespacedPrefixes: [String] = [ - "BitwardenShared.BitwardenMenuField", + "BitwardenKit.BitwardenMenuField", ] }