CSJSKOverlayProtocol.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // CSJSKOverlayProtocol.h
  3. // CSJAdSDK
  4. //
  5. // Created by Eason on 2021/7/27.
  6. //
  7. #ifndef BUSKOverlayProtocol_h
  8. #define BUSKOverlayProtocol_h
  9. #import <Foundation/Foundation.h>
  10. API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(macos, watchos) __TVOS_PROHIBITED
  11. @protocol CSJSKOverlayCallBackDelegate <NSObject>
  12. @optional
  13. - (void)storeOverlay:(NSObject *_Nonnull)overlay didFailToLoadWithError:(NSError *_Nullable)error NS_SWIFT_NAME(storeOverlayDidFailToLoad(_:error:));
  14. - (void)storeOverlay:(NSObject *_Nonnull)overlay willStartPresentation:(NSObject *_Nullable)transitionContext NS_SWIFT_NAME(storeOverlayWillStartPresentation(_:transitionContext:));
  15. - (void)storeOverlay:(NSObject *_Nonnull)overlay didFinishPresentation:(NSObject *_Nullable)transitionContext NS_SWIFT_NAME(storeOverlayDidFinishPresentation(_:transitionContext:));
  16. - (void)storeOverlay:(NSObject *_Nonnull)overlay willStartDismissal:(NSObject *_Nullable)transitionContext NS_SWIFT_NAME(storeOverlayWillStartDismissal(_:transitionContext:));
  17. - (void)storeOverlay:(NSObject *_Nonnull)overlay didFinishDismissal:(NSObject *_Nullable)transitionContext NS_SWIFT_NAME(storeOverlayDidFinishDismissal(_:transitionContext:));
  18. @end
  19. API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(macos, watchos) __TVOS_PROHIBITED
  20. @protocol CSJSKOverlayAppConfigurationDelegate <NSObject>
  21. @optional
  22. /// Creates a new app overlay configuration that will show an app from the App Store.
  23. /// @param appIdentifier the app identifier of the app to show.
  24. /// @param position the desired position of the overlay.
  25. - (instancetype _Nullable)initWithAppIdentifier:(NSString *_Nonnull)appIdentifier position:(NSInteger)position NS_SWIFT_NAME(init(appIdentifier:position:));
  26. /// The identifier of the app that will be shown.
  27. @property (nonatomic, retain) NSString * _Nullable appIdentifier;
  28. /// A token representing an App Analytics campaign.
  29. @property (nonatomic, retain, nullable) NSString *campaignToken;
  30. /// The provider token for the developer that created the app being presented.
  31. @property (nonatomic, retain, nullable) NSString *providerToken;
  32. /// The position an overlay will show at on screen.
  33. @property (nonatomic) NSInteger position;
  34. /// Allows the user to interactively dismiss an overlay.
  35. @property (nonatomic) BOOL userDismissible;
  36. - (void)setAdditionalValue:(nullable id)value forKey:(NSString *_Nonnull)key;
  37. - (nullable id)additionalValueForKey:(NSString *_Nonnull)key NS_WARN_UNUSED_RESULT;
  38. @end
  39. API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(macos, watchos) __TVOS_PROHIBITED
  40. @protocol CSJSKOverlayDelegate <NSObject>
  41. @optional
  42. /// Creates an overlay with the provided configuration.
  43. /// @param configuration the configuration for the overlay.
  44. - (instancetype _Nullable )initWithConfiguration:(NSObject *_Nullable)configuration;
  45. #if !TARGET_OS_OSX
  46. /// Attempts to present an app overlay in a `UIWindowScene`.
  47. - (void)presentInScene:(UIWindowScene *_Nonnull)scene API_AVAILABLE(ios(14.0)) NS_EXTENSION_UNAVAILABLE("Overlays are not available in extensions");
  48. #endif
  49. /// A delegate for overlay events.
  50. @property (nonatomic, weak, nullable) id <CSJSKOverlayCallBackDelegate> delegate;
  51. /// The overlay configuration.
  52. @property (readonly, copy) NSObject * _Nullable configuration;
  53. @end
  54. API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(macos, watchos) __TVOS_PROHIBITED
  55. @protocol BUSKOverlayClassDelegate
  56. @optional
  57. /// Dismisses an overlay being presented in a `UIWindowScene`.
  58. + (void)dismissOverlayInScene:(UIWindowScene *_Nullable)scene API_AVAILABLE(ios(14.0)) NS_EXTENSION_UNAVAILABLE("Overlays are not available in extensions");
  59. @end
  60. #endif /* BUSKOverlayProtocol_h */