Skip to content

Commit d4c37a5

Browse files
[PM-21128] Hide the maximum access count info for View Send (#1630)
1 parent d8b0e52 commit d4c37a5

File tree

6 files changed

+26
-3
lines changed

6 files changed

+26
-3
lines changed

BitwardenShared/UI/Tools/Send/SendItem/AddEditSendItem/SendItemAccessCountStepper.swift

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ struct SendItemAccessCountStepper: View {
1010
/// The number of times the send has been accessed.
1111
let currentAccessCount: Int?
1212

13+
/// Whether the maximum access count info text should be displayed in the footer.
14+
let displayInfoText: Bool
15+
1316
/// A binding for changing the maximum access account for the send in the stepper.
1417
@Binding var maximumAccessCount: Int
1518

@@ -28,9 +31,11 @@ struct SendItemAccessCountStepper: View {
2831
.foregroundStyle(Asset.Colors.textPrimary.swiftUIColor)
2932
} footer: {
3033
VStack(alignment: .leading, spacing: 2) {
31-
Text(Localizations.maximumAccessCountInfo)
32-
.styleGuide(.footnote)
33-
.foregroundColor(Asset.Colors.textSecondary.swiftUIColor)
34+
if displayInfoText {
35+
Text(Localizations.maximumAccessCountInfo)
36+
.styleGuide(.footnote)
37+
.foregroundColor(Asset.Colors.textSecondary.swiftUIColor)
38+
}
3439

3540
if let currentAccessCount {
3641
// Wrap these texts in a group so that the style guide can be set on
@@ -48,6 +53,21 @@ struct SendItemAccessCountStepper: View {
4853
.accessibilityIdentifier("SendMaxAccessCountEntry")
4954
}
5055
}
56+
57+
// MARK: Initialization
58+
59+
/// Initialize a `SendItemAccessCountStepper`.
60+
///
61+
/// - Parameters:
62+
/// - currentAccessCount: The number of times the send has been accessed.
63+
/// - displayInfoText: Whether the maximum access count info text should be displayed in the footer.
64+
/// - maximumAccessCount: A binding for changing the maximum access account for the send in the stepper.
65+
///
66+
init(currentAccessCount: Int?, displayInfoText: Bool = true, maximumAccessCount: Binding<Int>) {
67+
self.currentAccessCount = currentAccessCount
68+
self.displayInfoText = displayInfoText
69+
_maximumAccessCount = maximumAccessCount
70+
}
5171
}
5272

5373
// MARK: - Previews

BitwardenShared/UI/Tools/Send/SendItem/ViewSendItem/ViewSendItemView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct ViewSendItemView: View {
6161
deleteSendButton
6262
}
6363
.animation(.default, value: store.state.isAdditionalOptionsExpanded)
64+
.padding(.bottom, FloatingActionButton.bottomOffsetPadding)
6465
}
6566

6667
/// The expandable additional options section.
@@ -77,6 +78,7 @@ struct ViewSendItemView: View {
7778
if let maxAccessCount = store.state.sendView.maxAccessCount {
7879
SendItemAccessCountStepper(
7980
currentAccessCount: Int(store.state.sendView.accessCount),
81+
displayInfoText: false,
8082
maximumAccessCount: .constant(Int(maxAccessCount))
8183
)
8284
.disabled(true)

BitwardenShared/UI/Tools/Send/SendItem/ViewSendItem/ViewSendItemViewTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ class ViewSendItemViewTests: BitwardenTestCase {
100100
name: "My text send",
101101
notes: "Private notes for the send",
102102
text: .fixture(text: "Some text to send"),
103+
maxAccessCount: 3,
103104
),
104105
shareURL: URL(string: "send.bitwarden.com/39ngaol3")
105106
)

0 commit comments

Comments
 (0)