diff --git a/BitwardenShared/Core/Tools/Models/Enum/SendExpirationDateType.swift b/BitwardenShared/Core/Tools/Models/Enum/SendExpirationDateType.swift deleted file mode 100644 index 53dae8511..000000000 --- a/BitwardenShared/Core/Tools/Models/Enum/SendExpirationDateType.swift +++ /dev/null @@ -1,75 +0,0 @@ -import Foundation - -// MARK: - SendExpirationDateType - -/// An object that repsents the options available when setting the expiration period for a Send Item. -/// -enum SendExpirationDateType: CaseIterable, Menuable { - /// A never ending time period. - case never - - /// A time period of one hour. - case oneHour - - /// A time period of one day. - case oneDay - - /// A time period of two days. - case twoDays - - /// A time period of three days. - case threeDays - - /// A time period of seven days. - case sevenDays - - /// A time period of thirty days. - case thirtyDays - - /// A custom time period. - case custom - - // MARK: Properties - - var localizedName: String { - switch self { - case .never: Localizations.never - case .oneHour: Localizations.oneHour - case .oneDay: Localizations.oneDay - case .twoDays: Localizations.twoDays - case .threeDays: Localizations.threeDays - case .sevenDays: Localizations.sevenDays - case .thirtyDays: Localizations.thirtyDays - case .custom: Localizations.custom - } - } - - // MARK: Methods - - /// Calculates the date representation of this value. - /// - /// - Parameters: - /// - originDate: The date that this calculation should be based on. Defaults to `Date()`. - /// - customValue: This value will be used when this value is `.custom`. - /// - func calculateDate(from originDate: Date = Date(), customValue: Date?) -> Date? { - switch self { - case .never: - nil - case .oneHour: - Calendar.current.date(byAdding: .hour, value: 1, to: originDate) - case .oneDay: - Calendar.current.date(byAdding: .day, value: 1, to: originDate) - case .twoDays: - Calendar.current.date(byAdding: .day, value: 2, to: originDate) - case .threeDays: - Calendar.current.date(byAdding: .day, value: 3, to: originDate) - case .sevenDays: - Calendar.current.date(byAdding: .day, value: 7, to: originDate) - case .thirtyDays: - Calendar.current.date(byAdding: .day, value: 30, to: originDate) - case .custom: - customValue - } - } -} diff --git a/BitwardenShared/Core/Tools/Models/Enum/SendExpirationDateTypeTests.swift b/BitwardenShared/Core/Tools/Models/Enum/SendExpirationDateTypeTests.swift deleted file mode 100644 index b02082548..000000000 --- a/BitwardenShared/Core/Tools/Models/Enum/SendExpirationDateTypeTests.swift +++ /dev/null @@ -1,39 +0,0 @@ -import XCTest - -@testable import BitwardenShared - -// MARK: - SendExpirationDateTypeTests - -class SendExpirationDateTypeTests: BitwardenTestCase { - // MARK: Tests - - /// `calculateDate()` returns the correct date. - func test_calculateDate() { - let originDate = Date(year: 2023, month: 11, day: 5) - let customDate = Date(year: 2024, month: 1, day: 19) - - let never = SendExpirationDateType.never.calculateDate(from: originDate, customValue: customDate) - XCTAssertNil(never) - - let oneHour = SendExpirationDateType.oneHour.calculateDate(from: originDate, customValue: customDate) - XCTAssertEqual(oneHour, Date(year: 2023, month: 11, day: 5, hour: 1)) - - let oneDay = SendExpirationDateType.oneDay.calculateDate(from: originDate, customValue: customDate) - XCTAssertEqual(oneDay, Date(year: 2023, month: 11, day: 6)) - - let twoDays = SendExpirationDateType.twoDays.calculateDate(from: originDate, customValue: customDate) - XCTAssertEqual(twoDays, Date(year: 2023, month: 11, day: 7)) - - let threeDays = SendExpirationDateType.threeDays.calculateDate(from: originDate, customValue: customDate) - XCTAssertEqual(threeDays, Date(year: 2023, month: 11, day: 8)) - - let sevenDays = SendExpirationDateType.sevenDays.calculateDate(from: originDate, customValue: customDate) - XCTAssertEqual(sevenDays, Date(year: 2023, month: 11, day: 12)) - - let thirtyDays = SendExpirationDateType.thirtyDays.calculateDate(from: originDate, customValue: customDate) - XCTAssertEqual(thirtyDays, Date(year: 2023, month: 12, day: 5)) - - let custom = SendExpirationDateType.custom.calculateDate(from: originDate, customValue: customDate) - XCTAssertEqual(custom, Date(year: 2024, month: 1, day: 19)) - } -} diff --git a/BitwardenShared/UI/Platform/Application/Support/Colors.xcassets/Legacy/Contents.json b/BitwardenShared/UI/Platform/Application/Support/Colors.xcassets/Legacy/Contents.json deleted file mode 100644 index 6e965652d..000000000 --- a/BitwardenShared/UI/Platform/Application/Support/Colors.xcassets/Legacy/Contents.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - }, - "properties" : { - "provides-namespace" : true - } -} diff --git a/BitwardenShared/UI/Platform/Application/Support/Colors.xcassets/Legacy/fillTertiary.colorset/Contents.json b/BitwardenShared/UI/Platform/Application/Support/Colors.xcassets/Legacy/fillTertiary.colorset/Contents.json deleted file mode 100644 index 91c0f3375..000000000 --- a/BitwardenShared/UI/Platform/Application/Support/Colors.xcassets/Legacy/fillTertiary.colorset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0xF0", - "green" : "0xEF", - "red" : "0xEF" - } - }, - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "1.000", - "blue" : "0x66", - "green" : "0x63", - "red" : "0x63" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/BitwardenShared/UI/Platform/Application/Support/Localizations/en.lproj/Localizable.strings b/BitwardenShared/UI/Platform/Application/Support/Localizations/en.lproj/Localizable.strings index 53618a2b6..b7f912353 100644 --- a/BitwardenShared/UI/Platform/Application/Support/Localizations/en.lproj/Localizable.strings +++ b/BitwardenShared/UI/Platform/Application/Support/Localizations/en.lproj/Localizable.strings @@ -563,9 +563,7 @@ "DeletionTime" = "Deletion time"; "DeletionDateInfo" = "The Send will be permanently deleted on the specified date and time."; "PendingDelete" = "Pending deletion"; -"ExpirationDate" = "Expiration date"; "ExpirationTime" = "Expiration time"; -"ExpirationDateInfo" = "If set, access to this Send will expire on the specified date and time."; "Expired" = "Expired"; "MaximumAccessCount" = "Maximum access count"; "MaximumAccessCountInfo" = "If set, users will no longer be able to access this Send once the maximum access count is reached."; diff --git a/BitwardenShared/UI/Platform/Application/Views/BitwardenDatePicker.swift b/BitwardenShared/UI/Platform/Application/Views/BitwardenDatePicker.swift deleted file mode 100644 index 7bd350c2b..000000000 --- a/BitwardenShared/UI/Platform/Application/Views/BitwardenDatePicker.swift +++ /dev/null @@ -1,156 +0,0 @@ -import SwiftUI - -// MARK: - BitwardenDatePicker - -/// A view that uses wraps a SwiftUI date picker in a custom label. -/// -struct BitwardenDatePicker: View { - // MARK: Private Properties - - /// The date picker's current size. - @SwiftUI.State private var datePickerSize: CGSize = .zero - - /// The property used to track the non-nil selection state of the underlying date pickers. - @SwiftUI.State private var nonNilSelection: Date - - // MARK: Properties - - /// The accessibility identifier for the date picker. - var accessibilityIdentifier: String? - - /// The date value being displayed and selected. - @Binding var selection: Date? - - /// The date components to display in this picker. - var displayComponents: DatePicker.Components = .date - - // MARK: View - - var body: some View { - ZStack(alignment: .center) { - // A hidden date picker used to calculate the size for the scaled metrics of the actual - // date picker below. - DatePicker("", selection: $nonNilSelection, displayedComponents: displayComponents) - .background( - GeometryReader { reader in - Color.clear.onAppear { - datePickerSize = reader.size - } - } - ) - .labelsHidden() - .allowsHitTesting(false) - .fixedSize() - .opacity(0) - - GeometryReader { reader in - // The actual date picker used for user interaction, scaled to fit the same size as - // the content displayed above it. - DatePicker("", selection: $nonNilSelection, displayedComponents: displayComponents) - .scaleEffect( - x: reader.size.width / datePickerSize.width, - y: reader.size.height / datePickerSize.height, - anchor: .topLeading - ) - .labelsHidden() - // Set an extremely low opacity here to hide this DatePicker from view while - // simultaneously allowing to still receive touch events. This is the lowest - // opacity value that still allows user interaction. - .opacity(0.1) - .accessibilityIdentifier(accessibilityIdentifier ?? "") - - HStack { - Spacer() - - if let selection { - switch displayComponents { - case .date: - Text(selection.formatted(date: .numeric, time: .omitted)) - case .hourAndMinute: - Text(selection.formatted(date: .omitted, time: .shortened)) - default: - Text(selection.formatted(date: .numeric, time: .shortened)) - } - } else { - switch displayComponents { - case .date: - Text("mm/dd/yyyy") - case .hourAndMinute: - Text("--:-- --") - default: - Text("mm/dd/yyyy --:-- --") - } - } - - Spacer() - } - .styleGuide(.subheadline) - .frame(maxWidth: .infinity) - .padding(8) - .background(Asset.Colors.Legacy.fillTertiary.swiftUIColor) - .foregroundStyle(Asset.Colors.textInteraction.swiftUIColor) - .clipShape(Capsule()) - // Turn off hit testing here so that the DatePicker above receives all user interaction. - .allowsHitTesting(false) - } - } - .onChange(of: nonNilSelection, perform: { newValue in - if selection != newValue { - selection = newValue - } - }) - .onChange(of: selection, perform: { newValue in - if let newValue, newValue != nonNilSelection { - nonNilSelection = newValue - } - }) - } - - // MARK: Initialization - - /// Creates a `BitwardenDatePicker` with an optional date binding. - /// - /// - Parameters: - /// - selection: The binding for the optional date value to display within this component. - /// - displayComponents: The date components to display in this picker. - /// - accessibilityIdentifier: The accessibility identifier for the picker. - /// - init( - selection: Binding, - displayComponents: DatePicker.Components = .date, - accessibilityIdentifier: String? = nil - ) { - _selection = selection - let nonNilStartValue = selection.wrappedValue ?? Date() - _nonNilSelection = .init(initialValue: nonNilStartValue) - self.accessibilityIdentifier = accessibilityIdentifier - self.displayComponents = displayComponents - datePickerSize = .zero - } - - /// Creates a `BitwardenDatePicker` with a date binding. - /// - /// - Parameters: - /// - selection: The binding for the date value to display within this component. - /// - displayComponents: The date components to display in this picker. - /// - accessibilityIdentifier: The accessibility identifier for the picker. - /// - init( - selection: Binding, - displayComponents: DatePicker.Components = .date, - accessibilityIdentifier: String? = nil - ) { - _selection = Binding( - get: { - selection.wrappedValue - }, set: { newValue in - selection.wrappedValue = newValue ?? Date() - } - ) - let nonNilStartValue = selection.wrappedValue - _nonNilSelection = .init(initialValue: nonNilStartValue) - self.accessibilityIdentifier = accessibilityIdentifier - self.displayComponents = displayComponents - datePickerSize = .zero - } -} diff --git a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemAction.swift b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemAction.swift index 376ffaaf6..5f2983ac6 100644 --- a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemAction.swift +++ b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemAction.swift @@ -8,12 +8,6 @@ enum AddEditSendItemAction: Equatable { /// The choose file button was pressed. case chooseFilePressed - /// The clear expiration date button was pressed. - case clearExpirationDatePressed - - /// The custom expiration date was changed. - case customExpirationDateChanged(Date?) - /// The deactivate this send toggle was changed. case deactivateThisSendChanged(Bool) @@ -23,9 +17,6 @@ enum AddEditSendItemAction: Equatable { /// The dismiss button was pressed. case dismissPressed - /// The expiration date was changed. - case expirationDateChanged(SendExpirationDateType) - /// The hide my email toggle was changed. case hideMyEmailChanged(Bool) diff --git a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemProcessor.swift b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemProcessor.swift index 2ac1d4b74..2d32519c1 100644 --- a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemProcessor.swift +++ b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemProcessor.swift @@ -86,16 +86,10 @@ class AddEditSendItemProcessor: switch action { case .chooseFilePressed: presentFileSelectionAlert() - case .clearExpirationDatePressed: - state.customExpirationDate = nil - case let .customExpirationDateChanged(newValue): - state.customExpirationDate = newValue case let .deactivateThisSendChanged(newValue): state.isDeactivateThisSendOn = newValue case let .deletionDateChanged(newValue): state.deletionDate = newValue - case let .expirationDateChanged(newValue): - state.expirationDate = newValue case .dismissPressed: coordinator.navigate(to: .cancel) case let .hideMyEmailChanged(newValue): diff --git a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemProcessorTests.swift b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemProcessorTests.swift index 5d15b6138..1dd543988 100644 --- a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemProcessorTests.swift +++ b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemProcessorTests.swift @@ -502,24 +502,6 @@ class AddEditSendItemProcessorTests: BitwardenTestCase { // swiftlint:disable:th XCTAssertIdentical(coordinator.contexts.last as? FileSelectionDelegate, subject) } - /// `receive(_:)` with `.clearExpirationDatePressed` removes the expiration date. - @MainActor - func test_receive_clearExpirationDatePressed() { - subject.state.customExpirationDate = Date(year: 2023, month: 11, day: 5) - subject.receive(.clearExpirationDatePressed) - - XCTAssertNil(subject.state.customExpirationDate) - } - - /// `receive(_:)` with `.customExpirationDateChanged` updates the custom expiration date. - @MainActor - func test_receive_customExpirationDateChanged() { - subject.state.customExpirationDate = Date(year: 2000, month: 5, day: 5) - subject.receive(.customExpirationDateChanged(Date(year: 2023, month: 11, day: 5))) - - XCTAssertEqual(subject.state.customExpirationDate, Date(year: 2023, month: 11, day: 5)) - } - /// `receive(_:)` with `.deactivateThisSendChanged` updates the deactivate this send toggle. @MainActor func test_receive_deactivateThisSendChanged() { @@ -546,15 +528,6 @@ class AddEditSendItemProcessorTests: BitwardenTestCase { // swiftlint:disable:th XCTAssertEqual(coordinator.routes.last, .cancel) } - /// `receive(_:)` with `.expirationDateChanged` updates the expiration date. - @MainActor - func test_receive_expirationDateChanged() { - subject.state.expirationDate = .sevenDays - subject.receive(.expirationDateChanged(.thirtyDays)) - - XCTAssertEqual(subject.state.expirationDate, .thirtyDays) - } - /// `receive(_:)` with `.hideMyEmailChanged` updates the hide my email toggle. @MainActor func test_receive_hideMyEmailChanged() { diff --git a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemState.swift b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemState.swift index 3c6eb0d0a..2a08d858a 100644 --- a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemState.swift +++ b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemState.swift @@ -43,14 +43,11 @@ struct AddEditSendItemState: Equatable, Sendable { /// The custom deletion date. var customDeletionDate = Date.midnightOneWeekFromToday() ?? Date() - /// The custom expiration date. - var customExpirationDate: Date? - /// The deletion date for this item. var deletionDate: SendDeletionDateType = .sevenDays /// The expiration date for this item. - var expirationDate: SendExpirationDateType = .never + var expirationDate: Date? /// The data for the selected file. var fileData: Data? @@ -146,9 +143,8 @@ extension AddEditSendItemState { accessId: sendView.accessId, currentAccessCount: Int(sendView.accessCount), customDeletionDate: sendView.deletionDate, - customExpirationDate: sendView.expirationDate, deletionDate: .custom(sendView.deletionDate), - expirationDate: .custom, + expirationDate: sendView.expirationDate, fileData: nil, fileName: sendView.file?.fileName, fileSize: sendView.file?.sizeName, @@ -191,7 +187,7 @@ extension AddEditSendItemState { hideEmail: isHideMyEmailOn, revisionDate: Date(), deletionDate: deletionDate.calculateDate() ?? Date(), - expirationDate: expirationDate.calculateDate(customValue: customExpirationDate) + expirationDate: expirationDate ) } diff --git a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemStateTests.swift b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemStateTests.swift index 90be140b4..7aac6e6c1 100644 --- a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemStateTests.swift +++ b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemStateTests.swift @@ -41,9 +41,7 @@ class AddEditSendItemStateTests: BitwardenTestCase { let date = Date(year: 2023, month: 11, day: 5) let subject = AddEditSendItemState( customDeletionDate: date, - customExpirationDate: date, deletionDate: .custom(date), - expirationDate: .never, isDeactivateThisSendOn: true, isHideMyEmailOn: false, isHideTextByDefaultOn: true, @@ -120,7 +118,7 @@ class AddEditSendItemStateTests: BitwardenTestCase { Date(year: 2023, month: 11, day: 5, hour: 9, minute: 41, second: 11) ) XCTAssertEqual( - subject.customExpirationDate, + subject.expirationDate, Date(year: 2023, month: 11, day: 5, hour: 9, minute: 41, second: 22) ) } @@ -168,7 +166,7 @@ class AddEditSendItemStateTests: BitwardenTestCase { Date(year: 2023, month: 11, day: 5, hour: 9, minute: 41, second: 11) ) XCTAssertEqual( - subject.customExpirationDate, + subject.expirationDate, Date(year: 2023, month: 11, day: 5, hour: 9, minute: 41, second: 22) ) } diff --git a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemView.swift b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemView.swift index c41897cb2..b1f7fca4c 100644 --- a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemView.swift +++ b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemView.swift @@ -127,8 +127,6 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length send: AddEditSendItemAction.toastShown )) .animation(.easeInOut(duration: 0.2), value: store.state.type) - .animation(.easeInOut(duration: 0.2), value: store.state.deletionDate) - .animation(.easeInOut(duration: 0.2), value: store.state.expirationDate) .animation(.default, value: store.state.isOptionsExpanded) .task { await store.perform(.loadData) @@ -224,81 +222,6 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length } } - /// The expiration date field. - @ViewBuilder private var expirationDate: some View { - ContentBlock(dividerLeadingPadding: 16) { - VStack(alignment: .leading, spacing: 0) { - switch store.state.mode { - case .add, - .shareExtension: - BitwardenMenuField( - title: Localizations.expirationDate, - accessibilityIdentifier: "SendExpirationOptionsPicker", - options: SendExpirationDateType.allCases, - selection: store.binding( - get: \.expirationDate, - send: AddEditSendItemAction.expirationDateChanged - ) - ) - - if store.state.expirationDate == .custom { - Divider() - .padding(.leading, 16) - } - case .edit: - Text(Localizations.expirationDate) - .styleGuide(.subheadline, weight: .semibold) - .foregroundColor(Asset.Colors.textSecondary.swiftUIColor) - .padding(.top, 12) - .padding(.horizontal, 16) - } - - if store.state.expirationDate == .custom { - AccessibleHStack(alignment: .leading, spacing: 8) { - BitwardenDatePicker( - selection: store.binding( - get: \.customExpirationDate, - send: AddEditSendItemAction.customExpirationDateChanged - ), - displayComponents: .date, - accessibilityIdentifier: "SendCustomExpirationDatePicker" - ) - - BitwardenDatePicker( - selection: store.binding( - get: \.customExpirationDate, - send: AddEditSendItemAction.customExpirationDateChanged - ), - displayComponents: .hourAndMinute, - accessibilityIdentifier: "SendCustomDeletionTimePicker" - ) - } - .padding(.horizontal, 16) - .padding(.vertical, 12) - } - } - - HStack(spacing: 8) { - Text(Localizations.expirationDateInfo) - .styleGuide(.footnote) - .foregroundColor(Asset.Colors.textSecondary.swiftUIColor) - - if store.state.mode == .edit { - Spacer() - - Button(Localizations.clear) { - store.send(.clearExpirationDatePressed) - } - .styleGuide(.body) - .tint(Asset.Colors.textInteraction.swiftUIColor) - .accessibilityIdentifier("SendClearExpirationDateButton") - } - } - .padding(.horizontal, 16) - .padding(.vertical, 12) - } - } - /// The attributes for a file type send. @ViewBuilder private var fileSendAttributes: some View { SectionView(Localizations.file, titleDesignVersion: .v2, contentSpacing: 8) { @@ -367,8 +290,6 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length /// Additional options. @ViewBuilder private var options: some View { - expirationDate - accessCount BitwardenTextField( @@ -569,22 +490,6 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length } } -#Preview("Options - Custom Dates") { - NavigationView { - AddEditSendItemView( - store: Store( - processor: StateProcessor( - state: AddEditSendItemState( - deletionDate: .custom(.now), - expirationDate: .custom, - isOptionsExpanded: true - ) - ) - ) - ) - } -} - #Preview("Text - Edit") { NavigationView { AddEditSendItemView( @@ -593,9 +498,7 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length state: AddEditSendItemState( currentAccessCount: 42, customDeletionDate: Date(), - customExpirationDate: nil, deletionDate: .custom(.now), - expirationDate: .custom, isHideTextByDefaultOn: true, isOptionsExpanded: true, mode: .edit, @@ -617,9 +520,7 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length state: AddEditSendItemState( currentAccessCount: 42, customDeletionDate: Date(), - customExpirationDate: nil, deletionDate: .custom(.now), - expirationDate: .custom, fileName: "example.txt", fileSize: "420.42 KB", isHideTextByDefaultOn: true, @@ -642,9 +543,7 @@ struct AddEditSendItemView: View { // swiftlint:disable:this type_body_length state: AddEditSendItemState( currentAccessCount: 42, customDeletionDate: Date(), - customExpirationDate: nil, deletionDate: .custom(.now), - expirationDate: .custom, isHideTextByDefaultOn: true, isOptionsExpanded: true, mode: .shareExtension(.singleAccount), diff --git a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemViewTests.swift b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemViewTests.swift index 9adf708a4..45aebb14e 100644 --- a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemViewTests.swift +++ b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/AddEditSendItemViewTests.swift @@ -70,16 +70,6 @@ class AddEditSendItemViewTests: BitwardenTestCase { // swiftlint:disable:this ty XCTAssertEqual(processor.dispatchedActions.last, .chooseFilePressed) } - /// Tapping the clear expiration date button sends the `.clearExpirationDatePressed` action. - @MainActor - func test_clearExpirationDateButton_tap() throws { - processor.state.isOptionsExpanded = true - processor.state.mode = .edit - let button = try subject.inspect().find(button: Localizations.clear) - try button.tap() - XCTAssertEqual(processor.dispatchedActions.last, .clearExpirationDatePressed) - } - /// Updating the deletion date menu sends the `.deletionDateChanged` action. @MainActor func test_deletionDateMenu_updated() throws { @@ -89,15 +79,6 @@ class AddEditSendItemViewTests: BitwardenTestCase { // swiftlint:disable:this ty XCTAssertEqual(processor.dispatchedActions.last, .deletionDateChanged(.thirtyDays)) } - /// Updating the expiration date menu sends the `.expirationDateChanged` action. - @MainActor - func test_expirationDateMenu_updated() throws { - processor.state.isOptionsExpanded = true - let menuField = try subject.inspect().find(bitwardenMenuField: Localizations.expirationDate) - try menuField.select(newValue: SendExpirationDateType.thirtyDays) - XCTAssertEqual(processor.dispatchedActions.last, .expirationDateChanged(.thirtyDays)) - } - /// Updating the maximum access count stepper sends the `.maximumAccessCountChanged` action. @MainActor func test_maximumAccessCountStepper_updated() throws { @@ -268,8 +249,6 @@ class AddEditSendItemViewTests: BitwardenTestCase { // swiftlint:disable:this ty processor.state.isHideTextByDefaultOn = true processor.state.deletionDate = .custom(deletionDate) processor.state.customDeletionDate = deletionDate - processor.state.expirationDate = .custom - processor.state.customExpirationDate = Date(year: 2023, month: 11, day: 5, hour: 9, minute: 41) processor.state.maximumAccessCount = 42 processor.state.maximumAccessCountText = "42" processor.state.password = "pa$$w0rd" @@ -289,8 +268,6 @@ class AddEditSendItemViewTests: BitwardenTestCase { // swiftlint:disable:this ty processor.state.fileSize = "420.42 KB" processor.state.deletionDate = .custom(deletionDate) processor.state.customDeletionDate = deletionDate - processor.state.expirationDate = .custom - processor.state.customExpirationDate = nil processor.state.maximumAccessCount = 420 processor.state.maximumAccessCountText = "420" processor.state.currentAccessCount = 42 @@ -340,8 +317,6 @@ class AddEditSendItemViewTests: BitwardenTestCase { // swiftlint:disable:this ty processor.state.isHideTextByDefaultOn = true processor.state.deletionDate = .custom(deletionDate) processor.state.customDeletionDate = deletionDate - processor.state.expirationDate = .custom - processor.state.customExpirationDate = Date(year: 2023, month: 11, day: 5, hour: 9, minute: 41) processor.state.maximumAccessCount = 42 processor.state.maximumAccessCountText = "42" processor.state.password = "pa$$w0rd" @@ -360,8 +335,6 @@ class AddEditSendItemViewTests: BitwardenTestCase { // swiftlint:disable:this ty processor.state.text = "Text" processor.state.deletionDate = .custom(deletionDate) processor.state.customDeletionDate = deletionDate - processor.state.expirationDate = .custom - processor.state.customExpirationDate = nil processor.state.maximumAccessCount = 420 processor.state.maximumAccessCountText = "420" processor.state.currentAccessCount = 42 diff --git a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_file_edit_withOptions_withValues.1.png b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_file_edit_withOptions_withValues.1.png index ed16ea7e6..a3fac1d94 100644 Binary files a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_file_edit_withOptions_withValues.1.png and b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_file_edit_withOptions_withValues.1.png differ diff --git a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_file_withOptions_empty.1.png b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_file_withOptions_empty.1.png index 2d26a940d..b78618a75 100644 Binary files a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_file_withOptions_empty.1.png and b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_file_withOptions_empty.1.png differ diff --git a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_file_withOptions_withValues.1.png b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_file_withOptions_withValues.1.png index 20a4efbf5..f8718d742 100644 Binary files a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_file_withOptions_withValues.1.png and b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_file_withOptions_withValues.1.png differ diff --git a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_text_edit_withOptions_withValues.1.png b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_text_edit_withOptions_withValues.1.png index 2014bfe5d..83a8e9ce9 100644 Binary files a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_text_edit_withOptions_withValues.1.png and b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_text_edit_withOptions_withValues.1.png differ diff --git a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_text_withOptions_empty.1.png b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_text_withOptions_empty.1.png index eb1dcf0ed..0c54fe146 100644 Binary files a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_text_withOptions_empty.1.png and b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_text_withOptions_empty.1.png differ diff --git a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_text_withOptions_withValues.1.png b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_text_withOptions_withValues.1.png index a502a9aaf..66e4d8b84 100644 Binary files a/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_text_withOptions_withValues.1.png and b/BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/__Snapshots__/AddEditSendItemViewTests/test_snapshot_text_withOptions_withValues.1.png differ