|
| 1 | +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. |
| 2 | +// |
| 3 | +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, |
| 4 | +// copy, modify, and distribute this software in source code or binary form for use |
| 5 | +// in connection with the web services and APIs provided by Facebook. |
| 6 | +// |
| 7 | +// As with any software that integrates with the Facebook platform, your use of |
| 8 | +// this software is subject to the Facebook Developer Principles and Policies |
| 9 | +// [http://developers.facebook.com/policy/]. This copyright notice shall be |
| 10 | +// included in all copies or substantial portions of the software. |
| 11 | +// |
| 12 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 13 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
| 14 | +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 15 | +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| 16 | +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 17 | +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 18 | + |
| 19 | +#import <UIKit/UIKit.h> |
| 20 | + |
| 21 | +#import "FBAdDefines.h" |
| 22 | + |
| 23 | +NS_ASSUME_NONNULL_BEGIN |
| 24 | + |
| 25 | +@class FBAdImage; |
| 26 | +@class FBNativeAd; |
| 27 | +@class FBNativeAdViewAttributes; |
| 28 | + |
| 29 | +/*! |
| 30 | + @class FBAdChoicesView |
| 31 | +
|
| 32 | + @abstract |
| 33 | + FBAdChoicesView offers a simple way to display a sponsored or AdChoices icon. |
| 34 | + */ |
| 35 | +FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED |
| 36 | +@interface FBAdChoicesView : UIView |
| 37 | + |
| 38 | +/*! |
| 39 | + @property |
| 40 | + @abstract Access to the text label contained in this view. |
| 41 | + */ |
| 42 | +@property (nonatomic, weak, readonly, nullable) UILabel *label; |
| 43 | + |
| 44 | +/*! |
| 45 | + @property |
| 46 | + @abstract Determines whether the background mask is shown, or a transparent mask is used. |
| 47 | + */ |
| 48 | +@property (nonatomic, assign, getter=isBackgroundShown) BOOL backgroundShown; |
| 49 | + |
| 50 | +/*! |
| 51 | + @property |
| 52 | + @abstract Determines whether the view can be expanded upon being tapped, or defaults to fullsize. Defaults to NO. |
| 53 | + */ |
| 54 | +@property (nonatomic, assign, readonly, getter=isExpandable) BOOL expandable; |
| 55 | + |
| 56 | +/* |
| 57 | + @property |
| 58 | + @abstract The native ad that provides AdChoices info, such as the image url, and click url. Setting this updates the nativeAd. |
| 59 | + */ |
| 60 | +@property (nonatomic, weak, readwrite, nullable) FBNativeAd *nativeAd; |
| 61 | + |
| 62 | +/* |
| 63 | + @property |
| 64 | + @abstract Affects background mask rendering. Setting this property updates the rendering. |
| 65 | + */ |
| 66 | +@property (nonatomic, assign, readwrite) UIRectCorner corner; |
| 67 | + |
| 68 | +/* |
| 69 | + @property |
| 70 | + @abstract The view controller to present the ad choices info from. If nil, the top view controller is used. |
| 71 | + */ |
| 72 | +@property (nonatomic, weak, readwrite, nullable) UIViewController *viewController; |
| 73 | + |
| 74 | +/*! |
| 75 | + @method |
| 76 | +
|
| 77 | + @abstract |
| 78 | + Initialize this view with a given native ad. Configuration is pulled from the native ad. |
| 79 | +
|
| 80 | + @param nativeAd The native ad to initialize with. |
| 81 | + */ |
| 82 | +- (instancetype)initWithNativeAd:(FBNativeAd *)nativeAd; |
| 83 | + |
| 84 | +/*! |
| 85 | + @method |
| 86 | +
|
| 87 | + @abstract |
| 88 | + Initialize this view with a given native ad. Configuration is pulled from the native ad. |
| 89 | +
|
| 90 | + @param nativeAd The native ad to initialize with. |
| 91 | + @param expandable Controls whether view defaults to expanded or not, see property documentation |
| 92 | + */ |
| 93 | +- (instancetype)initWithNativeAd:(FBNativeAd *)nativeAd |
| 94 | + expandable:(BOOL)expandable; |
| 95 | + |
| 96 | +/*! |
| 97 | + @method |
| 98 | +
|
| 99 | + @abstract |
| 100 | + Initialize this view with explicit parameters. |
| 101 | +
|
| 102 | + @param viewController View controller to present the AdChoices webview from. |
| 103 | + @param adChoicesIcon Native ad AdChoices icon. |
| 104 | + @param adChoicesLinkURL Native ad AdChoices link URL. |
| 105 | + @param attributes Attributes to configure look and feel. |
| 106 | + */ |
| 107 | +- (instancetype)initWithViewController:(nullable UIViewController *)viewController |
| 108 | + adChoicesIcon:(FBAdImage *)adChoicesIcon |
| 109 | + adChoicesLinkURL:(NSURL *)adChoicesLinkURL |
| 110 | + attributes:(nullable FBNativeAdViewAttributes *)attributes; |
| 111 | + |
| 112 | +/*! |
| 113 | + @method |
| 114 | +
|
| 115 | + @abstract |
| 116 | + Initialize this view with explicit parameters. |
| 117 | +
|
| 118 | + @param viewController View controller to present the AdChoices webview from. |
| 119 | + @param adChoicesIcon Native ad AdChoices icon. |
| 120 | + @param adChoicesLinkURL Native ad AdChoices link URL. |
| 121 | + @param attributes Attributes to configure look and feel. |
| 122 | + @param expandable Controls whether view defaults to expanded or not, see property documentation |
| 123 | + */ |
| 124 | +- (instancetype)initWithViewController:(nullable UIViewController *)viewController |
| 125 | + adChoicesIcon:(FBAdImage *)adChoicesIcon |
| 126 | + adChoicesLinkURL:(NSURL *)adChoicesLinkURL |
| 127 | + attributes:(nullable FBNativeAdViewAttributes *)attributes |
| 128 | + expandable:(BOOL)expandable; |
| 129 | + |
| 130 | +/*! |
| 131 | + @method |
| 132 | +
|
| 133 | + @abstract |
| 134 | + Initialize this view with explicit parameters. |
| 135 | +
|
| 136 | + @param viewController View controller to present the AdChoices webview from. |
| 137 | + @param adChoicesIcon Native ad AdChoices icon. |
| 138 | + @param adChoicesLinkURL Native ad AdChoices link URL. |
| 139 | + @param adChoicesText Native ad AdChoices label. |
| 140 | + @param attributes Attributes to configure look and feel. |
| 141 | + @param expandable Controls whether view defaults to expanded or not, see property documentation |
| 142 | + */ |
| 143 | +- (instancetype)initWithViewController:(nullable UIViewController *)viewController |
| 144 | + adChoicesIcon:(FBAdImage *)adChoicesIcon |
| 145 | + adChoicesLinkURL:(NSURL *)adChoicesLinkURL |
| 146 | + adChoicesText:(nullable NSString*)adChoicesText |
| 147 | + attributes:(nullable FBNativeAdViewAttributes *)attributes |
| 148 | + expandable:(BOOL)expandable NS_DESIGNATED_INITIALIZER; |
| 149 | +/*! |
| 150 | + @method |
| 151 | +
|
| 152 | + @abstract |
| 153 | + Using the superview, this updates the frame of this view, positioning the icon in the top right corner by default. |
| 154 | + */ |
| 155 | +- (void)updateFrameFromSuperview; |
| 156 | + |
| 157 | +/*! |
| 158 | + @method |
| 159 | +
|
| 160 | + @abstract |
| 161 | + Using the superview, this updates the frame of this view, positioning the icon in the corner specified. UIRectCornerAllCorners not supported. |
| 162 | +
|
| 163 | + @param corner The corner to display this view from. |
| 164 | + */ |
| 165 | +- (void)updateFrameFromSuperview:(UIRectCorner)corner; |
| 166 | + |
| 167 | +@end |
| 168 | + |
| 169 | +NS_ASSUME_NONNULL_END |
0 commit comments