Skip to content

Commit

Permalink
Add code to temporarily report metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettmoon authored and nguyenhuy committed Oct 6, 2017
1 parent 4a203db commit 8ebe5c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Source/Details/ASPINRemoteImageDownloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

NS_ASSUME_NONNULL_BEGIN

@class PINRemoteImageManagerResult;

typedef void (^ASPINRemoteImageResultProvider)(PINRemoteImageManagerResult *result);

@class PINRemoteImageManager;

@interface ASPINRemoteImageDownloader : NSObject <ASImageCacheProtocol, ASImageDownloaderProtocol>
Expand Down Expand Up @@ -58,6 +62,13 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (PINRemoteImageManager *)sharedPINRemoteImageManager;

/**
* Allows you to view results of any download requests
*
* This is likely temporary.
*/
@property (atomic, strong, nullable) ASPINRemoteImageResultProvider resultProvider;

@end

NS_ASSUME_NONNULL_END
Expand Down
4 changes: 4 additions & 0 deletions Source/Details/ASPINRemoteImageDownloader.m
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ - (nullable id)downloadImageWithURLs:(NSArray <NSURL *> *)URLs
};

PINRemoteImageManagerImageCompletion imageCompletion = ^(PINRemoteImageManagerResult * _Nonnull result) {
if (self.resultProvider) {
self.resultProvider(result);
}

/// If we're targeting the main queue and we're on the main thread, complete immediately.
if (ASDisplayNodeThreadIsMain() && callbackQueue == dispatch_get_main_queue()) {
#if PIN_ANIMATED_AVAILABLE
Expand Down

0 comments on commit 8ebe5c2

Please sign in to comment.