51 Commits

Author SHA1 Message Date
Garrett Moon
c0eb6cac09 Add support for disabling progressive image rendering
Differential Revision: https://phabricator.pinadmin.com/D89742
2016-05-09 15:01:05 -07:00
Wendy
fd4d18259e Use dispatch_async for setting currentImageQuality to ensure current order 2016-04-29 22:30:56 -07:00
Wendy
492d0d7ad6 [ASNetworkImageNode] Fix threading issue in current image quality
Summary:
Because we trampoline to main when setting _currentImageQuality, there would be situations where displayWillStart was called, we get a cached image and set currentImageQuality to 1.0, and then a background thread calling setDefaultImage would enqueue an operation that sets currentImageQuality to 0 and overwrites the correct value
2016-04-28 14:52:31 -07:00
Wendy
fe5c4caf90 Lock properly when setting currentImageQuality 2016-04-26 18:35:03 -07:00
Wendy
0b55df9649 Add the ability for ASNetworkImageNodes to keep track of their progressive image quality 2016-04-26 18:33:59 -07:00
Michael Schneider
ce6e11c6d2 Fix deadlock in ASNetworkImageNode
Calling _updateProgressImageBlockOnDownloaderIfNeeded should be called without _lock held. We will lock super to read our interface state and it's best to avoid acquiring both locks.
2016-04-25 13:15:11 -07:00
Adlai Holler
05b22531e6 Include necessary header 2016-04-22 19:12:38 -05:00
Adlai Holler
a216b17b01 Merge branch 'master' into ImageNodeImprovements
Conflicts:
	AsyncDisplayKit/ASNetworkImageNode.mm
2016-04-22 12:36:58 -05:00
Adlai Holler
bc8a2b19ef [ASNetworkImageNode] Carry recent progress image block changes over from multiplex image node 2016-04-22 12:34:13 -05:00
Garrett Moon
0fc39d1ccd Follow up to animated GIF PR 2016-04-19 13:43:41 -07:00
Garrett Moon
b56e20853b Prevent retain cycle, clear out animatedImage on _clearImage. 2016-04-13 14:23:02 -07:00
Garrett Moon
f4b526a8db Fix non example build 2016-04-13 14:23:02 -07:00
Garrett Moon
1b316217ef Downstream ASAnimatedImage 2016-04-13 14:23:02 -07:00
Garrett Moon
3bcbfb149d Add support for animated GIFs
Summary:
Use NSData as key

Add chunking of files

Add support for Animated Images

This adds support for GIF playback in ASDK. It's not currently ready
for merging to public ASDK – for one the GIF decompression may make
more sense in PINRemoteImage.

Removed duration as it wasn't used

Make cover image lazily loaded

Differential Revision: https://phabricator.pinadmin.com/D82033
2016-04-13 14:23:02 -07:00
Adlai Holler
faf29dd978 Fix indentation 2016-04-12 17:45:40 -07:00
Adlai Holler
0022cad000 [ASMultiplexImageNode] Copy recent changes made to ASNetworkImageNode for progress image handling 2016-04-12 14:34:11 -07:00
Adlai Holler
362c41ae80 [ASNetworkImageNode] Attach progress image handler even if download starts while already visible 2016-04-12 14:17:41 -07:00
Adlai Holler
37c7f6f849 [ASNetworkImageNode] Remove retain 2016-04-12 14:17:41 -07:00
Adlai Holler
11461f415f [ASNetworkImageNode] Improve readability, resolve self retain, reduce locking 2016-04-12 14:17:41 -07:00
Scott Goodson
c5c7abb1d6 [ASDisplayNode] Placeholders should always be recreated if returning to past nodes.
If previously-displayed contents is gone (e.g. clearContents), and is not finished displaying
by the time the node is onscreen, recreate the placeholder immediately.
2016-03-18 21:13:26 -07:00
Scott Goodson
a966b7b6a6 [ASImageNode] -setDefaultImage: should release lock before calling -setImage:
This allows -setImage: to fully unlock before it calls -invalidateCalculatedSize.
2016-03-16 20:55:08 -07:00
Garrett Moon
3a7d150680 Remove extraneous brackets, check _imageLoaded before doing work 2016-03-11 21:58:49 -08:00
Garrett Moon
af61645faf Add support for attempting to get image synchronously 2016-03-11 21:58:49 -08:00
Scott Goodson
cdd1bd1e39 [ASRangeController] Ensure that visibilityDidChange: is always called on app launch for all initial cells. 2016-03-11 17:18:32 -08:00
Eric Jensen
c2f85397ce Mark depreciated protocols with deprivation attribute 2016-03-08 11:56:58 -08:00
Michael Schneider
3c32c48be0 Add clear image to ASMultiplexImageNode 2016-03-02 06:14:35 -08:00
Michael Schneider
6e69c312d6 Dispatch deallocation of UIImage on background thread
Destruction of bigger images in ASNetworkImageNode on the main thread can be expensive and can take some time, so we dispatch onto a background queue to actually dealloc.
2016-03-01 17:04:38 -08:00
Garrett Moon
359d19da29 ASNetworkImageNode should support a nil cache. 2016-02-22 21:58:45 -08:00
Scott Goodson
ca8357a364 [AS*ImageNode] dispatch to the background before scheduling image download request (perf). 2016-02-20 13:01:03 -08:00
Garrett Moon
7d80fb31bd rename imageNodeDidStartLoading to imageNodeDidStartFetchingData 2016-02-12 15:10:58 -08:00
Garrett Moon
cf1e4c87f5 Add image loading delegate method / cache instead of respondsToSelector 2016-02-12 15:04:14 -08:00
Garrett Moon
752f0540d0 Fix warnings 2016-02-10 10:38:41 -08:00
Garrett Moon
48fc4810cd Addressing comments 2016-02-09 14:06:41 -08:00
Garrett Moon
5a4e4dcac4 Add default PINRemoteImageDownloader 2016-02-08 16:00:19 -08:00
Christoph Zelazowski
a02a60fa75 Add error handler to ASNetworkImageNodeDelegate 2016-01-19 19:55:22 -08:00
Scott Goodson
b75b72c660 Improve handling of file URLs for ASNetworkImageNode.
Details discussed in https://github.com/facebook/AsyncDisplayKit/pull/1003.  This PR supercedes that one.
2015-12-27 16:38:34 -08:00
Scott Goodson
840884272d Introduced ASHierarchyState. Created ASDisplayNode+FrameworkPrivate.h. Fixed deadlock. 2015-12-05 22:20:16 -08:00
Adlai Holler
dfc7c0cc0e Image nodes call fetchData when image source is updated while in fetch range 2015-11-29 17:29:44 -08:00
Scott Goodson
3175ce2fe7 Fix retain cycle in basic, cache-less ASNetworkImageNodes
This should not directly affect more complex apps that don't use the ASBasicImageDownloader.

Also disables the default-on text placeholders, as they churn memory during the measurement pass.
These were intended to be written with pure layers (without using backing stores), so I don't
think it is a reasonable default-on behavior until that is fixed.
2015-10-30 22:42:05 -07:00
Adlai Holler
87caed27e2 Add more deep compares when setting public properties to the same value 2015-10-05 23:48:48 -07:00
Scott Goodson
a58844379c Implementation of Synchronous Concurrency features for AsyncDisplayKit 2.0
This provides internal features on _ASAsyncTransaction and ASDisplayNode to facilitate
implementing public API that allows clients to choose if they would prefer to block
on the completion of unfinished rendering, rather than allow a placeholder state to
become visible.

The internal features are:
-[_ASAsyncTransaction waitUntilComplete]
-[ASDisplayNode recursivelyEnsureDisplay]

Also provided are two such implementations:
-[ASCellNode setNeverShowPlaceholders:], which integrates with both Tables and Collections
-[ASViewController setNeverShowPlaceholders:], which should work with Nav and Tab controllers.

Lastly, on ASDisplayNode, a new property .shouldBypassEnsureDisplay allows individual node types
to exempt themselves from blocking the main thread on their display.

By implementing the feature at the ASCellNode level rather than ASTableView & ASCollectionView,
developers can retain fine-grained control on display characteristics.  For example, certain
cell types may be appropriate to display to the user with placeholders, whereas others may not.

Follow-up work will include unit tests, revisiting names, and the header locations of definitions.
2015-09-27 19:14:36 -07:00
Scott Goodson
e3f0e66cb3 Updating API names for network range and memory culling before ASDK 1.2 tag. 2015-05-21 22:43:38 -10:00
Ryan Nystrom
db8bbcfd0e Thread safe creation and canceling of download tasks
fixes #364
2015-03-11 16:52:14 -07:00
Ryan Nystrom
4fa03a01d1 Functioning Preload range
Refactor how we do ranges so they can be arbitrarily managed. Introduce the concept of a preload range.
2015-02-26 15:41:32 -08:00
Nadine Salter
92d6c577ed Fix strong ASNetworkImageNodeDelegate reference.
Fixes #239.
2015-01-24 11:59:41 -08:00
Ryan Nystrom
ebe614b8c9 Dispatch lazy image downloaders to another thread
fixes #148
2015-01-07 16:22:39 -08:00
Nadine Salter
93ce2b38a2 Make ASNetworkImageNode Just Work.
Use ASBasicImageDownloader by default -- you can now do...

  ASNetworkImageNode *imageNode = [[ASNetworkImageNode alloc] init];
  imageNode.URL = [NSURL URLWithString:@"..."];
  [self.view addSubview:imageNode.view];

...and it'll do the right thing.
2014-12-03 17:31:56 -08:00
Nadine Salter
79e65342b1 Working-range-driven image loading.
Add a `usleep(1.0 * USEC_PER_SEC)` delay to ASBasicImageDownloader and
slowly scroll through the Kittens sample project.  Without this patch,
you'll see that images only start downloading after their purple
placeholders appear onscreen.  With it, images can download and render
before you scroll them onscreen, thanks to the working range.
2014-12-02 19:23:23 -08:00
Nadine Salter
18d52949e6 Missed a spot! 2014-11-21 17:48:29 -08:00
Nadine Salter
03156dceb6 ASNetworkImageNode ARC fixes. 2014-11-21 17:05:24 -08:00