PINRemoteImageMacros.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // PINRemoteImageMacros.h
  3. // PINRemoteImage
  4. //
  5. #import <TargetConditionals.h>
  6. #ifndef PINRemoteImageMacros_h
  7. #define PINRemoteImageMacros_h
  8. #define PIN_TARGET_IOS (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR || TARGET_OS_TV)
  9. #define PIN_TARGET_MAC (TARGET_OS_MAC)
  10. #define PINRemoteImageLogging 0
  11. #if PINRemoteImageLogging
  12. #define PINLog(args...) NSLog(args)
  13. #else
  14. #define PINLog(args...)
  15. #endif
  16. #if __has_include(<FLAnimatedImage/FLAnimatedImage.h>)
  17. #define USE_FLANIMATED_IMAGE 1
  18. #else
  19. #define USE_FLANIMATED_IMAGE 0
  20. #define FLAnimatedImage NSObject
  21. #endif
  22. #if __has_include(<PINCache/PINCache.h>)
  23. #define USE_PINCACHE 1
  24. #else
  25. #define USE_PINCACHE 0
  26. #endif
  27. #if PIN_TARGET_IOS
  28. #define PINImage UIImage
  29. #define PINImageView UIImageView
  30. #define PINButton UIButton
  31. #define PINNSOperationSupportsQOS (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0)
  32. #define PINNSURLSessionTaskSupportsPriority (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0)
  33. #elif PIN_TARGET_MAC
  34. #define PINImage NSImage
  35. #define PINImageView NSImageView
  36. #define PINButton NSButton
  37. #define PINNSOperationSupportsQOS (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_10)
  38. #define PINNSURLSessionTaskSupportsPriority (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_10)
  39. #endif
  40. #define BlockAssert(condition, desc, ...) \
  41. do { \
  42. __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \
  43. if (!(condition)) { \
  44. [[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \
  45. object:strongSelf file:[NSString stringWithUTF8String:__FILE__] \
  46. lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \
  47. } \
  48. __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \
  49. } while(0);
  50. #endif /* PINRemoteImageMacros_h */