-
Notifications
You must be signed in to change notification settings - Fork 46
"Edit" entry mode with Delete functionality #1060
Conversation
This might be a good candidate for @jhugman given that I wrote most of it :p |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fairly long PR. Sorry it took so long to get to it.
It looks good. I have only a couple of comments.
class ItemDetailView: UIViewController { | ||
internal var presenter: ItemDetailPresenter? | ||
private var disposeBag = DisposeBag() | ||
private var swipeBag = DisposeBag() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
cell.valueLabel.textColor = cellConfiguration.valueFontColor | ||
cellConfiguration.value | ||
.drive(cell.textValue.rx.text) | ||
.disposed(by: cell.disposeBag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔
} else { | ||
self.navigationItem.leftBarButtonItem = nil | ||
self.navigationController?.interactivePopGestureRecognizer?.delegate = nil | ||
self.swipeBag = DisposeBag() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be clearing the existing one, before simply discarding it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still have a few questions about the various disposeBag
s you're using, but otherwise this is looking really nice.
} | ||
} | ||
|
||
typealias ItemDetailSectionModelObserver = ((Observable<[ItemDetailSectionModel]>) -> Disposable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
* start of updating logins * add hostname editing * fix broken tests * add test for DataStoreAction.update * ItemEditAction tests * add edit action tests * ItemDetailPresenter tests * add ItemDetailView tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking fine.
There are some followup issues to be filed here:
- disable edit hostname.
- errors: currently implemented in android — duplicate usernames, empty passwords.
I'm hopeful that the strategy of combining view controllers for display, edit and create is going to pay off.
Well done keeping this from bit rotting, and a tricky merge process.
Let's get this landed!
@@ -60,16 +60,16 @@ class LockwiseXCUITests: BaseTestCase { | |||
XCTAssertTrue(app.cells["passwordItemDetail"].exists) | |||
XCTAssertTrue(app.cells["webAddressItemDetail"].exists) | |||
// The value in each field is correct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: file an issue to convert these XCUITests to MappaMundi
.
enum ItemEditAction: Action { | ||
case editUsername(value: String) | ||
case editPassword(value: String) | ||
case editWebAddress(value: String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to be able to edit the hostname, but keep this in because it'll be useful when we implement Manual Create Entry.
@@ -91,7 +91,7 @@ extension Constant.string { | |||
static let settingsGetSupport = NSLocalizedString("settings.getSupport", value: "Ask a Question", comment: "Support link to Discourse discussion forum") | |||
static let websiteCellAccessibilityLabel = NSLocalizedString("website_accessibility_instructions", value: "Web address: double tap to open in browser %@", comment: "Accessibility label and instructions for web address section of login details") | |||
static let usernameCellAccessibilityLabel = NSLocalizedString("username_accessibility_instructions", value: "Username: double tap to copy %@", comment: "Accessibility label and instructions for username section of login details. %@ will be replaced with the username value") | |||
static let passwordCellAccessibilityLabel = NSLocalizedString("password_accessibility_instructions", value: "Password: double tap to copy %@", comment: "Accessibility label and instructions for password section of login details. %@ will be replaced with the password value") | |||
static let passwordCellAccessibilityLabel = NSLocalizedString("password_accessibility_instructions", value: "Password: double tap to copy", comment: "Accessibility label and instructions for password section of login details. %@ will be replaced with the password value") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: copy pasta: %@ will be replaced with the password value
.
} | ||
} | ||
return actions | ||
.map { id -> [Action] in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can replace the .map
and then a for
loop with .mapIterable
. Will check.
} | ||
.asDriver(onErrorJustReturn: "") | ||
|
||
let editing = itemDetailStore.isEditing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: naming. isEditing
to show it's Bool
like.
This was original PR #981 but has been updated with edit and delete functionality.
Fixes #937