Commit graph

9 commits

Author SHA1 Message Date
Jesse Seidman
03049f742f Add IGListAdapterDelegate Methods 3/n
Summary:
## CONTEXT
`IGListAdapterDelegate` currently has methods that are fired when an object is *first* displayed and when an object *ended* display on screen.  For many use cases this works but there are use cases in which it would be helpful to know whenever a cell will be displayed or ends display.  This is especially relevant in the `IGListAdapterDelegateAnnouncer` which will enable you to add code for tracking cells globally.  This change also balances the `IGListAdapterDelegate` with `IGListDisplayDelegate`  which has methods which include the cell as well

## PLAN
This diff will be go out in multiple parts
- delegate method addition (many file change due to our pattern of not preferring default implementation of protocol methods)
- Update to `IGListDisplayHandler` and `IGListAdapterDelegateAnnouncer` for invocation of delegate methods
- Unit test additions

## THIS DIFF
This diff updates the unit tests of `IGListAdapterDelegateAnnouncerTests`, `IGListAdapterE2ETests` and `IGListDisplayHandlerTests`.  We added new expectations and to existing unit tests because the functionality to confirm is already tested it was just only checking the existing delegate methods.  The new tests check the new methods as well

Reviewed By: maxolls

Differential Revision: D70406065

fbshipit-source-id: ee054a21f0709b14081fdff38e22ab9710222794
2025-04-24 13:07:16 -07:00
Maxime Ollivier
6ea2b91150 avoid crashing when not subclassing IGListSectionController
Summary:
Currently, if you use `IGListSectionController` without a subclass, `UICollectionView` will crash when requesting the cell. That's because `[IGListSectionController numberOfItems]` defaults to 1, but returns no cell. There's a few issues with that:
1. It can be tough to debug, because the crash in within `UICollectionView`. We don't know the dataSource or object type responsible.
2. The crash only happens if the user scrolls by the missing cell, which can make it hard to repro.
3. If we don't know how to render a single section, we might not want to crash the entire app. Passing a plain `IGListSectionController` kind of feels like the dataSource is ok with just rendering nothing. It's not clear at all that it will crash.

Options:
1. Crash immediately when a plain `IGListSectionController` is passed to `IGListAdapter`, so we get a clear callstack and API feedback. If the dataSource doesn't want to crash, it must return `IGEmptySectionController` that has 0 `numberOfItems`.
2. Don't crash, but log a `IGFailAssert()`. If the dataSource wants to throw on a missing object-controller match, they can can, but it's not the IGListKit default.

I'm leaning on #2 for a few reasons. It's really not obvious that passing a plain `IGListSectionController` would crash and no one will know that `IGEmptySectionController` exists. We could have a linter, but that only works within Meta.

Reviewed By: DimaVartanian

Differential Revision: D52087286

fbshipit-source-id: 8b8754d56e66c0c2b00f8df3b9671a6fc2287aea
2023-12-14 14:27:34 -08:00
Tim Oliver
f92b9339ee Standarize the copyright notice in all source files
Summary:
The standardized Meta copyright notice is "Copyright (c) Meta Platforms, Inc. and affiliates." and not "Copyright (c) Meta Platforms, Inc. and its affiliates." (Dropping the "its")

This diff updates the copyright notice in each source file to the correct this.

Reviewed By: willbailey

Differential Revision: D44737667

fbshipit-source-id: 643bf36df76723e70d9d826c53cf8f29b8a0c8cc
2023-04-06 02:44:16 -07:00
Tim Oliver
a1b9c2ddb3 Updated corporate branding in IGListKit source files
Summary:
A quick push to fix something I noticed while studying how IGListKit works. This simply replaces "Facebook, Inc" with "Meta Platforms, Inc" in all of the source files where the company copyright notice is posted. This should help bring our external facing projects more in line with our new corporate branding.

There's still a lot more references to "Facebook" as a company in the library (especially around linking to other Meta sponsored open source libraries), but this might need additional scrutiny and review on a case-by-case basis, so let's handle those ones separately.

Reviewed By: lorixx

Differential Revision: D41207363

fbshipit-source-id: 57cdbf5eb1023b41a5f32c0c05e01628686a19fe
2022-11-15 21:47:29 -08:00
Maxime Ollivier
3f1a2fb0ac unit test missing section-controller fix
Summary: Lets test that the new updater (`IGListExperimentalAdapterUpdater`) can handle a missing section-controller. The old adapater `IGListAdapterUpdater` would crash.

Reviewed By: patters

Differential Revision: D23145773

fbshipit-source-id: 4589dcb11ddef5c7400947aea4b6827f1b2caaa8
2020-09-08 09:11:12 -07:00
Nate Stedman
1a44045dce Run lint on IGListKit
Differential Revision: D19141253

fbshipit-source-id: 9ed4c278a91bb48a1f6d33cafa9ce8f21861573d
2019-12-19 09:34:42 -08:00
Ryan Nystrom
8d8a632b67 Update MIT license language (#1272)
Summary:
Updating license language to meet FB open source standards.
Pull Request resolved: https://github.com/Instagram/IGListKit/pull/1272

Differential Revision: D12844366

Pulled By: rnystrom

fbshipit-source-id: 27ae49ae00d963c5c012c79c5738365c232a5773
2018-11-01 10:58:46 -07:00
Ryan Nystrom
fdbe025fe1 Add base test case class for simpler unit testing
Summary:
Making it simpler to setup tests w/ default config and objects. Less LoC in tests, lower setup cost when creating new test suites.

Should I changelog?

Issue fixed: #183

- [x] All tests pass. Demo project builds and runs.
- [x] I added tests, an experiment, or detailed why my change isn't tested.
Closes https://github.com/Instagram/IGListKit/pull/678

Differential Revision: D4921633

Pulled By: rnystrom

fbshipit-source-id: fb4d08acb6ed0ba885cf56ce147f70b304301ff1
2017-04-20 14:36:28 -07:00
FBShipIt
cdc796746a Initial commit
fbshipit-source-id: c38b897b9e2b87c782e0e01b0145d9189dc7f9d8
2016-10-11 10:12:17 -04:00