From 7c2b48151ed406443c11376b82dc3718aaa3d3e7 Mon Sep 17 00:00:00 2001 From: Sarah Zhou Date: Thu, 15 Apr 2021 13:13:50 -0700 Subject: [PATCH] Add containerContentOffset to IGListCollectionContext Summary: **In this diff** Add `containerContentOffset` to `IGListCollectionContext` - In this stack, I check this value from the product tile and content tile section controllers to determine how far the user has scrolled down the containing scroll view **In this stack** Add `scroll_logging_info` to product card and content tile events to track scroll depth on the Shop Tab homepage - Project plan: https://fb.quip.com/mF9qAnGPE8CI - Logging spec: https://fb.quip.com/6wp7AO63d8Wb#LPWACADjpNK Differential Revision: D27793071 fbshipit-source-id: 22123511b0f85fd636d82981671ccda0b0d7db7d --- Source/IGListKit/IGListAdapter.m | 4 ++++ Source/IGListKit/IGListCollectionContext.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/Source/IGListKit/IGListAdapter.m b/Source/IGListKit/IGListAdapter.m index 08777bcf..e9cf4cdb 100644 --- a/Source/IGListKit/IGListAdapter.m +++ b/Source/IGListKit/IGListAdapter.m @@ -943,6 +943,10 @@ return UIEdgeInsetsInsetRect(collectionView.bounds, collectionView.ig_contentInset).size; } +- (CGPoint)containerContentOffset { + return self.collectionView.contentOffset; +} + - (IGListCollectionScrollingTraits)scrollingTraits { UICollectionView *collectionView = self.collectionView; return (IGListCollectionScrollingTraits) { diff --git a/Source/IGListKit/IGListCollectionContext.h b/Source/IGListKit/IGListCollectionContext.h index 745434be..29b493ba 100644 --- a/Source/IGListKit/IGListCollectionContext.h +++ b/Source/IGListKit/IGListCollectionContext.h @@ -42,6 +42,11 @@ NS_SWIFT_NAME(ListCollectionContext) */ @property (nonatomic, readonly) CGSize insetContainerSize; +/** + The content offset of the collection view. + */ +@property (nonatomic, readonly) CGPoint containerContentOffset; + /** The current scrolling traits of the underlying collection view. */