Skip to content

Commit e349ead

Browse files
author
becvert
committed
initial commit
1 parent 4b13618 commit e349ead

24 files changed

+2184
-0
lines changed
74.1 MB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
#ifndef FBAudienceNetwork_FBAdDefines_h
20+
#define FBAudienceNetwork_FBAdDefines_h
21+
22+
#ifdef __cplusplus
23+
#define FB_EXTERN_C_BEGIN extern "C" {
24+
#define FB_EXTERN_C_END }
25+
#else
26+
#define FB_EXTERN_C_BEGIN
27+
#define FB_EXTERN_C_END
28+
#endif
29+
30+
#ifdef __cplusplus
31+
# define FB_EXPORT extern "C" __attribute__((visibility("default")))
32+
#else
33+
# define FB_EXPORT extern __attribute__((visibility("default")))
34+
#endif
35+
36+
#define FB_CLASS_EXPORT __attribute__((visibility("default")))
37+
#define FB_DEPRECATED __attribute__((deprecated))
38+
39+
#if __has_feature(objc_generics)
40+
#define FB_NSArrayOf(x) NSArray<x>
41+
#define FB_NSMutableArrayOf(x) NSMutableArray<x>
42+
#define FB_NSDictionaryOf(x,y) NSDictionary<x, y>
43+
#define FB_NSMutableDictionaryOf(x, y) NSMutableDictionary<x, y>
44+
#define FB_NSSetOf(x) NSSet<x>
45+
#define FB_NSMutableSetOf(x) NSMutableSet<x>
46+
#else
47+
#define FB_NSArrayOf(x) NSArray
48+
#define FB_NSMutableArrayOf(x) NSMutableArray
49+
#define FB_NSDictionaryOf(x,y) NSDictionary
50+
#define FB_NSMutableDictionaryOf(x, y) NSMutableDictionary
51+
#define FB_NSSetOf(x) NSSet
52+
#define FB_NSMutableSetOf(x) NSMutableSet
53+
#define __covariant
54+
#endif
55+
56+
#if ! __has_feature(nullability)
57+
#define NS_ASSUME_NONNULL_BEGIN
58+
#define NS_ASSUME_NONNULL_END
59+
#define nullable
60+
#define __nullable
61+
#endif
62+
63+
#ifndef FB_IOS9_SDK_OR_LATER
64+
#define FB_IOS9_SDK_OR_LATER (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_9_0)
65+
#endif
66+
67+
#ifndef FBInterfaceOrientationMask
68+
#if !FB_IOS9_SDK_OR_LATER
69+
#define FBInterfaceOrientationMask NSUInteger
70+
#else
71+
#define FBInterfaceOrientationMask UIInterfaceOrientationMask
72+
#endif // FB_IOS9_SDK_OR_LATER
73+
#endif // FBInterfaceOrientationMask
74+
75+
#ifndef FB_SUBCLASSING_RESTRICTED
76+
#if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)
77+
#define FB_SUBCLASSING_RESTRICTED __attribute__((objc_subclassing_restricted))
78+
#else
79+
#define FB_SUBCLASSING_RESTRICTED
80+
#endif
81+
#endif
82+
83+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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 <Foundation/Foundation.h>
20+
21+
#import "FBAdDefines.h"
22+
23+
NS_ASSUME_NONNULL_BEGIN
24+
25+
FB_EXPORT NSString * const FBAudienceNetworkErrorDomain;
26+
27+
typedef NS_ENUM(NSInteger, FBAdLogLevel) {
28+
FBAdLogLevelNone,
29+
FBAdLogLevelNotification,
30+
FBAdLogLevelError,
31+
FBAdLogLevelWarning,
32+
FBAdLogLevelLog,
33+
FBAdLogLevelDebug,
34+
FBAdLogLevelVerbose
35+
};
36+
37+
/*!
38+
@class FBAdSettings
39+
40+
@abstract AdSettings contains global settings for all ad controls.
41+
*/
42+
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
43+
@interface FBAdSettings : NSObject
44+
45+
/*!
46+
@method
47+
48+
@abstract
49+
Adds a test device.
50+
51+
@param deviceHash The id of the device to use test mode, can be obtained from debug log
52+
53+
@discussion
54+
Copy the current device Id from debug log and add it as a test device to get test ads. Apps
55+
running on emulator will automatically get test ads. Test devices should be added before loadAd is called.
56+
*/
57+
+ (void)addTestDevice:(NSString *)deviceHash;
58+
59+
/*!
60+
@method
61+
62+
@abstract
63+
Add a collection of test devices. See `+addTestDevices:` for details.
64+
65+
@param devicesHash The array of the device id to use test mode, can be obtained from debug log
66+
*/
67+
+ (void)addTestDevices:(FB_NSArrayOf(NSString *)*)devicesHash;
68+
69+
/*!
70+
@method
71+
72+
@abstract
73+
Clear all the added test devices
74+
*/
75+
+ (void)clearTestDevices;
76+
77+
/*!
78+
@method
79+
80+
@abstract
81+
Configures the ad control for treatment as child-directed.
82+
83+
@param isChildDirected Indicates whether you would like your ad control to be treated as child-directed
84+
85+
@discussion
86+
Note that you may have other legal obligations under the Children's Online Privacy Protection Act (COPPA).
87+
Please review the FTC's guidance and consult with your own legal counsel.
88+
*/
89+
+ (void)setIsChildDirected:(BOOL)isChildDirected;
90+
91+
/*!
92+
@method
93+
94+
@abstract
95+
If an ad provided service is mediating Audience Network in their sdk, it is required to set the name of the mediation service
96+
97+
@param service Representing the name of the mediation that is mediation Audience Network
98+
*/
99+
+ (void)setMediationService:(NSString *)service;
100+
101+
/*!
102+
@method
103+
104+
@abstract
105+
Gets the url prefix to use when making ad requests.
106+
107+
@discussion
108+
This method should never be used in production.
109+
*/
110+
+ (NSString *)urlPrefix;
111+
112+
/*!
113+
@method
114+
115+
@abstract
116+
Sets the url prefix to use when making ad requests.
117+
118+
@discussion
119+
This method should never be used in production.
120+
*/
121+
+ (void)setUrlPrefix:(NSString *) urlPrefix;
122+
123+
/*!
124+
@method
125+
126+
@abstract
127+
Gets the current SDK logging level
128+
*/
129+
+ (FBAdLogLevel)getLogLevel;
130+
131+
/*!
132+
@method
133+
134+
@abstract
135+
Sets the current SDK logging level
136+
*/
137+
+ (void)setLogLevel:(FBAdLogLevel)level;
138+
139+
@end
140+
141+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)