-
Notifications
You must be signed in to change notification settings - Fork 593
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
Refactor handling updates #779
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #779 +/- ##
==========================================
+ Coverage 47.63% 47.69% +0.05%
==========================================
Files 133 133
Lines 6491 6498 +7
==========================================
+ Hits 3092 3099 +7
Misses 3399 3399
Continue to review full report at Codecov.
|
@@ -31,18 +32,29 @@ public final class NewChatMessageCollectionAdapter: NSObject, | |||
// MARK: - Private type declarations | |||
|
|||
private struct ModelUpdates { | |||
struct ScrollPositionData { | |||
let oldRect: CGRect |
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.
Just naming. Do you think it would make sense to name it just rect
and the property holding this value would call it oldScrollPositionData
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.
What ScrollPositionData
essentially contains is an old rect, and a new indexPath.
Should I rename referenceIndexPath
to newIndexPath
, what do you think?
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.
Ahh, got it. Let's keep it like this then 👍
let changes = updates.changes | ||
let layout = updates.layoutModel | ||
let visibleCellsAreValid = self.visibleCellsAreValid(changes: updates.changes) | ||
let wantsReloadData = updateType != .normal && updateType != .firstSync |
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 do switch to enforce that we handle all possible new use cases?
guard let self = self, let collectionView = collectionView else { return } | ||
|
||
switch scrollAction { | ||
case .scrollToBottom: |
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.
(Just to confirm) Is this not needed anymore?
No description provided.