Skip to content

Commit 9bacbdd

Browse files
PM-18205: Removed "additional options" for secure note (#1358)
1 parent 27523e2 commit 9bacbdd

File tree

7 files changed

+59
-10
lines changed

7 files changed

+59
-10
lines changed

BitwardenShared/UI/Vault/VaultItem/ViewItem/ViewItemDetailsView.swift

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,23 @@ struct ViewItemDetailsView: View { // swiftlint:disable:this type_body_length
201201
@ViewBuilder private var notesSection: some View {
202202
if !store.state.notes.isEmpty {
203203
let notes = store.state.notes
204-
SectionView(Localizations.additionalOptions) {
205-
BitwardenTextValueField(
206-
title: Localizations.notes,
207-
value: notes,
208-
useUIKitTextView: true,
209-
copyButtonAccessibilityIdentifier: "CopyNotesButton",
210-
copyButtonAction: { store.send(.copyPressed(value: notes, field: .notes))
211-
}
212-
)
213-
}
204+
let notesView = BitwardenTextValueField(
205+
title: Localizations.notes,
206+
value: notes,
207+
useUIKitTextView: true,
208+
copyButtonAccessibilityIdentifier: "CopyNotesButton",
209+
copyButtonAction: { store.send(.copyPressed(value: notes, field: .notes))
210+
}
211+
)
214212
.accessibilityElement(children: .contain)
215213
.accessibilityIdentifier("CipherNotesLabel")
214+
if store.state.type == .secureNote {
215+
notesView
216+
} else {
217+
SectionView(Localizations.additionalOptions) {
218+
notesView
219+
}
220+
}
216221
}
217222
}
218223

BitwardenShared/UI/Vault/VaultItem/ViewItem/ViewItemView.swift

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ struct ViewItemView_Previews: PreviewProvider {
200200
]
201201
state.isMasterPasswordRePromptOn = false
202202
state.name = "Example"
203+
state.notes = "secure note"
203204
state.loginState.fido2Credentials = [
204205
.fixture(creationDate: Date(timeIntervalSince1970: 1_710_494_110)),
205206
]
@@ -221,6 +222,16 @@ struct ViewItemView_Previews: PreviewProvider {
221222
return state
222223
}
223224

225+
static var secureNoteState: CipherItemState {
226+
var state = CipherItemState(
227+
existing: cipher,
228+
hasPremium: true
229+
)!
230+
state.notes = "secure note"
231+
state.type = .secureNote
232+
return state
233+
}
234+
224235
static var sshKeyState: CipherItemState {
225236
var state = CipherItemState(
226237
existing: cipher,
@@ -261,6 +272,8 @@ struct ViewItemView_Previews: PreviewProvider {
261272

262273
loginPreview
263274

275+
secureNotePreview
276+
264277
sshKeyPreview
265278
}
266279

@@ -308,6 +321,28 @@ struct ViewItemView_Previews: PreviewProvider {
308321
.previewDisplayName("Login")
309322
}
310323

324+
@ViewBuilder static var secureNotePreview: some View {
325+
NavigationView {
326+
ViewItemView(
327+
store: Store(
328+
processor: StateProcessor(
329+
state: ViewItemState(
330+
loadingState: .data(secureNoteState)
331+
)
332+
)
333+
),
334+
timeProvider: PreviewTimeProvider(
335+
fixedDate: Date(
336+
timeIntervalSinceReferenceDate: .init(
337+
1_695_000_011
338+
)
339+
)
340+
)
341+
)
342+
}
343+
.previewDisplayName("SecureNote")
344+
}
345+
311346
@ViewBuilder static var sshKeyPreview: some View {
312347
NavigationView {
313348
ViewItemView(

BitwardenShared/UI/Vault/VaultItem/ViewItem/ViewItemViewTests.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,15 @@ class ViewItemViewTests: BitwardenTestCase { // swiftlint:disable:this type_body
569569
)
570570
}
571571

572+
/// Snapshots the previews for secure note types.
573+
@MainActor
574+
func test_snapshot_previews_secureNote() {
575+
assertSnapshot(
576+
of: ViewItemView_Previews.secureNotePreview,
577+
as: .defaultPortrait
578+
)
579+
}
580+
572581
/// Snapshots the previews for login types.
573582
@MainActor
574583
func test_snapshot_previews_sshKey() {

0 commit comments

Comments
 (0)