-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[NT-145] Shipping rules search #834
Conversation
.observeValues { [weak self] indexPath in | ||
self?.tableView.cellForRow(at: indexPath)?.accessoryType = .none | ||
.observeValues { [weak self] _ in | ||
self?.tableView.visibleCells.forEach { $0.accessoryType = .none } |
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 simplified a lot of logic, because we don't have to keep in track previously selected index (this gets really complicated in case the list is filtered causing that previous index to be out of sync).
To simplify this behaviour we simply make sure to deselect cells first, then selecting the latest index.
.filter { oldIndex, newIndex in oldIndex != newIndex } | ||
.map(second) | ||
let searchText = self.searchTextDidChangeProperty.signal | ||
.ksr_debounce(.milliseconds(100), on: AppEnvironment.current.scheduler) |
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.
Adding a little bit of delay so that this functionality doesn't cause a bottle neck on slower devices when typing really fast.
Generated by 🚫 Danger |
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.
Some initial comments/questions. Good job on this though it's a deceptively complex feature!
@@ -9,14 +9,19 @@ public struct ShippingRuleData: Equatable { | |||
public let shippingRule: ShippingRule | |||
} | |||
|
|||
private typealias ShippingRulesInputData = ( | |||
project: Project, shippingRules: [ShippingRule], selectedShippingRule: ShippingRule |
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.
Might I suggest initialSelectedShippingRule
instead of selectedShippingRule
to differentiate between the shipping rule that the VC is initially configured with and any future selected rules?
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.
That's why I called this type Input
...but I see how this still could be confusing. 👍
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.
Technically we're never really accessing this one from the tuple value ¯_(ツ)_/¯
…ng rule after the layout pass
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.
Works great! Nice job!
📲 What
Adds the ability to search shipping rules picker.
🤔 Why
Shipping rules picker usually comes with a very long list of locations that we want our users to be able to filter down based on the search term.
🛠 How
The VM had to be completely re-written in order to support search & selection.
😱 Please note that this PR is marked as Big, because there's a lot of tests coverage. The tests should be very descriptive and include a lot of comments.
👀 See
✅ Acceptance criteria
Cancel
button dismisses the picker