Signal-iOS/Signal
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
..
AudioFiles Don't use CallKit for video calls received while the app is active 2020-08-17 15:41:10 -07:00
Images.xcassets extracted additional assets needed for donate megaphone 2022-05-09 12:05:12 -07:00
Lottie Adjust megaphone priority and remove old megaphones 2022-01-24 10:42:34 -08:00
NSE-Images.xcassets Cache built avatars to disk for NSE 2022-02-14 11:59:13 -08:00
Settings.bundle Upgrade GRDB to version 5.23.0 2022-04-20 09:08:50 -05:00
Sounds Autoplay subsequent audio messages 2021-04-29 18:01:21 -07:00
src MediaGallery: Separate the lazy loading logic into a testable MediaGallerySections 2022-05-09 18:04:12 -07:00
test MediaGallery: Separate the lazy loading logic into a testable MediaGallerySections 2022-05-09 18:04:12 -07:00
translations extracted additional assets needed for donate megaphone 2022-05-09 12:05:12 -07:00
.swiftlint.yml
iTunesArtwork@3x.png
main.m Call UIApplicationMain() outside of autoreleasepool 2021-04-08 13:35:17 -07:00
Signal-AppStore.entitlements iOS 15 communication notification support for messages 2021-08-17 10:48:39 -10:00
Signal-Info.plist "Bump build to 5.38.0.6." (nightly-05-07-2022) 2022-05-07 04:00:59 -07:00
Signal-Prefix.pch Label the "slow write transactions" logging with the source of the transaction. 2020-06-07 10:37:55 -03:00
Signal.entitlements iOS 15 communication notification support for messages 2021-08-17 10:48:39 -10:00
SignalTSan.supp
SignalUBSan.supp