Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions Vault/Sources/VaultiOS/Views/Detail/EncryptedItemDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,29 +81,37 @@ struct EncryptedItemDetailView: View {
}
}

@ViewBuilder
private var passwordEntrySection: some View {
Section {
FormRow(image: Image(systemName: "lock.fill"), color: .primary, style: .standard) {
SecureField("Password...", text: $viewModel.enteredEncryptionPassword)
}
} footer: {
}
.onChange(of: viewModel.enteredEncryptionPassword) { _, _ in
// When the text changes, reset the state.
viewModel.resetState()
}

Section {
AsyncButton {
await viewModel.startDecryption()
} label: {
Label("Decrypt", systemImage: "key.horizontal.fill")
decryptRow {
Text("Decrypt")
.foregroundStyle(Color.accentColor)
}
} loading: {
ProgressView()
.tint(.white)
decryptRow {
ProgressView()
}
}
.modifier(ProminentButtonModifier())
.animation(.easeOut, value: viewModel.state)
.padding()
.frame(maxWidth: .infinity)
.disabled(!viewModel.canStartDecryption)
}
.onChange(of: viewModel.enteredEncryptionPassword) { _, _ in
// When the text changes, reset the state.
viewModel.resetState()
}
.animation(.easeOut, value: viewModel.state)
}

private func decryptRow(@ViewBuilder content: @escaping () -> some View) -> some View {
FormRow(image: Image(systemName: "key.horizontal.fill"), color: .accentColor, content: content)
}
}
16 changes: 9 additions & 7 deletions Vault/Sources/VaultiOS/Views/Detail/OTP/OTPCodeDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ struct OTPCodeDetailView<PreviewGenerator: VaultItemPreviewViewGenerator<VaultIt
}
}

@ViewBuilder
private var editingActionsSection: some View {
Section {
Button {
Expand Down Expand Up @@ -416,12 +417,11 @@ struct OTPCodeDetailView<PreviewGenerator: VaultItemPreviewViewGenerator<VaultIt
}
}
}
} footer: {
if viewModel.shouldShowDeleteButton {
}

if viewModel.shouldShowDeleteButton {
Section {
deleteButton
.padding(.horizontal)
.frame(maxWidth: .infinity)
.padding(.vertical, 12)
}
}
}
Expand All @@ -430,9 +430,11 @@ struct OTPCodeDetailView<PreviewGenerator: VaultItemPreviewViewGenerator<VaultIt
Button {
isShowingDeleteConfirmation = true
} label: {
Label(localized(key: "action.delete.title"), systemImage: "trash.fill")
FormRow(image: Image(systemName: "trash.fill"), color: .red) {
Text(localized(key: "action.delete.title"))
.foregroundStyle(Color.red)
}
}
.modifier(ProminentButtonModifier(color: .red))
}

func copyableViewGenerator() -> VaultItemOnTapDecoratorViewGenerator<PreviewGenerator> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ struct SecureNoteDetailView: View {
}
}

@ViewBuilder
private var editingActionsSection: some View {
Section {
Picker(selection: $viewModel.editingModel.detail.textFormat) {
Expand Down Expand Up @@ -382,12 +383,11 @@ struct SecureNoteDetailView: View {
}
}
}
} footer: {
if viewModel.shouldShowDeleteButton {
}

if viewModel.shouldShowDeleteButton {
Section {
deleteButton
.padding(.horizontal)
.frame(maxWidth: .infinity)
.padding(.vertical, 12)
}
}
}
Expand All @@ -396,9 +396,11 @@ struct SecureNoteDetailView: View {
Button {
isShowingDeleteConfirmation = true
} label: {
Label(localized(key: "action.delete.title"), systemImage: "trash.fill")
FormRow(image: Image(systemName: "trash.fill"), color: .red) {
Text(localized(key: "action.delete.title"))
.foregroundStyle(Color.red)
}
}
.modifier(ProminentButtonModifier(color: .red))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct VaultDetailEncryptionEditView: View {
}
}

@ViewBuilder
private var createEncryptionSection: some View {
Section {
FormRow(image: Image(systemName: "lock.fill"), color: .primary, style: .standard) {
Expand All @@ -68,22 +69,25 @@ struct VaultDetailEncryptionEditView: View {
SecureField("Confirm Password", text: $newEncryptionPasswordConfirm)
}
}
} footer: {
if newEncryptionPassword.isNotBlank {
}

if newEncryptionPassword.isNotBlank {
Section {
Button {
didSetNewEncryptionPassword(newEncryptionPassword)
dismiss()
} label: {
Label("Encrypt", systemImage: "checkmark.circle.fill")
FormRow(image: Image(systemName: "checkmark.circle.fill"), color: .accentColor) {
Text("Encrypt")
.foregroundStyle(Color.accentColor)
}
}
.modifier(ProminentButtonModifier())
.padding()
.frame(maxWidth: .infinity)
.disabled(!doPasswordsMatch)
}
}
}

@ViewBuilder
private var removeEncryptionSection: some View {
Section {
Text("""
Expand All @@ -93,16 +97,18 @@ struct VaultDetailEncryptionEditView: View {
""")
.foregroundStyle(.secondary)
.font(.caption)
} footer: {
}

Section {
Button {
didRemoveEncryption()
dismiss()
} label: {
Label("Remove Encryption", systemImage: "xmark.circle.fill")
FormRow(image: Image(systemName: "xmark.circle.fill"), color: .red) {
Text("Remove Encryption")
.foregroundStyle(Color.red)
}
}
.modifier(ProminentButtonModifier(color: .red))
.padding()
.frame(maxWidth: .infinity)
}
}
}
33 changes: 21 additions & 12 deletions Vault/Sources/VaultiOS/Views/Detail/VaultItemDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,22 @@ struct VaultItemDetailView<ChildViewModel: DetailViewModel, ContentsView: View>:
)
.padding()
.containerRelativeFrame(.horizontal)
} footer: {
}

Section {
AsyncButton {
try await authenticationService.validateAuthentication(reason: "Unlock item")
viewModel.isLocked = false
} label: {
Label("Unlock", systemImage: "key.horizontal.fill")
unlockRow {
Text("Unlock")
.foregroundStyle(Color.accentColor)
}
} loading: {
ProgressView()
.tint(.white)
unlockRow {
ProgressView()
}
}
.modifier(ProminentButtonModifier())
.containerRelativeFrame(.horizontal)
.padding()
}
} else {
Section {
Expand All @@ -128,19 +131,25 @@ struct VaultItemDetailView<ChildViewModel: DetailViewModel, ContentsView: View>:
.foregroundStyle(.secondary)
}
}
} footer: {
}

Section {
Button {
viewModel.isLocked = false
} label: {
Text("Dismiss")
FormRow(image: Image(systemName: "xmark.circle.fill"), color: .accentColor) {
Text("Dismiss")
.foregroundStyle(Color.accentColor)
}
}
.modifier(ProminentButtonModifier())
.containerRelativeFrame(.horizontal)
.padding()
}
}
}

private func unlockRow(@ViewBuilder content: @escaping () -> some View) -> some View {
FormRow(image: Image(systemName: "key.horizontal.fill"), color: .accentColor, content: content)
}

private var cancelCreationItem: some ToolbarContent {
// This button always dismisses immediately (without saving) if it's the initial creation.
// (Dirty or not!)
Expand Down
30 changes: 0 additions & 30 deletions Vault/Sources/VaultiOS/Views/General/ProminentButtonModifier.swift

This file was deleted.

35 changes: 17 additions & 18 deletions Vault/Sources/VaultiOS/Views/Settings/SettingsDangerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct SettingsDangerView: View {
var body: some View {
Form {
headerSection
deleteAllSection
}
.navigationBarTitleDisplayMode(.inline)
.interactiveDismissDisabled(viewModel.isDeleting)
Expand All @@ -31,16 +32,11 @@ struct SettingsDangerView: View {
.padding()
.containerRelativeFrame(.horizontal)
.foregroundStyle(.red)
} footer: {
VStack(alignment: .center, spacing: 16) {
deleteAllButton
}
.padding(16)
}
}

private var deleteAllButton: some View {
VStack(alignment: .center, spacing: 8) {
private var deleteAllSection: some View {
Section {
AsyncButton {
do {
withAnimation {
Expand All @@ -56,21 +52,24 @@ struct SettingsDangerView: View {
}
}
} label: {
Label("Delete All Data", systemImage: "trash.fill")
deleteAllRow {
Text("Delete All Data")
.foregroundStyle(Color.red)
}
} loading: {
ProgressView()
.tint(.white)
deleteAllRow {
ProgressView()
}
}
.modifier(ProminentButtonModifier(color: .red))

} footer: {
if let deleteError {
Group {
Text(deleteError.userDescription ?? "Error deleting data.")
}
.font(.caption)
.foregroundStyle(.secondary)
Text(deleteError.userDescription ?? "Error deleting data.")
.foregroundStyle(.red)
}
}
.frame(maxWidth: .infinity)
}

private func deleteAllRow(@ViewBuilder content: @escaping () -> some View) -> some View {
FormRow(image: Image(systemName: "trash.fill"), color: .red, content: content)
}
}
17 changes: 11 additions & 6 deletions Vault/Sources/VaultiOS/Views/Tags/VaultTagDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,20 @@ struct VaultTagDetailView: View {
await viewModel.delete()
dismiss()
} label: {
Label("Delete Tag", systemImage: "trash.fill")
deleteRow {
Text("Delete Tag")
.foregroundStyle(Color.red)
}
} loading: {
ProgressView()
.tint(.white)
deleteRow {
ProgressView()
}
}
.modifier(ProminentButtonModifier(color: .red))
.frame(maxWidth: .infinity)
}
.listRowBackground(EmptyView())
}

private func deleteRow(@ViewBuilder content: @escaping () -> some View) -> some View {
FormRow(image: Image(systemName: "trash.fill"), color: .red, content: content)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ struct VaultAutofillConfigurationView: View {
viewModel.dismiss()
} label: {
Text("Continue")
.font(.headline)
.frame(maxWidth: .infinity)
}
.modifier(ProminentButtonModifier())
.buttonStyle(.borderedProminent)
.controlSize(.large)
}
.multilineTextAlignment(.center)
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.