[iOS] Updated Mopub version

This commit is contained in:
Alexander Boriskov 2020-09-11 12:13:01 +03:00 committed by mpimenov
parent 281a27c71e
commit 8ad69d5123
491 changed files with 14036 additions and 10352 deletions

View file

@ -13,8 +13,8 @@ pod 'Pushwoosh', '5.16.0'
pod 'FBSDKCoreKit', '5.15.1'
pod 'FBSDKLoginKit', '5.15.1'
pod 'Flurry-iOS-SDK/FlurrySDK', '10.1'
pod 'mopub-ios-sdk', '5.10'
pod 'MoPub-FacebookAudienceNetwork-Adapters', '5.6.0.0'
pod 'mopub-ios-sdk', '5.12'
pod 'MoPub-FacebookAudienceNetwork-Adapters', '5.9.0'
pod 'Firebase/Crashlytics', '6.26.0'
pod 'Firebase/Analytics', '6.26.0'

View file

@ -1,6 +1,6 @@
PODS:
- AppsFlyerFramework (4.9.0)
- FBAudienceNetwork (5.6.0):
- FBAudienceNetwork (5.9.0):
- FBSDKCoreKit/Basics (>= 5.6.0)
- FBSDKCoreKit (5.15.1):
- FBSDKCoreKit/Basics (= 5.15.1)
@ -86,25 +86,30 @@ PODS:
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (6.7.1):
- GoogleUtilities/Logger
- MoPub-FacebookAudienceNetwork-Adapters (5.6.0.0):
- MoPub-FacebookAudienceNetwork-Adapters/MoPub (= 5.6.0.0)
- MoPub-FacebookAudienceNetwork-Adapters/Network (= 5.6.0.0)
- MoPub-FacebookAudienceNetwork-Adapters/MoPub (5.6.0.0):
- MoPub-FacebookAudienceNetwork-Adapters (5.9.0.0):
- MoPub-FacebookAudienceNetwork-Adapters/MoPub (= 5.9.0.0)
- MoPub-FacebookAudienceNetwork-Adapters/Network (= 5.9.0.0)
- MoPub-FacebookAudienceNetwork-Adapters/MoPub (5.9.0.0):
- mopub-ios-sdk/Core (~> 5.6)
- MoPub-FacebookAudienceNetwork-Adapters/Network (5.6.0.0):
- FBAudienceNetwork (= 5.6.0)
- mopub-ios-sdk/NativeAds (~> 5.6)
- MoPub-FacebookAudienceNetwork-Adapters/Network (5.9.0.0):
- FBAudienceNetwork (= 5.9.0)
- mopub-ios-sdk/Core (~> 5.6)
- mopub-ios-sdk (5.10.0):
- mopub-ios-sdk/MoPubSDK (= 5.10.0)
- mopub-ios-sdk/Avid (5.10.0):
- mopub-ios-sdk/NativeAds (~> 5.6)
- mopub-ios-sdk (5.12.0):
- mopub-ios-sdk/MoPubSDK (= 5.12.0)
- mopub-ios-sdk/Avid (5.12.0):
- mopub-ios-sdk/Core
- mopub-ios-sdk/Core (5.10.0)
- mopub-ios-sdk/Moat (5.10.0):
- mopub-ios-sdk/Core (5.12.0)
- mopub-ios-sdk/Moat (5.12.0):
- mopub-ios-sdk/Core
- mopub-ios-sdk/MoPubSDK (5.10.0):
- mopub-ios-sdk/MoPubSDK (5.12.0):
- mopub-ios-sdk/Avid
- mopub-ios-sdk/Core
- mopub-ios-sdk/Moat
- mopub-ios-sdk/NativeAds
- mopub-ios-sdk/NativeAds (5.12.0):
- mopub-ios-sdk/Core
- nanopb (1.30905.0):
- nanopb/decode (= 1.30905.0)
- nanopb/encode (= 1.30905.0)
@ -122,8 +127,8 @@ DEPENDENCIES:
- Firebase/Analytics (= 6.26.0)
- Firebase/Crashlytics (= 6.26.0)
- Flurry-iOS-SDK/FlurrySDK (= 10.1)
- MoPub-FacebookAudienceNetwork-Adapters (= 5.6.0.0)
- mopub-ios-sdk (= 5.10)
- MoPub-FacebookAudienceNetwork-Adapters (= 5.9.0)
- mopub-ios-sdk (= 5.12)
- Pushwoosh (= 5.16.0)
SPEC REPOS:
@ -153,7 +158,7 @@ SPEC REPOS:
SPEC CHECKSUMS:
AppsFlyerFramework: f57e5d590ad3124d3e594a76032a181bc91ec6cd
FBAudienceNetwork: 1ea63543665445a3a5b4a059e8210a343b6ab3c1
FBAudienceNetwork: 648648b13d8ea3d39676542dece2b04dbe867497
FBSDKCoreKit: 1d5acf7c9d7a2f92bb1a242dc60cae5b7adb91df
FBSDKLoginKit: f1ea8026a58b52d30c9f2e6a58ca7d813619fb83
Firebase: 7cf5f9c67f03cb3b606d1d6535286e1080e57eb6
@ -169,12 +174,12 @@ SPEC CHECKSUMS:
GoogleDataTransport: 9a8a16f79feffc7f42096743de2a7c4815e84020
GoogleDataTransportCCTSupport: 489c1265d2c85b68187a83a911913d190012158d
GoogleUtilities: e121a3867449ce16b0e35ddf1797ea7a389ffdf2
MoPub-FacebookAudienceNetwork-Adapters: 3cec249235d12e3fec9a01bf559d608fa3ec05e1
mopub-ios-sdk: 3d65133b95b6498aa871a66818a11a5ba307e565
MoPub-FacebookAudienceNetwork-Adapters: c9cbf2549ab2e108086594ab18f1709cc5897300
mopub-ios-sdk: bb61d5741ba16c6a78e5a54e37bc60ef8c9a80a8
nanopb: c43f40fadfe79e8b8db116583945847910cbabc9
PromisesObjC: b48e0338dbbac2207e611750777895f7a5811b75
Pushwoosh: 6cba171e52f3f7b8ccd280f492a5831deac2f594
PODFILE CHECKSUM: c3f8758a04bfcf497d7cf4a86726c990ae127e6a
PODFILE CHECKSUM: 8a9705a6477e83ec21530a12f6522770e57f6ca4
COCOAPODS: 1.9.3
COCOAPODS: 1.8.3

View file

@ -30,8 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
FBAdChoicesView offers a simple way to display a sponsored or AdChoices icon.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBAdChoicesView : UIView
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBAdChoicesView : UIView
/**
Access to the text label contained in this view.
@ -86,8 +85,7 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@param nativeAd The native ad to initialize with.
@param expandable Controls whether view defaults to expanded or not, see property documentation
*/
- (instancetype)initWithNativeAd:(FBNativeAdBase *)nativeAd
expandable:(BOOL)expandable;
- (instancetype)initWithNativeAd:(FBNativeAdBase *)nativeAd expandable:(BOOL)expandable;
/**
Initialize this view with a given native ad. Configuration is pulled from the native ad.
@ -106,14 +104,16 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
- (void)updateFrameFromSuperview;
/**
Using the superview, this updates the frame of this view, positioning the icon in the corner specified. UIRectCornerAllCorners not supported.
Using the superview, this updates the frame of this view, positioning the icon in the corner specified.
UIRectCornerAllCorners not supported.
@param corner The corner to display this view from.
*/
- (void)updateFrameFromSuperview:(UIRectCorner)corner;
/**
Using the superview, this updates the frame of this view, positioning the icon in the corner specified. UIRectCornerAllCorners not supported.
Using the superview, this updates the frame of this view, positioning the icon in the corner specified.
UIRectCornerAllCorners not supported.
@param corner The corner to display this view from.
@param insets Insets to take into account when positioning the view. Only respective insets are applied to corners.

View file

@ -20,17 +20,17 @@
#define FBAudienceNetwork_FBAdDefines_h
#ifdef __cplusplus
#define FB_EXTERN_C_BEGIN extern "C" {
#define FB_EXTERN_C_END }
#define FB_EXTERN_C_BEGIN extern "C" {
#define FB_EXTERN_C_END }
#else
#define FB_EXTERN_C_BEGIN
#define FB_EXTERN_C_END
#endif
#ifdef __cplusplus
# define FB_EXPORT extern "C" __attribute__((visibility("default")))
#define FB_EXPORT extern "C" __attribute__((visibility("default")))
#else
# define FB_EXPORT extern __attribute__((visibility("default")))
#define FB_EXPORT extern __attribute__((visibility("default")))
#endif
#define FB_CLASS_EXPORT __attribute__((visibility("default")))
@ -40,21 +40,21 @@
#if __has_feature(objc_generics)
#define FB_NSArrayOf(x) NSArray<x>
#define FB_NSMutableArrayOf(x) NSMutableArray<x>
#define FB_NSDictionaryOf(x,y) NSDictionary<x, y>
#define FB_NSDictionaryOf(x, y) NSDictionary<x, y>
#define FB_NSMutableDictionaryOf(x, y) NSMutableDictionary<x, y>
#define FB_NSSetOf(x) NSSet<x>
#define FB_NSMutableSetOf(x) NSMutableSet<x>
#else
#define FB_NSArrayOf(x) NSArray
#define FB_NSMutableArrayOf(x) NSMutableArray
#define FB_NSDictionaryOf(x,y) NSDictionary
#define FB_NSDictionaryOf(x, y) NSDictionary
#define FB_NSMutableDictionaryOf(x, y) NSMutableDictionary
#define FB_NSSetOf(x) NSSet
#define FB_NSMutableSetOf(x) NSMutableSet
#define __covariant
#endif
#if ! __has_feature(nullability)
#if !__has_feature(nullability)
#define NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_END
#define nullable

View file

@ -0,0 +1,52 @@
// Copyright 2004-present Facebook. All Rights Reserved.
//
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
// copy, modify, and distribute this software in source code or binary form for use
// in connection with the web services and APIs provided by Facebook.
//
// As with any software that integrates with the Facebook platform, your use of
// this software is subject to the Facebook Developer Principles and Policies
// [http://developers.facebook.com/policy/]. This copyright notice shall be
// included in all copies or substantial portions of the software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <FBAudienceNetwork/FBAdDefines.h>
NS_ASSUME_NONNULL_BEGIN
typedef NSString *FBAdExperienceType NS_STRING_ENUM;
extern FBAdExperienceType const FBAdExperienceTypeRewarded;
extern FBAdExperienceType const FBAdExperienceTypeInterstitial;
extern FBAdExperienceType const FBAdExperienceTypeRewardedInterstitial;
FB_CLASS_EXPORT
/**
FBAdExperienceConfig is class designed to add some configuration to ad experience
*/
@interface FBAdExperienceConfig : NSObject
/**
Ad experience type to set up
*/
@property (nonatomic, strong, readwrite, nonnull) FBAdExperienceType adExperienceType;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
/**
Creates an FBAdExperienceConfig with a specified type of experience
*/
- (instancetype)initWithAdExperienceType:(FBAdExperienceType)adExperienceType NS_DESIGNATED_INITIALIZER;
@end
NS_ASSUME_NONNULL_END

View file

@ -48,16 +48,14 @@ FB_CLASS_EXPORT
@param width the image width.
@param height the image height.
*/
- (instancetype)initWithURL:(NSURL *)url
width:(NSInteger)width
height:(NSInteger)height NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithURL:(NSURL *)url width:(NSInteger)width height:(NSInteger)height NS_DESIGNATED_INITIALIZER;
/**
Loads an image from self.url over the network, or returns the cached image immediately.
@param block Block to handle the loaded image.
*/
- (void)loadImageAsyncWithBlock:(nullable void (^)(UIImage * __nullable image))block;
- (void)loadImageAsyncWithBlock:(nullable void (^)(UIImage *__nullable image))block;
@end

View file

@ -25,11 +25,11 @@ NS_ASSUME_NONNULL_BEGIN
/**
Audience Network error domain
*/
FB_EXPORT NSString * const FBAudienceNetworkErrorDomain;
FB_EXPORT NSString *const FBAudienceNetworkErrorDomain;
/**
Audience Network error FBMediaView error domain
*/
FB_EXPORT NSString * const FBAudienceNetworkMediaViewErrorDomain;
FB_EXPORT NSString *const FBAudienceNetworkMediaViewErrorDomain;
/**
Audience Network SDK logging levels
@ -51,20 +51,6 @@ typedef NS_ENUM(NSInteger, FBAdLogLevel) {
FBAdLogLevelVerbose
};
/**
Determines what method is used for rendering FBMediaView content
*/
typedef NS_ENUM(NSInteger, FBMediaViewRenderingMethod) {
/// Automatic selection of rendering method
FBMediaViewRenderingMethodDefault,
/// Force Metal rendering (only use for devices with support)
FBMediaViewRenderingMethodMetal,
/// Force OpenGL rendering
FBMediaViewRenderingMethodOpenGL,
/// Software fallback
FBMediaViewRenderingMethodSoftware
} FB_DEPRECATED_WITH_MESSAGE("Rendering method is no longer used in Audience Network");
/**
Test Ad type to be injected when test mode is on
*/
@ -102,8 +88,7 @@ typedef NS_ENUM(NSInteger, FBAdTestAdType) {
/**
AdSettings contains global settings for all ad controls.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBAdSettings : NSObject
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBAdSettings : NSObject
/**
Controls support for audio-only video playback when the app is backgrounded. Note that this is only supported
@ -119,8 +104,8 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@property (class, nonatomic, assign) FBAdTestAdType testAdType;
/**
When this delegate is set, logs will be redirected to the delegate instead of being logged directly to the console with NSLog.
This can be used in combination with external logging frameworks.
When this delegate is set, logs will be redirected to the delegate instead of being logged directly to the console with
NSLog. This can be used in combination with external logging frameworks.
*/
@property (class, nonatomic, weak, nullable) id<FBAdLoggingDelegate> loggingDelegate;
@ -161,7 +146,7 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@param devicesHash The array of the device id to use test mode, can be obtained from debug log or testDeviceHash
*/
+ (void)addTestDevices:(FB_NSArrayOf(NSString *)*)devicesHash;
+ (void)addTestDevices:(FB_NSArrayOf(NSString *) *)devicesHash;
/**
Clear all the added test devices
@ -194,7 +179,8 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@property (class, nonatomic, assign, getter=isMixedAudience) BOOL mixedAudience;
/**
If an ad provided service is mediating Audience Network in their sdk, it is required to set the name of the mediation service
If an ad provided service is mediating Audience Network in their sdk, it is required to set the name of the mediation
service
@param service Representing the name of the mediation that is mediation Audience Network
*/
@ -214,7 +200,7 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
This method should never be used in production.
*/
+ (void)setUrlPrefix:(nullable NSString *) urlPrefix;
+ (void)setUrlPrefix:(nullable NSString *)urlPrefix;
/**
Gets the current SDK logging level
@ -226,23 +212,6 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
*/
+ (void)setLogLevel:(FBAdLogLevel)level;
/**
Gets the FBMediaView rendering method
*/
+ (FBMediaViewRenderingMethod)
mediaViewRenderingMethod FB_DEPRECATED_WITH_MESSAGE("Rendering method is no longer used in Audience Network");
/**
Sets the FBMediaView rendering method
- Parameter mediaViewRenderingMethod:
FBMediaViewRenderingMethodDefault: SDK chooses optimized rendering method
FBMediaViewRenderingMethodMetal: use Metal kit rendering method
FBMediaViewRenderingMethodOpenGL: use OpenGL rendering method
FBMediaViewRenderingMethodSoftware: use software rendering method
*/
+ (void)setMediaViewRenderingMethod:(FBMediaViewRenderingMethod)mediaViewRenderingMethod
FB_DEPRECATED_WITH_MESSAGE("Rendering method is no longer used in Audience Network");
@end
@protocol FBAdLoggingDelegate <NSObject>

View file

@ -16,7 +16,6 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import <StoreKit/StoreKit.h>
#import <UIKit/UIKit.h>
#import <FBAudienceNetwork/FBAdDefines.h>

View file

@ -16,7 +16,6 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import <StoreKit/StoreKit.h>
#import <UIKit/UIKit.h>
#import <FBAudienceNetwork/FBAdDefines.h>
@ -55,7 +54,7 @@ FB_CLASS_EXPORT
- (nullable instancetype)initWithPlacementID:(NSString *)placementID
bidPayload:(NSString *)bidPayload
rootViewController:(nullable UIViewController *)rootViewController
error:(NSError * __autoreleasing *) error;
error:(NSError *__autoreleasing *)error;
/**
Begins loading the FBAdView content.

View file

@ -21,6 +21,7 @@
#import <FBAudienceNetwork/FBAdChoicesView.h>
#import <FBAudienceNetwork/FBAdDefines.h>
#import <FBAudienceNetwork/FBAdExperienceConfig.h>
#import <FBAudienceNetwork/FBAdExtraHint.h>
#import <FBAudienceNetwork/FBAdIconView.h>
#import <FBAudienceNetwork/FBAdOptionsView.h>
@ -56,4 +57,4 @@
// NOTE: Any changes should also be made to the module.modulemap
// to ensure comptability with Swift apps using Cocoapods
#define FB_AD_SDK_VERSION @"5.6.0"
#define FB_AD_SDK_VERSION @"5.9.0"

View file

@ -25,12 +25,12 @@ NS_ASSUME_NONNULL_BEGIN
/**
FBAdInitSettings is an object to incapsulate all the settings you can pass to SDK on initialization call.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBAdInitSettings : NSObject
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBAdInitSettings : NSObject
/**
Designated initializer for FBAdInitSettings
If an ad provided service is mediating Audience Network in their sdk, it is required to set the name of the mediation service
If an ad provided service is mediating Audience Network in their sdk, it is required to set the name of the mediation
service
@param placementIDs An array of placement identifiers.
@param mediationService String to identify mediation provider.
@ -52,13 +52,12 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
/**
FBAdInitResults is an object to incapsulate all the results you'll get as a result of SDK initialization call.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBAdInitResults : NSObject
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBAdInitResults : NSObject
/**
Boolean which says whether initialization was successful
*/
@property (nonatomic, assign, readonly, getter = isSuccess) BOOL success;
@property (nonatomic, assign, readonly, getter=isSuccess) BOOL success;
/**
Message which provides more details about initialization result
@ -80,16 +79,17 @@ typedef NS_ENUM(NSInteger, FBAdFormatTypeName) {
FBAdFormatTypeNameRewardedVideo,
};
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBAudienceNetworkAds : NSObject
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBAudienceNetworkAds : NSObject
/**
Initialize Audience Network SDK at any given point of time. It will be called automatically with default settigs when you first touch AN related code otherwise.
Initialize Audience Network SDK at any given point of time. It will be called automatically with default settigs when
you first touch AN related code otherwise.
@param settings The settings to initialize with
@param completionHandler The block which will be called when initialization finished
*/
+ (void)initializeWithSettings:(nullable FBAdInitSettings *)settings completionHandler:(nullable void (^)(FBAdInitResults *results))completionHandler;
+ (void)initializeWithSettings:(nullable FBAdInitSettings *)settings
completionHandler:(nullable void (^)(FBAdInitResults *results))completionHandler;
/**
Returns ad format type name for a given placement id.

View file

@ -28,8 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
A customized UIView to display an instream video ad by Facebook.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBInstreamAdView : UIView
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBInstreamAdView : UIView
/**
Returns YES if the instream ad has been successfully loaded.

View file

@ -17,7 +17,6 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>
#import <FBAudienceNetwork/FBAdDefines.h>
#import <FBAudienceNetwork/FBAdExtraHint.h>
@ -31,8 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
A modal view controller to represent a Facebook interstitial ad. This
is a full-screen ad shown in your application.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBInterstitialAd : NSObject
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBInterstitialAd : NSObject
/**
Typed access to the id of the ad placement.

View file

@ -28,7 +28,8 @@ NS_ASSUME_NONNULL_BEGIN
@class FBNativeAd;
/**
The FBMediaView loads media content from a given FBNativeAd. This view takes the place of manually loading a cover image.
The FBMediaView loads media content from a given FBNativeAd. This view takes the place of manually loading a cover
image.
*/
FB_CLASS_EXPORT
@interface FBMediaView : UIView
@ -77,7 +78,8 @@ FB_CLASS_EXPORT
@end
/**
The methods declared by the FBMediaViewDelegate protocol allow the adopting delegate to respond to messages from the FBMediaView class and thus respond to operations such as whether the media content has been loaded.
The methods declared by the FBMediaViewDelegate protocol allow the adopting delegate to respond to messages from the
FBMediaView class and thus respond to operations such as whether the media content has been loaded.
*/
@protocol FBMediaViewDelegate <NSObject>

View file

@ -24,7 +24,9 @@
NS_ASSUME_NONNULL_BEGIN
/**
The FBMediaViewVideoRenderer class allows for customization of the user experience for video ads in FBMediaView. This class should be subclassed, and an instance of that subclass should be passed to the videoRenderer property of an FBMediaView instance.
The FBMediaViewVideoRenderer class allows for customization of the user experience for video ads in FBMediaView. This
class should be subclassed, and an instance of that subclass should be passed to the videoRenderer property of an
FBMediaView instance.
*/
FB_CLASS_EXPORT
@interface FBMediaViewVideoRenderer : UIView
@ -65,7 +67,8 @@ FB_CLASS_EXPORT
- (void)pauseVideo;
/**
Used to put the video into seek mode. Video playback halts, and one or more calls to seekVideoToTime: can be made before calling disengageVideoSeek.
Used to put the video into seek mode. Video playback halts, and one or more calls to seekVideoToTime: can be made
before calling disengageVideoSeek.
*/
- (void)engageVideoSeek;
@ -82,7 +85,8 @@ FB_CLASS_EXPORT
/**
Requests the periodic invocation of a given block during playback to report changing time.
@param interval The time interval at which the block should be invoked during normal playback, according to progress of the player's current time.
@param interval The time interval at which the block should be invoked during normal playback, according to progress of
the player's current time.
@param queue A serial dispatch queue onto which block should be enqueued.
@param block The block to be invoked periodically.
*/

View file

@ -32,8 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
The FBNativeAd represents ad metadata to allow you to construct custom ad views.
See the AdUnitsSample in the sample apps section of the Audience Network framework.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBNativeAd: FBNativeAdBase
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBNativeAd : FBNativeAdBase
/**
the delegate
@ -49,8 +48,8 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@param mediaView The FBMediaView you created to render the media (cover image / video / carousel)
@param iconView The FBMediaView you created to render the icon
@param viewController The UIViewController that will be used to present SKStoreProductViewController
(iTunes Store product information) or the in-app browser. If nil is passed, the top view controller currently shown will be used.
The whole area of the UIView will be clickable.
(iTunes Store product information) or the in-app browser. If nil is passed, the top view controller currently shown
will be used. The whole area of the UIView will be clickable.
*/
- (void)registerViewForInteraction:(UIView *)view
mediaView:(FBMediaView *)mediaView
@ -75,7 +74,6 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
viewController:(nullable UIViewController *)viewController
clickableViews:(nullable NSArray<UIView *> *)clickableViews;
/**
This is a method to associate a FBNativeAd with the UIView you will use to display the native ads.
@ -83,8 +81,8 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@param mediaView The FBMediaView you created to render the media (cover image / video / carousel)
@param iconImageView The UIImageView you created to render the icon
@param viewController The UIViewController that will be used to present SKStoreProductViewController
(iTunes Store product information) or the in-app browser. If nil is passed, the top view controller currently shown will be used.
The whole area of the UIView will be clickable.
(iTunes Store product information) or the in-app browser. If nil is passed, the top view controller currently shown
will be used. The whole area of the UIView will be clickable.
*/
- (void)registerViewForInteraction:(UIView *)view
mediaView:(FBMediaView *)mediaView
@ -97,7 +95,7 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@param view The UIView you created to render all the native ads data elements.
@param mediaView The FBMediaView you created to render the media (cover image / video / carousel)
@param iconImageView The UIImageView you created to render the icon
@param iconImageView The UIImageView you created to render the icon. Image will be set
@param viewController The UIViewController that will be used to present SKStoreProductViewController
(iTunes Store product information). If nil is passed, the top view controller currently shown will be used.
@param clickableViews An array of UIView you created to render the native ads data element, e.g.

View file

@ -26,7 +26,7 @@ typedef NS_ENUM(NSInteger, FBAdFormatType) {
FBAdFormatTypeUnknown = 0,
FBAdFormatTypeImage,
FBAdFormatTypeVideo,
FBAdFormatTypeCarousel,
FBAdFormatTypeCarousel
};
NS_ASSUME_NONNULL_BEGIN
@ -58,7 +58,8 @@ typedef NS_ENUM(NSInteger, FBNativeAdsCachePolicy) {
*/
@property (nonatomic, copy, readonly) NSString *placementID;
/**
Typed access to the headline that the advertiser entered when they created their ad. This is usually the ad's main title.
Typed access to the headline that the advertiser entered when they created their ad. This is usually the ad's main
title.
*/
@property (nonatomic, copy, readonly, nullable) NSString *headline;
/**
@ -78,11 +79,13 @@ typedef NS_ENUM(NSInteger, FBNativeAdsCachePolicy) {
*/
@property (nonatomic, copy, readonly, nullable) NSString *callToAction;
/**
Typed access to the body raw untruncated text, Contains the text that the advertiser entered when they created their ad. This often tells people what the ad is promoting.
Typed access to the body raw untruncated text, Contains the text that the advertiser entered when they created their
ad. This often tells people what the ad is promoting.
*/
@property (nonatomic, copy, readonly, nullable) NSString *rawBodyText;
/**
Typed access to the body text, truncated at length 90, which contains the text that the advertiser entered when they created their ad. This often tells people what the ad is promoting.
Typed access to the body text, truncated at length 90, which contains the text that the advertiser entered when they
created their ad. This often tells people what the ad is promoting.
*/
@property (nonatomic, copy, readonly, nullable) NSString *bodyText;
/**
@ -101,16 +104,22 @@ typedef NS_ENUM(NSInteger, FBNativeAdsCachePolicy) {
Typed access to the AdChoices icon. See `FBAdImage` for details. See `FBAdChoicesView` for an included implementation.
*/
@property (nonatomic, strong, readonly, nullable) FBAdImage *adChoicesIcon;
/**
Typed access to the icon image. Only available after ad is successfully loaded.
*/
@property (nonatomic, strong, readonly, nullable) UIImage *iconImage;
/**
Aspect ratio of the ad creative.
*/
@property (nonatomic, assign, readonly) CGFloat aspectRatio;
/**
Typed access to the AdChoices URL. Navigate to this link when the icon is tapped. See `FBAdChoicesView` for an included implementation.
Typed access to the AdChoices URL. Navigate to this link when the icon is tapped. See `FBAdChoicesView` for an included
implementation.
*/
@property (nonatomic, copy, readonly, nullable) NSURL *adChoicesLinkURL;
/**
Typed access to the AdChoices text, usually a localized version of "AdChoices". See `FBAdChoicesView` for an included implementation.
Typed access to the AdChoices text, usually a localized version of "AdChoices". See `FBAdChoicesView` for an included
implementation.
*/
@property (nonatomic, copy, readonly, nullable) NSString *adChoicesText;
/**
@ -152,9 +161,10 @@ typedef NS_ENUM(NSInteger, FBNativeAdsCachePolicy) {
You can implement `nativeAdDidLoad:` and `nativeAd:didFailWithError:` methods
of `FBNativeAdDelegate` if you would like to be notified as loading succeeds or fails.
@param mediaCachePolicy controls which media (images, video, etc) from the native ad are cached before the native ad calls nativeAdLoaded on its delegate. The default is to cache everything.
Note that impression is not logged until the media for the ad is visible on screen (Video or Image for FBNativeAd / Icon for FBNativeBannerAd) and setting this to anything else than FBNativeAdsCachePolicyAll
will delay the impression call.
@param mediaCachePolicy controls which media (images, video, etc) from the native ad are cached before the native ad
calls nativeAdLoaded on its delegate. The default is to cache everything. Note that impression is not logged until the
media for the ad is visible on screen (Video or Image for FBNativeAd / Icon for FBNativeBannerAd) and setting this to
anything else than FBNativeAdsCachePolicyAll will delay the impression call.
*/
- (void)loadAdWithMediaCachePolicy:(FBNativeAdsCachePolicy)mediaCachePolicy;
@ -170,15 +180,16 @@ typedef NS_ENUM(NSInteger, FBNativeAdsCachePolicy) {
@param bidPayload The payload of the ad bid. You can get your bid payload from Facebook bidder endpoint.
@param mediaCachePolicy controls which media (images, video, etc) from the native ad are cached before the native ad calls nativeAdLoaded on its delegate. The default is to cache everything.
Note that impression is not logged until the media for the ad is visible on screen (Video or Image for FBNativeAd / Icon for FBNativeBannerAd) and setting this to anything else than FBNativeAdsCachePolicyAll
will delay the impression call.
@param mediaCachePolicy controls which media (images, video, etc) from the native ad are cached before the native ad
calls nativeAdLoaded on its delegate. The default is to cache everything. Note that impression is not logged until the
media for the ad is visible on screen (Video or Image for FBNativeAd / Icon for FBNativeBannerAd) and setting this to
anything else than FBNativeAdsCachePolicyAll will delay the impression call.
*/
- (void)loadAdWithBidPayload:(NSString *)bidPayload
mediaCachePolicy:(FBNativeAdsCachePolicy)mediaCachePolicy;
- (void)loadAdWithBidPayload:(NSString *)bidPayload mediaCachePolicy:(FBNativeAdsCachePolicy)mediaCachePolicy;
/**
Creates a new instance of a FBNativeAdBase from a bid payload. The actual subclass returned will depend on the contents of the payload.
Creates a new instance of a FBNativeAdBase from a bid payload. The actual subclass returned will depend on the contents
of the payload.
@param placementId The placement ID of the ad.
@ -188,7 +199,7 @@ typedef NS_ENUM(NSInteger, FBNativeAdsCachePolicy) {
*/
+ (nullable instancetype)nativeAdWithPlacementId:(NSString *)placementId
bidPayload:(NSString *)bidPayload
error:(NSError * __autoreleasing *)error;
error:(NSError *__autoreleasing *)error;
@end

View file

@ -27,7 +27,9 @@
NS_ASSUME_NONNULL_BEGIN
/**
Additional functionality on top of FBNativeAdsManager to assist in using native ads within a UICollectionView. This class contains a mechanism to map indexPaths to native ads in a stable manner as well as helpers which assist in doing the math to include ads at a regular interval within a collection view.
Additional functionality on top of FBNativeAdsManager to assist in using native ads within a UICollectionView. This
class contains a mechanism to map indexPaths to native ads in a stable manner as well as helpers which assist in doing
the math to include ads at a regular interval within a collection view.
*/
FB_CLASS_EXPORT
@interface FBNativeAdCollectionViewAdProvider : NSObject
@ -50,7 +52,9 @@ FB_CLASS_EXPORT
- (instancetype)initWithManager:(FBNativeAdsManager *)manager NS_DESIGNATED_INITIALIZER;
/**
Retrieve a native ad for an indexPath, will return the same ad for a given indexPath until the native ads manager is refreshed. This method is intended for usage with a collection view and specifically the caller is recommended to wait until collectionView:cellForRowAtIndexPath: to ensure getting the best native ad for the given collection cell.
Retrieve a native ad for an indexPath, will return the same ad for a given indexPath until the native ads manager is
refreshed. This method is intended for usage with a collection view and specifically the caller is recommended to wait
until collectionView:cellForRowAtIndexPath: to ensure getting the best native ad for the given collection cell.
@param collectionView The collectionView where native ad will be used
@param indexPath The indexPath to use as a key for this native ad
@ -68,7 +72,8 @@ FB_CLASS_EXPORT
- (BOOL)isAdCellAtIndexPath:(NSIndexPath *)indexPath forStride:(NSUInteger)stride;
/**
Support for evenly distributed native ads within a collection view. Adjusts a non-ad cell indexPath to the indexPath it would be in a collection with no ads.
Support for evenly distributed native ads within a collection view. Adjusts a non-ad cell indexPath to the indexPath
it would be in a collection with no ads.
@param indexPath The indexPath to of the non-ad cell
@param stride The frequency that native ads are to appear within the collection view
@ -77,7 +82,8 @@ FB_CLASS_EXPORT
- (nullable NSIndexPath *)adjustNonAdCellIndexPath:(NSIndexPath *)indexPath forStride:(NSUInteger)stride;
/**
Support for evenly distributed native ads within a collection view. Adjusts the total count of cells within the collection view to account for the ad cells.
Support for evenly distributed native ads within a collection view. Adjusts the total count of cells within the
collection view to account for the ad cells.
@param count The count of cells in the collection view not including ads
@param stride The frequency that native ads are to appear within the collection view

View file

@ -28,10 +28,12 @@
NS_ASSUME_NONNULL_BEGIN
/**
Class which assists in putting FBNativeAdViews into UICollectionViews. This class manages the creation of UICollectionViewCells which host native ad views. Functionality is provided to create UICollectionCellViews as needed for a given indexPath as well as computing the height of the cells.
Class which assists in putting FBNativeAdViews into UICollectionViews. This class manages the creation of
UICollectionViewCells which host native ad views. Functionality is provided to create UICollectionCellViews as needed
for a given indexPath as well as computing the height of the cells.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBNativeAdCollectionViewCellProvider : FBNativeAdCollectionViewAdProvider
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBNativeAdCollectionViewCellProvider
: FBNativeAdCollectionViewAdProvider
/**
Method to create a FBNativeAdCollectionViewCellProvider.
@ -48,15 +50,20 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@param type The type of this native ad template. For more information, consult FBNativeAdViewType.
@param attributes The layout of this native ad template. For more information, consult FBNativeAdViewLayout.
*/
- (instancetype)initWithManager:(FBNativeAdsManager *)manager forType:(FBNativeAdViewType)type forAttributes:(FBNativeAdViewAttributes *)attributes NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithManager:(FBNativeAdsManager *)manager
forType:(FBNativeAdViewType)type
forAttributes:(FBNativeAdViewAttributes *)attributes NS_DESIGNATED_INITIALIZER;
/**
Helper method for implementors of UICollectionViewDataSource who would like to host native ad UICollectionViewCells in their collection view.
Helper method for implementors of UICollectionViewDataSource who would like to host native ad UICollectionViewCells in
their collection view.
*/
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath;
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
cellForItemAtIndexPath:(NSIndexPath *)indexPath;
/**
Helper method for implementors of UICollectionViewDelegate who would like to host native ad UICollectionViewCells in their collection view.
Helper method for implementors of UICollectionViewDelegate who would like to host native ad UICollectionViewCells in
their collection view.
*/
- (CGFloat)collectionView:(UICollectionView *)collectionView heightForRowAtIndexPath:(NSIndexPath *)indexPath;

View file

@ -30,13 +30,16 @@ NS_ASSUME_NONNULL_BEGIN
Contains multiple ads in a scroll view.
If adding this view to a XIB or Storyboard, you may recieve the error "Unknown class FBNativeAdScrollView in Interface Builder file" in some cases. This error is caused by the linker failing to include FBNativeAdScrollView in your build. To resolve this, call [FBNativeAdScrollView class] in your project, or add "-all_load -ObjC" to "Other Linker Flags" in your project settings.
If adding this view to a XIB or Storyboard, you may recieve the error "Unknown class FBNativeAdScrollView in Interface
Builder file" in some cases. This error is caused by the linker failing to include FBNativeAdScrollView in your build.
To resolve this, call [FBNativeAdScrollView class] in your project, or add "-all_load -ObjC" to "Other Linker Flags" in
your project settings.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBNativeAdScrollView : UIView
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBNativeAdScrollView : UIView
/**
Maximum native ads that this scroll view will load. Defaults to 10. If changed after calling loadAds, all current ads will be discarded and loadAds must be called again.
Maximum native ads that this scroll view will load. Defaults to 10. If changed after calling loadAds, all current ads
will be discarded and loadAds must be called again.
*/
@property (nonatomic, assign, readonly) NSUInteger maximumNativeAdCount;
@ -66,16 +69,18 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@property (nonatomic, weak, nullable) id<FBNativeAdDelegate> delegate;
/**
Creates a native ad horizontal scroll view for a given native ads manager and native ad template. The manager can be preloaded with ads, and loadAds will use the preloaded ads from the manager. Otherwise, the scroll view uses the manager to load ads normally.
Creates a native ad horizontal scroll view for a given native ads manager and native ad template. The manager can be
preloaded with ads, and loadAds will use the preloaded ads from the manager. Otherwise, the scroll view uses the
manager to load ads normally.
@param manager An instance of FBNativeAdManager. Can be preloaded with ads.
@param type The type of this native ad template. For more information, consult FBNativeAdViewType.
*/
- (instancetype)initWithNativeAdsManager:(FBNativeAdsManager *)manager
withType:(FBNativeAdViewType)type;
- (instancetype)initWithNativeAdsManager:(FBNativeAdsManager *)manager withType:(FBNativeAdViewType)type;
/**
Creates a native ad horizontal scroll view for a given native ads manager and native ad template. The manager can be preloaded with ads, and loadAds will use the preloaded ads from the manager. Otherwise, the scroll view uses the manager to load ads normally.
Creates a native ad horizontal scroll view for a given native ads manager and native ad template. The manager can be
preloaded with ads, and loadAds will use the preloaded ads from the manager. Otherwise, the scroll view uses the
manager to load ads normally.
@param manager An instance of FBNativeAdManager. Can be preloaded with ads.
@param type The type of this native ad template. For more information, consult FBNativeAdViewType.
@param attributes The layout of this native ad template. For more information, consult FBNativeAdViewLayout.
@ -85,7 +90,9 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
withAttributes:(FBNativeAdViewAttributes *)attributes;
/**
Creates a native ad horizontal scroll view for a given native ads manager and native ad template. The manager can be preloaded with ads, and loadAds will use the preloaded ads from the manager. Otherwise, the scroll view uses the manager to load ads normally.
Creates a native ad horizontal scroll view for a given native ads manager and native ad template. The manager can be
preloaded with ads, and loadAds will use the preloaded ads from the manager. Otherwise, the scroll view uses the
manager to load ads normally.
@param manager An instance of FBNativeAdManager. Can be preloaded with ads.
@param type The type of this native ad template. For more information, consult FBNativeAdViewType.
@param attributes The layout of this native ad template. For more information, consult FBNativeAdViewLayout.
@ -96,23 +103,26 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
withAttributes:(FBNativeAdViewAttributes *)attributes
withMaximum:(NSUInteger)maximumNativeAdCount;
/**
This is a method to create a native ad horizontal scroll view from a user provided view.
@param manager An instance of FBNativeAdManager. Can be preloaded with ads.
@param childViewProvider Block that creates new views for each loaded native ad. Must not reuse the same instance, but return a new view for each call. Views may be arbitrarily resized and should support resizing their content through Auto Layout constraints, autoresizing masks, or manual resizing.
@param childViewProvider Block that creates new views for each loaded native ad. Must not reuse the same instance, but
return a new view for each call. Views may be arbitrarily resized and should support resizing their content through
Auto Layout constraints, autoresizing masks, or manual resizing.
*/
- (instancetype)initWithNativeAdsManager:(FBNativeAdsManager *)manager
withViewProvider:(UIView *(^)( FBNativeAd *nativeAd, NSUInteger position))childViewProvider;
withViewProvider:(UIView * (^)(FBNativeAd *nativeAd, NSUInteger position))childViewProvider;
/**
This is a method to create a native ad horizontal scroll view from a user provided view.
@param manager An instance of FBNativeAdManager. Can be preloaded with ads.
@param childViewProvider Block that creates new views for each loaded native ad. Must not reuse the same instance, but return a new view for each call. Views may be arbitrarily resized and should support resizing their content through Auto Layout constraints, autoresizing masks, or manual resizing.
@param childViewProvider Block that creates new views for each loaded native ad. Must not reuse the same instance, but
return a new view for each call. Views may be arbitrarily resized and should support resizing their content through
Auto Layout constraints, autoresizing masks, or manual resizing.
@param maximumNativeAdCount Maximum native ads to show at once.
*/
- (instancetype)initWithNativeAdsManager:(FBNativeAdsManager *)manager
withViewProvider:(UIView *(^)(FBNativeAd *nativeAd, NSUInteger position))childViewProvider
withViewProvider:(UIView * (^)(FBNativeAd *nativeAd, NSUInteger position))childViewProvider
withMaximum:(NSUInteger)maximumNativeAdCount NS_DESIGNATED_INITIALIZER;
@end

View file

@ -27,7 +27,9 @@
NS_ASSUME_NONNULL_BEGIN
/**
Additional functionality on top of FBNativeAdsManager to assist in using native ads within a UITableView. This class contains a mechanism to map indexPaths to native ads in a stable manner as well as helpers which assist in doing the math to include ads at a regular interval within a table view.
Additional functionality on top of FBNativeAdsManager to assist in using native ads within a UITableView. This class
contains a mechanism to map indexPaths to native ads in a stable manner as well as helpers which assist in doing the
math to include ads at a regular interval within a table view.
*/
FB_CLASS_EXPORT
@interface FBNativeAdTableViewAdProvider : NSObject
@ -50,7 +52,9 @@ FB_CLASS_EXPORT
- (instancetype)initWithManager:(FBNativeAdsManager *)manager NS_DESIGNATED_INITIALIZER;
/**
Retrieve a native ad for an indexPath, will return the same ad for a given indexPath until the native ads manager is refreshed. This method is intended for usage with a table view and specifically the caller is recommended to wait until tableView:cellForRowAtIndexPath: to ensure getting the best native ad for the given table cell.
Retrieve a native ad for an indexPath, will return the same ad for a given indexPath until the native ads manager is
refreshed. This method is intended for usage with a table view and specifically the caller is recommended to wait until
tableView:cellForRowAtIndexPath: to ensure getting the best native ad for the given table cell.
@param tableView The tableView where native ad will be used
@param indexPath The indexPath to use as a key for this native ad
@ -68,7 +72,8 @@ FB_CLASS_EXPORT
- (BOOL)isAdCellAtIndexPath:(NSIndexPath *)indexPath forStride:(NSUInteger)stride;
/**
Support for evenly distributed native ads within a table view. Adjusts a non-ad cell indexPath to the indexPath it would be in a collection with no ads.
Support for evenly distributed native ads within a table view. Adjusts a non-ad cell indexPath to the indexPath it
would be in a collection with no ads.
@param indexPath The indexPath to of the non-ad cell
@param stride The frequency that native ads are to appear within the table view
@ -77,7 +82,8 @@ FB_CLASS_EXPORT
- (nullable NSIndexPath *)adjustNonAdCellIndexPath:(NSIndexPath *)indexPath forStride:(NSUInteger)stride;
/**
Support for evenly distributed native ads within a table view. Adjusts the total count of cells within the table view to account for the ad cells.
Support for evenly distributed native ads within a table view. Adjusts the total count of cells within the table view
to account for the ad cells.
@param count The count of cells in the table view not including ads
@param stride The frequency that native ads are to appear within the table view

View file

@ -28,10 +28,12 @@
NS_ASSUME_NONNULL_BEGIN
/**
Class which assists in putting FBNativeAdViews into UITableViews. This class manages the creation of UITableViewCells which host native ad views. Functionality is provided to create UITableCellViews as needed for a given indexPath as well as computing the height of the cells.
Class which assists in putting FBNativeAdViews into UITableViews. This class manages the creation of UITableViewCells
which host native ad views. Functionality is provided to create UITableCellViews as needed for a given indexPath as
well as computing the height of the cells.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBNativeAdTableViewCellProvider : FBNativeAdTableViewAdProvider<UITableViewDataSource>
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBNativeAdTableViewCellProvider
: FBNativeAdTableViewAdProvider<UITableViewDataSource>
/**
Method to create a FBNativeAdTableViewCellProvider.
@ -48,20 +50,25 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@param type The type of this native ad template. For more information, consult FBNativeAdViewType.
@param attributes The layout of this native ad template. For more information, consult FBNativeAdViewLayout.
*/
- (instancetype)initWithManager:(FBNativeAdsManager *)manager forType:(FBNativeAdViewType)type forAttributes:(FBNativeAdViewAttributes *)attributes NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithManager:(FBNativeAdsManager *)manager
forType:(FBNativeAdViewType)type
forAttributes:(FBNativeAdViewAttributes *)attributes NS_DESIGNATED_INITIALIZER;
/**
Helper method for implementors of UITableViewDataSource who would like to host native ad UITableViewCells in their table view.
Helper method for implementors of UITableViewDataSource who would like to host native ad UITableViewCells in their
table view.
*/
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
/**
Helper method for implementors of UITableViewDelegate who would like to host native ad UITableViewCells in their table view.
Helper method for implementors of UITableViewDelegate who would like to host native ad UITableViewCells in their table
view.
*/
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
/**
Helper method for implementors of UITableViewDelegate who would like to host native ad UITableViewCells in their table view.
Helper method for implementors of UITableViewDelegate who would like to host native ad UITableViewCells in their table
view.
*/
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath;

View file

@ -74,7 +74,9 @@ FB_CLASS_EXPORT
@param type The type of this native ad template. For more information, consult FBNativeAdViewType.
@param attributes The attributes to render this native ad template with.
*/
+ (instancetype)nativeAdViewWithNativeAd:(FBNativeAd *)nativeAd withType:(FBNativeAdViewType)type withAttributes:(FBNativeAdViewAttributes *)attributes;
+ (instancetype)nativeAdViewWithNativeAd:(FBNativeAd *)nativeAd
withType:(FBNativeAdViewType)type
withAttributes:(FBNativeAdViewAttributes *)attributes;
@end

View file

@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
This is a method to create native ad view attributes with a dictionary
*/
- (instancetype)initWithDictionary:(NSDictionary<id, id> *) dict NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithDictionary:(NSDictionary<id, id> *)dict NS_DESIGNATED_INITIALIZER;
/**
Background color of the native ad view.
@ -77,7 +77,8 @@ NS_ASSUME_NONNULL_BEGIN
/**
Enables or disables autoplay for some types of media. Defaults to YES.
*/
@property (nonatomic, assign, getter=isAutoplayEnabled) BOOL autoplayEnabled __attribute((deprecated("This attribute is no longer used.")));
@property (nonatomic, assign, getter=isAutoplayEnabled) BOOL autoplayEnabled
__attribute((deprecated("This attribute is no longer used.")));
@end

View file

@ -32,13 +32,17 @@ NS_ASSUME_NONNULL_BEGIN
@protocol FBNativeAdsManagerDelegate <NSObject>
/**
When the FBNativeAdsManager has finished loading a batch of ads this message will be sent. A batch of ads may be loaded in response to calling loadAds or due to an automatic refresh by the FBNativeAdsManager. At the point this message is fired all of the native ads will already be loaded and will not hence send their own nativeAdLoad: or nativeAd:didFailWithError: message.
When the FBNativeAdsManager has finished loading a batch of ads this message will be sent. A batch of ads may be
loaded in response to calling loadAds or due to an automatic refresh by the FBNativeAdsManager. At the point this
message is fired all of the native ads will already be loaded and will not hence send their own nativeAdLoad: or
nativeAd:didFailWithError: message.
*/
- (void)nativeAdsLoaded;
/**
When the FBNativeAdsManager has reached a failure while attempting to load a batch of ads this message will be sent to the application.
When the FBNativeAdsManager has reached a failure while attempting to load a batch of ads this message will be sent to
the application.
@param error An NSError object with information about the failure.
*/
- (void)nativeAdsFailedToLoadWithError:(NSError *)error;
@ -46,10 +50,12 @@ NS_ASSUME_NONNULL_BEGIN
@end
/**
This class provides a mechanism to fetch a set of ads and then use them within your application. The recommended usage is to call nextNativeAd: at the moment when you are about to render an ad. The native ads manager supports giving out as many ads as needed by cloning over the set of ads it got back from the server which can be useful for feed scenarios.
This class provides a mechanism to fetch a set of ads and then use them within your application. The recommended usage
is to call nextNativeAd: at the moment when you are about to render an ad. The native ads manager supports giving out
as many ads as needed by cloning over the set of ads it got back from the server which can be useful for feed
scenarios.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBNativeAdsManager : NSObject
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBNativeAdsManager : NSObject
/**
The delegate
@ -57,12 +63,14 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@property (nonatomic, weak, nullable) id<FBNativeAdsManagerDelegate> delegate;
/**
Set the native ads manager caching policy. This controls which media from the native ads are cached before the native ads manager calls nativeAdsLoaded on its delegate. The default is to not block on caching.
Set the native ads manager caching policy. This controls which media from the native ads are cached before the native
ads manager calls nativeAdsLoaded on its delegate. The default is to not block on caching.
*/
@property (nonatomic, assign) FBNativeAdsCachePolicy mediaCachePolicy;
/**
Number of unique native ads that can be accessed through nextNativeAd:. This is not valid until the nativeAdsLoaded: message has been sent.
Number of unique native ads that can be accessed through nextNativeAd:. This is not valid until the nativeAdsLoaded:
message has been sent.
*/
@property (nonatomic, assign, readonly) NSUInteger uniqueNativeAdCount;
@ -91,13 +99,17 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
- (void)loadAds;
/**
By default the native ads manager will refresh its ads periodically. This does not mean that any ads which are shown in the application's UI will be refreshed but simply that calling nextNativeAd: may return different ads at different times. This method disables that functionality.
By default the native ads manager will refresh its ads periodically. This does not mean that any ads which are shown
in the application's UI will be refreshed but simply that calling nextNativeAd: may return different ads at different
times. This method disables that functionality.
*/
- (void)disableAutoRefresh;
/**
Retrieve the next native ad to be used from the batch. It is highly recommended that the caller wait until immediately before rendering the ad content to call this method to ensure the best ad for the given context is used. If more than uniqueNativeAdCount ads are requested cloned ads will be returned. Periodically the native ads manager will refresh and new ads will be returned.
Retrieve the next native ad to be used from the batch. It is highly recommended that the caller wait until immediately
before rendering the ad content to call this method to ensure the best ad for the given context is used. If more than
uniqueNativeAdCount ads are requested cloned ads will be returned. Periodically the native ads manager will refresh and
new ads will be returned.
@return A FBNativeAd which is loaded and ready to be used.
*/

View file

@ -34,8 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
The FBNativeBannerAd represents ad metadata to allow you to construct custom ad views.
See the AdUnitsSample in the sample apps section of the Audience Network framework.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBNativeBannerAd : FBNativeAdBase
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBNativeBannerAd : FBNativeAdBase
@property (nonatomic, weak, nullable) id<FBNativeBannerAdDelegate> delegate;
@ -47,7 +46,8 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@param view The UIView you created to render all the native ads data elements.
@param iconView The FBMediaView you created to render the icon
@param viewController The UIViewController that will be used to present SKStoreProductViewController
(iTunes Store product information) or the in-app browser. If nil is passed, the top view controller currently shown will be used.
(iTunes Store product information) or the in-app browser. If nil is passed, the top view controller currently shown
will be used.
The whole area of the UIView will be clickable.

View file

@ -54,7 +54,8 @@ FB_CLASS_EXPORT
@param nativeBannerAd The native banner ad to use to create this view.
@param type The type of this native banner ad template. For more information, consult FBNativeAdBannerViewType.
*/
+ (instancetype)nativeBannerAdViewWithNativeBannerAd:(FBNativeBannerAd *)nativeBannerAd withType:(FBNativeBannerAdViewType)type;
+ (instancetype)nativeBannerAdViewWithNativeBannerAd:(FBNativeBannerAd *)nativeBannerAd
withType:(FBNativeBannerAdViewType)type;
/**
This is a method to create a native ad template using the given placement id and type.
@ -62,7 +63,9 @@ FB_CLASS_EXPORT
@param type The type of this native banner ad template. For more information, consult FBNativeAdBannerViewType.
@param attributes The attributes to render this native ad template with.
*/
+ (instancetype)nativeBannerAdViewWithNativeBannerAd:(FBNativeBannerAd *)nativeBannerAd withType:(FBNativeBannerAdViewType)type withAttributes:(FBNativeAdViewAttributes *)attributes;
+ (instancetype)nativeBannerAdViewWithNativeBannerAd:(FBNativeBannerAd *)nativeBannerAd
withType:(FBNativeBannerAdViewType)type
withAttributes:(FBNativeAdViewAttributes *)attributes;
@end

View file

@ -18,9 +18,9 @@
#import <CoreMedia/CoreMedia.h>
#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>
#import <FBAudienceNetwork/FBAdDefines.h>
#import <FBAudienceNetwork/FBAdExperienceConfig.h>
#import <FBAudienceNetwork/FBAdExtraHint.h>
NS_ASSUME_NONNULL_BEGIN
@ -31,8 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
A modal view controller to represent a Facebook rewarded video ad. This
is a full-screen ad shown in your application.
*/
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBRewardedVideoAd : NSObject
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED @interface FBRewardedVideoAd : NSObject
/**
Typed access to the id of the ad placement.
@ -60,6 +59,11 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
*/
@property (nonatomic, strong, nullable) FBAdExtraHint *extraHint;
/**
FBAdExperiencConfig to provide additional ad configuration
*/
@property (nonatomic, copy, nullable) FBAdExperienceConfig *adExperienceConfig;
/**
This is a method to initialize an FBRewardedVideoAd matching the given placement id.
@ -105,8 +109,7 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
- Parameter currency reward currency type
*/
- (BOOL)setRewardDataWithUserID:(NSString *)userID
withCurrency:(NSString *)currency;
- (BOOL)setRewardDataWithUserID:(NSString *)userID withCurrency:(NSString *)currency;
/**
Presents the rewarded video ad modally from the specified view controller.
@ -211,5 +214,4 @@ FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@end
NS_ASSUME_NONNULL_END

View file

@ -32,6 +32,7 @@ framework module FBAudienceNetwork {
header "FBAdChoicesView.h"
header "FBAdDefines.h"
header "FBAdExperienceConfig.h"
header "FBAdSettings.h"
header "FBAdView.h"
header "FBInstreamAdView.h"
@ -46,7 +47,7 @@ framework module FBAudienceNetwork {
header "FBNativeAdView.h"
header "FBNativeAdsManager.h"
header "FBRewardedVideoAd.h"
header "FBAdBridgeCommon.h"
header "FBAdBridgeContainer.h"
header "FBAdSettingsBridge.h"

View file

@ -1,6 +1,6 @@
PODS:
- AppsFlyerFramework (4.9.0)
- FBAudienceNetwork (5.6.0):
- FBAudienceNetwork (5.9.0):
- FBSDKCoreKit/Basics (>= 5.6.0)
- FBSDKCoreKit (5.15.1):
- FBSDKCoreKit/Basics (= 5.15.1)
@ -86,25 +86,30 @@ PODS:
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (6.7.1):
- GoogleUtilities/Logger
- MoPub-FacebookAudienceNetwork-Adapters (5.6.0.0):
- MoPub-FacebookAudienceNetwork-Adapters/MoPub (= 5.6.0.0)
- MoPub-FacebookAudienceNetwork-Adapters/Network (= 5.6.0.0)
- MoPub-FacebookAudienceNetwork-Adapters/MoPub (5.6.0.0):
- MoPub-FacebookAudienceNetwork-Adapters (5.9.0.0):
- MoPub-FacebookAudienceNetwork-Adapters/MoPub (= 5.9.0.0)
- MoPub-FacebookAudienceNetwork-Adapters/Network (= 5.9.0.0)
- MoPub-FacebookAudienceNetwork-Adapters/MoPub (5.9.0.0):
- mopub-ios-sdk/Core (~> 5.6)
- MoPub-FacebookAudienceNetwork-Adapters/Network (5.6.0.0):
- FBAudienceNetwork (= 5.6.0)
- mopub-ios-sdk/NativeAds (~> 5.6)
- MoPub-FacebookAudienceNetwork-Adapters/Network (5.9.0.0):
- FBAudienceNetwork (= 5.9.0)
- mopub-ios-sdk/Core (~> 5.6)
- mopub-ios-sdk (5.10.0):
- mopub-ios-sdk/MoPubSDK (= 5.10.0)
- mopub-ios-sdk/Avid (5.10.0):
- mopub-ios-sdk/NativeAds (~> 5.6)
- mopub-ios-sdk (5.12.0):
- mopub-ios-sdk/MoPubSDK (= 5.12.0)
- mopub-ios-sdk/Avid (5.12.0):
- mopub-ios-sdk/Core
- mopub-ios-sdk/Core (5.10.0)
- mopub-ios-sdk/Moat (5.10.0):
- mopub-ios-sdk/Core (5.12.0)
- mopub-ios-sdk/Moat (5.12.0):
- mopub-ios-sdk/Core
- mopub-ios-sdk/MoPubSDK (5.10.0):
- mopub-ios-sdk/MoPubSDK (5.12.0):
- mopub-ios-sdk/Avid
- mopub-ios-sdk/Core
- mopub-ios-sdk/Moat
- mopub-ios-sdk/NativeAds
- mopub-ios-sdk/NativeAds (5.12.0):
- mopub-ios-sdk/Core
- nanopb (1.30905.0):
- nanopb/decode (= 1.30905.0)
- nanopb/encode (= 1.30905.0)
@ -122,8 +127,8 @@ DEPENDENCIES:
- Firebase/Analytics (= 6.26.0)
- Firebase/Crashlytics (= 6.26.0)
- Flurry-iOS-SDK/FlurrySDK (= 10.1)
- MoPub-FacebookAudienceNetwork-Adapters (= 5.6.0.0)
- mopub-ios-sdk (= 5.10)
- MoPub-FacebookAudienceNetwork-Adapters (= 5.9.0)
- mopub-ios-sdk (= 5.12)
- Pushwoosh (= 5.16.0)
SPEC REPOS:
@ -153,7 +158,7 @@ SPEC REPOS:
SPEC CHECKSUMS:
AppsFlyerFramework: f57e5d590ad3124d3e594a76032a181bc91ec6cd
FBAudienceNetwork: 1ea63543665445a3a5b4a059e8210a343b6ab3c1
FBAudienceNetwork: 648648b13d8ea3d39676542dece2b04dbe867497
FBSDKCoreKit: 1d5acf7c9d7a2f92bb1a242dc60cae5b7adb91df
FBSDKLoginKit: f1ea8026a58b52d30c9f2e6a58ca7d813619fb83
Firebase: 7cf5f9c67f03cb3b606d1d6535286e1080e57eb6
@ -169,12 +174,12 @@ SPEC CHECKSUMS:
GoogleDataTransport: 9a8a16f79feffc7f42096743de2a7c4815e84020
GoogleDataTransportCCTSupport: 489c1265d2c85b68187a83a911913d190012158d
GoogleUtilities: e121a3867449ce16b0e35ddf1797ea7a389ffdf2
MoPub-FacebookAudienceNetwork-Adapters: 3cec249235d12e3fec9a01bf559d608fa3ec05e1
mopub-ios-sdk: 3d65133b95b6498aa871a66818a11a5ba307e565
MoPub-FacebookAudienceNetwork-Adapters: c9cbf2549ab2e108086594ab18f1709cc5897300
mopub-ios-sdk: bb61d5741ba16c6a78e5a54e37bc60ef8c9a80a8
nanopb: c43f40fadfe79e8b8db116583945847910cbabc9
PromisesObjC: b48e0338dbbac2207e611750777895f7a5811b75
Pushwoosh: 6cba171e52f3f7b8ccd280f492a5831deac2f594
PODFILE CHECKSUM: c3f8758a04bfcf497d7cf4a86726c990ae127e6a
PODFILE CHECKSUM: 8a9705a6477e83ec21530a12f6522770e57f6ca4
COCOAPODS: 1.9.3
COCOAPODS: 1.8.3

View file

@ -14,7 +14,7 @@
#import "MPConstants.h"
#endif
#define FACEBOOK_ADAPTER_VERSION @"5.6.0.0"
#define FACEBOOK_ADAPTER_VERSION @"5.9.0.0"
#define MOPUB_NETWORK_NAME @"facebook"
static NSString * const kFacebookPlacementIDs = @"placement_ids";

View file

@ -1,5 +1,18 @@
# mopub-ios-mediation
We have formally separated network adapters from our MoPub SDK repository to enable an independent release cadence resulting in faster certification cycles.
Thanks for taking a look at MoPub! We take pride in having an easy-to-use, and flexible monetization solution that works across multiple platforms.
We have separated network adapters from our MoPub SDK repository to enable an independent release cadence resulting in faster certification cycles.
## Need Help?
You can find Mediation Integration Tool [here]https://developers.mopub.com/docs/mediation/integrate/). Additional documentation can be found [here](https://developers.mopub.com/publishers/mediation/).
## New Pull Requests?
Thank you for submitting pull requests to the MoPub iOS Mediation GitHub repository. Our team regularly monitors and investigates all submissions for the inclusion in our official adapter releases.
## License
To view the full license, visit [http://www.mopub.com/legal/sdk-license-agreement/](http://www.mopub.com/legal/sdk-license-agreement/)
We have also added a new tool to make it easier for publishers to get up and running with mediation integration. Check it out [here](https://developers.mopub.com/docs/mediation/integrate/).

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@ FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/GoogleDat
GCC_C_LANGUAGE_STANDARD = c99
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 PB_FIELD_32BIT=1 PB_NO_PACKED_STRUCTS=1 PB_ENABLE_MALLOC=1
GCC_TREAT_WARNINGS_AS_ERRORS = YES
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_TARGET_SRCROOT}/Firebase/CoreDiagnostics/"
HEADER_SEARCH_PATHS = $(inherited) "${PODS_TARGET_SRCROOT}" "${PODS_TARGET_SRCROOT}/Firebase/CoreDiagnostics/"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

View file

@ -2,7 +2,7 @@ CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/GoogleDataTransportCCTSupport
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/GoogleDataTransport" "${PODS_CONFIGURATION_BUILD_DIR}/nanopb"
GCC_C_LANGUAGE_STANDARD = c99
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 PB_FIELD_32BIT=1 PB_NO_PACKED_STRUCTS=1 PB_ENABLE_MALLOC=1 GDTCCTSUPPORT_VERSION=3.1.0
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 PB_FIELD_32BIT=1 PB_NO_PACKED_STRUCTS=1 PB_ENABLE_MALLOC=1 GDTCCTSUPPORT_VERSION=3.2.0
GCC_TREAT_WARNINGS_AS_ERRORS = YES
HEADER_SEARCH_PATHS = $(inherited) "${PODS_TARGET_SRCROOT}/GoogleDataTransportCCTSupport/"
PODS_BUILD_DIR = ${BUILD_DIR}

View file

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>5.6.0</string>
<string>5.9.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View file

@ -46,8 +46,8 @@ install_framework()
fi
# Use filter instead of exclude so missing patterns don't throw errors.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
@ -84,29 +84,27 @@ install_framework()
# Copies and strips a vendored dSYM
install_dsym() {
local source="$1"
warn_missing_arch=${2:-true}
if [ -r "$source" ]; then
# Copy the dSYM into the targets temp dir.
# Copy the dSYM into a the targets temp dir.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
local basename
basename="$(basename -s .dSYM "$source")"
binary_name="$(ls "$source/Contents/Resources/DWARF")"
binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}"
basename="$(basename -s .framework.dSYM "$source")"
binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then
strip_invalid_archs "$binary" "$warn_missing_arch"
strip_invalid_archs "$binary"
fi
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
# Move the stripped file into its final destination.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
else
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM"
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
fi
fi
}
@ -137,16 +135,13 @@ code_sign_if_enabled() {
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
warn_missing_arch=${2:-true}
# Get architectures for current target binary
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
# Intersect them with the architectures we are building for
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
# If there are no archs supported by this binary then warn the user
if [[ -z "$intersected_archs" ]]; then
if [[ "$warn_missing_arch" == "true" ]]; then
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
fi
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
STRIP_BINARY_RETVAL=0
return
fi
@ -164,37 +159,6 @@ strip_invalid_archs() {
STRIP_BINARY_RETVAL=1
}
install_artifact() {
artifact="$1"
base="$(basename "$artifact")"
case $base in
*.framework)
install_framework "$artifact"
;;
*.dSYM)
# Suppress arch warnings since XCFrameworks will include many dSYM files
install_dsym "$artifact" "false"
;;
*.bcsymbolmap)
install_bcsymbolmap "$artifact"
;;
*)
echo "error: Unrecognized artifact "$artifact""
;;
esac
}
copy_artifacts() {
file_list="$1"
while read artifact; do
install_artifact "$artifact"
done <$file_list
}
ARTIFACT_LIST_FILE="${BUILT_PRODUCTS_DIR}/cocoapods-artifacts-${CONFIGURATION}.txt"
if [ -r "${ARTIFACT_LIST_FILE}" ]; then
copy_artifacts "${ARTIFACT_LIST_FILE}"
fi
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "${BUILT_PRODUCTS_DIR}/FBSDKCoreKit/FBSDKCoreKit.framework"

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>5.13.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View file

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>5.10.0</string>
<string>5.12.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View file

@ -28,8 +28,6 @@
#import "MPBannerCustomEventAdapter.h"
#import "MPBaseBannerAdapter.h"
#import "MPPrivateBannerCustomEventDelegate.h"
#import "MPAdAlertGestureRecognizer.h"
#import "MPAdAlertManager.h"
#import "MPActivityViewControllerHelper+TweetShare.h"
#import "MPActivityViewControllerHelper.h"
#import "MPAdConfiguration.h"
@ -61,20 +59,26 @@
#import "MPInterstitialViewController.h"
#import "MPPrivateInterstitialCustomEventDelegate.h"
#import "MPAdServerKeys.h"
#import "MPATSSetting.h"
#import "MPConsentDialogViewController.h"
#import "MPConsentManager.h"
#import "MPCoreInstanceProvider+MRAID.h"
#import "MPCoreInstanceProvider.h"
#import "MPDeviceInformation.h"
#import "MPDiskLRUCache.h"
#import "MPExtendedHitBoxButton.h"
#import "MPHTTPNetworkSession.h"
#import "MPHTTPNetworkTaskData.h"
#import "MPMediationManager.h"
#import "MPMemoryCache.h"
#import "MPNativeAdError.h"
#import "MPNetworkStatus.h"
#import "MPRateLimitConfiguration.h"
#import "MPRateLimitManager.h"
#import "MPReachabilityManager.h"
#import "MPURL.h"
#import "MPURLRequest.h"
#import "MPVASTInterstitialCustomEvent.h"
#import "MPVASTTracking.h"
#import "MPWebBrowserUserAgentInfo.h"
#import "MPForceableOrientationProtocol.h"
@ -92,7 +96,6 @@
#import "MRProperty.h"
#import "MRVideoPlayerManager.h"
#import "MoPub+Utility.h"
#import "MPNativeAdError+VAST.h"
#import "NSBundle+MPAdditions.h"
#import "NSDate+MPAdditions.h"
#import "NSDictionary+MPAdditions.h"
@ -104,6 +107,7 @@
#import "NSString+MPConsentStatus.h"
#import "NSURL+MPAdditions.h"
#import "SKStoreProductViewController+MPAdditions.h"
#import "UIButton+MPAdditions.h"
#import "UIColor+MPAdditions.h"
#import "UIView+MPAdditions.h"
#import "MOPUBExperimentProvider.h"
@ -112,6 +116,9 @@
#import "MPGeolocationProvider.h"
#import "MPGlobal.h"
#import "MPIdentityProvider.h"
#import "MPImageDownloadQueue.h"
#import "MPImageLoader.h"
#import "MPNativeCache.h"
#import "MPReachability.h"
#import "MPSessionTracker.h"
#import "MPStopwatch.h"
@ -120,6 +127,7 @@
#import "MPMediaFileCache.h"
#import "MPVASTAd.h"
#import "MPVASTCompanionAd.h"
#import "MPVASTConstant.h"
#import "MPVASTCreative.h"
#import "MPVASTDurationOffset.h"
#import "MPVASTError.h"
@ -135,6 +143,16 @@
#import "MPVASTStringUtilities.h"
#import "MPVASTTrackingEvent.h"
#import "MPVASTWrapper.h"
#import "MPVideoEvent.h"
#import "MPVASTCompanionAdView.h"
#import "MPVASTIndustryIconView.h"
#import "MPVASTResourceView.h"
#import "MPVideoPlayer.h"
#import "MPVideoPlayerContainerView.h"
#import "MPVideoPlayerFullScreenVASTAdOverlay.h"
#import "MPVideoPlayerView.h"
#import "MPVideoPlayerViewController.h"
#import "MPVideoPlayerViewOverlay.h"
#import "MPConsoleLogger.h"
#import "MPLogManager.h"
#import "MPBLogger.h"
@ -168,11 +186,27 @@
#import "MPMoPubAd.h"
#import "MPMoPubAdPlacer.h"
#import "MPMoPubConfiguration.h"
#import "MPMoPubRewardedPlayableCustomEvent.h"
#import "MPMoPubRewardedVideoCustomEvent.h"
#import "MPPrivateRewardedVideoCustomEventDelegate.h"
#import "MPRewardedVideo+Internal.h"
#import "MPRewardedVideoAdapter.h"
#import "MPRewardedVideoAdManager.h"
#import "MPRewardedVideoConnection.h"
#import "MPRewardedVideo.h"
#import "MPRewardedVideoCustomEvent.h"
#import "MPRewardedVideoError.h"
#import "MPRewardedVideoReward.h"
#import "MPViewabilityAdapter.h"
#import "MPViewabilityOption.h"
#import "MPViewabilityTracker.h"
#import "MPWebView+Viewability.h"
#import "MPViewabilityAdapterMoat.h"
#import "MPNativeAdError+VAST.h"
#import "MPNativeAdRequest+MPNativeAdSource.h"
#import "MPAdPlacerInvocation.h"
#import "MPBaseNativeAdRenderer+Internal.h"
#import "MPCollectionViewAdPlacerCell.h"
#import "MPDiskLRUCache.h"
#import "MPImageDownloadQueue.h"
#import "MPMoPubNativeAdAdapter.h"
#import "MPMoPubNativeCustomEvent.h"
#import "MPNativeAd+Internal.h"
@ -182,13 +216,13 @@
#import "MPNativeAdRendererImageHandler.h"
#import "MPNativeAdSourceQueue.h"
#import "MPNativeAdUtils.h"
#import "MPNativeCache.h"
#import "MPNativePositionResponseDeserializer.h"
#import "MPNativePositionSource.h"
#import "MPNativeView.h"
#import "MPStreamAdPlacerDelegate.h"
#import "MPTableViewAdPlacerCell.h"
#import "MPAdPositioning.h"
#import "MPBaseNativeAdRenderer.h"
#import "MPClientAdPositioning.h"
#import "MPCollectionViewAdPlacer.h"
#import "MPCollectionViewAdPlacerDelegate.h"
@ -197,7 +231,6 @@
#import "MPNativeAdConstants.h"
#import "MPNativeAdData.h"
#import "MPNativeAdDelegate.h"
#import "MPNativeAdError.h"
#import "MPNativeAdRenderer.h"
#import "MPNativeAdRendererConfiguration.h"
#import "MPNativeAdRendererSettings.h"
@ -205,6 +238,7 @@
#import "MPNativeAdRenderingImageLoader.h"
#import "MPNativeAdRequest.h"
#import "MPNativeAdRequestTargeting.h"
#import "MPNativeAds.h"
#import "MPNativeAdSource.h"
#import "MPNativeAdSourceDelegate.h"
#import "MPNativeCustomEvent.h"
@ -229,22 +263,6 @@
#import "MOPUBReplayView.h"
#import "MOPUBNativeVideoAdRenderer.h"
#import "MOPUBNativeVideoAdRendererSettings.h"
#import "MPMoPubRewardedPlayableCustomEvent.h"
#import "MPMoPubRewardedVideoCustomEvent.h"
#import "MPPrivateRewardedVideoCustomEventDelegate.h"
#import "MPRewardedVideo+Internal.h"
#import "MPRewardedVideoAdapter.h"
#import "MPRewardedVideoAdManager.h"
#import "MPRewardedVideoConnection.h"
#import "MPRewardedVideo.h"
#import "MPRewardedVideoCustomEvent.h"
#import "MPRewardedVideoError.h"
#import "MPRewardedVideoReward.h"
#import "MPViewabilityAdapter.h"
#import "MPViewabilityOption.h"
#import "MPViewabilityTracker.h"
#import "MPWebView+Viewability.h"
#import "MPViewabilityAdapterMoat.h"
FOUNDATION_EXPORT double MoPubVersionNumber;
FOUNDATION_EXPORT const unsigned char MoPubVersionString[];

View file

@ -1,7 +1,7 @@
//
// MPBannerAdManager.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPBannerAdManager.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -215,12 +215,6 @@
}
}
- (BOOL)shouldScheduleTimerOnImpressionDisplay {
// If `visibleImpressionTrackingEnabled` is set to `YES`, we
// should schedule the timer only after the impression has fired.
return self.requestingConfiguration.visibleImpressionTrackingEnabled;
}
- (void)fetchAdWithConfiguration:(MPAdConfiguration *)configuration {
MPLogInfo(@"Banner ad view is fetching ad type: %@", configuration.adType);
@ -312,7 +306,7 @@
- (CLLocation *)location
{
return self.targeting.location;
return nil;
}
- (BOOL)requestingAdapterIsReadyToBePresented
@ -332,10 +326,6 @@
[self.onscreenAdapter didDisplayAd];
self.requestingAdapterAdContentView = nil;
if (![self shouldScheduleTimerOnImpressionDisplay]) {
[self scheduleRefreshTimer];
}
}
}
@ -401,7 +391,7 @@
}
- (void)adapterDidTrackImpressionForAd:(MPBaseBannerAdapter *)adapter {
if (self.onscreenAdapter == adapter && [self shouldScheduleTimerOnImpressionDisplay]) {
if (self.onscreenAdapter == adapter) {
[self scheduleRefreshTimer];
}

View file

@ -1,7 +1,7 @@
//
// MPBannerAdManagerDelegate.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPBannerCustomEvent+Internal.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPBannerCustomEvent+Internal.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPBannerCustomEventAdapter.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPBannerCustomEventAdapter.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -17,6 +17,9 @@
#import "MPAdImpressionTimer.h"
#import "MPBannerCustomEvent+Internal.h"
static CGFloat const kDefaultRequiredPixelsInViewForImpression = 1.0;
static NSTimeInterval const kDefaultRequiredSecondsInViewForImpression = 0.0;
@interface MPBannerCustomEventAdapter () <MPAdImpressionTimerDelegate>
@property (nonatomic, strong) MPBannerCustomEvent *bannerCustomEvent;
@ -26,8 +29,6 @@
@property (nonatomic) MPAdImpressionTimer *impressionTimer;
@property (nonatomic) UIView *adView;
- (void)trackClickOnce;
@end
@implementation MPBannerCustomEventAdapter
@ -85,13 +86,8 @@
- (void)didDisplayAd
{
if([self shouldTrackImpressionOnDisplay]) {
[self trackImpressionOnDisplay];
} else if (self.configuration.visibleImpressionTrackingEnabled) {
if ([self.bannerCustomEvent enableAutomaticImpressionAndClickTracking]) {
[self startViewableTrackingTimer];
} else {
// Mediated networks except Google AdMob
// no-op here.
}
[self.bannerCustomEvent didDisplayAd];
@ -99,30 +95,18 @@
#pragma mark - 1px impression tracking methods
- (void)trackImpressionOnDisplay
{
self.hasTrackedImpression = YES;
[self trackImpression];
}
- (void)startViewableTrackingTimer
{
self.impressionTimer = [[MPAdImpressionTimer alloc] initWithRequiredSecondsForImpression:self.configuration.impressionMinVisibleTimeInSec requiredViewVisibilityPixels:self.configuration.impressionMinVisiblePixels];
// Use defaults if server did not send values
NSTimeInterval minimumSecondsForImpression = self.configuration.impressionMinVisibleTimeInSec >= 0 ? self.configuration.impressionMinVisibleTimeInSec : kDefaultRequiredSecondsInViewForImpression;
CGFloat minimumPixelsForImpression = self.configuration.impressionMinVisiblePixels >= 0 ? self.configuration.impressionMinVisiblePixels : kDefaultRequiredPixelsInViewForImpression;
self.impressionTimer = [[MPAdImpressionTimer alloc] initWithRequiredSecondsForImpression:minimumSecondsForImpression
requiredViewVisibilityPixels:minimumPixelsForImpression];
self.impressionTimer.delegate = self;
[self.impressionTimer startTrackingView:self.adView];
}
- (BOOL)shouldTrackImpressionOnDisplay {
if (self.configuration.visibleImpressionTrackingEnabled) {
return NO;
}
if([self.bannerCustomEvent enableAutomaticImpressionAndClickTracking] && !self.hasTrackedImpression) {
return YES;
}
return NO;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark - MPPrivateBannerCustomEventDelegate
@ -142,10 +126,13 @@
return [self.delegate bannerDelegate];
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-implementations"
- (CLLocation *)location
{
return [self.delegate location];
}
#pragma GCC diagnostic pop
- (void)bannerCustomEvent:(MPBannerCustomEvent *)event didLoadAd:(UIView *)ad
{
@ -166,7 +153,6 @@
- (void)bannerCustomEventWillBeginAction:(MPBannerCustomEvent *)event
{
[self trackClickOnce];
[self.delegate userActionWillBeginForAdapter:self];
}
@ -177,15 +163,15 @@
- (void)bannerCustomEventWillLeaveApplication:(MPBannerCustomEvent *)event
{
[self trackClickOnce];
[self.delegate userWillLeaveApplicationFromAdapter:self];
}
- (void)trackClickOnce
- (void)trackClick
{
// unlike `[super trackClick]`, this `trackClick` ensures the click is tracked only once
if ([self.bannerCustomEvent enableAutomaticImpressionAndClickTracking] && !self.hasTrackedClick) {
self.hasTrackedClick = YES;
[self trackClick];
[super trackClick];
}
}

View file

@ -1,7 +1,7 @@
//
// MPBaseBannerAdapter.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPBaseBannerAdapter.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPPrivateBannerCustomEventDelegate.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,26 +0,0 @@
//
// MPAdAlertGestureRecognizer.h
//
// Copyright 2018-2019 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
/**
To trigger this gesture recognizer, the user needs to swipe from left to right, and then right to
left at least four times in the target view, while keeping the finger in a straight horizontal line.
See documentation here:
https://developers.mopub.com/publishers/tools/creative-flagging-tool/#report-a-creative
*/
#import <UIKit/UIKit.h>
@interface MPAdAlertGestureRecognizer : UIGestureRecognizer
/**
After adding this gesture recognizer to a new view, set minimum tracking distance base on the view size.
Default is 100.
*/
@property (nonatomic, assign) CGFloat minTrackedDistanceForZigZag;
@end

View file

@ -1,230 +0,0 @@
//
// MPAdAlertGestureRecognizer.m
//
// Copyright 2018-2019 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
#import "MPAdAlertGestureRecognizer.h"
#import <UIKit/UIGestureRecognizerSubclass.h>
#define kMaxRequiredTrackedDistance 100
#define kDefaultMinTrackedDistance 100
#define kDefaultNumZigZagsForRecognition 4
typedef NS_ENUM(NSUInteger, MPAdAlertGestureRecognizerState) {
MPAdAlertGestureRecognizerState_ZigRight1,
MPAdAlertGestureRecognizerState_ZagLeft2,
MPAdAlertGestureRecognizerState_Recognized
};
NSInteger const kMPAdAlertGestureMaxAllowedYAxisMovement = 50;
@interface MPAdAlertGestureRecognizer ()
@property (nonatomic, assign) MPAdAlertGestureRecognizerState currentAlertGestureState;
@property (nonatomic, assign) CGPoint inflectionPoint;
@property (nonatomic, assign) CGPoint startingPoint;
@property (nonatomic, assign) BOOL thresholdReached;
@property (nonatomic, assign) NSInteger curNumZigZags;
@property (nonatomic, assign) NSInteger numZigZagsForRecognition; // default is 4
@end
@implementation MPAdAlertGestureRecognizer
- (id)init
{
self = [super init];
if (self != nil) {
[self commonInit];
}
return self;
}
- (id)initWithTarget:(id)target action:(SEL)action
{
self = [super initWithTarget:target action:action];
if (self != nil) {
[self commonInit];
}
return self;
}
- (void)commonInit
{
self.minTrackedDistanceForZigZag = kDefaultMinTrackedDistance;
self.numZigZagsForRecognition = kDefaultNumZigZagsForRecognition;
[self resetToInitialState];
}
- (void)setMinTrackedDistanceForZigZag:(CGFloat)minTrackedDistanceForZigZag
{
if (_minTrackedDistanceForZigZag != minTrackedDistanceForZigZag) {
_minTrackedDistanceForZigZag = MIN(minTrackedDistanceForZigZag, kMaxRequiredTrackedDistance);
}
}
#pragma mark Required Overrides
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
if ([touches count] != 1) {
self.state = UIGestureRecognizerStateFailed;
return;
}
CGPoint nowPoint = [touches.anyObject locationInView:self.view];
self.inflectionPoint = nowPoint;
self.startingPoint = nowPoint;
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesMoved:touches withEvent:event];
if (self.state == UIGestureRecognizerStateFailed) {
return;
}
[self updateAlertGestureStateWithTouches:touches];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
if ((self.state == UIGestureRecognizerStatePossible) && self.currentAlertGestureState == MPAdAlertGestureRecognizerState_Recognized) {
self.state = UIGestureRecognizerStateRecognized;
}
[self resetToInitialState];
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesCancelled:touches withEvent:event];
[self resetToInitialState];
self.state = UIGestureRecognizerStateFailed;
}
- (void)reset
{
[super reset];
[self resetToInitialState];
}
- (void)resetToInitialState
{
self.currentAlertGestureState = MPAdAlertGestureRecognizerState_ZigRight1;
self.inflectionPoint = CGPointZero;
self.startingPoint = CGPointZero;
self.thresholdReached = NO;
self.curNumZigZags = 0;
}
#pragma mark State Transitions
- (void)handleZigRightGestureStateWithTouches:(NSSet *)touches
{
CGPoint nowPoint = [touches.anyObject locationInView:self.view];
CGPoint prevPoint = [touches.anyObject previousLocationInView:self.view];
// first zig must be to the right, x must increase
// if the touch has covered enough distance, then we're ready to move on to the next state
if (nowPoint.x > prevPoint.x && nowPoint.x - self.inflectionPoint.x >= self.minTrackedDistanceForZigZag) {
self.thresholdReached = YES;
} else if (nowPoint.x < prevPoint.x) {
// user has changed touch direction
if (self.thresholdReached) {
self.inflectionPoint = nowPoint;
self.currentAlertGestureState = MPAdAlertGestureRecognizerState_ZagLeft2;
self.thresholdReached = NO;
} else {
// the user changed directions before covering the required distance, fail
self.state = UIGestureRecognizerStateFailed;
}
}
// else remain in the current state and continue tracking finger movement
}
- (void)handleZagLeftGestureStateWithTouches:(NSSet *)touches
{
CGPoint nowPoint = [touches.anyObject locationInView:self.view];
CGPoint prevPoint = [touches.anyObject previousLocationInView:self.view];
// zag to the left, x must decrease
// if the touch has covered enough distance, then we're ready to move on to the next state
if (nowPoint.x < prevPoint.x && self.inflectionPoint.x - nowPoint.x >= self.minTrackedDistanceForZigZag) {
BOOL prevThresholdState = self.thresholdReached;
self.thresholdReached = YES;
// increment once, and only once, after we hit the threshold for the zag
if (prevThresholdState != self.thresholdReached) {
self.curNumZigZags++;
}
if (self.curNumZigZags >= self.numZigZagsForRecognition) {
self.currentAlertGestureState = MPAdAlertGestureRecognizerState_Recognized;
}
} else if (nowPoint.x > prevPoint.x) {
// user has changed touch direction
if (self.thresholdReached) {
self.inflectionPoint = nowPoint;
self.currentAlertGestureState = MPAdAlertGestureRecognizerState_ZigRight1;
self.thresholdReached = NO;
} else {
// the user changed directions before covering the required distance, fail
self.state = UIGestureRecognizerStateFailed;
}
}
// else remain in the current state and continue tracking finger movement
}
- (void)updateAlertGestureStateWithTouches:(NSSet *)touches
{
// fail gesture recognition if the touch moves outside of our defined bounds
if (![self touchIsWithinBoundsForTouches:touches] && self.currentAlertGestureState != MPAdAlertGestureRecognizerState_Recognized) {
self.state = UIGestureRecognizerStateFailed;
return;
}
switch (self.currentAlertGestureState) {
case MPAdAlertGestureRecognizerState_ZigRight1:
[self handleZigRightGestureStateWithTouches:touches];
break;
case MPAdAlertGestureRecognizerState_ZagLeft2:
[self handleZagLeftGestureStateWithTouches:touches];
break;
default:
break;
}
}
- (BOOL)validYAxisMovementForTouches:(NSSet *)touches
{
CGPoint nowPoint = [touches.anyObject locationInView:self.view];
return fabs(nowPoint.y - self.startingPoint.y) <= kMPAdAlertGestureMaxAllowedYAxisMovement;
}
- (BOOL)touchIsWithinBoundsForTouches:(NSSet *)touches
{
CGPoint nowPoint = [touches.anyObject locationInView:self.view];
// 1. use self.view.bounds because locationInView converts to self.view's coordinate system
// 2. ensure user doesn't stray too far in the Y-axis
return CGRectContainsPoint(self.view.bounds, nowPoint) && [self validYAxisMovementForTouches:touches];
}
@end

View file

@ -1,31 +0,0 @@
//
// MPAdAlertManager.h
//
// Copyright 2018-2019 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "MPGlobal.h"
@class CLLocation;
@protocol MPAdAlertManagerDelegate;
@class MPAdConfiguration;
@interface MPAdAlertManager : NSObject <MPAdAlertManagerProtocol>
@end
@protocol MPAdAlertManagerDelegate <NSObject>
@required
- (UIViewController *)viewControllerForPresentingMailVC;
- (void)adAlertManagerDidTriggerAlert:(MPAdAlertManager *)manager;
@optional
- (void)adAlertManagerDidProcessAlert:(MPAdAlertManager *)manager;
@end

View file

@ -1,231 +0,0 @@
//
// MPAdAlertManager.m
//
// Copyright 2018-2019 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
#import "MPAdAlertManager.h"
#import "MPAdConfiguration.h"
#import "MPAdAlertGestureRecognizer.h"
#import "MPConstants.h"
#import "MPCoreInstanceProvider.h"
#import "MPIdentityProvider.h"
#import "MPLastResortDelegate.h"
#import "MPLogging.h"
#import <QuartzCore/QuartzCore.h>
#import <CoreLocation/CoreLocation.h>
#import <MessageUI/MessageUI.h>
#define kTimestampParamKey @"timestamp"
@interface MPAdAlertManager () <UIGestureRecognizerDelegate, MFMailComposeViewControllerDelegate>
@property (nonatomic, assign) BOOL processedAlert;
@property (nonatomic, strong) MPAdAlertGestureRecognizer *adAlertGestureRecognizer;
@property (nonatomic, strong) MFMailComposeViewController *currentOpenMailVC;
@end
@implementation MPAdAlertManager
// synthesize for `MPAdAlertManagerProtocol` protocol
@synthesize delegate = _delegate;
@synthesize adConfiguration = _adConfiguration;
@synthesize adUnitId = _adUnitId;
@synthesize targetAdView = _targetAdView;
@synthesize location = _location;
- (id)init
{
self = [super init];
if (self != nil) {
self.adAlertGestureRecognizer = [[MPCoreInstanceProvider sharedProvider] buildMPAdAlertGestureRecognizerWithTarget:self
action:@selector(handleAdAlertGesture)];
self.adAlertGestureRecognizer.delegate = self;
self.processedAlert = NO;
}
return self;
}
- (void)dealloc
{
[_targetAdView removeGestureRecognizer:_adAlertGestureRecognizer];
[_adAlertGestureRecognizer removeTarget:self action:nil];
_adAlertGestureRecognizer.delegate = nil;
_currentOpenMailVC.mailComposeDelegate = [MPLastResortDelegate sharedDelegate];
}
- (void)processAdAlert
{
static NSDateFormatter *dateFormatter = nil;
MPLogInfo(@"MPAdAlertManager processing ad alert");
// don't even try if this device can't send emails
if (![MFMailComposeViewController canSendMail]) {
if ([self.delegate respondsToSelector:@selector(adAlertManagerDidProcessAlert:)]) {
[self.delegate adAlertManagerDidProcessAlert:self];
}
return;
}
// since iOS 4, drawing an image to a graphics context is thread-safe
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// take screenshot of the ad
UIGraphicsBeginImageContextWithOptions(self.targetAdView.bounds.size, YES, 0.0);
[self.targetAdView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
dispatch_async(dispatch_get_main_queue(), ^{
// package additional ad data
NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setValue:@"iOS" forKey:@"platform"];
[params setValue:[UIDevice currentDevice].systemVersion forKey:@"platform_version"];
[params setValue:[MPIdentityProvider identifier] forKey:@"device_id"];
[params setValue:[UIDevice currentDevice].model forKey:@"device_model"];
[params setValue:[NSNumber numberWithBool:self.adConfiguration.isFullscreenAd] forKey:@"is_fullscreen_ad"];
[params setValue:self.adUnitId forKey:@"ad_unit_id"];
[params setValue:self.adConfiguration.dspCreativeId forKey:@"creative_id"];
[params setValue:self.adConfiguration.adType forKey:@"ad_type"];
[params setValue:[[NSLocale currentLocale] localeIdentifier] forKey:@"device_locale"];
[params setValue:[self.location description] forKey:@"location"];
[params setValue:MP_SDK_VERSION forKey:@"sdk_version"];
if (self.adConfiguration.hasPreferredSize) {
[params setValue:NSStringFromCGSize(self.adConfiguration.preferredSize) forKey:@"ad_size"];
}
if (dateFormatter == nil) {
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeStyle:NSDateFormatterLongStyle];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
}
[params setValue:[dateFormatter stringFromDate:self.adConfiguration.creationTimestamp] forKey:kTimestampParamKey];
[self processAdParams:params andScreenshot:image];
MPLogInfo(@"MPAdAlertManager finished processing ad alert");
});
});
}
- (void)handleAdAlertGesture
{
MPLogInfo(@"MPAdAlertManager alert gesture recognized");
[self.delegate adAlertManagerDidTriggerAlert:self];
}
- (void)processAdParams:(NSDictionary *)params andScreenshot:(UIImage *)screenshot
{
NSData *imageData = UIImagePNGRepresentation(screenshot);
NSData *paramData =[[self stringFromDictionary:params] dataUsingEncoding:NSUTF8StringEncoding];
NSData *markupData = self.adConfiguration.adResponseData;
self.currentOpenMailVC = [[MFMailComposeViewController alloc] init];
self.currentOpenMailVC.mailComposeDelegate = self;
[self.currentOpenMailVC setToRecipients:[NSArray arrayWithObject:@"creative-review@mopub.com"]];
[self.currentOpenMailVC setSubject:[NSString stringWithFormat:@"New creative violation report - %@", [params objectForKey:kTimestampParamKey]]];
[self.currentOpenMailVC setMessageBody:@"" isHTML:YES];
if (imageData != nil) {
[self.currentOpenMailVC addAttachmentData:imageData mimeType:@"image/png" fileName:@"mp_adalert_screenshot.png"];
}
if (paramData != nil) {
[self.currentOpenMailVC addAttachmentData:paramData mimeType:@"text/plain" fileName:@"mp_adalert_parameters.txt"];
}
if (markupData != nil) {
[self.currentOpenMailVC addAttachmentData:markupData mimeType:@"text/html" fileName:@"mp_adalert_markup.html"];
}
[[self.delegate viewControllerForPresentingMailVC] presentViewController:self.currentOpenMailVC animated:MP_ANIMATED completion:nil];
if ([self.delegate respondsToSelector:@selector(adAlertManagerDidProcessAlert:)]) {
[self.delegate adAlertManagerDidProcessAlert:self];
}
}
// could just use [dictionary description], but this gives us more control over the output
- (NSString *)stringFromDictionary:(NSDictionary *)dictionary
{
NSMutableString *result = [NSMutableString string];
for (NSString *key in [dictionary allKeys]) {
[result appendFormat:@"%@ : %@\n", key, [dictionary objectForKey:key]];
}
return result;
}
#pragma mark - <MFMailComposeViewControllerDelegate>
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
self.currentOpenMailVC = nil;
// reset processed state to allow the user to alert on this ad again
if (result == MFMailComposeResultCancelled || result == MFMailComposeResultFailed) {
self.processedAlert = NO;
}
[[self.delegate viewControllerForPresentingMailVC] dismissViewControllerAnimated:MP_ANIMATED completion:nil];
}
#pragma mark - Public
- (void)beginMonitoringAlerts
{
[self endMonitoringAlerts];
[self.targetAdView addGestureRecognizer:self.adAlertGestureRecognizer];
// dynamically set minimum tracking distance to account for all ad sizes
self.adAlertGestureRecognizer.minTrackedDistanceForZigZag = self.targetAdView.bounds.size.width / 3;
self.processedAlert = NO;
}
- (void)endMonitoringAlerts
{
[self.targetAdView removeGestureRecognizer:self.adAlertGestureRecognizer];
}
- (void)processAdAlertOnce
{
if (self.processedAlert) {
return;
}
self.processedAlert = YES;
[self processAdAlert];
}
#pragma mark - <UIGestureRecognizerDelegate>
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if ([touch.view isKindOfClass:[UIButton class]]) {
// we touched a button
return NO; // ignore the touch
}
return YES; // handle the touch
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}
@end

View file

@ -1,7 +1,7 @@
//
// MPAPIEndpoints.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,14 +1,14 @@
//
// MPAPIEndpoints.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
#import "MPAPIEndpoints.h"
#import "MPConstants.h"
#import "MPCoreInstanceProvider.h"
#import "MPDeviceInformation.h"
// URL scheme constants
static NSString * const kUrlSchemeHttp = @"http";
@ -46,7 +46,7 @@ static BOOL sUsesHTTPS = YES;
+ (NSString *)baseURL
{
if ([[MPCoreInstanceProvider sharedProvider] appTransportSecuritySettings] == MPATSSettingEnabled) {
if (MPDeviceInformation.appTransportSecuritySettings == MPATSSettingEnabled) {
return [@"https://" stringByAppendingString:self.baseHostname];
}

View file

@ -1,7 +1,7 @@
//
// MPActivityViewControllerHelper+TweetShare.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPActivityViewControllerHelper+TweetShare.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPActivityViewControllerHelper.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPActivityViewControllerHelper.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPAdConfiguration.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -9,8 +9,10 @@
#import <Foundation/Foundation.h>
#import "MPGlobal.h"
#import "MPImpressionData.h"
#import "MPVideoEvent.h"
@class MPRewardedVideoReward;
@class MPVASTTrackingEvent;
typedef NS_ENUM(NSUInteger, MPAfterLoadResult) {
MPAfterLoadResultMissingAdapter,
@ -49,6 +51,7 @@ extern NSString * const kRewardedCurrenciesMetadataKey;
extern NSString * const kRewardedPlayableDurationMetadataKey;
extern NSString * const kRewardedPlayableRewardOnClickMetadataKey;
extern NSString * const kImpressionDataMetadataKey;
extern NSString * const kVASTVideoTrackersMetadataKey;
extern NSString * const kFullAdTypeMetadataKey;
extern NSString * const kOrientationTypeMetadataKey;
@ -102,25 +105,36 @@ extern NSString * const kBannerImpressionMinPixelMetadataKey;
@property (nonatomic, assign) NSInteger nativeImpressionMinVisiblePercent; // The pixels Metadata takes priority over percentage, but percentage is left for backwards compatibility
@property (nonatomic, assign) NSTimeInterval nativeImpressionMinVisibleTimeInterval;
@property (nonatomic, assign) NSTimeInterval nativeVideoMaxBufferingTime;
@property (nonatomic) NSDictionary *nativeVideoTrackers;
@property (nonatomic, readonly) NSArray *availableRewards;
@property (nonatomic) NSDictionary<MPVideoEvent, NSArray<MPVASTTrackingEvent *> *> *vastVideoTrackers;
@property (nonatomic, readonly) NSArray<MPRewardedVideoReward *> *availableRewards;
@property (nonatomic, strong) MPRewardedVideoReward *selectedReward;
@property (nonatomic, copy) NSString *rewardedVideoCompletionUrl;
@property (nonatomic, assign) NSTimeInterval rewardedPlayableDuration;
@property (nonatomic, assign) BOOL rewardedPlayableShouldRewardOnClick;
@property (nonatomic, copy) NSString *advancedBidPayload;
@property (nonatomic, strong) MPImpressionData *impressionData;
@property (nonatomic, assign) BOOL isVASTClickabilityExperimentEnabled;
@property (nonatomic, assign) BOOL enableEarlyClickthroughForNonRewardedVideo;
@property (nonatomic, readonly) BOOL isMoVideo;
/**
MRAID `useCustomClose()` functionality is available for use.
*/
@property (nonatomic, readonly) BOOL mraidAllowCustomClose;
/**
Unified ad unit format in its raw string representation.
*/
@property (nonatomic, copy) NSString *format;
// viewable impression tracking experiment
// viewable impression tracking
@property (nonatomic) NSTimeInterval impressionMinVisibleTimeInSec;
@property (nonatomic) CGFloat impressionMinVisiblePixels;
@property (nonatomic) BOOL visibleImpressionTrackingEnabled;
/**
When there is no actual reward, `availableRewards` contains a default reward with the type
`kMPRewardedVideoRewardCurrencyTypeUnspecified`, thus we cannot simply count the array size
of `availableRewards` to tell whether there is a valid reward.
*/
@property (nonatomic, readonly) BOOL hasValidReward;
- (instancetype)initWithMetadata:(NSDictionary *)metadata data:(NSData *)data isFullscreenAd:(BOOL)isFullscreenAd;

View file

@ -1,7 +1,7 @@
//
// MPAdConfiguration.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -18,14 +18,22 @@
#import "MPMRAIDBannerCustomEvent.h"
#import "MPMRAIDInterstitialCustomEvent.h"
#import "MPRewardedVideoReward.h"
#import "MPVASTInterstitialCustomEvent.h"
#import "MPVASTTracking.h"
#import "MPViewabilityTracker.h"
#import "NSDictionary+MPAdditions.h"
#import "NSJSONSerialization+MPAdditions.h"
#import "NSString+MPAdditions.h"
#if MP_HAS_NATIVE_PACKAGE
#if __has_include("MOPUBNativeVideoCustomEvent.h")
#import "MOPUBNativeVideoCustomEvent.h"
#endif
#if __has_include("MPMoPubNativeCustomEvent.h")
#import "MPMoPubNativeCustomEvent.h"
#endif
#if __has_include("MPVASTTrackingEvent.h")
#import "MPVASTTrackingEvent.h"
#endif
@ -33,6 +41,12 @@
#define AFTER_LOAD_DURATION_MACRO @"%%LOAD_DURATION_MS%%"
#define AFTER_LOAD_RESULT_MACRO @"%%LOAD_RESULT%%"
typedef NS_ENUM(NSUInteger, MPVASTPlayerVersion) {
MPVASTPlayerVersionUndetermined = 0, // default value, should be treated as web view player
MPVASTPlayerVersionWebViewPlayer = 1,
MPVASTPlayerVersionNativePlayer = 2
};
NSString * const kAdTypeMetadataKey = @"x-adtype";
NSString * const kAdUnitWarmingUpMetadataKey = @"x-warmup";
NSString * const kClickthroughMetadataKey = @"x-clickthrough";
@ -67,7 +81,7 @@ NSString * const kNativeImpressionVisibleMsMetadataKey = @"x-impression-visible-
NSString * const kNativeVideoPlayVisiblePercentMetadataKey = @"x-play-visible-percent";
NSString * const kNativeVideoPauseVisiblePercentMetadataKey = @"x-pause-visible-percent";
NSString * const kNativeVideoMaxBufferingTimeMsMetadataKey = @"x-max-buffer-ms";
NSString * const kNativeVideoTrackersMetadataKey = @"x-video-trackers";
NSString * const kVASTVideoTrackersMetadataKey = @"x-video-trackers";
NSString * const kBannerImpressionVisableMsMetadataKey = @"x-banner-impression-min-ms";
NSString * const kBannerImpressionMinPixelMetadataKey = @"x-banner-impression-min-pixels";
@ -80,6 +94,7 @@ NSString * const kAdTypeNative = @"json";
NSString * const kAdTypeNativeVideo = @"json_video";
NSString * const kAdTypeRewardedVideo = @"rewarded_video";
NSString * const kAdTypeRewardedPlayable = @"rewarded_playable";
NSString * const kAdTypeVAST = @"vast"; // a possible value of "x-fulladtype"
// rewarded video
NSString * const kRewardedVideoCurrencyNameMetadataKey = @"x-rewarded-video-currency-name";
@ -91,12 +106,12 @@ NSString * const kRewardedCurrenciesMetadataKey = @"x-rewarded-currencies";
NSString * const kRewardedPlayableDurationMetadataKey = @"x-rewarded-duration";
NSString * const kRewardedPlayableRewardOnClickMetadataKey = @"x-should-reward-on-click";
// native video
NSString * const kNativeVideoTrackerUrlMacro = @"%%VIDEO_EVENT%%";
NSString * const kNativeVideoTrackerEventsMetadataKey = @"events";
NSString * const kNativeVideoTrackerUrlsMetadataKey = @"urls";
NSString * const kNativeVideoTrackerEventDictionaryKey = @"event";
NSString * const kNativeVideoTrackerTextDictionaryKey = @"text";
// vast video trackers
NSString * const kVASTVideoTrackerUrlMacro = @"%%VIDEO_EVENT%%";
NSString * const kVASTVideoTrackerEventsMetadataKey = @"events";
NSString * const kVASTVideoTrackerUrlsMetadataKey = @"urls";
NSString * const kVASTVideoTrackerEventDictionaryKey = @"event";
NSString * const kVASTVideoTrackerTextDictionaryKey = @"text";
// clickthrough experiment
NSString * const kClickthroughExperimentBrowserAgent = @"x-browser-agent";
@ -108,13 +123,24 @@ NSString * const kViewabilityDisableMetadataKey = @"x-disable-viewability";
// advanced bidding
NSString * const kAdvancedBiddingMarkupMetadataKey = @"adm";
// clickability experiment
// Correspond to a numeric value: 2 means native player, 1 or 0 means MoVideo web view player
NSString * const kVASTPlayerVersionKey = @"vast-player-version";
// MRAID
NSString * const kMRAIDAllowCustomCloseKey = @"allow-custom-close";
/**
Format Unification Phase 2 item 1.1 - clickability experiment
When the experiment is enabled, users are able to click a fullscreen non-rewarded VAST video ad
immediately, so that they can consume additional content about the advertiser. Clicking on this
video should launch the CTA.
*/
NSString * const kVASTClickabilityExperimentKey = @"vast-click-enabled";
@interface MPAdConfiguration ()
@property (nonatomic, copy) NSString *adResponseHTMLString;
@property (nonatomic, strong, readwrite) NSArray *availableRewards;
@property (nonatomic, strong, readwrite) NSArray<MPRewardedVideoReward *> *availableRewards;
@property (nonatomic) MOPUBDisplayAgentType clickthroughExperimentBrowserAgent;
@property (nonatomic, strong) MOPUBExperimentProvider *experimentProvider;
@ -176,7 +202,16 @@ NSString * const kVASTClickabilityExperimentKey = @"vast-click-enabled";
self.orientationType = [self orientationTypeFromMetadata:metadata];
self.customEventClass = [self setUpCustomEventClassFromMetadata:metadata];
switch ([metadata mp_unsignedIntegerForKey:kVASTPlayerVersionKey]) {
case MPVASTPlayerVersionNativePlayer:
self.customEventClass = [self setUpCustomEventClassFromMetadata:metadata
vastPlayerVersion:MPVASTPlayerVersionNativePlayer];
break;
default:
self.customEventClass = [self setUpCustomEventClassFromMetadata:metadata
vastPlayerVersion:MPVASTPlayerVersionWebViewPlayer];
break;
}
self.customEventClassData = [self customEventClassDataFromMetadata:metadata];
@ -203,15 +238,15 @@ NSString * const kVASTClickabilityExperimentKey = @"vast-click-enabled";
self.nativeImpressionMinVisibleTimeInterval = [self timeIntervalFromMsmetadata:metadata forKey:kNativeImpressionVisibleMsMetadataKey];
self.nativeVideoMaxBufferingTime = [self timeIntervalFromMsmetadata:metadata forKey:kNativeVideoMaxBufferingTimeMsMetadataKey];
#if MP_HAS_NATIVE_PACKAGE
self.nativeVideoTrackers = [self nativeVideoTrackersFromMetadata:metadata key:kNativeVideoTrackersMetadataKey];
#endif
// VAST video trackers
self.vastVideoTrackers = [self vastVideoTrackersFromMetadata:metadata key:kVASTVideoTrackersMetadataKey];
self.impressionMinVisibleTimeInSec = [self timeIntervalFromMsmetadata:metadata forKey:kBannerImpressionVisableMsMetadataKey];
self.impressionMinVisiblePixels = [[self adAmountFromMetadata:metadata key:kBannerImpressionMinPixelMetadataKey] floatValue];
self.impressionData = [self impressionDataFromMetadata:metadata];
self.isVASTClickabilityExperimentEnabled = [metadata mp_boolForKey:kVASTClickabilityExperimentKey defaultValue:NO];
self.enableEarlyClickthroughForNonRewardedVideo = [metadata mp_boolForKey:kVASTClickabilityExperimentKey defaultValue:NO];
// Organize impression tracking URLs
NSArray <NSURL *> * URLs = [self URLsFromMetadata:metadata forKey:kImpressionTrackersMetadataKey];
@ -280,26 +315,41 @@ NSString * const kVASTClickabilityExperimentKey = @"vast-click-enabled";
// advanced bidding
self.advancedBidPayload = [metadata objectForKey:kAdvancedBiddingMarkupMetadataKey];
// MRAID
_mraidAllowCustomClose = [metadata mp_boolForKey:kMRAIDAllowCustomCloseKey defaultValue:NO];
}
/**
Provided the metadata of an ad, return the class of corresponding custome event.
*/
- (Class)setUpCustomEventClassFromMetadata:(NSDictionary *)metadata
vastPlayerVersion:(MPVASTPlayerVersion)vastPlayerVersion
{
NSDictionary *customEventTable;
if (self.isFullscreenAd) {
Class rewardedVideoClass;
switch (vastPlayerVersion) {
case MPVASTPlayerVersionNativePlayer:
rewardedVideoClass = [MPVASTInterstitialCustomEvent class];
break;
default: // web view player
rewardedVideoClass = [MPMoPubRewardedVideoCustomEvent class];
break;
}
customEventTable = @{@"admob_full": @"MPGoogleAdMobInterstitialCustomEvent", // optional class
kAdTypeHtml: NSStringFromClass([MPHTMLInterstitialCustomEvent class]),
kAdTypeMraid: NSStringFromClass([MPMRAIDInterstitialCustomEvent class]),
kAdTypeRewardedVideo: NSStringFromClass([MPMoPubRewardedVideoCustomEvent class]),
kAdTypeRewardedPlayable: NSStringFromClass([MPMoPubRewardedPlayableCustomEvent class])};
kAdTypeRewardedVideo: NSStringFromClass(rewardedVideoClass),
kAdTypeRewardedPlayable: NSStringFromClass([MPMoPubRewardedPlayableCustomEvent class]),
kAdTypeVAST: NSStringFromClass([MPVASTInterstitialCustomEvent class])};
} else {
customEventTable = @{@"admob_native": @"MPGoogleAdMobBannerCustomEvent", // optional class
kAdTypeHtml: NSStringFromClass([MPHTMLBannerCustomEvent class]),
kAdTypeMraid: NSStringFromClass([MPMRAIDBannerCustomEvent class]),
kAdTypeNativeVideo: NSStringFromClass([MOPUBNativeVideoCustomEvent class]),
kAdTypeNative: NSStringFromClass([MPMoPubNativeCustomEvent class])};
kAdTypeNativeVideo: @"MOPUBNativeVideoCustomEvent", // optional native class
kAdTypeNative: @"MPMoPubNativeCustomEvent"}; // optional native class
}
NSString *customEventClassName = metadata[kCustomEventClassNameMetadataKey];
@ -345,6 +395,12 @@ NSString * const kVASTClickabilityExperimentKey = @"vast-click-enabled";
return (self.preferredSize.width > 0 && self.preferredSize.height > 0);
}
- (BOOL)hasValidReward
{
return (self.availableRewards.firstObject != nil
&& [self.availableRewards.firstObject.currencyType isEqualToString:kMPRewardedVideoRewardCurrencyTypeUnspecified] == NO);
}
- (NSString *)adResponseHTMLString
{
if (!_adResponseHTMLString) {
@ -406,6 +462,16 @@ NSString * const kVASTClickabilityExperimentKey = @"vast-click-enabled";
return [self.metadataAdType isEqualToString:kAdTypeMraid];
}
- (BOOL)isMoVideo
{
// Comparing using class name strings instead of `isKindOfClass:`. The isKindOfClass:`
// check fails because `self.customEventClass` was instantiated using reflection.
NSString *className = NSStringFromClass(self.customEventClass);
BOOL isMoVideoRewardedVideo = [className isEqualToString:@"MPMoPubRewardedVideoCustomEvent"];
BOOL isMoVideoRewardedPlayable = [className isEqualToString:@"MPMoPubRewardedPlayableCustomEvent"];
return isMoVideoRewardedVideo || isMoVideoRewardedPlayable;
}
#pragma mark - Private
- (NSArray *)concatenateBaseUrlArray:(NSArray *)baseArray withConditionalArray:(NSArray *)conditionalArray {
@ -582,25 +648,20 @@ NSString * const kVASTClickabilityExperimentKey = @"vast-click-enabled";
}
}
#if MP_HAS_NATIVE_PACKAGE
- (NSDictionary *)nativeVideoTrackersFromMetadata:(NSDictionary *)metadata key:(NSString *)key
- (NSDictionary<MPVideoEvent, NSArray<MPVASTTrackingEvent *> *> *)vastVideoTrackersFromMetadata:(NSDictionary *)metadata
key:(NSString *)key
{
NSDictionary *dictFromMetadata = [self dictionaryFromMetadata:metadata forKey:key];
if (!dictFromMetadata) {
return nil;
}
NSMutableDictionary *videoTrackerDict = [NSMutableDictionary new];
NSArray *events = dictFromMetadata[kNativeVideoTrackerEventsMetadataKey];
NSArray *urls = dictFromMetadata[kNativeVideoTrackerUrlsMetadataKey];
NSSet<MPVideoEvent> *supportedEvents = [NSSet setWithObjects:
MPVideoEventStart,
MPVideoEventFirstQuartile,
MPVideoEventMidpoint,
MPVideoEventThirdQuartile,
MPVideoEventComplete,
nil];
NSMutableDictionary<MPVideoEvent, NSArray<MPVASTTrackingEvent *> *> *videoTrackerDict = [NSMutableDictionary new];
NSArray<NSString *> *events = dictFromMetadata[kVASTVideoTrackerEventsMetadataKey];
NSArray<NSString *> *urls = dictFromMetadata[kVASTVideoTrackerUrlsMetadataKey];
for (MPVideoEvent event in events) {
if (![supportedEvents containsObject:event]) {
if (![MPVideoEvents isSupportedEvent:event]) {
continue;
}
[self setVideoTrackers:videoTrackerDict event:event urls:urls];
@ -611,24 +672,27 @@ NSString * const kVASTClickabilityExperimentKey = @"vast-click-enabled";
return videoTrackerDict;
}
- (void)setVideoTrackers:(NSMutableDictionary *)videoTrackerDict event:(MPVideoEvent)event urls:(NSArray *)urls {
NSMutableArray *trackers = [NSMutableArray new];
for (NSString *url in urls) {
if ([url rangeOfString:kNativeVideoTrackerUrlMacro].location != NSNotFound) {
NSString *trackerUrl = [url stringByReplacingOccurrencesOfString:kNativeVideoTrackerUrlMacro withString:event];
NSDictionary *dict = @{kNativeVideoTrackerEventDictionaryKey:event, kNativeVideoTrackerTextDictionaryKey:trackerUrl};
- (void)setVideoTrackers:(NSMutableDictionary<MPVideoEvent, NSArray<MPVASTTrackingEvent *> *> *)videoTrackerDict
event:(MPVideoEvent)event
urls:(NSArray<NSString *> *)urls {
NSMutableArray<MPVASTTrackingEvent *> *trackers = [NSMutableArray new];
[urls enumerateObjectsUsingBlock:^(NSString * _Nonnull urlString, NSUInteger idx, BOOL * _Nonnull stop) {
// Perform macro replacement
if ([urlString rangeOfString:kVASTVideoTrackerUrlMacro].location != NSNotFound) {
NSString *trackerUrl = [urlString stringByReplacingOccurrencesOfString:kVASTVideoTrackerUrlMacro withString:event];
NSDictionary *dict = @{kVASTVideoTrackerEventDictionaryKey:event, kVASTVideoTrackerTextDictionaryKey:trackerUrl};
MPVASTTrackingEvent *tracker = [[MPVASTTrackingEvent alloc] initWithDictionary:dict];
[trackers addObject:tracker];
}
}
}];
// Add to events dictionary if there are trackers available
if (trackers.count > 0) {
videoTrackerDict[event] = trackers;
}
}
#endif
- (NSArray *)parseAvailableRewardsFromMetadata:(NSDictionary *)metadata {
- (NSArray<MPRewardedVideoReward *> *)parseAvailableRewardsFromMetadata:(NSDictionary *)metadata {
// The X-Rewarded-Currencies Metadata key doesn't exist. This is probably
// not a rewarded ad.
NSDictionary * currencies = [metadata objectForKey:kRewardedCurrenciesMetadataKey];
@ -667,14 +731,6 @@ NSString * const kVASTClickabilityExperimentKey = @"vast-click-enabled";
return variant;
}
- (BOOL)visibleImpressionTrackingEnabled
{
if (self.impressionMinVisibleTimeInSec < 0 || self.impressionMinVisiblePixels <= 0) {
return NO;
}
return YES;
}
- (MPImpressionData *)impressionDataFromMetadata:(NSDictionary *)metadata
{
NSDictionary * impressionDataDictionary = metadata[kImpressionDataMetadataKey];

View file

@ -1,31 +1,39 @@
//
// MPAdDestinationDisplayAgent.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
#import <Foundation/Foundation.h>
#import "MPActivityViewControllerHelper+TweetShare.h"
#import "MPAdConfiguration.h"
#import "MPURLResolver.h"
#import "MPProgressOverlayView.h"
#import "MOPUBDisplayAgentType.h"
@protocol MPAdDestinationDisplayAgentDelegate;
@interface MPAdDestinationDisplayAgent : NSObject <MPProgressOverlayViewDelegate,
MPActivityViewControllerHelperDelegate>
@protocol MPAdDestinationDisplayAgent
@property (nonatomic, weak) id<MPAdDestinationDisplayAgentDelegate> delegate;
+ (MPAdDestinationDisplayAgent *)agentWithDelegate:(id<MPAdDestinationDisplayAgentDelegate>)delegate;
+ (id<MPAdDestinationDisplayAgent>)agentWithDelegate:(id<MPAdDestinationDisplayAgentDelegate>)delegate;
+ (BOOL)shouldDisplayContentInApp;
- (void)displayDestinationForURL:(NSURL *)URL;
- (void)cancel;
@end
@interface MPAdDestinationDisplayAgent : NSObject <
MPAdDestinationDisplayAgent,
MPProgressOverlayViewDelegate,
MPActivityViewControllerHelperDelegate
>
@end
@protocol MPAdDestinationDisplayAgentDelegate <NSObject>
- (UIViewController *)viewControllerForPresentingModalView;

View file

@ -1,7 +1,7 @@
//
// MPAdDestinationDisplayAgent.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -40,6 +40,8 @@ static NSString * const kDisplayAgentErrorDomain = @"com.mopub.displayagent";
@implementation MPAdDestinationDisplayAgent
@synthesize delegate;
+ (MPAdDestinationDisplayAgent *)agentWithDelegate:(id<MPAdDestinationDisplayAgentDelegate>)delegate
{
MPAdDestinationDisplayAgent *agent = [[MPAdDestinationDisplayAgent alloc] init];

View file

@ -1,7 +1,7 @@
//
// MPAdImpressionTimer.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPAdImpressionTimer.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPAdServerCommunicator.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPAdServerCommunicator.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPAdServerURLBuilder.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -11,8 +11,6 @@
#import "MPEngineInfo.h"
#import "MPURL.h"
@class CLLocation;
@interface MPAdServerURLBuilder : NSObject
/**

View file

@ -1,7 +1,7 @@
//
// MPAdServerURLBuilder.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -15,6 +15,7 @@
#import "MPConsentManager.h"
#import "MPConstants.h"
#import "MPCoreInstanceProvider+MRAID.h"
#import "MPDeviceInformation.h"
#import "MPError.h"
#import "MPGeolocationProvider.h"
#import "MPGlobal.h"
@ -204,10 +205,10 @@ static MPEngineInfo * _engineInfo = nil;
queryParams[kTimeZoneKey] = [self timeZoneValue];
queryParams[kIsMRAIDEnabledSDKKey] = [self isMRAIDEnabledSDKValue];
queryParams[kConnectionTypeKey] = [self connectionTypeValue];
queryParams[kCarrierNameKey] = [self carrierNameValue];
queryParams[kISOCountryCodeKey] = [self isoCountryCodeValue];
queryParams[kMobileNetworkCodeKey] = [self mobileNetworkCodeValue];
queryParams[kMobileCountryCodeKey] = [self mobileCountryCodeValue];
queryParams[kCarrierNameKey] = MPDeviceInformation.carrierName;
queryParams[kISOCountryCodeKey] = MPDeviceInformation.isoCountryCode;
queryParams[kMobileNetworkCodeKey] = MPDeviceInformation.mobileNetworkCode;
queryParams[kMobileCountryCodeKey] = MPDeviceInformation.mobileCountryCode;
queryParams[kDeviceNameKey] = [self deviceNameValue];
queryParams[kDesiredAdAssetsKey] = [self desiredAdAssetsValue:assets];
queryParams[kAdSequenceKey] = [self adSequenceValue:adSequence];
@ -222,7 +223,7 @@ static MPEngineInfo * _engineInfo = nil;
queryParams[kAdvancedBiddingKey] = [self advancedBiddingValue];
queryParams[kBackoffMsKey] = [self backoffMillisecondsValueForAdUnitID:adUnitID];
queryParams[kBackoffReasonKey] = [[MPRateLimitManager sharedInstance] lastRateLimitReasonForAdUnitId:adUnitID];
[queryParams addEntriesFromDictionary:[self locationInformationDictionary:targeting.location]];
[queryParams addEntriesFromDictionary:self.locationInformation];
return [self URLWithEndpointPath:MOPUB_API_PATH_AD_REQUEST postData:queryParams];
}
@ -265,30 +266,6 @@ static MPEngineInfo * _engineInfo = nil;
return [NSString stringWithFormat:@"%ld", (long)MPReachabilityManager.sharedManager.currentStatus];
}
+ (NSString *)carrierNameValue
{
NSString *carrierName = [[[MPCoreInstanceProvider sharedProvider] sharedCarrierInfo] objectForKey:@"carrierName"];
return carrierName;
}
+ (NSString *)isoCountryCodeValue
{
NSString *code = [[[MPCoreInstanceProvider sharedProvider] sharedCarrierInfo] objectForKey:@"isoCountryCode"];
return code;
}
+ (NSString *)mobileNetworkCodeValue
{
NSString *code = [[[MPCoreInstanceProvider sharedProvider] sharedCarrierInfo] objectForKey:@"mobileNetworkCode"];
return code;
}
+ (NSString *)mobileCountryCodeValue
{
NSString *code = [[[MPCoreInstanceProvider sharedProvider] sharedCarrierInfo] objectForKey:@"mobileCountryCode"];
return code;
}
+ (NSString *)deviceNameValue
{
NSString *deviceName = [[UIDevice currentDevice] mp_hardwareDeviceName];
@ -330,7 +307,7 @@ static MPEngineInfo * _engineInfo = nil;
+ (NSString *)appTransportSecurityStatusValue
{
return [NSString stringWithFormat:@"%@", @([[MPCoreInstanceProvider sharedProvider] appTransportSecuritySettings])];
return [NSString stringWithFormat:@"%@", @(MPDeviceInformation.appTransportSecuritySettings)];
}
+ (NSString *)keywordsValue:(NSString *)keywords
@ -384,7 +361,7 @@ static MPEngineInfo * _engineInfo = nil;
return MPMediationManager.sharedManager.adRequestPayload;
}
+ (NSDictionary *)locationInformationDictionary:(CLLocation *)location {
+ (NSDictionary *)locationInformation {
// Not allowed to collect location because it is PII
if (![MPConsentManager.sharedManager canCollectPersonalInfo]) {
return @{};
@ -392,14 +369,7 @@ static MPEngineInfo * _engineInfo = nil;
NSMutableDictionary *locationDict = [NSMutableDictionary dictionary];
CLLocation *bestLocation = location;
CLLocation *locationFromProvider = [[[MPCoreInstanceProvider sharedProvider] sharedMPGeolocationProvider] lastKnownLocation];
// Location determined by CoreLocation is given priority over the Publisher-specified location.
if (locationFromProvider) {
bestLocation = locationFromProvider;
}
CLLocation *bestLocation = MPGeolocationProvider.sharedProvider.lastKnownLocation;
if (bestLocation && bestLocation.horizontalAccuracy >= 0) {
locationDict[kLocationLatitudeLongitudeKey] = [NSString stringWithFormat:@"%@,%@",
@(bestLocation.coordinate.latitude),
@ -408,9 +378,8 @@ static MPEngineInfo * _engineInfo = nil;
locationDict[kLocationHorizontalAccuracy] = [NSString stringWithFormat:@"%@", @(bestLocation.horizontalAccuracy)];
}
if (bestLocation == locationFromProvider) {
locationDict[kLocationIsFromSDK] = @"1";
}
// Only SDK-specified locations are allowed.
locationDict[kLocationIsFromSDK] = @"1";
NSTimeInterval locationLastUpdatedMillis = [[NSDate date] timeIntervalSinceDate:bestLocation.timestamp] * 1000.0;
locationDict[kLocationLastUpdatedMilliseconds] = [NSString stringWithFormat:@"%.0f", locationLastUpdatedMillis];

View file

@ -1,7 +1,7 @@
//
// MPClosableView.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPClosableView.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPCountdownTimerView.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -41,6 +41,16 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)stopAndSignalCompletion:(BOOL)shouldSignalCompletion;
/**
* Pause the countdown timer.
*/
- (void)pause;
/**
* Resume the countdown timer.
*/
- (void)resume;
@end
NS_ASSUME_NONNULL_END

View file

@ -1,7 +1,7 @@
//
// MPCountdownTimerView.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -88,6 +88,7 @@ static NSString * const kAnimationKey = @"Timer";
[self addSubview:_countdownLabel];
self.userInteractionEnabled = NO;
self.accessibilityLabel = @"Countdown Timer";
}
return self;

View file

@ -1,7 +1,7 @@
//
// MPEnhancedDeeplinkRequest.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPEnhancedDeeplinkRequest.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPLastResortDelegate.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPLastResortDelegate.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPProgressOverlayView.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPProgressOverlayView.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPRealTimeTimer.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPRealTimeTimer.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPURLActionInfo.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPURLActionInfo.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPURLResolver.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPURLResolver.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -13,7 +13,7 @@
#import "NSURL+MPAdditions.h"
#import "NSHTTPURLResponse+MPAdditions.h"
#import "MPLogging.h"
#import "MPCoreInstanceProvider.h"
#import "MPDeviceInformation.h"
#import "MOPUBExperimentProvider.h"
#import "NSURL+MPAdditions.h"
#import "MPURLRequest.h"
@ -175,7 +175,7 @@ static NSString * const kRedirectURLQueryStringKey = @"r";
// is running iOS 8, this method will always return `MPATSSettingAllowsArbitraryLoads`. If the device is running
// iOS 9, this method will never give us `MPATSSettingAllowsArbitraryLoadsInWebContent`. As a result, we don't
// have to do OS checks here; we can just trust these settings.
MPATSSetting settings = [[MPCoreInstanceProvider sharedProvider] appTransportSecuritySettings];
MPATSSetting settings = MPDeviceInformation.appTransportSecuritySettings;
if ((settings & MPATSSettingAllowsArbitraryLoads) != 0) { // opens as normal if ATS is disabled
// don't do anything

View file

@ -1,12 +1,13 @@
//
// MPVideoConfig.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
#import <Foundation/Foundation.h>
#import "MPVASTCompanionAd.h"
#import "MPVASTResponse.h"
@interface MPVideoConfig : NSObject
@ -18,6 +19,11 @@
@property (nonatomic, readonly) NSArray<MPVASTMediaFile *> *mediaFiles;
@property (nonatomic, readonly) NSURL *clickThroughURL;
@property (nonatomic, readonly) MPVASTDurationOffset *skipOffset;
@property (nonatomic, readonly) NSString *callToActionButtonTitle;
@property (nonatomic, readonly) NSArray<MPVASTIndustryIcon *> *industryIcons;
@property (nonatomic, assign) BOOL isRewarded; // default is NO
@property (nonatomic, assign) BOOL enableEarlyClickthroughForNonRewardedVideo; // default is NO
- (instancetype)initWithVASTResponse:(MPVASTResponse *)response additionalTrackers:(NSDictionary *)additionalTrackers;
@ -27,3 +33,6 @@
- (NSArray<MPVASTTrackingEvent *> *)trackingEventsForKey:(MPVideoEvent)key;
@end
@interface MPVideoConfig (MPVASTCompanionAdProvider) <MPVASTCompanionAdProvider>
@end

View file

@ -1,7 +1,7 @@
//
// MPVideoConfig.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -9,6 +9,8 @@
#import "MPVideoConfig.h"
#import "MPLogging.h"
#import "MPVASTStringUtilities.h"
#import "MPVASTCompanionAd.h"
#import "MPVASTConstant.h"
#import "MPVASTTracking.h"
/**
@ -19,6 +21,9 @@
@property (nonatomic, strong) MPVASTLinearAd *linearAd;
@property (nonatomic, strong) NSArray<NSURL *> *errorURLs;
@property (nonatomic, strong) NSArray<NSURL *> *impressionURLs;
@property (nonatomic, strong) MPVASTDurationOffset *skipOffset;
@property (nonatomic, strong) NSString *callToActionButtonTitle;
@property (nonatomic, strong) NSArray<MPVASTCompanionAd *> *companionAds;
@end
@ -39,6 +44,8 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
@interface MPVideoConfig ()
@property (nonatomic, strong) MPVASTDurationOffset *skipOffset;
@property (nonatomic, strong) NSArray<MPVASTCompanionAd *> *companionAds;
@property (nonatomic, strong) NSDictionary<MPVideoEvent, NSArray<MPVASTTrackingEvent *> *> *trackingEventTable;
@end
@ -46,6 +53,15 @@
#pragma mark - Public
- (MPVASTDurationOffset *)skipOffset {
// If the video is rewarded, do not use the skip offset for countdown timer purposes
if (self.isRewarded) {
return nil;
} else {
return _skipOffset;
}
}
- (instancetype)initWithVASTResponse:(MPVASTResponse *)response additionalTrackers:(NSDictionary *)additionalTrackers
{
self = [super init];
@ -71,8 +87,19 @@
MPVideoPlaybackCandidate *candidate = candidates[0];
// obtain from linear ad
_mediaFiles = candidate.linearAd.mediaFiles;
_clickThroughURL = candidate.linearAd.clickThroughURL;
_industryIcons = candidate.linearAd.industryIcons;
_skipOffset = candidate.skipOffset;
_companionAds = candidate.companionAds;
if (candidate.callToActionButtonTitle.length > 0) {
_callToActionButtonTitle = candidate.callToActionButtonTitle;
} else {
_callToActionButtonTitle = kVASTDefaultCallToActionButtonTitle;
}
// set up the tracking event table
NSMutableDictionary<MPVideoEvent, NSArray<MPVASTTrackingEvent *> *> *table
@ -118,14 +145,24 @@
for (MPVASTAd *ad in response.ads) {
if (ad.inlineAd) {
MPVASTInline *inlineAd = ad.inlineAd;
NSArray *creatives = inlineAd.creatives;
for (MPVASTCreative *creative in creatives) {
MPVideoPlaybackCandidate *candidate = [[MPVideoPlaybackCandidate alloc] init];
candidate.callToActionButtonTitle = [self extensionFromInlineAd:inlineAd forKey:kVASTMoPubCTATextKey][kVASTAdTextKey];
for (MPVASTCreative *creative in inlineAd.creatives) {
if (creative.linearAd && [creative.linearAd.mediaFiles count]) {
MPVideoPlaybackCandidate *candidate = [[MPVideoPlaybackCandidate alloc] init];
candidate.linearAd = creative.linearAd;
candidate.skipOffset = creative.linearAd.skipOffset;
candidate.errorURLs = inlineAd.errorURLs;
candidate.impressionURLs = inlineAd.impressionURLs;
[candidates addObject:candidate];
} else if (creative.companionAds.count > 0) {
NSMutableArray<MPVASTCompanionAd *> *companionAds = [NSMutableArray new];
for (MPVASTCompanionAd *companionAd in creative.companionAds) {
if (companionAd.resourceToDisplay != nil) { // cannot display ad without any resource
[companionAds addObject:companionAd];
}
}
candidate.companionAds = [NSArray arrayWithArray:companionAds];
}
}
} else if (ad.wrapper) {
@ -271,3 +308,18 @@
}
@end
#pragma mark - MPVASTCompanionAdProvider
@implementation MPVideoConfig (MPVASTCompanionAdProvider)
- (BOOL)hasCompanionAd {
return self.companionAds.count > 0;
}
- (MPVASTCompanionAd *)companionAdForContainerSize:(CGSize)containerSize {
return [MPVASTCompanionAd bestCompanionAdForCandidates:self.companionAds
containerSize:containerSize];
}
@end

View file

@ -1,7 +1,7 @@
//
// MPXMLParser.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPXMLParser.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPAdWebViewAgent.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -42,8 +42,6 @@ typedef NSUInteger MPAdWebViewEvent;
@protocol MPAdWebViewAgentDelegate <NSObject>
- (NSString *)adUnitId;
- (CLLocation *)location;
- (UIViewController *)viewControllerForPresentingModalView;
- (void)adDidClose:(MPWebView *)ad;
- (void)adDidFinishLoadingAd:(MPWebView *)ad;

View file

@ -1,7 +1,7 @@
//
// MPAdWebViewAgent.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -30,9 +30,8 @@
@interface MPAdWebViewAgent () <UIGestureRecognizerDelegate>
@property (nonatomic, strong) MPAdConfiguration *configuration;
@property (nonatomic, strong) MPAdDestinationDisplayAgent *destinationDisplayAgent;
@property (nonatomic, strong) id<MPAdDestinationDisplayAgent> destinationDisplayAgent;
@property (nonatomic, assign) BOOL shouldHandleRequests;
@property (nonatomic, strong) id<MPAdAlertManagerProtocol> adAlertManager;
@property (nonatomic, assign) BOOL userInteractedWithWebView;
@property (nonatomic, strong) MPUserInteractionGestureRecognizer *userInteractionRecognizer;
@property (nonatomic, assign) CGRect frame;
@ -57,7 +56,6 @@
self.delegate = delegate;
self.shouldHandleRequests = YES;
self.didFireClickImpression = NO;
self.adAlertManager = [[MPCoreInstanceProvider sharedProvider] buildMPAdAlertManagerWithDelegate:self];
self.userInteractionRecognizer = [[MPUserInteractionGestureRecognizer alloc] initWithTarget:self action:@selector(handleInteraction:)];
self.userInteractionRecognizer.cancelsTouchesInView = NO;
@ -90,18 +88,6 @@
return YES;
}
#pragma mark - <MPAdAlertManagerDelegate>
- (UIViewController *)viewControllerForPresentingMailVC
{
return [self.delegate viewControllerForPresentingModalView];
}
- (void)adAlertManagerDidTriggerAlert:(MPAdAlertManager *)manager
{
[self.adAlertManager processAdAlertOnce];
}
#pragma mark - Public
- (void)loadConfiguration:(MPAdConfiguration *)configuration
@ -139,17 +125,15 @@
[self.view loadHTMLString:[configuration adResponseHTMLString]
baseURL:[NSURL URLWithString:[MPAPIEndpoints baseURL]]
];
[self initAdAlertManager];
}
- (void)invokeJavaScriptForEvent:(MPAdWebViewEvent)event
{
switch (event) {
case MPAdWebViewEventAdDidAppear:
// For banner, viewability tracker is handled right after adView is initialized (not here).
// For banner, viewability tracker is handled in @c MPBannerCustomEventAdapter (not here).
// For interstitial (handled here), we start tracking viewability if it's not started during adView initialization.
if (![self shouldStartViewabilityDuringInitialization]) {
if ([self isInterstitialAd]) {
[self startViewabilityTracker];
}
@ -293,18 +277,10 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
- (void)init3rdPartyViewabilityTrackers
{
self.viewabilityTracker = [[MPViewabilityTracker alloc] initWithAdView:self.view isVideo:self.configuration.isVastVideoPlayer startTrackingImmediately:[self shouldStartViewabilityDuringInitialization]];
}
- (BOOL)shouldStartViewabilityDuringInitialization
{
// If viewabile impression tracking experiment is enabled, we defer viewability trackers until
// ad view is at least x pixels on screen for y seconds, where x and y are configurable values defined in server.
if (self.adConfiguration.visibleImpressionTrackingEnabled) {
return NO;
}
return ![self isInterstitialAd];
self.viewabilityTracker = [[MPViewabilityTracker alloc]
initWithWebView:self.view
isVideo:self.configuration.isVastVideoPlayer
startTrackingImmediately:NO];
}
- (BOOL)isInterstitialAd
@ -312,13 +288,4 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
return self.configuration.isFullscreenAd;
}
- (void)initAdAlertManager
{
self.adAlertManager.adConfiguration = self.configuration;
self.adAlertManager.adUnitId = [self.delegate adUnitId];
self.adAlertManager.targetAdView = self.view;
self.adAlertManager.location = [self.delegate location];
[self.adAlertManager beginMonitoringAlerts];
}
@end

View file

@ -1,7 +1,7 @@
//
// MPContentBlocker.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPContentBlocker.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPHTMLBannerCustomEvent.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPHTMLBannerCustomEvent.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -27,7 +27,7 @@
- (BOOL)enableAutomaticImpressionAndClickTracking
{
return NO;
return YES;
}
- (void)requestAdWithSize:(CGSize)size customEventInfo:(NSDictionary *)info adMarkup:(NSString *)adMarkup
@ -48,11 +48,6 @@
#pragma mark - MPAdWebViewAgentDelegate
- (CLLocation *)location
{
return [self.delegate location];
}
- (NSString *)adUnitId
{
return [self.delegate adUnitId];

View file

@ -1,7 +1,7 @@
//
// MPHTMLInterstitialCustomEvent.h
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//

View file

@ -1,7 +1,7 @@
//
// MPHTMLInterstitialCustomEvent.m
//
// Copyright 2018-2019 Twitter, Inc.
// Copyright 2018-2020 Twitter, Inc.
// Licensed under the MoPub SDK License Agreement
// http://www.mopub.com/legal/sdk-license-agreement/
//
@ -28,6 +28,11 @@
// `id<MPInterstitialCustomEventDelegate>` and this `delegate` is `id<MPPrivateInterstitialCustomEventDelegate>`
@synthesize delegate;
- (NSString *)adUnitId
{
return [self.delegate adUnitId];
}
- (BOOL)enableAutomaticImpressionAndClickTracking
{
// An HTML interstitial tracks its own clicks. Turn off automatic tracking to prevent the tap event callback
@ -68,16 +73,6 @@
@implementation MPHTMLInterstitialCustomEvent (MPInterstitialViewControllerDelegate)
- (CLLocation *)location
{
return [self.delegate location];
}
- (NSString *)adUnitId
{
return [self.delegate adUnitId];
}
- (void)interstitialDidLoadAd:(id<MPInterstitialViewController>)interstitial
{
MPLogAdEvent([MPLogEvent adLoadSuccessForAdapter:NSStringFromClass(self.class)], self.adUnitId);

Some files were not shown because too many files have changed in this diff Show more