Commit Graph

76 Commits

Author SHA1 Message Date
Garrett Moon
3dbbfc7591 Without this, the system is likely caching our NSURLResponses which means double caching :( (#219) 2016-07-15 15:02:09 -07:00
Garrett Moon
2cfc232d11 Adds better support for cancelation (#218)
In order to avoid blocking on the main thread, PINRemoteImage creates
a UUID but does not immediately start a task instead putting it on an
operation queue. This means that a client can request cancelation for
a UUID before its task is created.

Previously, we attempted to handle this by maintaining a set of canceled
UUIDs. This was being done incorrectly however. The logic was to check if,
before creating a task, a UUID was in canceledTasks. If it was, don't
create the task. If it wasn't clear out the canceledTasks list. This
example illustrates why that was erroneous:
1. Request starting a task with UUID #1
2. Request starting a task with UUID #2
3. Request canceling UUID #2
4. Task creation starts for UUID #1
5. UUID one is not in canceledTasks so it is cleared
6. Task creation starts for UUID #2, it is not in canceledTasks
   so the task is created and is not canceled.

This patch changes canceledTasks to a weak hash table and removes
the line which cleared out canceledTasks. As long as there are blocks
(for task creation) referencing the UUID, they will not be removed
from canceledTasks. When no one is referencing the UUIDs any longer,
they will be cleared out.
2016-07-15 14:51:48 -07:00
Diego Torres
6c5b928935 Generate the cacheKey only when necessary (#191) 2016-04-22 11:34:25 -07:00
Diego Torres
1d04bf82b2 Use a hashed key when the URL is too long (#189)
* Use a hashed key when the URL is too long

* Added tests for new cacheKey behaviour

* Conform to project style
2016-04-19 15:48:08 -07:00
Garrett Moon
05b24714f4 Materialize object isn't meant to be called on nil objects. (#187) 2016-04-13 10:21:53 -07:00
Garrett Moon
bf1012741c Add error for empty images. (#188) 2016-04-13 10:09:38 -07:00
Wendy Lu
0e81f77d16 Have PINProgressiveImage pass back the quality of the current progressive image (#185)
* Have PINProgressiveImage pass back the quality of the current progressive image
* fix
* Check for nil for imageProgress pointer
* Rename some variables
* Rename a bunch of things
* Update comment
2016-04-13 07:42:37 -07:00
Adlai Holler
632e1bcd2a Modify estimatedRemainingTimeThreshhold Behavior to Match Documentation (#184)
* Modify estimatedRemainingTimeThreshhold behavior to match documentation
* Update documentation on maxProgressiveRenderSize property
* Update the behavior, not the docs
2016-04-11 15:36:50 -07:00
Garrett Moon
a0c421e50f Fix build, need to return results :) 2016-04-11 15:25:11 -07:00
Adlai Holler
157771425d Another indentation fix 2016-04-09 12:59:58 -07:00
Adlai Holler
6ff9eea9ff Use spaces for indentation 2016-04-09 12:20:23 -07:00
Adlai Holler
df36ae409b Return tasks from prefetching methods 2016-04-09 12:08:02 -07:00
Garrett Moon
ea164f9524 Follow up to #175, addressing comments 2016-04-04 16:12:17 -07:00
Garrett Moon
4b5d3b8c7e Cleanup 2016-03-29 17:18:37 -07:00
Garrett Moon
509ee0cd2e UIImage -> PINImage 2016-03-29 16:48:46 -07:00
Garrett Moon
7c31744e31 Switch to alternative representation 2016-03-28 17:08:53 -07:00
Garrett Moon
4fbb5b540c Spacing 2016-03-28 17:06:36 -07:00
Garrett Moon
1d84f5ebc8 Add memory container 2016-03-28 17:05:59 -07:00
Eric Jensen
af382d93f6 Correct spelling typos 2016-03-22 22:02:27 -07:00
Eric Jensen
153df72ac4 Correct mixed indentation by replacing tabs with spaces 2016-03-22 22:01:35 -07:00
Garrett Moon
7ba1bee59c Merge pull request #167 from pinterest/preventDiskCacheRemoveOnMainThread
Don't want to call diskCache remove synchronously on the main thread.
2016-03-21 11:38:32 -07:00
Garrett Moon
d8c5795fcd Improved docs 2016-03-20 17:47:25 -07:00
Garrett Moon
42aa7b6dc5 Don't want to call diskCache remove synchronously on the main thread. 2016-03-18 14:08:28 -07:00
Garrett Moon
6d6f4fe264 Add slightly more performant locking. 2016-03-17 10:29:36 -07:00
Garrett Moon
2e3c844c28 UIImage should be PINImage 2016-03-11 16:35:46 -08:00
Garrett Moon
3b5164af98 Add support for synchronously getting images from the cache. Also, store images in cache even if they aren't decoded. 2016-03-11 15:17:30 -08:00
Garrett Moon
29b0b4ac65 Fixes a crash in task callbacks
While all methods on tasks are called within the manager's lock,
dispatching to another queue obviously means the manager may not
be locked anymore.

I also moved calling progress download callbacks to the download
task so it's similar to progress image.

Hopefully these issues have been fixed, but it leads me to believe
a better architecture would be to make the tasks immutable by the
manager and have the tasks manage a lock on themselves. I'll need
to think about that more.
2016-02-23 11:01:56 -08:00
Garrett Moon
d23487c57e That would have been bad. 2016-02-17 13:43:01 -08:00
Garrett Moon
5f609a7cde Remove load and instead make supportsQOS method. Thanks @appleguy! 2016-02-17 13:43:01 -08:00
Garrett Moon
ed5fa6af52 We only need to check respondsToSelector once and set QOS on queue, not each operation. 2016-02-17 13:43:01 -08:00
Garrett Moon
b57161ddcb Callback on callback queue 2016-02-10 18:20:55 -08:00
Michael Schneider
c2a5f4220b Call PINRemoteImageDownloadTask callback blocks outside the PINRemoteImageManager lock
We call the callback blocks outside the lock that way blocking the callback won't lock up PINRemoteImageManager.
2016-02-10 14:36:25 -08:00
Michael Schneider
07b779eb4b Rename PINRemoteImageManagerDownloadProgress to PINRemoteImageManagerProgressDownload 2016-02-10 14:23:57 -08:00
Michael Schneider
5d5dada353 Rename downloadProgress: to progressDownload: 2016-02-10 14:13:56 -08:00
Michael Schneider
e2f8f67c1d Change progress block name to progressImage 2016-02-10 13:54:00 -08:00
Michael Schneider
da255a576c Add optional block to track download progress of image 2016-02-08 20:28:29 -08:00
Garrett Moon
ff59acafa4 Allow setting of progress block to add or cancel updates 2016-02-03 12:59:44 -08:00
Garrett Moon
997c747bf1 Merge branch 'add-generics-for-image-url-arrays' of https://github.com/rounak/PINRemoteImage into rounak-add-generics-for-image-url-arrays 2016-02-02 14:28:00 -08:00
rounak
6a90410322 Add generics to collections 2016-02-01 22:19:51 -08:00
Michael Schneider
f18c250f3e Merge branch 'master' into feature/osx-support 2016-01-30 16:33:15 -08:00
Garrett Moon
bcb0bd9fc2 Allow maximum progressive render size to be set 2016-01-25 10:53:29 -08:00
Garrett Moon
873e26a183 Allow blurring of progressive to be disabled 2016-01-22 14:14:17 -08:00
Michael Schneider
8df9dc00c6 Add support for OS X to library
Mapping generic classes like PINImage, PINImageView and PINButton to the equivalent UIKit or AppKit classes. Throughout the framework use these mappings instead of the concrete UIKit / AppKit names. Furthermore we provide a category on NSImage that is adding methods that are not available on NSImage but on UIImage.
2016-01-04 17:39:50 +01:00
Bradley Smith
cc9f900a95 - added sharedImageManager configuration 2015-12-07 16:05:31 -05:00
Garrett Moon
bbc0a9c86f URLs need to be HTTPs 2015-10-23 11:39:12 -07:00
Kurry
21e95bfd82 made changes so FLAnimatedImage is optional and updated PINCache and pod version 2015-10-04 15:07:06 -04:00
Kurry
b795c4e384 added support for custom http request headers 2015-09-11 23:08:33 -04:00
Bilge Taylan Ulusoy
0229cf1410 authenticationChallenge tests + removed nullable 2015-09-11 19:55:54 +02:00
Bilge Taylan Ulusoy
dfd5a8d67e Call completionHandler if authenticationChallenge Block is not set
Using NSURLSessionAuthChallengePerformDefaultHandling
2015-09-11 11:36:56 +02:00
Bilge Taylan Ulusoy
f321dc4ce4 -didReceiveAuthenticationChallenge:forTask:completionHandler: Implementation 2015-09-11 11:29:33 +02:00