Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow delete from edit screen #2005

Merged
merged 24 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2a7fb43
add delete cell and extract strings
brindy Sep 7, 2023
78a2ed8
delegate placeholders for pushing up
brindy Sep 11, 2023
91c9866
Merge branch 'develop' into brindy/allow-delete-from-edit-screen
brindy Sep 11, 2023
2d8baab
merge develop
brindy Sep 11, 2023
66b22d0
support delete bookmark and undo
brindy Sep 12, 2023
555285f
keep button visible and enable/disable it
brindy Sep 12, 2023
7b03f7b
update trash icon
brindy Sep 12, 2023
3935652
Merge branch 'develop' into brindy/allow-delete-from-edit-screen
brindy Sep 12, 2023
457fad4
update bsk
brindy Sep 12, 2023
bd32178
use destructive button for deleting the folders
brindy Sep 13, 2023
1cf7836
fix button state on load
brindy Sep 13, 2023
35751f2
Use correct destructive colour
brindy Sep 15, 2023
39a7791
Merge branch 'develop' into brindy/allow-delete-from-edit-screen
brindy Sep 15, 2023
210b966
point to right version of bsk
brindy Sep 15, 2023
3377e90
correct action message after deleting
brindy Sep 15, 2023
cbc936c
tweak copy and font weights on edit screen
brindy Sep 18, 2023
2db4893
show deleted message when swiping
brindy Sep 18, 2023
abb9f47
handle favicons, but don't allow undelete for bookmarks
brindy Sep 19, 2023
bc67382
Merge branch 'develop' into brindy/allow-delete-from-edit-screen
brindy Sep 19, 2023
6aa2924
point to right version of bsk
brindy Sep 19, 2023
67df5c4
more font tweaks on edit screen
brindy Sep 19, 2023
975d62c
Update translations
brindy Sep 20, 2023
864c104
Merge branch 'develop' into brindy/allow-delete-from-edit-screen
brindy Sep 21, 2023
b6006c7
update to correct BSK
brindy Sep 21, 2023
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
Prev Previous commit
Next Next commit
keep button visible and enable/disable it
  • Loading branch information
brindy committed Sep 12, 2023
commit 555285fe9742ee12e09b6a0f0bcb5058854c5b5e
2 changes: 0 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,6 @@
317045BF2858C6B90016ED1F /* AutofillInterfaceEmailTruncatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillInterfaceEmailTruncatorTests.swift; sourceTree = "<group>"; };
31794BFF2821DFB600F18633 /* DuckUI */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = DuckUI; sourceTree = "<group>"; };
31951E8D2823003200CAF535 /* AutofillLoginDetailsHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillLoginDetailsHeaderView.swift; sourceTree = "<group>"; };
31951E94282310FF00CAF535 /* WebsiteAccountExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebsiteAccountExtension.swift; sourceTree = "<group>"; };
319A370F28299A850079FBCE /* PasswordHider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordHider.swift; sourceTree = "<group>"; };
319A37142829A55F0079FBCE /* AutofillListItemTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutofillListItemTableViewCell.swift; sourceTree = "<group>"; };
319A37162829C8AD0079FBCE /* UITableViewExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITableViewExtension.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5085,7 +5084,6 @@
C13B32D12A0E750700A59236 /* AutofillSettingStatus.swift */,
319A370F28299A850079FBCE /* PasswordHider.swift */,
31C70B5428045E3500FB6AD1 /* SecureVaultErrorReporter.swift */,
31951E94282310FF00CAF535 /* WebsiteAccountExtension.swift */,
F407605328131910006B1E0B /* AutofillLoginUI */,
310C4B4A281B69BC00BA79A9 /* Management */,
C17B59552A03AAC40055F2D1 /* PasswordGeneration */,
Expand Down
18 changes: 5 additions & 13 deletions DuckDuckGo/AutofillLoginDetailsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class AutofillLoginDetailsViewController: UIViewController {
super.viewDidLoad()

installSubviews()
setupNavigationBar()
setupCancellables()
setupTableViewAppearance()
applyTheme(ThemeManager.shared.currentTheme)
Expand All @@ -112,6 +111,7 @@ class AutofillLoginDetailsViewController: UIViewController {
if !authenticationNotRequired {
authenticator.authenticate()
}
setupNavigationBar()
}

override func viewWillDisappear(_ animated: Bool) {
Expand Down Expand Up @@ -189,7 +189,7 @@ class AutofillLoginDetailsViewController: UIViewController {
}

@objc private func appWillMoveToBackgroundCallback() {
if viewModel.viewMode != .new || viewModel.shouldShowSaveButton {
if viewModel.viewMode != .new || viewModel.canSave {
authenticationNotRequired = false
}
authenticator.logOut()
Expand Down Expand Up @@ -267,25 +267,17 @@ class AutofillLoginDetailsViewController: UIViewController {
private func setupNavigationBar() {
title = viewModel.navigationTitle
switch viewModel.viewMode {
case .edit:
case .edit, .new:
navigationItem.rightBarButtonItem = saveBarButtonItem
navigationItem.rightBarButtonItem?.isEnabled = viewModel.canSave
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(cancel))

case .view:
navigationItem.rightBarButtonItem = editBarButtonItem
navigationItem.leftBarButtonItem = nil

case .new:
if viewModel.shouldShowSaveButton {
navigationItem.rightBarButtonItem = saveBarButtonItem
} else {
navigationItem.rightBarButtonItem = nil
}
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(cancel))
}
}



@objc private func toggleEditMode() {
viewModel.toggleEditMode()
}
Expand Down
4 changes: 1 addition & 3 deletions DuckDuckGo/AutofillLoginDetailsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ final class AutofillLoginDetailsViewModel: ObservableObject {
}
}

var shouldShowSaveButton: Bool {
guard viewMode == .new else { return false }

var canSave: Bool {
return !username.isEmpty || !password.isEmpty || !address.isEmpty || !title.isEmpty || !notes.isEmpty
}

Expand Down