DNImagePickerHelper.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //
  2. // DNImagePickerHelper.h
  3. // DNImagePicker
  4. //
  5. // Created by Ding Xiao on 16/8/23.
  6. // Copyright © 2016年 Dennis. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. typedef NS_ENUM(NSUInteger, DNAlbumAuthorizationStatus) {
  11. // User has not yet made a choice with regards to this application
  12. DNAlbumAuthorizationStatusNotDetermined = 0,
  13. // This application is not authorized to access photo data.
  14. // The user cannot change this application’s status, possibly due to active restrictions
  15. // such as parental controls being in place.
  16. DNAlbumAuthorizationStatusRestricted,
  17. // User has explicitly denied this application access to photos data.
  18. DNAlbumAuthorizationStatusDenied,
  19. // User has authorized this application to access photos data.
  20. DNAlbumAuthorizationStatusAuthorized
  21. };
  22. typedef NS_ENUM(NSUInteger, DNImagePickerFitlerType) {
  23. DNImagePickerFitlerTypeUnknown = 0,
  24. DNImagePickerFitlerTypeImage = 1,
  25. DNImagePickerFitlerTypeVideo = 2,
  26. DNImagePickerFitlerTypeAudio = 3,
  27. };
  28. @class DNAlbum;
  29. @class DNAsset;
  30. NS_ASSUME_NONNULL_BEGIN
  31. FOUNDATION_EXTERN NSString * const DNImagePickerPhotoLibraryChangedNotification;
  32. NS_CLASS_AVAILABLE_IOS(8.0) @interface DNImagePickerHelper : NSObject
  33. + (instancetype)sharedHelper;
  34. + (void)cancelFetchWithAssets:(DNAsset *)asset;
  35. /**
  36. * Returns information about your app’s authorization for accessing the user’s Photos library.
  37. The current authorization status. See `DNAlbumAuthorizationStatus`.
  38. *
  39. * @return The current authorization status.
  40. */
  41. + (DNAlbumAuthorizationStatus)authorizationStatus;
  42. /**
  43. * Fetch the albumlist
  44. *
  45. */
  46. + (void)requestAlbumListWithCompleteHandler:(void(^)(NSArray<DNAlbum *>* anblumList))competeHandler;
  47. /**
  48. * Fetch the album which is stored by identifier; if not stored, it'll return the album without anything.
  49. *
  50. * @return the stored album
  51. */
  52. + (void)requestCurrentAblumWithCompleteHandler:(void(^)(DNAlbum * album))completeHandler;
  53. /**
  54. fetch images in the specific ablum
  55. @param album target album
  56. @param completeHandler callbacks with imageArray
  57. */
  58. + (void)fetchImageAssetsInAlbum:(DNAlbum *)album completeHandler:(void(^)(NSArray<DNAsset *>* imageArray))completeHandler;
  59. + (void)fetchImageSizeWithAsset:(DNAsset *)asset
  60. imageSizeResultHandler:(void (^)(CGFloat imageSize, NSString * sizeString))handler;
  61. /**
  62. fetch Image with assets
  63. @param asset target assets
  64. @param targetSize target size
  65. @param isHighQuality is need highQuality
  66. @param handler callback with image
  67. */
  68. + (void)fetchImageWithAsset:(DNAsset *)asset
  69. targetSize:(CGSize)targetSize
  70. needHighQuality:(BOOL)isHighQuality
  71. imageResutHandler:(void (^)(UIImage * image))handler;
  72. /**
  73. fetch Image with assets
  74. same as `fetchImageWithAsset:targetSize:needHighQuality:imageResutHandler:` param `isHighQuality` is NO
  75. */
  76. + (void)fetchImageWithAsset:(DNAsset *)asset
  77. targetSize:(CGSize)targetSize
  78. imageResutHandler:(void (^)(UIImage *))handler;
  79. // storeage
  80. + (void)saveAblumIdentifier:(NSString *)identifier;
  81. + (NSString *)albumIdentifier;
  82. @end
  83. NS_ASSUME_NONNULL_END