-
Notifications
You must be signed in to change notification settings - Fork 225
Dismissing GalleryVC when using RTL layout #3745
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
Conversation
Caution Review failedThe pull request is closed. WalkthroughThe changes refactor how the current page is tracked and scrolled to in the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GalleryVC
participant CollectionView
User->>GalleryVC: View appears
GalleryVC->>CollectionView: Scroll to current page (no animation)
User->>GalleryVC: Scrolls collection view
GalleryVC->>GalleryVC: updateCurrentPage()
alt Layout is RTL
GalleryVC->>GalleryVC: Calculate reversed page index
else Layout is LTR
GalleryVC->>GalleryVC: Calculate normal page index
end
GalleryVC->>GalleryVC: Set content.currentPage
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes detected. Possibly related PRs
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
f707b46
to
2c850ac
Compare
Public Interface open class GalleryVC: _ViewController, UIGestureRecognizerDelegate, AppearanceProvider, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, ComponentsProvider
- override open func viewWillDisappear(_ animated: Bool)
+ override open func viewDidAppear(_ animated: Bool)
- override open func updateContent()
+ override open func viewWillDisappear(_ animated: Bool)
- @objc open func handlePan(with gestureRecognizer: UIPanGestureRecognizer)
+ override open func updateContent()
- @objc open func closeButtonTapped()
+ @objc open func handlePan(with gestureRecognizer: UIPanGestureRecognizer)
- @objc open func shareButtonTapped()
+ @objc open func closeButtonTapped()
- open func updateCurrentPage()
+ @objc open func shareButtonTapped()
- open func collectionView(_ collectionView: UICollectionView,numberOfItemsInSection section: Int)-> Int
+ open func updateCurrentPage()
- open func collectionView(_ collectionView: UICollectionView,cellForItemAt indexPath: IndexPath)-> UICollectionViewCell
+ open func collectionView(_ collectionView: UICollectionView,numberOfItemsInSection section: Int)-> Int
- open func collectionView(_ collectionView: UICollectionView,layout collectionViewLayout: UICollectionViewLayout,sizeForItemAt indexPath: IndexPath)-> CGSize
+ open func collectionView(_ collectionView: UICollectionView,cellForItemAt indexPath: IndexPath)-> UICollectionViewCell
- open func collectionView(_ collectionView: UICollectionView,targetContentOffsetForProposedContentOffset proposedContentOffset: CGPoint)-> CGPoint
+ open func collectionView(_ collectionView: UICollectionView,layout collectionViewLayout: UICollectionViewLayout,sizeForItemAt indexPath: IndexPath)-> CGSize
- open func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
+ open func collectionView(_ collectionView: UICollectionView,targetContentOffsetForProposedContentOffset proposedContentOffset: CGPoint)-> CGPoint
- open func scrollViewDidScroll(_ scrollView: UIScrollView)
+ open func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
- override open func viewWillTransition(to size: CGSize,with coordinator: UIViewControllerTransitionCoordinator)
+ open func scrollViewDidScroll(_ scrollView: UIScrollView)
- open func shareItem(at indexPath: IndexPath)-> Any?
+ override open func viewWillTransition(to size: CGSize,with coordinator: UIViewControllerTransitionCoordinator)
- open func cellReuseIdentifierForItem(at indexPath: IndexPath)-> String?
+ open func shareItem(at indexPath: IndexPath)-> Any?
- open func handleSingleTapOnCell(at indexPath: IndexPath)
+ open func cellReuseIdentifierForItem(at indexPath: IndexPath)-> String?
-
+ open func handleSingleTapOnCell(at indexPath: IndexPath)
-
+
- public struct Content
+
-
+ public struct Content
- public var message: ChatMessage
+
- public var currentPage: Int
+ public var message: ChatMessage
-
+ public var currentPage: Int
-
+
- public init(message: ChatMessage,currentPage: Int = 0)
+
+ public init(message: ChatMessage,currentPage: Int = 0) |
Generated by 🚫 Danger |
SDK Size
|
Public Interface open class GalleryVC: _ViewController, UIGestureRecognizerDelegate, AppearanceProvider, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, ComponentsProvider
- override open func viewWillDisappear(_ animated: Bool)
+ override open func viewDidAppear(_ animated: Bool)
- override open func updateContent()
+ override open func viewWillDisappear(_ animated: Bool)
- @objc open func handlePan(with gestureRecognizer: UIPanGestureRecognizer)
+ override open func updateContent()
- @objc open func closeButtonTapped()
+ @objc open func handlePan(with gestureRecognizer: UIPanGestureRecognizer)
- @objc open func shareButtonTapped()
+ @objc open func closeButtonTapped()
- open func updateCurrentPage()
+ @objc open func shareButtonTapped()
- open func collectionView(_ collectionView: UICollectionView,numberOfItemsInSection section: Int)-> Int
+ open func updateCurrentPage()
- open func collectionView(_ collectionView: UICollectionView,cellForItemAt indexPath: IndexPath)-> UICollectionViewCell
+ open func collectionView(_ collectionView: UICollectionView,numberOfItemsInSection section: Int)-> Int
- open func collectionView(_ collectionView: UICollectionView,layout collectionViewLayout: UICollectionViewLayout,sizeForItemAt indexPath: IndexPath)-> CGSize
+ open func collectionView(_ collectionView: UICollectionView,cellForItemAt indexPath: IndexPath)-> UICollectionViewCell
- open func collectionView(_ collectionView: UICollectionView,targetContentOffsetForProposedContentOffset proposedContentOffset: CGPoint)-> CGPoint
+ open func collectionView(_ collectionView: UICollectionView,layout collectionViewLayout: UICollectionViewLayout,sizeForItemAt indexPath: IndexPath)-> CGSize
- open func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
+ open func collectionView(_ collectionView: UICollectionView,targetContentOffsetForProposedContentOffset proposedContentOffset: CGPoint)-> CGPoint
- open func scrollViewDidScroll(_ scrollView: UIScrollView)
+ open func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
- override open func viewWillTransition(to size: CGSize,with coordinator: UIViewControllerTransitionCoordinator)
+ open func scrollViewDidScroll(_ scrollView: UIScrollView)
- open func shareItem(at indexPath: IndexPath)-> Any?
+ override open func viewWillTransition(to size: CGSize,with coordinator: UIViewControllerTransitionCoordinator)
- open func cellReuseIdentifierForItem(at indexPath: IndexPath)-> String?
+ open func shareItem(at indexPath: IndexPath)-> Any?
- open func handleSingleTapOnCell(at indexPath: IndexPath)
+ open func cellReuseIdentifierForItem(at indexPath: IndexPath)-> String?
-
+ open func handleSingleTapOnCell(at indexPath: IndexPath)
-
+
- public struct Content
+
-
+ public struct Content
- public var message: ChatMessage
+
- public var currentPage: Int
+ public var message: ChatMessage
-
+ public var currentPage: Int
-
+
- public init(message: ChatMessage,currentPage: Int = 0)
+
+ public init(message: ChatMessage,currentPage: Int = 0) |
Public Interface open class GalleryVC: _ViewController, UIGestureRecognizerDelegate, AppearanceProvider, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, ComponentsProvider
- override open func viewWillDisappear(_ animated: Bool)
+ override open func viewDidAppear(_ animated: Bool)
- override open func updateContent()
+ override open func viewWillDisappear(_ animated: Bool)
- @objc open func handlePan(with gestureRecognizer: UIPanGestureRecognizer)
+ override open func updateContent()
- @objc open func closeButtonTapped()
+ @objc open func handlePan(with gestureRecognizer: UIPanGestureRecognizer)
- @objc open func shareButtonTapped()
+ @objc open func closeButtonTapped()
- open func updateCurrentPage()
+ @objc open func shareButtonTapped()
- open func collectionView(_ collectionView: UICollectionView,numberOfItemsInSection section: Int)-> Int
+ open func updateCurrentPage()
- open func collectionView(_ collectionView: UICollectionView,cellForItemAt indexPath: IndexPath)-> UICollectionViewCell
+ open func collectionView(_ collectionView: UICollectionView,numberOfItemsInSection section: Int)-> Int
- open func collectionView(_ collectionView: UICollectionView,layout collectionViewLayout: UICollectionViewLayout,sizeForItemAt indexPath: IndexPath)-> CGSize
+ open func collectionView(_ collectionView: UICollectionView,cellForItemAt indexPath: IndexPath)-> UICollectionViewCell
- open func collectionView(_ collectionView: UICollectionView,targetContentOffsetForProposedContentOffset proposedContentOffset: CGPoint)-> CGPoint
+ open func collectionView(_ collectionView: UICollectionView,layout collectionViewLayout: UICollectionViewLayout,sizeForItemAt indexPath: IndexPath)-> CGSize
- open func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
+ open func collectionView(_ collectionView: UICollectionView,targetContentOffsetForProposedContentOffset proposedContentOffset: CGPoint)-> CGPoint
- open func scrollViewDidScroll(_ scrollView: UIScrollView)
+ open func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
- override open func viewWillTransition(to size: CGSize,with coordinator: UIViewControllerTransitionCoordinator)
+ open func scrollViewDidScroll(_ scrollView: UIScrollView)
- open func shareItem(at indexPath: IndexPath)-> Any?
+ override open func viewWillTransition(to size: CGSize,with coordinator: UIViewControllerTransitionCoordinator)
- open func cellReuseIdentifierForItem(at indexPath: IndexPath)-> String?
+ open func shareItem(at indexPath: IndexPath)-> Any?
- open func handleSingleTapOnCell(at indexPath: IndexPath)
+ open func cellReuseIdentifierForItem(at indexPath: IndexPath)-> String?
-
+ open func handleSingleTapOnCell(at indexPath: IndexPath)
-
+
- public struct Content
+
-
+ public struct Content
- public var message: ChatMessage
+
- public var currentPage: Int
+ public var message: ChatMessage
-
+ public var currentPage: Int
-
+
- public init(message: ChatMessage,currentPage: Int = 0)
+
+ public init(message: ChatMessage,currentPage: Int = 0) |
Public Interface open class SlideToCancelView: _View, ThemeProvider
- override open func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?)
+ override open func updateContent()
- override open func updateContent()
+
-
+
-
+ public struct Content: Equatable
- public struct Content: Equatable
+
-
+ public var alpha: CGFloat
- public var alpha: CGFloat
+
-
+
-
+ public init(alpha: CGFloat)
- public init(alpha: CGFloat) |
|
🔗 Issue Links
Resolves: https://linear.app/stream/issue/IOS-996
🎯 Goal
Dismissing GalleryVC when using RTL layout did not work
📝 Summary
🛠 Implementation
Dismissing did not work because the transition coordinator failed to get the source view and then it did nothing and left the app in inconsistent state.
🎨 Showcase
🧪 Manual Testing Notes
Open scheme settings for run, and set app language to right to left pseudolanguage
☑️ Contributor Checklist
docs-content
repoSummary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
Documentation