Signal-iOS/Signal/test
Jordan Rose 4e37af097b
MediaGallery: Separate the lazy loading logic into a testable MediaGallerySections
MediaGallery models a list of GalleryDate-based sections (in practice, months), each of which has a certain number of items. Sections are loaded on demand (that is, there may be newer and older sections that are not in the model), and always know their number of items. Items are also loaded on demand, potentially non-contiguously. This model is designed around the needs of UICollectionView (a thread's All Media view), but it also supports flat views of media (swiping between items in the media detail view, which can cross album boundaries).

This model is a result of refactoring I did last year to improve the performance and UX of the All Media view, but the implementation in MediaGallery.swift is entangled with the actual attachments and messages in the database, making it hard to test. This commit pulls the state management part out into its own struct, MediaGallerySections, which wraps the OrderedDictionary of items-by-section. Our MediaGalleryItem model references TSAttachmentStream directly and our queries go straight to the database, so to avoid having to set up real attachments in testing, MediaGallerySections is generic over a loader (delegate? data source?) of items with "gallery dates" and unique IDs. Now all the basic section- and item-loading APIs can be unit-tested.
2022-05-09 18:04:12 -07:00
..
Assets Preserve orientation when stripping image metadata 2021-02-11 10:10:16 -08:00
attachments Simplify AFNetworking usage. 2021-10-15 10:50:37 -03:00
contact Add cachedContactNames(for:, transaction:) 2022-03-17 12:52:45 -07:00
Groups Convert to new Promise library 2021-09-03 11:41:34 -07:00
mocks Apply script to normalize includes and imports. 2021-10-21 09:21:10 -03:00
Models Store the local PNI alongside the local ACI and phone number 2022-03-14 12:59:44 -07:00
Payments Prefer "blocklist" 2022-04-29 18:34:19 -05:00
PerformanceTests Avoid deserializing envelope data more than necessary 2022-04-11 15:55:39 -07:00
profiles Check if a user is stories capable when sending group replies 2022-03-31 00:37:56 -07:00
SSKTests SSK: Add UUID parsing to ParamParser 2022-03-14 12:59:44 -07:00
subscriptions More project cleanup 2022-04-20 16:26:54 -07:00
Supporting Files iOS 9 Support 2015-10-31 04:45:55 +01:00
util Fix duplicate import 2022-04-29 13:02:19 -05:00
ViewControllers MediaGallery: Separate the lazy loading logic into a testable MediaGallerySections 2022-05-09 18:04:12 -07:00
views/ImageEditor Add SignalUI framework target. 2021-10-19 09:39:54 -03:00
PhoneNumberValidatorTest.swift Fix typos 2022-03-18 11:31:06 -07:00
SignalBaseTest.h Revert header import fix. 2021-07-20 16:43:17 -07:00
SignalBaseTest.m Apply script to normalize includes and imports. 2021-10-21 09:21:10 -03:00
SignalBaseTest+Swift.swift Rework dependency access. 2021-03-25 09:24:27 -03:00
SignalTests-Bridging-Header.h Respond to CR. 2021-10-21 09:21:31 -03:00
TestUtil.h Rework creation of singletons. 2018-09-19 15:11:26 -04:00