From 24f967d3ac611c1837f41cb09aedd1be2ce0ccbd Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Fri, 13 Sep 2019 17:39:23 +0530 Subject: [PATCH 01/35] Initial POC --- sdk/AppNexusSDK.xcodeproj/project.pbxproj | 12 +++++ sdk/sourcefiles/ANAdProtocol.h | 22 ++++----- sdk/sourcefiles/ANSingleUnifiedObject.h | 22 +++++++++ sdk/sourcefiles/ANSingleUnifiedObject.m | 45 +++++++++++++++++++ .../Categories/ANAdView+PrivateMethods.h | 2 - sdk/sourcefiles/internal/ANAdView.m | 26 +++++------ sdk/sourcefiles/internal/ANBannerAdView.m | 7 ++- sdk/sourcefiles/internal/ANBaseAdObject.h | 4 +- sdk/sourcefiles/internal/ANCSMVideoAd.h | 3 +- sdk/sourcefiles/internal/ANGlobal.h | 2 +- sdk/sourcefiles/internal/ANInterstitialAd.m | 7 +-- .../internal/ANUniversalTagAdServerResponse.m | 11 +++-- sdk/sourcefiles/native/ANNativeAdResponse.h | 6 --- .../native/internal/ANNativeAdRequest.m | 13 ------ .../internal/ANNativeStandardAdResponse.h | 3 +- .../internal/ANNativeStandardAdResponse.m | 2 +- sdk/sourcefiles/video/ANInstreamVideoAd.m | 5 --- 17 files changed, 119 insertions(+), 73 deletions(-) create mode 100644 sdk/sourcefiles/ANSingleUnifiedObject.h create mode 100644 sdk/sourcefiles/ANSingleUnifiedObject.m diff --git a/sdk/AppNexusSDK.xcodeproj/project.pbxproj b/sdk/AppNexusSDK.xcodeproj/project.pbxproj index 6b9d2a3f9..d0577e3e0 100644 --- a/sdk/AppNexusSDK.xcodeproj/project.pbxproj +++ b/sdk/AppNexusSDK.xcodeproj/project.pbxproj @@ -231,6 +231,10 @@ 8AFC046F1A2E75AE00BEA485 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AFC046E1A2E75AE00BEA485 /* AdSupport.framework */; }; 8AFC04711A2E760800BEA485 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AFC04701A2E760800BEA485 /* MessageUI.framework */; }; 8AFC04731A2E78E400BEA485 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AFC04721A2E78E400BEA485 /* StoreKit.framework */; }; + 9706554F232B93A200D484D4 /* ANSingleUnifiedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANSingleUnifiedObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 97065550232B93A200D484D4 /* ANSingleUnifiedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANSingleUnifiedObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 97065551232B93A200D484D4 /* ANSingleUnifiedObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANSingleUnifiedObject.m */; }; + 97065552232B93A200D484D4 /* ANSingleUnifiedObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANSingleUnifiedObject.m */; }; 972025CE222FD90E00C13454 /* ANVerificationScriptResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 97EC51EB2229782B00B740DF /* ANVerificationScriptResource.h */; settings = {ATTRIBUTES = (Private, ); }; }; 97EC51EF2229782B00B740DF /* ANVerificationScriptResource.m in Sources */ = {isa = PBXBuildFile; fileRef = 97EC51EC2229782B00B740DF /* ANVerificationScriptResource.m */; }; 9EEE4E50214FD2100056C5DD /* ANCarrierObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EEE4E4E214FD2100056C5DD /* ANCarrierObserver.h */; }; @@ -521,6 +525,8 @@ 8AFC046E1A2E75AE00BEA485 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; 8AFC04701A2E760800BEA485 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; }; 8AFC04721A2E78E400BEA485 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; + 9706554D232B93A200D484D4 /* ANSingleUnifiedObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ANSingleUnifiedObject.h; sourceTree = ""; }; + 9706554E232B93A200D484D4 /* ANSingleUnifiedObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ANSingleUnifiedObject.m; sourceTree = ""; }; 97A590D2228EBBD600D1C75C /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; 97A590D4228EBBE800D1C75C /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 97A590D6228EBBF600D1C75C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -667,6 +673,8 @@ 8A02D6EC1D6CE014006831A3 /* ANSDKSettings.h */, ECE4EA94194B768A0069D934 /* ANTargetingParameters.h */, 60D39E1322570FE20029F741 /* ANVideoPlayerSettings.h */, + 9706554D232B93A200D484D4 /* ANSingleUnifiedObject.h */, + 9706554E232B93A200D484D4 /* ANSingleUnifiedObject.m */, ); path = sourcefiles; sourceTree = ""; @@ -1070,6 +1078,7 @@ 0030D6FB20E5414D003B7C1D /* OMIDPartner.h in Headers */, 0030D6F620E5414D003B7C1D /* OMIDScriptInjector.h in Headers */, 0030D6F020E5414D003B7C1D /* OMIDSDK.h in Headers */, + 9706554F232B93A200D484D4 /* ANSingleUnifiedObject.h in Headers */, 0030D6F120E5414D003B7C1D /* OMIDVASTProperties.h in Headers */, 0030D6FA20E5414D003B7C1D /* OMIDVerificationScriptResource.h in Headers */, 0030D6F220E5414D003B7C1D /* OMIDVideoEvents.h in Headers */, @@ -1088,6 +1097,7 @@ 0099B483228CA0EB004E80AB /* UIView+ANCategory.h in Headers */, F5731B6D228C8E470012B134 /* ANSDKSettings+PrivateMethods.h in Headers */, F5731B6F228C8F680012B134 /* ANTargetingParameters.h in Headers */, + 97065550232B93A200D484D4 /* ANSingleUnifiedObject.h in Headers */, F5731B55228C8DD10012B134 /* ANCarrierObserver.h in Headers */, F5731BBE228C99BC0012B134 /* ANAdProtocol.h in Headers */, F5731B4F228C8D1A0012B134 /* ANNativeAdDelegate.h in Headers */, @@ -1324,6 +1334,7 @@ 8AC65F6E1A40DE74006BCF39 /* ANMRAIDResizeView.m in Sources */, 8AC65F701A40DE74006BCF39 /* ANMRAIDResizeViewManager.m in Sources */, F5731BCF228F07FC0012B134 /* ANNativeAdFetcher.m in Sources */, + 97065551232B93A200D484D4 /* ANSingleUnifiedObject.m in Sources */, 8AC65F721A40DE74006BCF39 /* ANMRAIDUtil.m in Sources */, 8A9AEE061A1BF99D00C58BDA /* ANNativeAdImageCache.m in Sources */, 8A9AEE071A1BF99D00C58BDA /* ANNativeAdRequest.m in Sources */, @@ -1380,6 +1391,7 @@ F5731B43228C8CCC0012B134 /* ANNativeAdResponse.m in Sources */, F5731B70228C8F820012B134 /* ANTargetingParameters.m in Sources */, F5731B5E228C8DFA0012B134 /* ANBaseAdObject.m in Sources */, + 97065552232B93A200D484D4 /* ANSingleUnifiedObject.m in Sources */, F5731B4A228C8D020012B134 /* ANNativeStandardAdResponse.m in Sources */, F5731B76228C902A0012B134 /* ANLogManager.m in Sources */, F5731B7E228C94990012B134 /* ANTrackerManager.m in Sources */, diff --git a/sdk/sourcefiles/ANAdProtocol.h b/sdk/sourcefiles/ANAdProtocol.h index 0dfe8862d..57ad74db4 100644 --- a/sdk/sourcefiles/ANAdProtocol.h +++ b/sdk/sourcefiles/ANAdProtocol.h @@ -19,9 +19,10 @@ #import "ANAdConstants.h" #import "ANLocation.h" - +#import "ANSingleUnifiedObject.h" @class ANLocation; +@class ANSingleUnifiedObject; @@ -143,9 +144,17 @@ @end //ANAdProtocolFoundation +@protocol ANAdProtocolUnifiedObject +/** + An AppNexus Single Unified object that will contain all the common fields of all the ads types that are returned in the UTv3 response + */ +// ANSingleUnifiedObject should be accessible from response Object only(like. ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). It is placed into ANAdProtocolUnifiedObject. +@property (nonatomic, readonly, strong, nullable) ANSingleUnifiedObject *anSingleUnifiedObject; + +@end -@protocol ANAdProtocolBrowser +@protocol ANAdProtocolBrowser /** Determines what action to take when the user clicks on an ad: @@ -205,14 +214,7 @@ #pragma mark - ANAdProtocol entrypoint combinations. -@protocol ANAdProtocol - -/** - An AppNexus creativeID for the current creative that is displayed - */ -// CreativeId should be accessible from response Object only(like. ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). It is placed into ANAdProtocol instead of ANAdProtocolFoundation to avoid creativeID being accessed through ANNativeAdRequest. -@property (nonatomic, readonly, strong, nullable) NSString *creativeId; - +@protocol ANAdProtocol @end diff --git a/sdk/sourcefiles/ANSingleUnifiedObject.h b/sdk/sourcefiles/ANSingleUnifiedObject.h new file mode 100644 index 000000000..120b0ba64 --- /dev/null +++ b/sdk/sourcefiles/ANSingleUnifiedObject.h @@ -0,0 +1,22 @@ +// +// ANSingleUnifiedObject.h +// AppNexusSDK +// +// Created by Akash Verma on 13/09/19. +// Copyright © 2019 AppNexus. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface ANSingleUnifiedObject : NSObject +/** + An AppNexus creativeID for the current creative that is displayed + */ +@property (nonatomic, readonly, strong, nullable) NSString *creativeId; +- (void)anParseResponse:(NSDictionary *)jsonDic; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/sourcefiles/ANSingleUnifiedObject.m b/sdk/sourcefiles/ANSingleUnifiedObject.m new file mode 100644 index 000000000..cb653da5a --- /dev/null +++ b/sdk/sourcefiles/ANSingleUnifiedObject.m @@ -0,0 +1,45 @@ +// +// ANSingleUnifiedObject.m +// AppNexusSDK +// +// Created by Akash Verma on 13/09/19. +// Copyright © 2019 AppNexus. All rights reserved. +// + +#import "ANSingleUnifiedObject.h" +#import "ANLogging.h" +#import "ANGlobal.h" + +@implementation ANSingleUnifiedObject + +@synthesize creativeId = __creativeId; + + +//Parsing Response +- (void)anParseResponse:(NSDictionary *)jsonDic +{ + +} + +//#pragma mark - ANAdProtocol: Getter methods +// +//- (nullable NSString *)creativeId { +// ANLogDebug(@"Creative Id returned %@", __creativeId); +// return __creativeId; +//} +// +//#pragma mark - ANAdProtocol: Setter methods +// +//- (void)setCreativeId:(NSString *)creativeId { +// creativeId = ANConvertToNSString(creativeId); +// if ([creativeId length] < 1) { +// ANLogError(@"Could not set creativeId to non-string value"); +// return; +// } +// if (creativeId != __creativeId) { +// ANLogDebug(@"Setting creativeId to %@", creativeId); +// __creativeId = creativeId; +// } +//} + +@end diff --git a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h index a63f70168..8cebb1db3 100644 --- a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h +++ b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h @@ -36,6 +36,4 @@ - (void)loadAdFromVast: (NSString *)xml width: (int)width height: (int)height; -- (void)setCreativeId:(NSString *)creativeId; - @end diff --git a/sdk/sourcefiles/internal/ANAdView.m b/sdk/sourcefiles/internal/ANAdView.m index 3ac50e252..c213708a7 100644 --- a/sdk/sourcefiles/internal/ANAdView.m +++ b/sdk/sourcefiles/internal/ANAdView.m @@ -61,13 +61,13 @@ @implementation ANAdView @synthesize gender = __gender; @synthesize customKeywords = __customKeywords; -@synthesize creativeId = __creativeId; @synthesize adType = __adType; @synthesize externalUid = __externalUid; @synthesize clickThroughAction = __clickThroughAction; @synthesize landingPageLoadsInBackground = __landingPageLoadsInBackground; +@synthesize anSingleUnifiedObject = __anSingleUnifiedObject; #pragma mark - Initialization @@ -189,19 +189,17 @@ - (void)loadAdFromVast: (NSString *)xml width: (int)width #pragma mark - ANAdProtocol: Setter methods -- (void)setCreativeId:(NSString *)creativeId { - creativeId = ANConvertToNSString(creativeId); - if ([creativeId length] < 1) { - ANLogError(@"Could not set creativeId to non-string value"); +- (void)setAnSingleUnifiedObject:(ANSingleUnifiedObject *)anSingleUnifiedObject { + if (!anSingleUnifiedObject) { + ANLogError(@"Could not set anSingleUnifiedObject"); return; } - if (creativeId != __creativeId) { - ANLogDebug(@"Setting creativeId to %@", creativeId); - __creativeId = creativeId; + if (anSingleUnifiedObject != __anSingleUnifiedObject) { + ANLogDebug(@"Setting anSingleUnifiedObject to %@", anSingleUnifiedObject); + __anSingleUnifiedObject = anSingleUnifiedObject; } } - - (void)setAdType:(ANAdType)adType { if (adType != __adType) { @@ -302,6 +300,11 @@ - (void)setClickThroughAction:(ANClickThroughAction)clickThroughAction #pragma mark - ANAdProtocol: Getter methods +- (nullable ANSingleUnifiedObject *)anSingleUnifiedObject { + ANLogDebug(@"ANSingleUnifiedObject returned %@", __anSingleUnifiedObject); + return __anSingleUnifiedObject; +} + - (nullable NSString *)placementId { ANLogDebug(@"placementId returned %@", __placementId); return __placementId; @@ -352,11 +355,6 @@ - (ANGender)gender { return __gender; } -- (nullable NSString *)creativeId { - ANLogDebug(@"Creative Id returned %@", __creativeId); - return __creativeId; -} - -(nullable NSString *)externalUid { ANLogDebug(@"ExternalUid returned %@", __externalUid); return __externalUid; diff --git a/sdk/sourcefiles/internal/ANBannerAdView.m b/sdk/sourcefiles/internal/ANBannerAdView.m index 09723be39..35cef9d3e 100644 --- a/sdk/sourcefiles/internal/ANBannerAdView.m +++ b/sdk/sourcefiles/internal/ANBannerAdView.m @@ -348,9 +348,9 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR self.contentView = nil; self.impressionURLs = nil; - NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:adObjectHandler]; - if (creativeId) { - [self setCreativeId:creativeId]; + ANSingleUnifiedObject *anSingleUnifiedObject = (ANSingleUnifiedObject *) [ANGlobal valueOfGetterProperty:kANSingleUnifiedObject forObject:adObjectHandler]; + if (anSingleUnifiedObject) { + [self setAnSingleUnifiedObject:anSingleUnifiedObject]; } NSString *adTypeString = (NSString *) [ANGlobal valueOfGetterProperty:kANAdType forObject:adObjectHandler]; @@ -403,7 +403,6 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR } else if ([adObject isKindOfClass:[ANNativeAdResponse class]]) { ANNativeAdResponse *nativeAdResponse = (ANNativeAdResponse *)response.adObject; - self.creativeId = nativeAdResponse.creativeId; self.adType = ANAdTypeNative; nativeAdResponse.clickThroughAction = self.clickThroughAction; diff --git a/sdk/sourcefiles/internal/ANBaseAdObject.h b/sdk/sourcefiles/internal/ANBaseAdObject.h index ea21bac64..aed8d69d0 100644 --- a/sdk/sourcefiles/internal/ANBaseAdObject.h +++ b/sdk/sourcefiles/internal/ANBaseAdObject.h @@ -14,7 +14,7 @@ */ #import - +#import "ANSingleUnifiedObject.h" @interface ANBaseAdObject : NSObject @@ -24,7 +24,7 @@ @property (nonatomic, readwrite, strong) NSString *width; @property (nonatomic, readwrite, strong) NSString *adType; -@property (nonatomic, readwrite, strong) NSString *creativeId; @property (nonatomic, readwrite, strong) NSArray *impressionUrls; +@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *anSingleUnifiedObject; @end diff --git a/sdk/sourcefiles/internal/ANCSMVideoAd.h b/sdk/sourcefiles/internal/ANCSMVideoAd.h index 2f4dedd7f..6f4147d95 100644 --- a/sdk/sourcefiles/internal/ANCSMVideoAd.h +++ b/sdk/sourcefiles/internal/ANCSMVideoAd.h @@ -15,11 +15,12 @@ */ #import +#import "ANSingleUnifiedObject.h" @interface ANCSMVideoAd : NSObject @property (nonatomic, readwrite, strong) NSDictionary *adDictionary; - +@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *anSingleUnifiedObject; @end diff --git a/sdk/sourcefiles/internal/ANGlobal.h b/sdk/sourcefiles/internal/ANGlobal.h index 450a0fdb7..76c1c050c 100644 --- a/sdk/sourcefiles/internal/ANGlobal.h +++ b/sdk/sourcefiles/internal/ANGlobal.h @@ -129,7 +129,7 @@ BOOL ANCanPresentFromViewController(UIViewController * __nullable viewController static NSString * __nonnull const kANCreativeId= @"creativeId"; static NSString * __nonnull const kANImpressionUrls = @"impressionUrls"; static NSString * __nonnull const kANAspectRatio = @"aspectRatio"; - +static NSString * __nonnull const kANSingleUnifiedObject= @"anSingleUnifiedObject"; #pragma mark - Global class. diff --git a/sdk/sourcefiles/internal/ANInterstitialAd.m b/sdk/sourcefiles/internal/ANInterstitialAd.m index 313218855..30b975bef 100644 --- a/sdk/sourcefiles/internal/ANInterstitialAd.m +++ b/sdk/sourcefiles/internal/ANInterstitialAd.m @@ -314,12 +314,7 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR if (!response.isSuccessful) { [self adRequestFailedWithError:response.error]; return; - } - NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:response.adObjectHandler]; - if(creativeId){ - [self setCreativeId:creativeId]; - } - + } NSMutableDictionary *adViewWithDateLoaded = [NSMutableDictionary dictionaryWithObjectsAndKeys: response.adObject, kANInterstitialAdViewKey, response.adObjectHandler, kANInterstitialAdObjectHandlerKey, diff --git a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m index 3707db77a..03c071a4d 100644 --- a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m +++ b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m @@ -25,6 +25,7 @@ #import "ANAdConstants.h" #import "ANNativeStandardAdResponse.h" #import "ANNativeAdResponse+PrivateMethods.h" +#import "ANSingleUnifiedObject.h" static NSString *const kANUniversalTagAdServerResponseKeyNoBid = @"nobid"; @@ -227,7 +228,8 @@ - (void)processResponseData:(NSData *)data continue; } - + ANSingleUnifiedObject *anSingleUnifiedObject = [[ANSingleUnifiedObject alloc] init]; + [anSingleUnifiedObject anParseResponse:firstTag]; // RTB if ([contentSource isEqualToString:kANUniversalTagAdServerResponseKeyAdsRTBObject]) @@ -239,7 +241,6 @@ - (void)processResponseData:(NSData *)data if ([adType isEqualToString:kANUniversalTagAdServerResponseKeyBannerObject]) { ANStandardAd *standardAd = [[self class] standardAdFromRTBObject:rtbObject]; if (standardAd) { - standardAd.creativeId = creativeId; [self.ads addObject:standardAd]; } @@ -247,7 +248,6 @@ - (void)processResponseData:(NSData *)data } else if([adType isEqualToString:kANUniversalTagAdServerResponseKeyVideoObject]){ ANRTBVideoAd *videoAd = [[self class] videoAdFromRTBObject:rtbObject]; if (videoAd) { - videoAd.creativeId = creativeId; videoAd.notifyUrlString = [adObject[kANUniversalTagAdServerResponseKeyAdsNotifyUrl] description]; [self.ads addObject:videoAd]; @@ -256,7 +256,7 @@ - (void)processResponseData:(NSData *)data } else if([adType isEqualToString:kANUniversalTagAdServerResponseKeyNativeObject]) { ANNativeStandardAdResponse *nativeAd = [[self class] nativeAdFromRTBObject:rtbObject]; if (nativeAd) { - nativeAd.creativeId = creativeId; + nativeAd.anSingleUnifiedObject = anSingleUnifiedObject; if(adObject[kANUniversalTagAdServerResponseKeyAdsRendererUrl] != nil) { NSString * nativeRenderingUrl = [NSString stringWithFormat:@"%@",adObject[kANUniversalTagAdServerResponseKeyAdsRendererUrl]]; @@ -296,7 +296,6 @@ - (void)processResponseData:(NSData *)data mediatedAd.verificationScriptResource = verificationScriptResource; } } - mediatedAd.creativeId = creativeId; if (mediatedAd.className.length > 0) { [self.ads addObject:mediatedAd]; } @@ -319,7 +318,6 @@ - (void)processResponseData:(NSData *)data if (ssmObject) { ANSSMStandardAd *ssmStandardAd = [[self class] standardSSMAdFromSSMObject:ssmObject]; if (ssmStandardAd) { - ssmStandardAd.creativeId = creativeId; [self.ads addObject:ssmStandardAd]; } } @@ -338,6 +336,7 @@ - (void)processResponseData:(NSData *)data if ([lastAdsObject isKindOfClass:[ANBaseAdObject class]]) { ANBaseAdObject *baseAdObject = (ANBaseAdObject *)lastAdsObject; baseAdObject.adType = [adType copy]; + baseAdObject.anSingleUnifiedObject = anSingleUnifiedObject; } } //endfor -- adObject diff --git a/sdk/sourcefiles/native/ANNativeAdResponse.h b/sdk/sourcefiles/native/ANNativeAdResponse.h index bf80fc163..6199708fb 100644 --- a/sdk/sourcefiles/native/ANNativeAdResponse.h +++ b/sdk/sourcefiles/native/ANNativeAdResponse.h @@ -119,12 +119,6 @@ extern NSString * __nonnull const kANNativeElementObject; @property (nonatomic, readonly, strong, nullable) NSString *sponsoredBy; -/*! - * An AppNexus creativeID for the current creative that is displayed - */ -@property (nonatomic, readonly, strong, nullable) NSString *creativeId; - - /*! * Additional description of the ad */ diff --git a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m index 015ec50ee..e47e38a6b 100644 --- a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m +++ b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m @@ -124,12 +124,6 @@ -(void)didFinishRequestWithResponse: (nonnull ANAdFetcherResponse *)response __weak ANNativeAdRequest *weakSelf = self; ANNativeAdResponse *nativeResponse = (ANNativeAdResponse *)response.adObject; - // - if (nativeResponse.creativeId == nil) { - NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:response.adObjectHandler]; - [self setCreativeId:creativeId onObject:nativeResponse forKeyPath:kANCreativeId]; - } - // dispatch_queue_t backgroundQueue = dispatch_queue_create(__PRETTY_FUNCTION__, DISPATCH_QUEUE_SERIAL); @@ -204,13 +198,6 @@ - (NSDictionary *) internalDelegateUniversalTagSizeParameters // #pragma mark - ANUniversalAdFetcherFoundationDelegate helper methods. -- (void)setCreativeId:(NSString *)creativeId - onObject:(id)object forKeyPath:(NSString *)keyPath -{ - [object setValue:creativeId forKeyPath:keyPath]; -} - - // RETURN: dispatch_semaphore_t For first time image requests. // nil When image is cached -OR- if imageURL is undefined. // diff --git a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h index e61cc9c28..0f392f0c4 100644 --- a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h +++ b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h @@ -29,7 +29,6 @@ @property (nonatomic, readwrite, strong) NSURL *iconImageURL; @property (nonatomic, readwrite, strong) NSDictionary *customElements; @property (nonatomic, readwrite, strong) NSString *adObjectMediaType; -@property (nonatomic, readwrite, strong) NSString *creativeId; @property (nonatomic, readwrite, strong) NSString *additionalDescription; @property (nonatomic, readwrite, strong) NSArray *clickTrackers; @property (nonatomic, readwrite, strong) NSArray *impTrackers; @@ -40,6 +39,6 @@ @property (nonatomic, readwrite, strong) NSString *privacyLink; @property (nonatomic, readwrite, strong) NSString *nativeRenderingUrl; @property (nonatomic, readwrite, strong) NSString *nativeRenderingObject; - +@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *anSingleUnifiedObject; @end diff --git a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m index 8740d68c1..378eba5ad 100644 --- a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m +++ b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m @@ -59,12 +59,12 @@ @implementation ANNativeStandardAdResponse @synthesize networkCode = _networkCode; @synthesize expired = _expired; @synthesize sponsoredBy = _sponsoredBy; -@synthesize creativeId = _creativeId; @synthesize additionalDescription = _additionalDescription; @synthesize vastXML = _vastXML; @synthesize privacyLink = _privacyLink; @synthesize nativeRenderingUrl = _nativeRenderingUrl; @synthesize nativeRenderingObject = _nativeRenderingObject; +@synthesize anSingleUnifiedObject = _anSingleUnifiedObject; #pragma mark - Lifecycle. diff --git a/sdk/sourcefiles/video/ANInstreamVideoAd.m b/sdk/sourcefiles/video/ANInstreamVideoAd.m index e7266f8f5..332a7c073 100644 --- a/sdk/sourcefiles/video/ANInstreamVideoAd.m +++ b/sdk/sourcefiles/video/ANInstreamVideoAd.m @@ -402,11 +402,6 @@ - (void) universalAdFetcher: (ANUniversalAdFetcher *)fetcher if ([response.adObject isKindOfClass:[ANVideoAdPlayer class]]) { self.adPlayer = (ANVideoAdPlayer *) response.adObject; self.adPlayer.delegate = self; - - NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:response.adObjectHandler]; - if(creativeId){ - [self setCreativeId:creativeId]; - } [self videoAdReady]; From 1ecdb14a84b04456b9d4c23aa689fc510efcee6e Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Fri, 13 Sep 2019 20:43:50 +0530 Subject: [PATCH 02/35] CreativeId added in unified object --- sdk/sourcefiles/ANAdProtocol.h | 2 +- sdk/sourcefiles/ANSingleUnifiedObject.h | 3 +- sdk/sourcefiles/ANSingleUnifiedObject.m | 32 ++----------------- .../Categories/ANAdView+PrivateMethods.h | 2 ++ sdk/sourcefiles/internal/ANAdView.m | 20 ++++++------ sdk/sourcefiles/internal/ANBannerAdView.m | 6 ++-- sdk/sourcefiles/internal/ANBaseAdObject.h | 2 +- sdk/sourcefiles/internal/ANCSMVideoAd.h | 2 +- sdk/sourcefiles/internal/ANGlobal.h | 3 +- .../internal/ANUniversalTagAdServerResponse.m | 8 ++--- .../internal/ANNativeStandardAdResponse.h | 2 +- .../internal/ANNativeStandardAdResponse.m | 2 +- 12 files changed, 28 insertions(+), 56 deletions(-) diff --git a/sdk/sourcefiles/ANAdProtocol.h b/sdk/sourcefiles/ANAdProtocol.h index 57ad74db4..3d19655b8 100644 --- a/sdk/sourcefiles/ANAdProtocol.h +++ b/sdk/sourcefiles/ANAdProtocol.h @@ -150,7 +150,7 @@ An AppNexus Single Unified object that will contain all the common fields of all the ads types that are returned in the UTv3 response */ // ANSingleUnifiedObject should be accessible from response Object only(like. ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). It is placed into ANAdProtocolUnifiedObject. -@property (nonatomic, readonly, strong, nullable) ANSingleUnifiedObject *anSingleUnifiedObject; +@property (nonatomic, readonly, strong, nullable) ANSingleUnifiedObject *unifiedObject; @end diff --git a/sdk/sourcefiles/ANSingleUnifiedObject.h b/sdk/sourcefiles/ANSingleUnifiedObject.h index 120b0ba64..8921aaa65 100644 --- a/sdk/sourcefiles/ANSingleUnifiedObject.h +++ b/sdk/sourcefiles/ANSingleUnifiedObject.h @@ -14,8 +14,7 @@ NS_ASSUME_NONNULL_BEGIN /** An AppNexus creativeID for the current creative that is displayed */ -@property (nonatomic, readonly, strong, nullable) NSString *creativeId; -- (void)anParseResponse:(NSDictionary *)jsonDic; +@property (nonatomic, readwrite, strong, nullable) NSString *creativeId; @end diff --git a/sdk/sourcefiles/ANSingleUnifiedObject.m b/sdk/sourcefiles/ANSingleUnifiedObject.m index cb653da5a..feb04f53e 100644 --- a/sdk/sourcefiles/ANSingleUnifiedObject.m +++ b/sdk/sourcefiles/ANSingleUnifiedObject.m @@ -7,39 +7,11 @@ // #import "ANSingleUnifiedObject.h" -#import "ANLogging.h" -#import "ANGlobal.h" + +static NSString *const kANUniversalTagAdServerResponseKeyAdsCreativeId = @"creative_id"; @implementation ANSingleUnifiedObject @synthesize creativeId = __creativeId; - -//Parsing Response -- (void)anParseResponse:(NSDictionary *)jsonDic -{ - -} - -//#pragma mark - ANAdProtocol: Getter methods -// -//- (nullable NSString *)creativeId { -// ANLogDebug(@"Creative Id returned %@", __creativeId); -// return __creativeId; -//} -// -//#pragma mark - ANAdProtocol: Setter methods -// -//- (void)setCreativeId:(NSString *)creativeId { -// creativeId = ANConvertToNSString(creativeId); -// if ([creativeId length] < 1) { -// ANLogError(@"Could not set creativeId to non-string value"); -// return; -// } -// if (creativeId != __creativeId) { -// ANLogDebug(@"Setting creativeId to %@", creativeId); -// __creativeId = creativeId; -// } -//} - @end diff --git a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h index 8cebb1db3..152b8e1b1 100644 --- a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h +++ b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h @@ -36,4 +36,6 @@ - (void)loadAdFromVast: (NSString *)xml width: (int)width height: (int)height; +- (void)setUnifiedObject:(ANSingleUnifiedObject *)unifiedObject; + @end diff --git a/sdk/sourcefiles/internal/ANAdView.m b/sdk/sourcefiles/internal/ANAdView.m index c213708a7..8013159b7 100644 --- a/sdk/sourcefiles/internal/ANAdView.m +++ b/sdk/sourcefiles/internal/ANAdView.m @@ -67,7 +67,7 @@ @implementation ANAdView @synthesize clickThroughAction = __clickThroughAction; @synthesize landingPageLoadsInBackground = __landingPageLoadsInBackground; -@synthesize anSingleUnifiedObject = __anSingleUnifiedObject; +@synthesize unifiedObject = __unifiedObject; #pragma mark - Initialization @@ -189,14 +189,14 @@ - (void)loadAdFromVast: (NSString *)xml width: (int)width #pragma mark - ANAdProtocol: Setter methods -- (void)setAnSingleUnifiedObject:(ANSingleUnifiedObject *)anSingleUnifiedObject { - if (!anSingleUnifiedObject) { - ANLogError(@"Could not set anSingleUnifiedObject"); +- (void)setUnifiedObject:(ANSingleUnifiedObject *)unifiedObject { + if (!unifiedObject) { + ANLogError(@"Could not set unifiedObject"); return; } - if (anSingleUnifiedObject != __anSingleUnifiedObject) { - ANLogDebug(@"Setting anSingleUnifiedObject to %@", anSingleUnifiedObject); - __anSingleUnifiedObject = anSingleUnifiedObject; + if (unifiedObject != __unifiedObject) { + ANLogDebug(@"Setting unifiedObject to %@", unifiedObject); + __unifiedObject = unifiedObject; } } @@ -300,9 +300,9 @@ - (void)setClickThroughAction:(ANClickThroughAction)clickThroughAction #pragma mark - ANAdProtocol: Getter methods -- (nullable ANSingleUnifiedObject *)anSingleUnifiedObject { - ANLogDebug(@"ANSingleUnifiedObject returned %@", __anSingleUnifiedObject); - return __anSingleUnifiedObject; +- (nullable ANSingleUnifiedObject *)unifiedObject { + ANLogDebug(@"ANSingleUnifiedObject returned %@", __unifiedObject); + return __unifiedObject; } - (nullable NSString *)placementId { diff --git a/sdk/sourcefiles/internal/ANBannerAdView.m b/sdk/sourcefiles/internal/ANBannerAdView.m index 35cef9d3e..8159a7a15 100644 --- a/sdk/sourcefiles/internal/ANBannerAdView.m +++ b/sdk/sourcefiles/internal/ANBannerAdView.m @@ -348,9 +348,9 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR self.contentView = nil; self.impressionURLs = nil; - ANSingleUnifiedObject *anSingleUnifiedObject = (ANSingleUnifiedObject *) [ANGlobal valueOfGetterProperty:kANSingleUnifiedObject forObject:adObjectHandler]; - if (anSingleUnifiedObject) { - [self setAnSingleUnifiedObject:anSingleUnifiedObject]; + ANSingleUnifiedObject *unifiedObject = (ANSingleUnifiedObject *) [ANGlobal valueOfGetterProperty:kANSingleUnifiedObject forObject:adObjectHandler]; + if (unifiedObject) { + [self setUnifiedObject:unifiedObject]; } NSString *adTypeString = (NSString *) [ANGlobal valueOfGetterProperty:kANAdType forObject:adObjectHandler]; diff --git a/sdk/sourcefiles/internal/ANBaseAdObject.h b/sdk/sourcefiles/internal/ANBaseAdObject.h index aed8d69d0..8c221eb96 100644 --- a/sdk/sourcefiles/internal/ANBaseAdObject.h +++ b/sdk/sourcefiles/internal/ANBaseAdObject.h @@ -25,6 +25,6 @@ @property (nonatomic, readwrite, strong) NSString *adType; @property (nonatomic, readwrite, strong) NSArray *impressionUrls; -@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *anSingleUnifiedObject; +@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *unifiedObject; @end diff --git a/sdk/sourcefiles/internal/ANCSMVideoAd.h b/sdk/sourcefiles/internal/ANCSMVideoAd.h index 6f4147d95..d4820f2a8 100644 --- a/sdk/sourcefiles/internal/ANCSMVideoAd.h +++ b/sdk/sourcefiles/internal/ANCSMVideoAd.h @@ -20,7 +20,7 @@ @interface ANCSMVideoAd : NSObject @property (nonatomic, readwrite, strong) NSDictionary *adDictionary; -@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *anSingleUnifiedObject; +@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *unifiedObject; @end diff --git a/sdk/sourcefiles/internal/ANGlobal.h b/sdk/sourcefiles/internal/ANGlobal.h index 76c1c050c..48a7f0cb8 100644 --- a/sdk/sourcefiles/internal/ANGlobal.h +++ b/sdk/sourcefiles/internal/ANGlobal.h @@ -126,10 +126,9 @@ NSNumber * __nullable ANiTunesIDForURL(NSURL * __nonnull URL); BOOL ANCanPresentFromViewController(UIViewController * __nullable viewController); -static NSString * __nonnull const kANCreativeId= @"creativeId"; static NSString * __nonnull const kANImpressionUrls = @"impressionUrls"; static NSString * __nonnull const kANAspectRatio = @"aspectRatio"; -static NSString * __nonnull const kANSingleUnifiedObject= @"anSingleUnifiedObject"; +static NSString * __nonnull const kANSingleUnifiedObject= @"unifiedObject"; #pragma mark - Global class. diff --git a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m index 03c071a4d..005865871 100644 --- a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m +++ b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m @@ -228,8 +228,8 @@ - (void)processResponseData:(NSData *)data continue; } - ANSingleUnifiedObject *anSingleUnifiedObject = [[ANSingleUnifiedObject alloc] init]; - [anSingleUnifiedObject anParseResponse:firstTag]; + ANSingleUnifiedObject *unifiedObject = [[ANSingleUnifiedObject alloc] init]; + unifiedObject.creativeId = creativeId; // RTB if ([contentSource isEqualToString:kANUniversalTagAdServerResponseKeyAdsRTBObject]) @@ -256,7 +256,7 @@ - (void)processResponseData:(NSData *)data } else if([adType isEqualToString:kANUniversalTagAdServerResponseKeyNativeObject]) { ANNativeStandardAdResponse *nativeAd = [[self class] nativeAdFromRTBObject:rtbObject]; if (nativeAd) { - nativeAd.anSingleUnifiedObject = anSingleUnifiedObject; + nativeAd.unifiedObject = unifiedObject; if(adObject[kANUniversalTagAdServerResponseKeyAdsRendererUrl] != nil) { NSString * nativeRenderingUrl = [NSString stringWithFormat:@"%@",adObject[kANUniversalTagAdServerResponseKeyAdsRendererUrl]]; @@ -336,7 +336,7 @@ - (void)processResponseData:(NSData *)data if ([lastAdsObject isKindOfClass:[ANBaseAdObject class]]) { ANBaseAdObject *baseAdObject = (ANBaseAdObject *)lastAdsObject; baseAdObject.adType = [adType copy]; - baseAdObject.anSingleUnifiedObject = anSingleUnifiedObject; + baseAdObject.unifiedObject = unifiedObject; } } //endfor -- adObject diff --git a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h index 0f392f0c4..f1299e573 100644 --- a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h +++ b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h @@ -39,6 +39,6 @@ @property (nonatomic, readwrite, strong) NSString *privacyLink; @property (nonatomic, readwrite, strong) NSString *nativeRenderingUrl; @property (nonatomic, readwrite, strong) NSString *nativeRenderingObject; -@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *anSingleUnifiedObject; +@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *unifiedObject; @end diff --git a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m index 378eba5ad..481415cd0 100644 --- a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m +++ b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m @@ -64,7 +64,7 @@ @implementation ANNativeStandardAdResponse @synthesize privacyLink = _privacyLink; @synthesize nativeRenderingUrl = _nativeRenderingUrl; @synthesize nativeRenderingObject = _nativeRenderingObject; -@synthesize anSingleUnifiedObject = _anSingleUnifiedObject; +@synthesize unifiedObject = _unifiedObject; #pragma mark - Lifecycle. From 999565a4a0eed8c7a07a88664d04e58b88d9cb7c Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Fri, 13 Sep 2019 21:54:57 +0530 Subject: [PATCH 03/35] TagId and AdType added in unified object --- sdk/sourcefiles/ANAdProtocol.h | 7 ------- sdk/sourcefiles/ANSingleUnifiedObject.h | 9 +++++++++ sdk/sourcefiles/ANSingleUnifiedObject.m | 2 +- sdk/sourcefiles/internal/ANAdView.m | 11 +---------- sdk/sourcefiles/internal/ANBannerAdView.m | 19 ++++++------------- sdk/sourcefiles/internal/ANBaseAdObject.h | 1 - sdk/sourcefiles/internal/ANInterstitialAd.m | 7 ++++++- .../internal/ANUniversalTagAdServerResponse.m | 10 +++++++++- .../native/internal/ANNativeAdRequest.m | 1 - sdk/sourcefiles/video/ANInstreamVideoAd.m | 5 +++++ 10 files changed, 37 insertions(+), 35 deletions(-) diff --git a/sdk/sourcefiles/ANAdProtocol.h b/sdk/sourcefiles/ANAdProtocol.h index 3d19655b8..7e4119b90 100644 --- a/sdk/sourcefiles/ANAdProtocol.h +++ b/sdk/sourcefiles/ANAdProtocol.h @@ -89,13 +89,6 @@ */ @property (nonatomic, readwrite, strong, nullable) NSString *externalUid; -/** - Report the Ad Type of the returned ad object. - Not available until load is complete and successful. - */ -@property (nonatomic, readwrite) ANAdType adType; - - /** Set the user's current location. This allows ad buyers to do location targeting, which can increase spend. diff --git a/sdk/sourcefiles/ANSingleUnifiedObject.h b/sdk/sourcefiles/ANSingleUnifiedObject.h index 8921aaa65..3b2e2f15b 100644 --- a/sdk/sourcefiles/ANSingleUnifiedObject.h +++ b/sdk/sourcefiles/ANSingleUnifiedObject.h @@ -7,6 +7,7 @@ // #import +#import "ANAdConstants.h" NS_ASSUME_NONNULL_BEGIN @@ -16,6 +17,14 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, readwrite, strong, nullable) NSString *creativeId; +/** + Report the Ad Type of the returned ad object. + Not available until load is complete and successful. + */ +@property (nonatomic, readwrite) ANAdType adType; + +@property (nonatomic, readwrite) NSString *tagId; + @end NS_ASSUME_NONNULL_END diff --git a/sdk/sourcefiles/ANSingleUnifiedObject.m b/sdk/sourcefiles/ANSingleUnifiedObject.m index feb04f53e..ca9366788 100644 --- a/sdk/sourcefiles/ANSingleUnifiedObject.m +++ b/sdk/sourcefiles/ANSingleUnifiedObject.m @@ -12,6 +12,6 @@ @implementation ANSingleUnifiedObject -@synthesize creativeId = __creativeId; +@synthesize creativeId, adType, tagId; @end diff --git a/sdk/sourcefiles/internal/ANAdView.m b/sdk/sourcefiles/internal/ANAdView.m index 8013159b7..616abdec1 100644 --- a/sdk/sourcefiles/internal/ANAdView.m +++ b/sdk/sourcefiles/internal/ANAdView.m @@ -61,7 +61,6 @@ @implementation ANAdView @synthesize gender = __gender; @synthesize customKeywords = __customKeywords; -@synthesize adType = __adType; @synthesize externalUid = __externalUid; @synthesize clickThroughAction = __clickThroughAction; @@ -200,14 +199,6 @@ - (void)setUnifiedObject:(ANSingleUnifiedObject *)unifiedObject { } } -- (void)setAdType:(ANAdType)adType -{ - if (adType != __adType) { - ANLogDebug(@"Setting adType to %@", @(adType)); - __adType = adType; - } -} - - (void)setPlacementId:(nullable NSString *)placementId { placementId = ANConvertToNSString(placementId); @@ -484,7 +475,7 @@ - (void)adInteractionDidEnd { ANLogDebug(@""); - if (ANAdTypeVideo != self.adType) { + if (ANAdTypeVideo != __unifiedObject.adType) { [self.universalAdFetcher restartAutoRefreshTimer]; [self.universalAdFetcher startAutoRefreshTimer]; } diff --git a/sdk/sourcefiles/internal/ANBannerAdView.m b/sdk/sourcefiles/internal/ANBannerAdView.m index 8159a7a15..f2c29df17 100644 --- a/sdk/sourcefiles/internal/ANBannerAdView.m +++ b/sdk/sourcefiles/internal/ANBannerAdView.m @@ -36,7 +36,6 @@ #import "ANNativeAdResponse+PrivateMethods.h" #import "ANNativeRenderingViewController.h" -static NSString *const kANAdType = @"adType"; static NSString *const kANBannerWidth = @"width"; static NSString *const kANBannerHeight = @"height"; static NSString *const kANInline = @"inline"; @@ -71,6 +70,7 @@ @implementation ANBannerAdView @synthesize shouldAllowNativeDemand = _shouldAllowNativeDemand; @synthesize nativeAdRendererId = _nativeAdRendererId; @synthesize enableNativeRendering = _enableNativeRendering; +@synthesize unifiedObject = _unifiedObject; #pragma mark - Lifecycle. @@ -348,14 +348,9 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR self.contentView = nil; self.impressionURLs = nil; - ANSingleUnifiedObject *unifiedObject = (ANSingleUnifiedObject *) [ANGlobal valueOfGetterProperty:kANSingleUnifiedObject forObject:adObjectHandler]; - if (unifiedObject) { - [self setUnifiedObject:unifiedObject]; - } - - NSString *adTypeString = (NSString *) [ANGlobal valueOfGetterProperty:kANAdType forObject:adObjectHandler]; - if (adTypeString) { - [self setAdType:[ANGlobal adTypeStringToEnum:adTypeString]]; + _unifiedObject = (ANSingleUnifiedObject *) [ANGlobal valueOfGetterProperty:kANSingleUnifiedObject forObject:adObjectHandler]; + if (_unifiedObject) { + [self setUnifiedObject:_unifiedObject]; } if ([adObject isKindOfClass:[UIView class]]) @@ -381,7 +376,7 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR } [self adDidReceiveAd:self]; - if ([self adType] == ANAdTypeBanner && !([adObjectHandler isKindOfClass:[ANNativeStandardAdResponse class]])) + if (_unifiedObject.adType == ANAdTypeBanner && !([adObjectHandler isKindOfClass:[ANNativeStandardAdResponse class]])) { self.impressionURLs = (NSArray *) [ANGlobal valueOfGetterProperty:kANImpressionUrls forObject:adObjectHandler]; @@ -403,8 +398,6 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR } else if ([adObject isKindOfClass:[ANNativeAdResponse class]]) { ANNativeAdResponse *nativeAdResponse = (ANNativeAdResponse *)response.adObject; - self.adType = ANAdTypeNative; - nativeAdResponse.clickThroughAction = self.clickThroughAction; nativeAdResponse.landingPageLoadsInBackground = self.landingPageLoadsInBackground; @@ -524,7 +517,7 @@ - (UIViewController *)displayController - (void)didMoveToWindow { - if (self.contentView && ( [self adType] == ANAdTypeBanner)) { + if (self.contentView && ( _unifiedObject.adType == ANAdTypeBanner)) { [ANTrackerManager fireTrackerURLArray:self.impressionURLs]; self.impressionURLs = nil; diff --git a/sdk/sourcefiles/internal/ANBaseAdObject.h b/sdk/sourcefiles/internal/ANBaseAdObject.h index 8c221eb96..b9df17348 100644 --- a/sdk/sourcefiles/internal/ANBaseAdObject.h +++ b/sdk/sourcefiles/internal/ANBaseAdObject.h @@ -23,7 +23,6 @@ @property (nonatomic, readwrite, strong) NSString *height; @property (nonatomic, readwrite, strong) NSString *width; -@property (nonatomic, readwrite, strong) NSString *adType; @property (nonatomic, readwrite, strong) NSArray *impressionUrls; @property (nonatomic, readwrite, strong) ANSingleUnifiedObject *unifiedObject; diff --git a/sdk/sourcefiles/internal/ANInterstitialAd.m b/sdk/sourcefiles/internal/ANInterstitialAd.m index 30b975bef..510d086ab 100644 --- a/sdk/sourcefiles/internal/ANInterstitialAd.m +++ b/sdk/sourcefiles/internal/ANInterstitialAd.m @@ -314,7 +314,12 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR if (!response.isSuccessful) { [self adRequestFailedWithError:response.error]; return; - } + } + ANSingleUnifiedObject *unifiedObject = (ANSingleUnifiedObject *) [ANGlobal valueOfGetterProperty:kANSingleUnifiedObject forObject:response.adObjectHandler]; + if (unifiedObject) { + [self setUnifiedObject:unifiedObject]; + } + NSMutableDictionary *adViewWithDateLoaded = [NSMutableDictionary dictionaryWithObjectsAndKeys: response.adObject, kANInterstitialAdViewKey, response.adObjectHandler, kANInterstitialAdObjectHandlerKey, diff --git a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m index 005865871..b8df68482 100644 --- a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m +++ b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m @@ -26,6 +26,7 @@ #import "ANNativeStandardAdResponse.h" #import "ANNativeAdResponse+PrivateMethods.h" #import "ANSingleUnifiedObject.h" +#import "ANGlobal.h" static NSString *const kANUniversalTagAdServerResponseKeyNoBid = @"nobid"; @@ -38,6 +39,7 @@ static NSString *const kANUniversalTagAdServerResponseKeyAdsAdType = @"ad_type"; static NSString *const kANUniversalTagAdServerResponseKeyAdsCreativeId = @"creative_id"; static NSString *const kANUniversalTagAdServerResponseKeyAdsRendererUrl = @"renderer_url"; +static NSString *const kANUniversalTagAdServerResponseKeyAdsTagId = @"tag_id"; static NSString *const kANUniversalTagAdServerResponseKeyAdsCSMObject = @"csm"; static NSString *const kANUniversalTagAdServerResponseKeyAdsSSMObject = @"ssm"; @@ -227,9 +229,16 @@ - (void)processResponseData:(NSData *)data ANLogError(@"Response from ad server in an unexpected format content_source/ad_type UNDEFINED. (adObject=%@)", adObject); continue; } + NSString *tagId = @""; + if(firstTag[kANUniversalTagAdServerResponseKeyAdsTagId] != nil) + { + tagId = [NSString stringWithFormat:@"%@",firstTag[kANUniversalTagAdServerResponseKeyAdsTagId]]; + } ANSingleUnifiedObject *unifiedObject = [[ANSingleUnifiedObject alloc] init]; unifiedObject.creativeId = creativeId; + unifiedObject.tagId = tagId; + unifiedObject.adType = [ANGlobal adTypeStringToEnum:adType]; // RTB if ([contentSource isEqualToString:kANUniversalTagAdServerResponseKeyAdsRTBObject]) @@ -335,7 +344,6 @@ - (void)processResponseData:(NSData *)data if ([lastAdsObject isKindOfClass:[ANBaseAdObject class]]) { ANBaseAdObject *baseAdObject = (ANBaseAdObject *)lastAdsObject; - baseAdObject.adType = [adType copy]; baseAdObject.unifiedObject = unifiedObject; } diff --git a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m index e47e38a6b..9636746ff 100644 --- a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m +++ b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m @@ -51,7 +51,6 @@ @implementation ANNativeAdRequest @synthesize customKeywords = __customKeywords; @synthesize externalUid = __externalUid; -@synthesize adType = __adType; @synthesize rendererId = _rendererId; diff --git a/sdk/sourcefiles/video/ANInstreamVideoAd.m b/sdk/sourcefiles/video/ANInstreamVideoAd.m index 332a7c073..9d6cb8b58 100644 --- a/sdk/sourcefiles/video/ANInstreamVideoAd.m +++ b/sdk/sourcefiles/video/ANInstreamVideoAd.m @@ -402,6 +402,11 @@ - (void) universalAdFetcher: (ANUniversalAdFetcher *)fetcher if ([response.adObject isKindOfClass:[ANVideoAdPlayer class]]) { self.adPlayer = (ANVideoAdPlayer *) response.adObject; self.adPlayer.delegate = self; + + ANSingleUnifiedObject *unifiedObject = (ANSingleUnifiedObject *) [ANGlobal valueOfGetterProperty:kANSingleUnifiedObject forObject:response.adObjectHandler]; + if (unifiedObject) { + [self setUnifiedObject:unifiedObject]; + } [self videoAdReady]; From 08fd9955966e987501ec5e518d4d92291fa7f93b Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Mon, 16 Sep 2019 15:10:23 +0530 Subject: [PATCH 04/35] CSM unified added --- sdk/sourcefiles/ANAdProtocol.h | 1 - .../native/internal/ANNativeAdRequest.m | 14 ++++++++++++++ .../native/internal/ANNativeAdResponse.m | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sdk/sourcefiles/ANAdProtocol.h b/sdk/sourcefiles/ANAdProtocol.h index 7e4119b90..6ccab0c42 100644 --- a/sdk/sourcefiles/ANAdProtocol.h +++ b/sdk/sourcefiles/ANAdProtocol.h @@ -22,7 +22,6 @@ #import "ANSingleUnifiedObject.h" @class ANLocation; -@class ANSingleUnifiedObject; diff --git a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m index 9636746ff..5abca1f6e 100644 --- a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m +++ b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m @@ -122,6 +122,14 @@ -(void)didFinishRequestWithResponse: (nonnull ANAdFetcherResponse *)response // __weak ANNativeAdRequest *weakSelf = self; ANNativeAdResponse *nativeResponse = (ANNativeAdResponse *)response.adObject; + + // In case of Mediation + if (nativeResponse.unifiedObject == nil) { + ANSingleUnifiedObject *unifiedObject = (ANSingleUnifiedObject *) [ANGlobal valueOfGetterProperty:kANSingleUnifiedObject forObject:response.adObjectHandler]; + if (unifiedObject) { + [self setUnifiedObject:unifiedObject onObject:nativeResponse forKeyPath:kANSingleUnifiedObject]; + } + } // dispatch_queue_t backgroundQueue = dispatch_queue_create(__PRETTY_FUNCTION__, DISPATCH_QUEUE_SERIAL); @@ -197,6 +205,12 @@ - (NSDictionary *) internalDelegateUniversalTagSizeParameters // #pragma mark - ANUniversalAdFetcherFoundationDelegate helper methods. +- (void)setUnifiedObject:(ANSingleUnifiedObject *)unifiedObject + onObject:(id)object forKeyPath:(NSString *)keyPath +{ + [object setValue:unifiedObject forKeyPath:keyPath]; +} + // RETURN: dispatch_semaphore_t For first time image requests. // nil When image is cached -OR- if imageURL is undefined. // diff --git a/sdk/sourcefiles/native/internal/ANNativeAdResponse.m b/sdk/sourcefiles/native/internal/ANNativeAdResponse.m index 56c523474..5de831bb8 100644 --- a/sdk/sourcefiles/native/internal/ANNativeAdResponse.m +++ b/sdk/sourcefiles/native/internal/ANNativeAdResponse.m @@ -52,6 +52,7 @@ @interface ANNativeAdResponse() @property (nonatomic, readwrite, assign) ANNativeAdNetworkCode networkCode; @property (nonatomic, readwrite, strong) OMIDAppnexusAdSession *omidAdSession; @property (nonatomic, readwrite, strong) ANVerificationScriptResource *verificationScriptResource; +@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *unifiedObject; @end From f1f86ae720b98190544e59ae2b6c52a7ae0b66b4 Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Mon, 16 Sep 2019 15:44:54 +0530 Subject: [PATCH 05/35] CSM Video unified object added --- sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m index b8df68482..84eeb4f87 100644 --- a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m +++ b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m @@ -313,6 +313,7 @@ - (void)processResponseData:(NSData *)data } else if([adType isEqualToString:kANUniversalTagAdServerResponseKeyVideoObject]) { ANCSMVideoAd *csmVideoAd = [[self class] videoCSMAdFromCSMObject:adObject withTagObject:firstTag]; if(csmVideoAd){ + csmVideoAd.unifiedObject = unifiedObject; [self.ads addObject:csmVideoAd]; } }else{ From 1de13f874bccb0b5ebdc234cba79aed2ca441673 Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Mon, 16 Sep 2019 16:03:47 +0530 Subject: [PATCH 06/35] UnifiedObject name renamed --- sdk/AppNexusSDK.xcodeproj/project.pbxproj | 24 ++++++------ sdk/sourcefiles/ANAdProtocol.h | 12 +++--- sdk/sourcefiles/ANCustomResponse.h | 37 +++++++++++++++++++ sdk/sourcefiles/ANCustomResponse.m | 24 ++++++++++++ sdk/sourcefiles/ANSingleUnifiedObject.h | 30 --------------- sdk/sourcefiles/ANSingleUnifiedObject.m | 17 --------- .../Categories/ANAdView+PrivateMethods.h | 2 +- sdk/sourcefiles/internal/ANAdView.m | 22 +++++------ sdk/sourcefiles/internal/ANBannerAdView.m | 12 +++--- sdk/sourcefiles/internal/ANBaseAdObject.h | 4 +- sdk/sourcefiles/internal/ANCSMVideoAd.h | 4 +- sdk/sourcefiles/internal/ANGlobal.h | 2 +- sdk/sourcefiles/internal/ANInterstitialAd.m | 6 +-- .../internal/ANUniversalTagAdServerResponse.m | 16 ++++---- .../native/internal/ANNativeAdRequest.m | 12 +++--- .../native/internal/ANNativeAdResponse.m | 2 +- .../internal/ANNativeStandardAdResponse.h | 2 +- .../internal/ANNativeStandardAdResponse.m | 2 +- sdk/sourcefiles/video/ANInstreamVideoAd.m | 6 +-- 19 files changed, 125 insertions(+), 111 deletions(-) create mode 100644 sdk/sourcefiles/ANCustomResponse.h create mode 100644 sdk/sourcefiles/ANCustomResponse.m delete mode 100644 sdk/sourcefiles/ANSingleUnifiedObject.h delete mode 100644 sdk/sourcefiles/ANSingleUnifiedObject.m diff --git a/sdk/AppNexusSDK.xcodeproj/project.pbxproj b/sdk/AppNexusSDK.xcodeproj/project.pbxproj index d0577e3e0..e0f6596ce 100644 --- a/sdk/AppNexusSDK.xcodeproj/project.pbxproj +++ b/sdk/AppNexusSDK.xcodeproj/project.pbxproj @@ -231,10 +231,10 @@ 8AFC046F1A2E75AE00BEA485 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AFC046E1A2E75AE00BEA485 /* AdSupport.framework */; }; 8AFC04711A2E760800BEA485 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AFC04701A2E760800BEA485 /* MessageUI.framework */; }; 8AFC04731A2E78E400BEA485 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AFC04721A2E78E400BEA485 /* StoreKit.framework */; }; - 9706554F232B93A200D484D4 /* ANSingleUnifiedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANSingleUnifiedObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 97065550232B93A200D484D4 /* ANSingleUnifiedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANSingleUnifiedObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 97065551232B93A200D484D4 /* ANSingleUnifiedObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANSingleUnifiedObject.m */; }; - 97065552232B93A200D484D4 /* ANSingleUnifiedObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANSingleUnifiedObject.m */; }; + 9706554F232B93A200D484D4 /* ANCustomResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANCustomResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 97065550232B93A200D484D4 /* ANCustomResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANCustomResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 97065551232B93A200D484D4 /* ANCustomResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANCustomResponse.m */; }; + 97065552232B93A200D484D4 /* ANCustomResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANCustomResponse.m */; }; 972025CE222FD90E00C13454 /* ANVerificationScriptResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 97EC51EB2229782B00B740DF /* ANVerificationScriptResource.h */; settings = {ATTRIBUTES = (Private, ); }; }; 97EC51EF2229782B00B740DF /* ANVerificationScriptResource.m in Sources */ = {isa = PBXBuildFile; fileRef = 97EC51EC2229782B00B740DF /* ANVerificationScriptResource.m */; }; 9EEE4E50214FD2100056C5DD /* ANCarrierObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EEE4E4E214FD2100056C5DD /* ANCarrierObserver.h */; }; @@ -525,8 +525,8 @@ 8AFC046E1A2E75AE00BEA485 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; 8AFC04701A2E760800BEA485 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; }; 8AFC04721A2E78E400BEA485 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; - 9706554D232B93A200D484D4 /* ANSingleUnifiedObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ANSingleUnifiedObject.h; sourceTree = ""; }; - 9706554E232B93A200D484D4 /* ANSingleUnifiedObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ANSingleUnifiedObject.m; sourceTree = ""; }; + 9706554D232B93A200D484D4 /* ANCustomResponse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ANCustomResponse.h; sourceTree = ""; }; + 9706554E232B93A200D484D4 /* ANCustomResponse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ANCustomResponse.m; sourceTree = ""; }; 97A590D2228EBBD600D1C75C /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; 97A590D4228EBBE800D1C75C /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 97A590D6228EBBF600D1C75C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -673,8 +673,8 @@ 8A02D6EC1D6CE014006831A3 /* ANSDKSettings.h */, ECE4EA94194B768A0069D934 /* ANTargetingParameters.h */, 60D39E1322570FE20029F741 /* ANVideoPlayerSettings.h */, - 9706554D232B93A200D484D4 /* ANSingleUnifiedObject.h */, - 9706554E232B93A200D484D4 /* ANSingleUnifiedObject.m */, + 9706554D232B93A200D484D4 /* ANCustomResponse.h */, + 9706554E232B93A200D484D4 /* ANCustomResponse.m */, ); path = sourcefiles; sourceTree = ""; @@ -1078,7 +1078,7 @@ 0030D6FB20E5414D003B7C1D /* OMIDPartner.h in Headers */, 0030D6F620E5414D003B7C1D /* OMIDScriptInjector.h in Headers */, 0030D6F020E5414D003B7C1D /* OMIDSDK.h in Headers */, - 9706554F232B93A200D484D4 /* ANSingleUnifiedObject.h in Headers */, + 9706554F232B93A200D484D4 /* ANCustomResponse.h in Headers */, 0030D6F120E5414D003B7C1D /* OMIDVASTProperties.h in Headers */, 0030D6FA20E5414D003B7C1D /* OMIDVerificationScriptResource.h in Headers */, 0030D6F220E5414D003B7C1D /* OMIDVideoEvents.h in Headers */, @@ -1097,7 +1097,7 @@ 0099B483228CA0EB004E80AB /* UIView+ANCategory.h in Headers */, F5731B6D228C8E470012B134 /* ANSDKSettings+PrivateMethods.h in Headers */, F5731B6F228C8F680012B134 /* ANTargetingParameters.h in Headers */, - 97065550232B93A200D484D4 /* ANSingleUnifiedObject.h in Headers */, + 97065550232B93A200D484D4 /* ANCustomResponse.h in Headers */, F5731B55228C8DD10012B134 /* ANCarrierObserver.h in Headers */, F5731BBE228C99BC0012B134 /* ANAdProtocol.h in Headers */, F5731B4F228C8D1A0012B134 /* ANNativeAdDelegate.h in Headers */, @@ -1334,7 +1334,7 @@ 8AC65F6E1A40DE74006BCF39 /* ANMRAIDResizeView.m in Sources */, 8AC65F701A40DE74006BCF39 /* ANMRAIDResizeViewManager.m in Sources */, F5731BCF228F07FC0012B134 /* ANNativeAdFetcher.m in Sources */, - 97065551232B93A200D484D4 /* ANSingleUnifiedObject.m in Sources */, + 97065551232B93A200D484D4 /* ANCustomResponse.m in Sources */, 8AC65F721A40DE74006BCF39 /* ANMRAIDUtil.m in Sources */, 8A9AEE061A1BF99D00C58BDA /* ANNativeAdImageCache.m in Sources */, 8A9AEE071A1BF99D00C58BDA /* ANNativeAdRequest.m in Sources */, @@ -1391,7 +1391,7 @@ F5731B43228C8CCC0012B134 /* ANNativeAdResponse.m in Sources */, F5731B70228C8F820012B134 /* ANTargetingParameters.m in Sources */, F5731B5E228C8DFA0012B134 /* ANBaseAdObject.m in Sources */, - 97065552232B93A200D484D4 /* ANSingleUnifiedObject.m in Sources */, + 97065552232B93A200D484D4 /* ANCustomResponse.m in Sources */, F5731B4A228C8D020012B134 /* ANNativeStandardAdResponse.m in Sources */, F5731B76228C902A0012B134 /* ANLogManager.m in Sources */, F5731B7E228C94990012B134 /* ANTrackerManager.m in Sources */, diff --git a/sdk/sourcefiles/ANAdProtocol.h b/sdk/sourcefiles/ANAdProtocol.h index 6ccab0c42..36410fdd0 100644 --- a/sdk/sourcefiles/ANAdProtocol.h +++ b/sdk/sourcefiles/ANAdProtocol.h @@ -19,7 +19,7 @@ #import "ANAdConstants.h" #import "ANLocation.h" -#import "ANSingleUnifiedObject.h" +#import "ANCustomResponse.h" @class ANLocation; @@ -136,17 +136,17 @@ @end //ANAdProtocolFoundation -@protocol ANAdProtocolUnifiedObject +@protocol ANAdProtocolCustomResponse /** An AppNexus Single Unified object that will contain all the common fields of all the ads types that are returned in the UTv3 response */ -// ANSingleUnifiedObject should be accessible from response Object only(like. ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). It is placed into ANAdProtocolUnifiedObject. -@property (nonatomic, readonly, strong, nullable) ANSingleUnifiedObject *unifiedObject; +// ANCustomResponse should be accessible from response Object only(like. ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). It is placed into ANAdProtocolCustomResponse. +@property (nonatomic, readonly, strong, nullable) ANCustomResponse *customResponse; @end -@protocol ANAdProtocolBrowser +@protocol ANAdProtocolBrowser /** Determines what action to take when the user clicks on an ad: @@ -206,7 +206,7 @@ #pragma mark - ANAdProtocol entrypoint combinations. -@protocol ANAdProtocol +@protocol ANAdProtocol @end diff --git a/sdk/sourcefiles/ANCustomResponse.h b/sdk/sourcefiles/ANCustomResponse.h new file mode 100644 index 000000000..91b6255f1 --- /dev/null +++ b/sdk/sourcefiles/ANCustomResponse.h @@ -0,0 +1,37 @@ +/* Copyright 2019 APPNEXUS INC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import +#import "ANAdConstants.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface ANCustomResponse : NSObject +/** + An AppNexus creativeID for the current creative that is displayed + */ +@property (nonatomic, readwrite, strong, nullable) NSString *creativeId; + +/** + Report the Ad Type of the returned ad object. + Not available until load is complete and successful. + */ +@property (nonatomic, readwrite) ANAdType adType; + +@property (nonatomic, readwrite) NSString *tagId; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/sourcefiles/ANCustomResponse.m b/sdk/sourcefiles/ANCustomResponse.m new file mode 100644 index 000000000..e6d56ba0c --- /dev/null +++ b/sdk/sourcefiles/ANCustomResponse.m @@ -0,0 +1,24 @@ +/* Copyright 2019 APPNEXUS INC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#import "ANCustomResponse.h" + +static NSString *const kANUniversalTagAdServerResponseKeyAdsCreativeId = @"creative_id"; + +@implementation ANCustomResponse + +@synthesize creativeId, adType, tagId; + +@end diff --git a/sdk/sourcefiles/ANSingleUnifiedObject.h b/sdk/sourcefiles/ANSingleUnifiedObject.h deleted file mode 100644 index 3b2e2f15b..000000000 --- a/sdk/sourcefiles/ANSingleUnifiedObject.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// ANSingleUnifiedObject.h -// AppNexusSDK -// -// Created by Akash Verma on 13/09/19. -// Copyright © 2019 AppNexus. All rights reserved. -// - -#import -#import "ANAdConstants.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ANSingleUnifiedObject : NSObject -/** - An AppNexus creativeID for the current creative that is displayed - */ -@property (nonatomic, readwrite, strong, nullable) NSString *creativeId; - -/** - Report the Ad Type of the returned ad object. - Not available until load is complete and successful. - */ -@property (nonatomic, readwrite) ANAdType adType; - -@property (nonatomic, readwrite) NSString *tagId; - -@end - -NS_ASSUME_NONNULL_END diff --git a/sdk/sourcefiles/ANSingleUnifiedObject.m b/sdk/sourcefiles/ANSingleUnifiedObject.m deleted file mode 100644 index ca9366788..000000000 --- a/sdk/sourcefiles/ANSingleUnifiedObject.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// ANSingleUnifiedObject.m -// AppNexusSDK -// -// Created by Akash Verma on 13/09/19. -// Copyright © 2019 AppNexus. All rights reserved. -// - -#import "ANSingleUnifiedObject.h" - -static NSString *const kANUniversalTagAdServerResponseKeyAdsCreativeId = @"creative_id"; - -@implementation ANSingleUnifiedObject - -@synthesize creativeId, adType, tagId; - -@end diff --git a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h index 152b8e1b1..0c7564bf0 100644 --- a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h +++ b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h @@ -36,6 +36,6 @@ - (void)loadAdFromVast: (NSString *)xml width: (int)width height: (int)height; -- (void)setUnifiedObject:(ANSingleUnifiedObject *)unifiedObject; +- (void)setCustomResponse:(ANCustomResponse *)customResponse; @end diff --git a/sdk/sourcefiles/internal/ANAdView.m b/sdk/sourcefiles/internal/ANAdView.m index 616abdec1..25322903a 100644 --- a/sdk/sourcefiles/internal/ANAdView.m +++ b/sdk/sourcefiles/internal/ANAdView.m @@ -66,7 +66,7 @@ @implementation ANAdView @synthesize clickThroughAction = __clickThroughAction; @synthesize landingPageLoadsInBackground = __landingPageLoadsInBackground; -@synthesize unifiedObject = __unifiedObject; +@synthesize customResponse = __customResponse; #pragma mark - Initialization @@ -188,14 +188,14 @@ - (void)loadAdFromVast: (NSString *)xml width: (int)width #pragma mark - ANAdProtocol: Setter methods -- (void)setUnifiedObject:(ANSingleUnifiedObject *)unifiedObject { - if (!unifiedObject) { - ANLogError(@"Could not set unifiedObject"); +- (void)setCustomResponse:(ANCustomResponse *)customResponse { + if (!customResponse) { + ANLogError(@"Could not set customResponse"); return; } - if (unifiedObject != __unifiedObject) { - ANLogDebug(@"Setting unifiedObject to %@", unifiedObject); - __unifiedObject = unifiedObject; + if (customResponse != __customResponse) { + ANLogDebug(@"Setting customResponse to %@", customResponse); + __customResponse = customResponse; } } @@ -291,9 +291,9 @@ - (void)setClickThroughAction:(ANClickThroughAction)clickThroughAction #pragma mark - ANAdProtocol: Getter methods -- (nullable ANSingleUnifiedObject *)unifiedObject { - ANLogDebug(@"ANSingleUnifiedObject returned %@", __unifiedObject); - return __unifiedObject; +- (nullable ANCustomResponse *)customResponse { + ANLogDebug(@"ANCustomResponse returned %@", __customResponse); + return __customResponse; } - (nullable NSString *)placementId { @@ -475,7 +475,7 @@ - (void)adInteractionDidEnd { ANLogDebug(@""); - if (ANAdTypeVideo != __unifiedObject.adType) { + if (ANAdTypeVideo != __customResponse.adType) { [self.universalAdFetcher restartAutoRefreshTimer]; [self.universalAdFetcher startAutoRefreshTimer]; } diff --git a/sdk/sourcefiles/internal/ANBannerAdView.m b/sdk/sourcefiles/internal/ANBannerAdView.m index f2c29df17..16eee98c3 100644 --- a/sdk/sourcefiles/internal/ANBannerAdView.m +++ b/sdk/sourcefiles/internal/ANBannerAdView.m @@ -70,7 +70,7 @@ @implementation ANBannerAdView @synthesize shouldAllowNativeDemand = _shouldAllowNativeDemand; @synthesize nativeAdRendererId = _nativeAdRendererId; @synthesize enableNativeRendering = _enableNativeRendering; -@synthesize unifiedObject = _unifiedObject; +@synthesize customResponse = _customResponse; #pragma mark - Lifecycle. @@ -348,9 +348,9 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR self.contentView = nil; self.impressionURLs = nil; - _unifiedObject = (ANSingleUnifiedObject *) [ANGlobal valueOfGetterProperty:kANSingleUnifiedObject forObject:adObjectHandler]; - if (_unifiedObject) { - [self setUnifiedObject:_unifiedObject]; + _customResponse = (ANCustomResponse *) [ANGlobal valueOfGetterProperty:kANCustomResponse forObject:adObjectHandler]; + if (_customResponse) { + [self setCustomResponse:_customResponse]; } if ([adObject isKindOfClass:[UIView class]]) @@ -376,7 +376,7 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR } [self adDidReceiveAd:self]; - if (_unifiedObject.adType == ANAdTypeBanner && !([adObjectHandler isKindOfClass:[ANNativeStandardAdResponse class]])) + if (_customResponse.adType == ANAdTypeBanner && !([adObjectHandler isKindOfClass:[ANNativeStandardAdResponse class]])) { self.impressionURLs = (NSArray *) [ANGlobal valueOfGetterProperty:kANImpressionUrls forObject:adObjectHandler]; @@ -517,7 +517,7 @@ - (UIViewController *)displayController - (void)didMoveToWindow { - if (self.contentView && ( _unifiedObject.adType == ANAdTypeBanner)) { + if (self.contentView && ( _customResponse.adType == ANAdTypeBanner)) { [ANTrackerManager fireTrackerURLArray:self.impressionURLs]; self.impressionURLs = nil; diff --git a/sdk/sourcefiles/internal/ANBaseAdObject.h b/sdk/sourcefiles/internal/ANBaseAdObject.h index b9df17348..0fd688257 100644 --- a/sdk/sourcefiles/internal/ANBaseAdObject.h +++ b/sdk/sourcefiles/internal/ANBaseAdObject.h @@ -14,7 +14,7 @@ */ #import -#import "ANSingleUnifiedObject.h" +#import "ANCustomResponse.h" @interface ANBaseAdObject : NSObject @@ -24,6 +24,6 @@ @property (nonatomic, readwrite, strong) NSString *width; @property (nonatomic, readwrite, strong) NSArray *impressionUrls; -@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *unifiedObject; +@property (nonatomic, readwrite, strong) ANCustomResponse *customResponse; @end diff --git a/sdk/sourcefiles/internal/ANCSMVideoAd.h b/sdk/sourcefiles/internal/ANCSMVideoAd.h index d4820f2a8..0966d2dff 100644 --- a/sdk/sourcefiles/internal/ANCSMVideoAd.h +++ b/sdk/sourcefiles/internal/ANCSMVideoAd.h @@ -15,12 +15,12 @@ */ #import -#import "ANSingleUnifiedObject.h" +#import "ANCustomResponse.h" @interface ANCSMVideoAd : NSObject @property (nonatomic, readwrite, strong) NSDictionary *adDictionary; -@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *unifiedObject; +@property (nonatomic, readwrite, strong) ANCustomResponse *customResponse; @end diff --git a/sdk/sourcefiles/internal/ANGlobal.h b/sdk/sourcefiles/internal/ANGlobal.h index 48a7f0cb8..1f97f982f 100644 --- a/sdk/sourcefiles/internal/ANGlobal.h +++ b/sdk/sourcefiles/internal/ANGlobal.h @@ -128,7 +128,7 @@ BOOL ANCanPresentFromViewController(UIViewController * __nullable viewController static NSString * __nonnull const kANImpressionUrls = @"impressionUrls"; static NSString * __nonnull const kANAspectRatio = @"aspectRatio"; -static NSString * __nonnull const kANSingleUnifiedObject= @"unifiedObject"; +static NSString * __nonnull const kANCustomResponse= @"customResponse"; #pragma mark - Global class. diff --git a/sdk/sourcefiles/internal/ANInterstitialAd.m b/sdk/sourcefiles/internal/ANInterstitialAd.m index 510d086ab..3fe432083 100644 --- a/sdk/sourcefiles/internal/ANInterstitialAd.m +++ b/sdk/sourcefiles/internal/ANInterstitialAd.m @@ -315,9 +315,9 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR [self adRequestFailedWithError:response.error]; return; } - ANSingleUnifiedObject *unifiedObject = (ANSingleUnifiedObject *) [ANGlobal valueOfGetterProperty:kANSingleUnifiedObject forObject:response.adObjectHandler]; - if (unifiedObject) { - [self setUnifiedObject:unifiedObject]; + ANCustomResponse *customResponse = (ANCustomResponse *) [ANGlobal valueOfGetterProperty:kANCustomResponse forObject:response.adObjectHandler]; + if (customResponse) { + [self setCustomResponse:customResponse]; } NSMutableDictionary *adViewWithDateLoaded = [NSMutableDictionary dictionaryWithObjectsAndKeys: diff --git a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m index 84eeb4f87..04c206dd3 100644 --- a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m +++ b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m @@ -25,7 +25,7 @@ #import "ANAdConstants.h" #import "ANNativeStandardAdResponse.h" #import "ANNativeAdResponse+PrivateMethods.h" -#import "ANSingleUnifiedObject.h" +#import "ANCustomResponse.h" #import "ANGlobal.h" @@ -235,10 +235,10 @@ - (void)processResponseData:(NSData *)data tagId = [NSString stringWithFormat:@"%@",firstTag[kANUniversalTagAdServerResponseKeyAdsTagId]]; } - ANSingleUnifiedObject *unifiedObject = [[ANSingleUnifiedObject alloc] init]; - unifiedObject.creativeId = creativeId; - unifiedObject.tagId = tagId; - unifiedObject.adType = [ANGlobal adTypeStringToEnum:adType]; + ANCustomResponse *customResponse = [[ANCustomResponse alloc] init]; + customResponse.creativeId = creativeId; + customResponse.tagId = tagId; + customResponse.adType = [ANGlobal adTypeStringToEnum:adType]; // RTB if ([contentSource isEqualToString:kANUniversalTagAdServerResponseKeyAdsRTBObject]) @@ -265,7 +265,7 @@ - (void)processResponseData:(NSData *)data } else if([adType isEqualToString:kANUniversalTagAdServerResponseKeyNativeObject]) { ANNativeStandardAdResponse *nativeAd = [[self class] nativeAdFromRTBObject:rtbObject]; if (nativeAd) { - nativeAd.unifiedObject = unifiedObject; + nativeAd.customResponse = customResponse; if(adObject[kANUniversalTagAdServerResponseKeyAdsRendererUrl] != nil) { NSString * nativeRenderingUrl = [NSString stringWithFormat:@"%@",adObject[kANUniversalTagAdServerResponseKeyAdsRendererUrl]]; @@ -313,7 +313,7 @@ - (void)processResponseData:(NSData *)data } else if([adType isEqualToString:kANUniversalTagAdServerResponseKeyVideoObject]) { ANCSMVideoAd *csmVideoAd = [[self class] videoCSMAdFromCSMObject:adObject withTagObject:firstTag]; if(csmVideoAd){ - csmVideoAd.unifiedObject = unifiedObject; + csmVideoAd.customResponse = customResponse; [self.ads addObject:csmVideoAd]; } }else{ @@ -345,7 +345,7 @@ - (void)processResponseData:(NSData *)data if ([lastAdsObject isKindOfClass:[ANBaseAdObject class]]) { ANBaseAdObject *baseAdObject = (ANBaseAdObject *)lastAdsObject; - baseAdObject.unifiedObject = unifiedObject; + baseAdObject.customResponse = customResponse; } } //endfor -- adObject diff --git a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m index 5abca1f6e..7cfb4ef73 100644 --- a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m +++ b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m @@ -124,10 +124,10 @@ -(void)didFinishRequestWithResponse: (nonnull ANAdFetcherResponse *)response ANNativeAdResponse *nativeResponse = (ANNativeAdResponse *)response.adObject; // In case of Mediation - if (nativeResponse.unifiedObject == nil) { - ANSingleUnifiedObject *unifiedObject = (ANSingleUnifiedObject *) [ANGlobal valueOfGetterProperty:kANSingleUnifiedObject forObject:response.adObjectHandler]; - if (unifiedObject) { - [self setUnifiedObject:unifiedObject onObject:nativeResponse forKeyPath:kANSingleUnifiedObject]; + if (nativeResponse.customResponse == nil) { + ANCustomResponse *customResponse = (ANCustomResponse *) [ANGlobal valueOfGetterProperty:kANCustomResponse forObject:response.adObjectHandler]; + if (customResponse) { + [self setCustomResponse:customResponse onObject:nativeResponse forKeyPath:kANCustomResponse]; } } @@ -205,10 +205,10 @@ - (NSDictionary *) internalDelegateUniversalTagSizeParameters // #pragma mark - ANUniversalAdFetcherFoundationDelegate helper methods. -- (void)setUnifiedObject:(ANSingleUnifiedObject *)unifiedObject +- (void)setCustomResponse:(ANCustomResponse *)customResponse onObject:(id)object forKeyPath:(NSString *)keyPath { - [object setValue:unifiedObject forKeyPath:keyPath]; + [object setValue:customResponse forKeyPath:keyPath]; } // RETURN: dispatch_semaphore_t For first time image requests. diff --git a/sdk/sourcefiles/native/internal/ANNativeAdResponse.m b/sdk/sourcefiles/native/internal/ANNativeAdResponse.m index 5de831bb8..79fd4e178 100644 --- a/sdk/sourcefiles/native/internal/ANNativeAdResponse.m +++ b/sdk/sourcefiles/native/internal/ANNativeAdResponse.m @@ -52,7 +52,7 @@ @interface ANNativeAdResponse() @property (nonatomic, readwrite, assign) ANNativeAdNetworkCode networkCode; @property (nonatomic, readwrite, strong) OMIDAppnexusAdSession *omidAdSession; @property (nonatomic, readwrite, strong) ANVerificationScriptResource *verificationScriptResource; -@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *unifiedObject; +@property (nonatomic, readwrite, strong) ANCustomResponse *customResponse; @end diff --git a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h index f1299e573..264052fdf 100644 --- a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h +++ b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h @@ -39,6 +39,6 @@ @property (nonatomic, readwrite, strong) NSString *privacyLink; @property (nonatomic, readwrite, strong) NSString *nativeRenderingUrl; @property (nonatomic, readwrite, strong) NSString *nativeRenderingObject; -@property (nonatomic, readwrite, strong) ANSingleUnifiedObject *unifiedObject; +@property (nonatomic, readwrite, strong) ANCustomResponse *customResponse; @end diff --git a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m index 481415cd0..f0e3b7042 100644 --- a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m +++ b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m @@ -64,7 +64,7 @@ @implementation ANNativeStandardAdResponse @synthesize privacyLink = _privacyLink; @synthesize nativeRenderingUrl = _nativeRenderingUrl; @synthesize nativeRenderingObject = _nativeRenderingObject; -@synthesize unifiedObject = _unifiedObject; +@synthesize customResponse = _customResponse; #pragma mark - Lifecycle. diff --git a/sdk/sourcefiles/video/ANInstreamVideoAd.m b/sdk/sourcefiles/video/ANInstreamVideoAd.m index 9d6cb8b58..145023827 100644 --- a/sdk/sourcefiles/video/ANInstreamVideoAd.m +++ b/sdk/sourcefiles/video/ANInstreamVideoAd.m @@ -403,9 +403,9 @@ - (void) universalAdFetcher: (ANUniversalAdFetcher *)fetcher self.adPlayer = (ANVideoAdPlayer *) response.adObject; self.adPlayer.delegate = self; - ANSingleUnifiedObject *unifiedObject = (ANSingleUnifiedObject *) [ANGlobal valueOfGetterProperty:kANSingleUnifiedObject forObject:response.adObjectHandler]; - if (unifiedObject) { - [self setUnifiedObject:unifiedObject]; + ANCustomResponse *customResponse = (ANCustomResponse *) [ANGlobal valueOfGetterProperty:kANCustomResponse forObject:response.adObjectHandler]; + if (customResponse) { + [self setCustomResponse:customResponse]; } [self videoAdReady]; From cff02b5aa4242375b04217f8feebb9b1cf873f2c Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Mon, 16 Sep 2019 16:06:57 +0530 Subject: [PATCH 07/35] code cleanup --- sdk/sourcefiles/ANCustomResponse.h | 3 +++ sdk/sourcefiles/ANCustomResponse.m | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/sourcefiles/ANCustomResponse.h b/sdk/sourcefiles/ANCustomResponse.h index 91b6255f1..499e9807e 100644 --- a/sdk/sourcefiles/ANCustomResponse.h +++ b/sdk/sourcefiles/ANCustomResponse.h @@ -30,6 +30,9 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, readwrite) ANAdType adType; +/** + An AppNexus tagId for the current ad object that is displayed + */ @property (nonatomic, readwrite) NSString *tagId; @end diff --git a/sdk/sourcefiles/ANCustomResponse.m b/sdk/sourcefiles/ANCustomResponse.m index e6d56ba0c..026fc2e9c 100644 --- a/sdk/sourcefiles/ANCustomResponse.m +++ b/sdk/sourcefiles/ANCustomResponse.m @@ -15,8 +15,6 @@ #import "ANCustomResponse.h" -static NSString *const kANUniversalTagAdServerResponseKeyAdsCreativeId = @"creative_id"; - @implementation ANCustomResponse @synthesize creativeId, adType, tagId; From d9219af74ebb350c21387c6f7f9bd145c570f16f Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Mon, 16 Sep 2019 16:10:18 +0530 Subject: [PATCH 08/35] code cleanup --- sdk/sourcefiles/ANCustomResponse.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sdk/sourcefiles/ANCustomResponse.h b/sdk/sourcefiles/ANCustomResponse.h index 499e9807e..1d044aac9 100644 --- a/sdk/sourcefiles/ANCustomResponse.h +++ b/sdk/sourcefiles/ANCustomResponse.h @@ -16,8 +16,6 @@ #import #import "ANAdConstants.h" -NS_ASSUME_NONNULL_BEGIN - @interface ANCustomResponse : NSObject /** An AppNexus creativeID for the current creative that is displayed @@ -31,10 +29,9 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readwrite) ANAdType adType; /** - An AppNexus tagId for the current ad object that is displayed + An AppNexus tagId for the current ad object which is placementID that is displayed */ -@property (nonatomic, readwrite) NSString *tagId; +@property (nonatomic, readwrite, strong, nullable) NSString *tagId; @end -NS_ASSUME_NONNULL_END From 712bacf158315cf7daf7e4256ac0a12c7613c8ad Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Fri, 1 Nov 2019 17:08:24 +0530 Subject: [PATCH 09/35] added deprecated properties --- sdk/sourcefiles/ANAdProtocol.h | 14 ++++++++++ .../Categories/ANAdView+PrivateMethods.h | 1 + sdk/sourcefiles/internal/ANAdView.m | 28 +++++++++++++++++++ sdk/sourcefiles/internal/ANBannerAdView.m | 14 ++++++++++ sdk/sourcefiles/internal/ANBaseAdObject.h | 2 ++ sdk/sourcefiles/internal/ANGlobal.h | 2 +- sdk/sourcefiles/internal/ANInterstitialAd.m | 4 +++ .../internal/ANUniversalTagAdServerResponse.m | 6 ++++ sdk/sourcefiles/native/ANNativeAdResponse.h | 6 ++++ .../native/internal/ANNativeAdRequest.m | 12 ++++++++ .../internal/ANNativeStandardAdResponse.h | 1 + .../internal/ANNativeStandardAdResponse.m | 1 + sdk/sourcefiles/video/ANInstreamVideoAd.m | 5 ++++ 13 files changed, 95 insertions(+), 1 deletion(-) diff --git a/sdk/sourcefiles/ANAdProtocol.h b/sdk/sourcefiles/ANAdProtocol.h index 36410fdd0..de3d30d81 100644 --- a/sdk/sourcefiles/ANAdProtocol.h +++ b/sdk/sourcefiles/ANAdProtocol.h @@ -88,6 +88,13 @@ */ @property (nonatomic, readwrite, strong, nullable) NSString *externalUid; +/** + Report the Ad Type of the returned ad object. + Not available until load is complete and successful. + */ +@property (nonatomic, readwrite) ANAdType adType DEPRECATED_MSG_ATTRIBUTE("Use ANCustomResponse instead."); + + /** Set the user's current location. This allows ad buyers to do location targeting, which can increase spend. @@ -208,6 +215,13 @@ @protocol ANAdProtocol +/** + An AppNexus creativeID for the current creative that is displayed + */ +// CreativeId should be accessible from response Object only(like. ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). It is placed into ANAdProtocol instead of ANAdProtocolFoundation to avoid creativeID being accessed through ANNativeAdRequest. +@property (nonatomic, readonly, strong, nullable) NSString *creativeId DEPRECATED_MSG_ATTRIBUTE("Use ANCustomResponse instead."); + + @end diff --git a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h index 0c7564bf0..3492073cb 100644 --- a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h +++ b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h @@ -36,6 +36,7 @@ - (void)loadAdFromVast: (NSString *)xml width: (int)width height: (int)height; +- (void)setCreativeId:(NSString *)creativeId; - (void)setCustomResponse:(ANCustomResponse *)customResponse; @end diff --git a/sdk/sourcefiles/internal/ANAdView.m b/sdk/sourcefiles/internal/ANAdView.m index 25322903a..0453430a4 100644 --- a/sdk/sourcefiles/internal/ANAdView.m +++ b/sdk/sourcefiles/internal/ANAdView.m @@ -61,6 +61,8 @@ @implementation ANAdView @synthesize gender = __gender; @synthesize customKeywords = __customKeywords; +@synthesize creativeId = __creativeId; +@synthesize adType = __adType; @synthesize externalUid = __externalUid; @synthesize clickThroughAction = __clickThroughAction; @@ -188,6 +190,27 @@ - (void)loadAdFromVast: (NSString *)xml width: (int)width #pragma mark - ANAdProtocol: Setter methods +- (void)setCreativeId:(NSString *)creativeId { + creativeId = ANConvertToNSString(creativeId); + if ([creativeId length] < 1) { + ANLogError(@"Could not set creativeId to non-string value"); + return; + } + if (creativeId != __creativeId) { + ANLogDebug(@"Setting creativeId to %@", creativeId); + __creativeId = creativeId; + } +} + + +- (void)setAdType:(ANAdType)adType +{ + if (adType != __adType) { + ANLogDebug(@"Setting adType to %@", @(adType)); + __adType = adType; + } +} + - (void)setCustomResponse:(ANCustomResponse *)customResponse { if (!customResponse) { ANLogError(@"Could not set customResponse"); @@ -346,6 +369,11 @@ - (ANGender)gender { return __gender; } +- (nullable NSString *)creativeId { + ANLogDebug(@"Creative Id returned %@", __creativeId); + return __creativeId; +} + -(nullable NSString *)externalUid { ANLogDebug(@"ExternalUid returned %@", __externalUid); return __externalUid; diff --git a/sdk/sourcefiles/internal/ANBannerAdView.m b/sdk/sourcefiles/internal/ANBannerAdView.m index 16eee98c3..1a2dd5a68 100644 --- a/sdk/sourcefiles/internal/ANBannerAdView.m +++ b/sdk/sourcefiles/internal/ANBannerAdView.m @@ -36,6 +36,7 @@ #import "ANNativeAdResponse+PrivateMethods.h" #import "ANNativeRenderingViewController.h" +static NSString *const kANAdType = @"adType"; static NSString *const kANBannerWidth = @"width"; static NSString *const kANBannerHeight = @"height"; static NSString *const kANInline = @"inline"; @@ -352,6 +353,16 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR if (_customResponse) { [self setCustomResponse:_customResponse]; } + + NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:adObjectHandler]; + if (creativeId) { + [self setCreativeId:creativeId]; + } + + NSString *adTypeString = (NSString *) [ANGlobal valueOfGetterProperty:kANAdType forObject:adObjectHandler]; + if (adTypeString) { + [self setAdType:[ANGlobal adTypeStringToEnum:adTypeString]]; + } if ([adObject isKindOfClass:[UIView class]]) { @@ -397,6 +408,9 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR } else if ([adObject isKindOfClass:[ANNativeAdResponse class]]) { ANNativeAdResponse *nativeAdResponse = (ANNativeAdResponse *)response.adObject; + + self.creativeId = nativeAdResponse.creativeId; + self.adType = ANAdTypeNative; nativeAdResponse.clickThroughAction = self.clickThroughAction; nativeAdResponse.landingPageLoadsInBackground = self.landingPageLoadsInBackground; diff --git a/sdk/sourcefiles/internal/ANBaseAdObject.h b/sdk/sourcefiles/internal/ANBaseAdObject.h index 0fd688257..f2175349d 100644 --- a/sdk/sourcefiles/internal/ANBaseAdObject.h +++ b/sdk/sourcefiles/internal/ANBaseAdObject.h @@ -23,6 +23,8 @@ @property (nonatomic, readwrite, strong) NSString *height; @property (nonatomic, readwrite, strong) NSString *width; +@property (nonatomic, readwrite, strong) NSString *adType; +@property (nonatomic, readwrite, strong) NSString *creativeId; @property (nonatomic, readwrite, strong) NSArray *impressionUrls; @property (nonatomic, readwrite, strong) ANCustomResponse *customResponse; diff --git a/sdk/sourcefiles/internal/ANGlobal.h b/sdk/sourcefiles/internal/ANGlobal.h index cbddcb139..fe704c8c6 100644 --- a/sdk/sourcefiles/internal/ANGlobal.h +++ b/sdk/sourcefiles/internal/ANGlobal.h @@ -125,7 +125,7 @@ NSURLRequest * __nonnull ANBasicRequestWithURL(NSURL * __nonnull URL); NSNumber * __nullable ANiTunesIDForURL(NSURL * __nonnull URL); BOOL ANCanPresentFromViewController(UIViewController * __nullable viewController); - +static NSString * __nonnull const kANCreativeId= @"creativeId"; static NSString * __nonnull const kANImpressionUrls = @"impressionUrls"; static NSString * __nonnull const kANAspectRatio = @"aspectRatio"; static NSString * __nonnull const kANCustomResponse= @"customResponse"; diff --git a/sdk/sourcefiles/internal/ANInterstitialAd.m b/sdk/sourcefiles/internal/ANInterstitialAd.m index 3fe432083..946cfd496 100644 --- a/sdk/sourcefiles/internal/ANInterstitialAd.m +++ b/sdk/sourcefiles/internal/ANInterstitialAd.m @@ -319,6 +319,10 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR if (customResponse) { [self setCustomResponse:customResponse]; } + NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:response.adObjectHandler]; + if(creativeId){ + [self setCreativeId:creativeId]; + } NSMutableDictionary *adViewWithDateLoaded = [NSMutableDictionary dictionaryWithObjectsAndKeys: response.adObject, kANInterstitialAdViewKey, diff --git a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m index 04c206dd3..37f2757c8 100644 --- a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m +++ b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m @@ -250,6 +250,7 @@ - (void)processResponseData:(NSData *)data if ([adType isEqualToString:kANUniversalTagAdServerResponseKeyBannerObject]) { ANStandardAd *standardAd = [[self class] standardAdFromRTBObject:rtbObject]; if (standardAd) { + standardAd.creativeId = creativeId; [self.ads addObject:standardAd]; } @@ -257,6 +258,7 @@ - (void)processResponseData:(NSData *)data } else if([adType isEqualToString:kANUniversalTagAdServerResponseKeyVideoObject]){ ANRTBVideoAd *videoAd = [[self class] videoAdFromRTBObject:rtbObject]; if (videoAd) { + videoAd.creativeId = creativeId; videoAd.notifyUrlString = [adObject[kANUniversalTagAdServerResponseKeyAdsNotifyUrl] description]; [self.ads addObject:videoAd]; @@ -265,6 +267,7 @@ - (void)processResponseData:(NSData *)data } else if([adType isEqualToString:kANUniversalTagAdServerResponseKeyNativeObject]) { ANNativeStandardAdResponse *nativeAd = [[self class] nativeAdFromRTBObject:rtbObject]; if (nativeAd) { + nativeAd.creativeId = creativeId; nativeAd.customResponse = customResponse; if(adObject[kANUniversalTagAdServerResponseKeyAdsRendererUrl] != nil) { @@ -305,6 +308,7 @@ - (void)processResponseData:(NSData *)data mediatedAd.verificationScriptResource = verificationScriptResource; } } + mediatedAd.creativeId = creativeId; if (mediatedAd.className.length > 0) { [self.ads addObject:mediatedAd]; } @@ -328,6 +332,7 @@ - (void)processResponseData:(NSData *)data if (ssmObject) { ANSSMStandardAd *ssmStandardAd = [[self class] standardSSMAdFromSSMObject:ssmObject]; if (ssmStandardAd) { + ssmStandardAd.creativeId = creativeId; [self.ads addObject:ssmStandardAd]; } } @@ -345,6 +350,7 @@ - (void)processResponseData:(NSData *)data if ([lastAdsObject isKindOfClass:[ANBaseAdObject class]]) { ANBaseAdObject *baseAdObject = (ANBaseAdObject *)lastAdsObject; + baseAdObject.adType = [adType copy]; baseAdObject.customResponse = customResponse; } diff --git a/sdk/sourcefiles/native/ANNativeAdResponse.h b/sdk/sourcefiles/native/ANNativeAdResponse.h index 6199708fb..b7271740b 100644 --- a/sdk/sourcefiles/native/ANNativeAdResponse.h +++ b/sdk/sourcefiles/native/ANNativeAdResponse.h @@ -119,6 +119,12 @@ extern NSString * __nonnull const kANNativeElementObject; @property (nonatomic, readonly, strong, nullable) NSString *sponsoredBy; +/*! + * An AppNexus creativeID for the current creative that is displayed + */ +@property (nonatomic, readonly, strong, nullable) NSString *creativeId DEPRECATED_MSG_ATTRIBUTE("Use ANCustomResponse instead."); + + /*! * Additional description of the ad */ diff --git a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m index 7cfb4ef73..1695bfb68 100644 --- a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m +++ b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m @@ -51,6 +51,7 @@ @implementation ANNativeAdRequest @synthesize customKeywords = __customKeywords; @synthesize externalUid = __externalUid; +@synthesize adType = __adType; @synthesize rendererId = _rendererId; @@ -130,6 +131,11 @@ -(void)didFinishRequestWithResponse: (nonnull ANAdFetcherResponse *)response [self setCustomResponse:customResponse onObject:nativeResponse forKeyPath:kANCustomResponse]; } } + // + if (nativeResponse.creativeId == nil) { + NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:response.adObjectHandler]; + [self setCreativeId:creativeId onObject:nativeResponse forKeyPath:kANCreativeId]; + } // dispatch_queue_t backgroundQueue = dispatch_queue_create(__PRETTY_FUNCTION__, DISPATCH_QUEUE_SERIAL); @@ -205,6 +211,12 @@ - (NSDictionary *) internalDelegateUniversalTagSizeParameters // #pragma mark - ANUniversalAdFetcherFoundationDelegate helper methods. +- (void)setCreativeId:(NSString *)creativeId + onObject:(id)object forKeyPath:(NSString *)keyPath +{ + [object setValue:creativeId forKeyPath:keyPath]; +} + - (void)setCustomResponse:(ANCustomResponse *)customResponse onObject:(id)object forKeyPath:(NSString *)keyPath { diff --git a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h index 264052fdf..3d810b441 100644 --- a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h +++ b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h @@ -29,6 +29,7 @@ @property (nonatomic, readwrite, strong) NSURL *iconImageURL; @property (nonatomic, readwrite, strong) NSDictionary *customElements; @property (nonatomic, readwrite, strong) NSString *adObjectMediaType; +@property (nonatomic, readwrite, strong) NSString *creativeId; @property (nonatomic, readwrite, strong) NSString *additionalDescription; @property (nonatomic, readwrite, strong) NSArray *clickTrackers; @property (nonatomic, readwrite, strong) NSArray *impTrackers; diff --git a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m index f0e3b7042..5b74f2f56 100644 --- a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m +++ b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m @@ -59,6 +59,7 @@ @implementation ANNativeStandardAdResponse @synthesize networkCode = _networkCode; @synthesize expired = _expired; @synthesize sponsoredBy = _sponsoredBy; +@synthesize creativeId = _creativeId; @synthesize additionalDescription = _additionalDescription; @synthesize vastXML = _vastXML; @synthesize privacyLink = _privacyLink; diff --git a/sdk/sourcefiles/video/ANInstreamVideoAd.m b/sdk/sourcefiles/video/ANInstreamVideoAd.m index 145023827..991d70c46 100644 --- a/sdk/sourcefiles/video/ANInstreamVideoAd.m +++ b/sdk/sourcefiles/video/ANInstreamVideoAd.m @@ -407,6 +407,11 @@ - (void) universalAdFetcher: (ANUniversalAdFetcher *)fetcher if (customResponse) { [self setCustomResponse:customResponse]; } + + NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:response.adObjectHandler]; + if(creativeId){ + [self setCreativeId:creativeId]; + } [self videoAdReady]; From c44d469aee2f27badbd0aa37c0501680e9834525 Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Fri, 1 Nov 2019 17:22:37 +0530 Subject: [PATCH 10/35] Rename AdResponse --- sdk/AppNexusSDK.xcodeproj/project.pbxproj | 24 +++++++++---------- sdk/sourcefiles/ANAdProtocol.h | 16 ++++++------- .../{ANCustomResponse.h => ANAdResponse.h} | 2 +- .../{ANCustomResponse.m => ANAdResponse.m} | 4 ++-- .../Categories/ANAdView+PrivateMethods.h | 2 +- sdk/sourcefiles/internal/ANAdView.m | 22 ++++++++--------- sdk/sourcefiles/internal/ANBannerAdView.m | 12 +++++----- sdk/sourcefiles/internal/ANBaseAdObject.h | 4 ++-- sdk/sourcefiles/internal/ANCSMVideoAd.h | 4 ++-- sdk/sourcefiles/internal/ANGlobal.h | 2 +- sdk/sourcefiles/internal/ANInterstitialAd.m | 6 ++--- .../internal/ANUniversalTagAdServerResponse.m | 16 ++++++------- sdk/sourcefiles/native/ANNativeAdResponse.h | 2 +- .../native/internal/ANNativeAdRequest.m | 12 +++++----- .../native/internal/ANNativeAdResponse.m | 2 +- .../internal/ANNativeStandardAdResponse.h | 2 +- .../internal/ANNativeStandardAdResponse.m | 2 +- sdk/sourcefiles/video/ANInstreamVideoAd.m | 6 ++--- 18 files changed, 70 insertions(+), 70 deletions(-) rename sdk/sourcefiles/{ANCustomResponse.h => ANAdResponse.h} (96%) rename sdk/sourcefiles/{ANCustomResponse.m => ANAdResponse.m} (90%) diff --git a/sdk/AppNexusSDK.xcodeproj/project.pbxproj b/sdk/AppNexusSDK.xcodeproj/project.pbxproj index 143f8ea06..719008849 100644 --- a/sdk/AppNexusSDK.xcodeproj/project.pbxproj +++ b/sdk/AppNexusSDK.xcodeproj/project.pbxproj @@ -220,10 +220,10 @@ 8AFC046F1A2E75AE00BEA485 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AFC046E1A2E75AE00BEA485 /* AdSupport.framework */; }; 8AFC04711A2E760800BEA485 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AFC04701A2E760800BEA485 /* MessageUI.framework */; }; 8AFC04731A2E78E400BEA485 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AFC04721A2E78E400BEA485 /* StoreKit.framework */; }; - 9706554F232B93A200D484D4 /* ANCustomResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANCustomResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 97065550232B93A200D484D4 /* ANCustomResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANCustomResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 97065551232B93A200D484D4 /* ANCustomResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANCustomResponse.m */; }; - 97065552232B93A200D484D4 /* ANCustomResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANCustomResponse.m */; }; + 9706554F232B93A200D484D4 /* ANAdResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANAdResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 97065550232B93A200D484D4 /* ANAdResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANAdResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 97065551232B93A200D484D4 /* ANAdResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANAdResponse.m */; }; + 97065552232B93A200D484D4 /* ANAdResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANAdResponse.m */; }; 972025CE222FD90E00C13454 /* ANVerificationScriptResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 97EC51EB2229782B00B740DF /* ANVerificationScriptResource.h */; settings = {ATTRIBUTES = (Private, ); }; }; 97EC51EF2229782B00B740DF /* ANVerificationScriptResource.m in Sources */ = {isa = PBXBuildFile; fileRef = 97EC51EC2229782B00B740DF /* ANVerificationScriptResource.m */; }; 9EEE4E50214FD2100056C5DD /* ANCarrierObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EEE4E4E214FD2100056C5DD /* ANCarrierObserver.h */; }; @@ -511,8 +511,8 @@ 8AFC046E1A2E75AE00BEA485 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; 8AFC04701A2E760800BEA485 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; }; 8AFC04721A2E78E400BEA485 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; - 9706554D232B93A200D484D4 /* ANCustomResponse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ANCustomResponse.h; sourceTree = ""; }; - 9706554E232B93A200D484D4 /* ANCustomResponse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ANCustomResponse.m; sourceTree = ""; }; + 9706554D232B93A200D484D4 /* ANAdResponse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ANAdResponse.h; sourceTree = ""; }; + 9706554E232B93A200D484D4 /* ANAdResponse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ANAdResponse.m; sourceTree = ""; }; 97A590D2228EBBD600D1C75C /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; 97A590D4228EBBE800D1C75C /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 97A590D6228EBBF600D1C75C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -640,8 +640,8 @@ 8A02D6EC1D6CE014006831A3 /* ANSDKSettings.h */, ECE4EA94194B768A0069D934 /* ANTargetingParameters.h */, 60D39E1322570FE20029F741 /* ANVideoPlayerSettings.h */, - 9706554D232B93A200D484D4 /* ANCustomResponse.h */, - 9706554E232B93A200D484D4 /* ANCustomResponse.m */, + 9706554D232B93A200D484D4 /* ANAdResponse.h */, + 9706554E232B93A200D484D4 /* ANAdResponse.m */, ); path = sourcefiles; sourceTree = ""; @@ -1037,7 +1037,7 @@ F52B044122AECD6B00985B62 /* NSObject+ANCategory.h in Headers */, 8A9AEDC71A1BF88200C58BDA /* NSString+ANCategory.h in Headers */, 8A9AEDC81A1BF88200C58BDA /* NSTimer+ANCategory.h in Headers */, - 9706554F232B93A200D484D4 /* ANCustomResponse.h in Headers */, + 9706554F232B93A200D484D4 /* ANAdResponse.h in Headers */, 8A9AEDC91A1BF88200C58BDA /* UIView+ANCategory.h in Headers */, 8A9AEDE61A1BF88300C58BDA /* UIView+ANNativeAdCategory.h in Headers */, 602E0E271FE46818002C0F1C /* WKWebView+ANCategory.h in Headers */, @@ -1048,7 +1048,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 97065550232B93A200D484D4 /* ANCustomResponse.h in Headers */, + 97065550232B93A200D484D4 /* ANAdResponse.h in Headers */, F5731BB7228C99350012B134 /* ANAdConstants.h in Headers */, 006F6B9F2295F72A003D2DF0 /* ANAdFetcherBase.h in Headers */, F5731B7A228C94720012B134 /* ANAdFetcherResponse.h in Headers */, @@ -1286,7 +1286,7 @@ 8AC65F6C1A40DE74006BCF39 /* ANMRAIDResizeProperties.m in Sources */, 8AC65F6E1A40DE74006BCF39 /* ANMRAIDResizeView.m in Sources */, 8AC65F701A40DE74006BCF39 /* ANMRAIDResizeViewManager.m in Sources */, - 97065551232B93A200D484D4 /* ANCustomResponse.m in Sources */, + 97065551232B93A200D484D4 /* ANAdResponse.m in Sources */, 8AC65F721A40DE74006BCF39 /* ANMRAIDUtil.m in Sources */, F5731BCF228F07FC0012B134 /* ANNativeAdFetcher.m in Sources */, 8A9AEE061A1BF99D00C58BDA /* ANNativeAdImageCache.m in Sources */, @@ -1349,7 +1349,7 @@ F5731B40228C8CB40012B134 /* ANNativeAdImageCache.m in Sources */, F5731B41228C8CBB0012B134 /* ANNativeAdRequest.m in Sources */, F5731B43228C8CCC0012B134 /* ANNativeAdResponse.m in Sources */, - 97065552232B93A200D484D4 /* ANCustomResponse.m in Sources */, + 97065552232B93A200D484D4 /* ANAdResponse.m in Sources */, F5731B44228C8CD10012B134 /* ANNativeAdStarRating.m in Sources */, F5731B46228C8CE40012B134 /* ANNativeMediatedAdController.m in Sources */, F5731B48228C8CF80012B134 /* ANNativeMediatedAdResponse.m in Sources */, diff --git a/sdk/sourcefiles/ANAdProtocol.h b/sdk/sourcefiles/ANAdProtocol.h index de3d30d81..de75453c7 100644 --- a/sdk/sourcefiles/ANAdProtocol.h +++ b/sdk/sourcefiles/ANAdProtocol.h @@ -19,7 +19,7 @@ #import "ANAdConstants.h" #import "ANLocation.h" -#import "ANCustomResponse.h" +#import "ANAdResponse.h" @class ANLocation; @@ -92,7 +92,7 @@ Report the Ad Type of the returned ad object. Not available until load is complete and successful. */ -@property (nonatomic, readwrite) ANAdType adType DEPRECATED_MSG_ATTRIBUTE("Use ANCustomResponse instead."); +@property (nonatomic, readwrite) ANAdType adType DEPRECATED_MSG_ATTRIBUTE("Use ANAdResponse instead."); /** @@ -143,17 +143,17 @@ @end //ANAdProtocolFoundation -@protocol ANAdProtocolCustomResponse +@protocol ANAdProtocolAdResponse /** An AppNexus Single Unified object that will contain all the common fields of all the ads types that are returned in the UTv3 response */ -// ANCustomResponse should be accessible from response Object only(like. ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). It is placed into ANAdProtocolCustomResponse. -@property (nonatomic, readonly, strong, nullable) ANCustomResponse *customResponse; +// ANAdResponse should be accessible from response Object only(like. ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). It is placed into ANAdProtocolAdResponse. +@property (nonatomic, readonly, strong, nullable) ANAdResponse *adResponse; @end -@protocol ANAdProtocolBrowser +@protocol ANAdProtocolBrowser /** Determines what action to take when the user clicks on an ad: @@ -213,13 +213,13 @@ #pragma mark - ANAdProtocol entrypoint combinations. -@protocol ANAdProtocol +@protocol ANAdProtocol /** An AppNexus creativeID for the current creative that is displayed */ // CreativeId should be accessible from response Object only(like. ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). It is placed into ANAdProtocol instead of ANAdProtocolFoundation to avoid creativeID being accessed through ANNativeAdRequest. -@property (nonatomic, readonly, strong, nullable) NSString *creativeId DEPRECATED_MSG_ATTRIBUTE("Use ANCustomResponse instead."); +@property (nonatomic, readonly, strong, nullable) NSString *creativeId DEPRECATED_MSG_ATTRIBUTE("Use ANAdResponse instead."); @end diff --git a/sdk/sourcefiles/ANCustomResponse.h b/sdk/sourcefiles/ANAdResponse.h similarity index 96% rename from sdk/sourcefiles/ANCustomResponse.h rename to sdk/sourcefiles/ANAdResponse.h index 1d044aac9..a5e4ae10f 100644 --- a/sdk/sourcefiles/ANCustomResponse.h +++ b/sdk/sourcefiles/ANAdResponse.h @@ -16,7 +16,7 @@ #import #import "ANAdConstants.h" -@interface ANCustomResponse : NSObject +@interface ANAdResponse : NSObject /** An AppNexus creativeID for the current creative that is displayed */ diff --git a/sdk/sourcefiles/ANCustomResponse.m b/sdk/sourcefiles/ANAdResponse.m similarity index 90% rename from sdk/sourcefiles/ANCustomResponse.m rename to sdk/sourcefiles/ANAdResponse.m index 026fc2e9c..008337406 100644 --- a/sdk/sourcefiles/ANCustomResponse.m +++ b/sdk/sourcefiles/ANAdResponse.m @@ -13,9 +13,9 @@ limitations under the License. */ -#import "ANCustomResponse.h" +#import "ANAdResponse.h" -@implementation ANCustomResponse +@implementation ANAdResponse @synthesize creativeId, adType, tagId; diff --git a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h index 3492073cb..87a16e390 100644 --- a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h +++ b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h @@ -37,6 +37,6 @@ height: (int)height; - (void)setCreativeId:(NSString *)creativeId; -- (void)setCustomResponse:(ANCustomResponse *)customResponse; +- (void)setAdResponse:(ANAdResponse *)adResponse; @end diff --git a/sdk/sourcefiles/internal/ANAdView.m b/sdk/sourcefiles/internal/ANAdView.m index 0453430a4..692f095f4 100644 --- a/sdk/sourcefiles/internal/ANAdView.m +++ b/sdk/sourcefiles/internal/ANAdView.m @@ -68,7 +68,7 @@ @implementation ANAdView @synthesize clickThroughAction = __clickThroughAction; @synthesize landingPageLoadsInBackground = __landingPageLoadsInBackground; -@synthesize customResponse = __customResponse; +@synthesize adResponse = __adResponse; #pragma mark - Initialization @@ -211,14 +211,14 @@ - (void)setAdType:(ANAdType)adType } } -- (void)setCustomResponse:(ANCustomResponse *)customResponse { - if (!customResponse) { - ANLogError(@"Could not set customResponse"); +- (void)setAdResponse:(ANAdResponse *)adResponse { + if (!adResponse) { + ANLogError(@"Could not set adResponse"); return; } - if (customResponse != __customResponse) { - ANLogDebug(@"Setting customResponse to %@", customResponse); - __customResponse = customResponse; + if (adResponse != __adResponse) { + ANLogDebug(@"Setting adResponse to %@", adResponse); + __adResponse = adResponse; } } @@ -314,9 +314,9 @@ - (void)setClickThroughAction:(ANClickThroughAction)clickThroughAction #pragma mark - ANAdProtocol: Getter methods -- (nullable ANCustomResponse *)customResponse { - ANLogDebug(@"ANCustomResponse returned %@", __customResponse); - return __customResponse; +- (nullable ANAdResponse *)adResponse { + ANLogDebug(@"ANAdResponse returned %@", __adResponse); + return __adResponse; } - (nullable NSString *)placementId { @@ -503,7 +503,7 @@ - (void)adInteractionDidEnd { ANLogDebug(@""); - if (ANAdTypeVideo != __customResponse.adType) { + if (ANAdTypeVideo != __adResponse.adType) { [self.universalAdFetcher restartAutoRefreshTimer]; [self.universalAdFetcher startAutoRefreshTimer]; } diff --git a/sdk/sourcefiles/internal/ANBannerAdView.m b/sdk/sourcefiles/internal/ANBannerAdView.m index 1a2dd5a68..4e8ce795f 100644 --- a/sdk/sourcefiles/internal/ANBannerAdView.m +++ b/sdk/sourcefiles/internal/ANBannerAdView.m @@ -71,7 +71,7 @@ @implementation ANBannerAdView @synthesize shouldAllowNativeDemand = _shouldAllowNativeDemand; @synthesize nativeAdRendererId = _nativeAdRendererId; @synthesize enableNativeRendering = _enableNativeRendering; -@synthesize customResponse = _customResponse; +@synthesize adResponse = _adResponse; #pragma mark - Lifecycle. @@ -349,9 +349,9 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR self.contentView = nil; self.impressionURLs = nil; - _customResponse = (ANCustomResponse *) [ANGlobal valueOfGetterProperty:kANCustomResponse forObject:adObjectHandler]; - if (_customResponse) { - [self setCustomResponse:_customResponse]; + _adResponse = (ANAdResponse *) [ANGlobal valueOfGetterProperty:kANAdResponse forObject:adObjectHandler]; + if (_adResponse) { + [self setAdResponse:_adResponse]; } NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:adObjectHandler]; @@ -387,7 +387,7 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR } [self adDidReceiveAd:self]; - if (_customResponse.adType == ANAdTypeBanner && !([adObjectHandler isKindOfClass:[ANNativeStandardAdResponse class]])) + if (_adResponse.adType == ANAdTypeBanner && !([adObjectHandler isKindOfClass:[ANNativeStandardAdResponse class]])) { self.impressionURLs = (NSArray *) [ANGlobal valueOfGetterProperty:kANImpressionUrls forObject:adObjectHandler]; @@ -531,7 +531,7 @@ - (UIViewController *)displayController - (void)didMoveToWindow { - if (self.contentView && ( _customResponse.adType == ANAdTypeBanner)) { + if (self.contentView && ( _adResponse.adType == ANAdTypeBanner)) { [ANTrackerManager fireTrackerURLArray:self.impressionURLs]; self.impressionURLs = nil; diff --git a/sdk/sourcefiles/internal/ANBaseAdObject.h b/sdk/sourcefiles/internal/ANBaseAdObject.h index f2175349d..fa93b0824 100644 --- a/sdk/sourcefiles/internal/ANBaseAdObject.h +++ b/sdk/sourcefiles/internal/ANBaseAdObject.h @@ -14,7 +14,7 @@ */ #import -#import "ANCustomResponse.h" +#import "ANAdResponse.h" @interface ANBaseAdObject : NSObject @@ -26,6 +26,6 @@ @property (nonatomic, readwrite, strong) NSString *adType; @property (nonatomic, readwrite, strong) NSString *creativeId; @property (nonatomic, readwrite, strong) NSArray *impressionUrls; -@property (nonatomic, readwrite, strong) ANCustomResponse *customResponse; +@property (nonatomic, readwrite, strong) ANAdResponse *adResponse; @end diff --git a/sdk/sourcefiles/internal/ANCSMVideoAd.h b/sdk/sourcefiles/internal/ANCSMVideoAd.h index 0966d2dff..3f25be34b 100644 --- a/sdk/sourcefiles/internal/ANCSMVideoAd.h +++ b/sdk/sourcefiles/internal/ANCSMVideoAd.h @@ -15,12 +15,12 @@ */ #import -#import "ANCustomResponse.h" +#import "ANAdResponse.h" @interface ANCSMVideoAd : NSObject @property (nonatomic, readwrite, strong) NSDictionary *adDictionary; -@property (nonatomic, readwrite, strong) ANCustomResponse *customResponse; +@property (nonatomic, readwrite, strong) ANAdResponse *adResponse; @end diff --git a/sdk/sourcefiles/internal/ANGlobal.h b/sdk/sourcefiles/internal/ANGlobal.h index fe704c8c6..bdfed0742 100644 --- a/sdk/sourcefiles/internal/ANGlobal.h +++ b/sdk/sourcefiles/internal/ANGlobal.h @@ -128,7 +128,7 @@ BOOL ANCanPresentFromViewController(UIViewController * __nullable viewController static NSString * __nonnull const kANCreativeId= @"creativeId"; static NSString * __nonnull const kANImpressionUrls = @"impressionUrls"; static NSString * __nonnull const kANAspectRatio = @"aspectRatio"; -static NSString * __nonnull const kANCustomResponse= @"customResponse"; +static NSString * __nonnull const kANAdResponse= @"adResponse"; #pragma mark - Global class. diff --git a/sdk/sourcefiles/internal/ANInterstitialAd.m b/sdk/sourcefiles/internal/ANInterstitialAd.m index 946cfd496..083fcf5c4 100644 --- a/sdk/sourcefiles/internal/ANInterstitialAd.m +++ b/sdk/sourcefiles/internal/ANInterstitialAd.m @@ -315,9 +315,9 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR [self adRequestFailedWithError:response.error]; return; } - ANCustomResponse *customResponse = (ANCustomResponse *) [ANGlobal valueOfGetterProperty:kANCustomResponse forObject:response.adObjectHandler]; - if (customResponse) { - [self setCustomResponse:customResponse]; + ANAdResponse *adResponse = (ANAdResponse *) [ANGlobal valueOfGetterProperty:kANAdResponse forObject:response.adObjectHandler]; + if (adResponse) { + [self setAdResponse:adResponse]; } NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:response.adObjectHandler]; if(creativeId){ diff --git a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m index 37f2757c8..10c05ee1f 100644 --- a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m +++ b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m @@ -25,7 +25,7 @@ #import "ANAdConstants.h" #import "ANNativeStandardAdResponse.h" #import "ANNativeAdResponse+PrivateMethods.h" -#import "ANCustomResponse.h" +#import "ANAdResponse.h" #import "ANGlobal.h" @@ -235,10 +235,10 @@ - (void)processResponseData:(NSData *)data tagId = [NSString stringWithFormat:@"%@",firstTag[kANUniversalTagAdServerResponseKeyAdsTagId]]; } - ANCustomResponse *customResponse = [[ANCustomResponse alloc] init]; - customResponse.creativeId = creativeId; - customResponse.tagId = tagId; - customResponse.adType = [ANGlobal adTypeStringToEnum:adType]; + ANAdResponse *adResponse = [[ANAdResponse alloc] init]; + adResponse.creativeId = creativeId; + adResponse.tagId = tagId; + adResponse.adType = [ANGlobal adTypeStringToEnum:adType]; // RTB if ([contentSource isEqualToString:kANUniversalTagAdServerResponseKeyAdsRTBObject]) @@ -268,7 +268,7 @@ - (void)processResponseData:(NSData *)data ANNativeStandardAdResponse *nativeAd = [[self class] nativeAdFromRTBObject:rtbObject]; if (nativeAd) { nativeAd.creativeId = creativeId; - nativeAd.customResponse = customResponse; + nativeAd.adResponse = adResponse; if(adObject[kANUniversalTagAdServerResponseKeyAdsRendererUrl] != nil) { NSString * nativeRenderingUrl = [NSString stringWithFormat:@"%@",adObject[kANUniversalTagAdServerResponseKeyAdsRendererUrl]]; @@ -317,7 +317,7 @@ - (void)processResponseData:(NSData *)data } else if([adType isEqualToString:kANUniversalTagAdServerResponseKeyVideoObject]) { ANCSMVideoAd *csmVideoAd = [[self class] videoCSMAdFromCSMObject:adObject withTagObject:firstTag]; if(csmVideoAd){ - csmVideoAd.customResponse = customResponse; + csmVideoAd.adResponse = adResponse; [self.ads addObject:csmVideoAd]; } }else{ @@ -351,7 +351,7 @@ - (void)processResponseData:(NSData *)data if ([lastAdsObject isKindOfClass:[ANBaseAdObject class]]) { ANBaseAdObject *baseAdObject = (ANBaseAdObject *)lastAdsObject; baseAdObject.adType = [adType copy]; - baseAdObject.customResponse = customResponse; + baseAdObject.adResponse = adResponse; } } //endfor -- adObject diff --git a/sdk/sourcefiles/native/ANNativeAdResponse.h b/sdk/sourcefiles/native/ANNativeAdResponse.h index b7271740b..74fc2d3b5 100644 --- a/sdk/sourcefiles/native/ANNativeAdResponse.h +++ b/sdk/sourcefiles/native/ANNativeAdResponse.h @@ -122,7 +122,7 @@ extern NSString * __nonnull const kANNativeElementObject; /*! * An AppNexus creativeID for the current creative that is displayed */ -@property (nonatomic, readonly, strong, nullable) NSString *creativeId DEPRECATED_MSG_ATTRIBUTE("Use ANCustomResponse instead."); +@property (nonatomic, readonly, strong, nullable) NSString *creativeId DEPRECATED_MSG_ATTRIBUTE("Use ANAdResponse instead."); /*! diff --git a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m index 1695bfb68..97a0c8676 100644 --- a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m +++ b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m @@ -125,10 +125,10 @@ -(void)didFinishRequestWithResponse: (nonnull ANAdFetcherResponse *)response ANNativeAdResponse *nativeResponse = (ANNativeAdResponse *)response.adObject; // In case of Mediation - if (nativeResponse.customResponse == nil) { - ANCustomResponse *customResponse = (ANCustomResponse *) [ANGlobal valueOfGetterProperty:kANCustomResponse forObject:response.adObjectHandler]; - if (customResponse) { - [self setCustomResponse:customResponse onObject:nativeResponse forKeyPath:kANCustomResponse]; + if (nativeResponse.adResponse == nil) { + ANAdResponse *adResponse = (ANAdResponse *) [ANGlobal valueOfGetterProperty:kANAdResponse forObject:response.adObjectHandler]; + if (adResponse) { + [self setAdResponse:adResponse onObject:nativeResponse forKeyPath:kANAdResponse]; } } // @@ -217,10 +217,10 @@ - (void)setCreativeId:(NSString *)creativeId [object setValue:creativeId forKeyPath:keyPath]; } -- (void)setCustomResponse:(ANCustomResponse *)customResponse +- (void)setAdResponse:(ANAdResponse *)adResponse onObject:(id)object forKeyPath:(NSString *)keyPath { - [object setValue:customResponse forKeyPath:keyPath]; + [object setValue:adResponse forKeyPath:keyPath]; } // RETURN: dispatch_semaphore_t For first time image requests. diff --git a/sdk/sourcefiles/native/internal/ANNativeAdResponse.m b/sdk/sourcefiles/native/internal/ANNativeAdResponse.m index 79fd4e178..c77b6895b 100644 --- a/sdk/sourcefiles/native/internal/ANNativeAdResponse.m +++ b/sdk/sourcefiles/native/internal/ANNativeAdResponse.m @@ -52,7 +52,7 @@ @interface ANNativeAdResponse() @property (nonatomic, readwrite, assign) ANNativeAdNetworkCode networkCode; @property (nonatomic, readwrite, strong) OMIDAppnexusAdSession *omidAdSession; @property (nonatomic, readwrite, strong) ANVerificationScriptResource *verificationScriptResource; -@property (nonatomic, readwrite, strong) ANCustomResponse *customResponse; +@property (nonatomic, readwrite, strong) ANAdResponse *adResponse; @end diff --git a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h index 3d810b441..79d75cf12 100644 --- a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h +++ b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h @@ -40,6 +40,6 @@ @property (nonatomic, readwrite, strong) NSString *privacyLink; @property (nonatomic, readwrite, strong) NSString *nativeRenderingUrl; @property (nonatomic, readwrite, strong) NSString *nativeRenderingObject; -@property (nonatomic, readwrite, strong) ANCustomResponse *customResponse; +@property (nonatomic, readwrite, strong) ANAdResponse *adResponse; @end diff --git a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m index 5b74f2f56..8fe4eb7ed 100644 --- a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m +++ b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m @@ -65,7 +65,7 @@ @implementation ANNativeStandardAdResponse @synthesize privacyLink = _privacyLink; @synthesize nativeRenderingUrl = _nativeRenderingUrl; @synthesize nativeRenderingObject = _nativeRenderingObject; -@synthesize customResponse = _customResponse; +@synthesize adResponse = _adResponse; #pragma mark - Lifecycle. diff --git a/sdk/sourcefiles/video/ANInstreamVideoAd.m b/sdk/sourcefiles/video/ANInstreamVideoAd.m index 991d70c46..cddcc7ddb 100644 --- a/sdk/sourcefiles/video/ANInstreamVideoAd.m +++ b/sdk/sourcefiles/video/ANInstreamVideoAd.m @@ -403,9 +403,9 @@ - (void) universalAdFetcher: (ANUniversalAdFetcher *)fetcher self.adPlayer = (ANVideoAdPlayer *) response.adObject; self.adPlayer.delegate = self; - ANCustomResponse *customResponse = (ANCustomResponse *) [ANGlobal valueOfGetterProperty:kANCustomResponse forObject:response.adObjectHandler]; - if (customResponse) { - [self setCustomResponse:customResponse]; + ANAdResponse *adResponse = (ANAdResponse *) [ANGlobal valueOfGetterProperty:kANAdResponse forObject:response.adObjectHandler]; + if (adResponse) { + [self setAdResponse:adResponse]; } NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:response.adObjectHandler]; From dca639922e05e63786ca94755139d40d0fc62133 Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Fri, 1 Nov 2019 17:32:35 +0530 Subject: [PATCH 11/35] AdResponse added inside ANAdProtocol --- sdk/sourcefiles/ANAdProtocol.h | 21 +++++++++------------ sdk/sourcefiles/native/ANNativeAdResponse.h | 6 ++++++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/sdk/sourcefiles/ANAdProtocol.h b/sdk/sourcefiles/ANAdProtocol.h index de75453c7..6aa1dc141 100644 --- a/sdk/sourcefiles/ANAdProtocol.h +++ b/sdk/sourcefiles/ANAdProtocol.h @@ -143,17 +143,7 @@ @end //ANAdProtocolFoundation -@protocol ANAdProtocolAdResponse - -/** - An AppNexus Single Unified object that will contain all the common fields of all the ads types that are returned in the UTv3 response - */ -// ANAdResponse should be accessible from response Object only(like. ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). It is placed into ANAdProtocolAdResponse. -@property (nonatomic, readonly, strong, nullable) ANAdResponse *adResponse; - -@end - -@protocol ANAdProtocolBrowser +@protocol ANAdProtocolBrowser /** Determines what action to take when the user clicks on an ad: @@ -213,7 +203,7 @@ #pragma mark - ANAdProtocol entrypoint combinations. -@protocol ANAdProtocol +@protocol ANAdProtocol /** An AppNexus creativeID for the current creative that is displayed @@ -222,6 +212,13 @@ @property (nonatomic, readonly, strong, nullable) NSString *creativeId DEPRECATED_MSG_ATTRIBUTE("Use ANAdResponse instead."); +/** + An AppNexus Single Unified object that will contain all the common fields of all the ads types + */ +// ANAdResponse should be accessible from response Object only(like. ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). It is placed into ANAdProtocol instead of ANAdProtocolFoundation to avoid adResponse being accessed through ANNativeAdRequest. +@property (nonatomic, readonly, strong, nullable) ANAdResponse *adResponse; + + @end diff --git a/sdk/sourcefiles/native/ANNativeAdResponse.h b/sdk/sourcefiles/native/ANNativeAdResponse.h index 74fc2d3b5..a33f772e3 100644 --- a/sdk/sourcefiles/native/ANNativeAdResponse.h +++ b/sdk/sourcefiles/native/ANNativeAdResponse.h @@ -125,6 +125,12 @@ extern NSString * __nonnull const kANNativeElementObject; @property (nonatomic, readonly, strong, nullable) NSString *creativeId DEPRECATED_MSG_ATTRIBUTE("Use ANAdResponse instead."); +/** + An AppNexus Single Unified object that will contain all the common fields of all the ads types + */ +@property (nonatomic, readonly, strong, nullable) ANAdResponse *adResponse; + + /*! * Additional description of the ad */ From 3c66bd2cd279a8a0667bac8f1f2440bebc0473b0 Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Tue, 5 Nov 2019 20:08:18 +0530 Subject: [PATCH 12/35] Added more public APIs based on UTv3 response --- sdk/sourcefiles/ANAdResponse.h | 23 +++++++++++++++++-- sdk/sourcefiles/ANAdResponse.m | 2 +- .../internal/ANUniversalTagAdServerResponse.m | 17 +++++++++++--- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/sdk/sourcefiles/ANAdResponse.h b/sdk/sourcefiles/ANAdResponse.h index a5e4ae10f..25afcfadf 100644 --- a/sdk/sourcefiles/ANAdResponse.h +++ b/sdk/sourcefiles/ANAdResponse.h @@ -29,9 +29,28 @@ @property (nonatomic, readwrite) ANAdType adType; /** - An AppNexus tagId for the current ad object which is placementID that is displayed + An AppNexus placement ID. A placement ID is a numeric ID that's + associated with a place where ads can be shown. In our + implementations of banner and interstitial ad views, we associate + each ad view with a placement ID. */ -@property (nonatomic, readwrite, strong, nullable) NSString *tagId; +@property (nonatomic, readwrite, strong, nullable) NSString *placementId; + +/** + An AppNexus member ID. A member ID is a numeric ID that's associated + with the member that this app belongs to. + */ +@property (nonatomic, readwrite, assign) NSInteger memberId; + +/** + An AppNexus contentSource. A contentSource can be RTB , CSM or SSM + */ +@property (nonatomic, readwrite, strong, nullable) NSString *contentSource; + +/** + An AppNexus networkName. A networkName belongs to mediation adaptor class based on UTv3 response + */ +@property (nonatomic, readwrite, strong, nullable) NSString *networkName; @end diff --git a/sdk/sourcefiles/ANAdResponse.m b/sdk/sourcefiles/ANAdResponse.m index 008337406..03838412b 100644 --- a/sdk/sourcefiles/ANAdResponse.m +++ b/sdk/sourcefiles/ANAdResponse.m @@ -17,6 +17,6 @@ @implementation ANAdResponse -@synthesize creativeId, adType, tagId; +@synthesize creativeId, adType, memberId, placementId, contentSource, networkName; @end diff --git a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m index 10c05ee1f..ab67e34c6 100644 --- a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m +++ b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m @@ -40,6 +40,7 @@ static NSString *const kANUniversalTagAdServerResponseKeyAdsCreativeId = @"creative_id"; static NSString *const kANUniversalTagAdServerResponseKeyAdsRendererUrl = @"renderer_url"; static NSString *const kANUniversalTagAdServerResponseKeyAdsTagId = @"tag_id"; +static NSString *const kANUniversalTagAdServerResponseKeyAdsBuyerMemberId = @"buyer_member_id"; static NSString *const kANUniversalTagAdServerResponseKeyAdsCSMObject = @"csm"; static NSString *const kANUniversalTagAdServerResponseKeyAdsSSMObject = @"ssm"; @@ -229,16 +230,25 @@ - (void)processResponseData:(NSData *)data ANLogError(@"Response from ad server in an unexpected format content_source/ad_type UNDEFINED. (adObject=%@)", adObject); continue; } - NSString *tagId = @""; + NSString *placementId = @""; if(firstTag[kANUniversalTagAdServerResponseKeyAdsTagId] != nil) { - tagId = [NSString stringWithFormat:@"%@",firstTag[kANUniversalTagAdServerResponseKeyAdsTagId]]; + placementId = [NSString stringWithFormat:@"%@",firstTag[kANUniversalTagAdServerResponseKeyAdsTagId]]; + } + NSInteger memberId = 0; + if(adObject[kANUniversalTagAdServerResponseKeyAdsBuyerMemberId] != nil) + { + memberId = [[NSString stringWithFormat:@"%@",adObject[kANUniversalTagAdServerResponseKeyAdsBuyerMemberId]] integerValue]; } + ANAdResponse *adResponse = [[ANAdResponse alloc] init]; adResponse.creativeId = creativeId; - adResponse.tagId = tagId; + adResponse.placementId = placementId; adResponse.adType = [ANGlobal adTypeStringToEnum:adType]; + adResponse.contentSource = contentSource; + adResponse.memberId = memberId; + // RTB if ([contentSource isEqualToString:kANUniversalTagAdServerResponseKeyAdsRTBObject]) @@ -310,6 +320,7 @@ - (void)processResponseData:(NSData *)data } mediatedAd.creativeId = creativeId; if (mediatedAd.className.length > 0) { + adResponse.networkName = mediatedAd.className; [self.ads addObject:mediatedAd]; } } From f1e28ed399fc1f44d4d3c9dcc59e642f396efb5b Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Wed, 6 Nov 2019 15:39:53 +0530 Subject: [PATCH 13/35] Added more changes --- sdk/sourcefiles/internal/ANCSMVideoAd.h | 5 ++--- sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/sdk/sourcefiles/internal/ANCSMVideoAd.h b/sdk/sourcefiles/internal/ANCSMVideoAd.h index 3f25be34b..2c9cd3772 100644 --- a/sdk/sourcefiles/internal/ANCSMVideoAd.h +++ b/sdk/sourcefiles/internal/ANCSMVideoAd.h @@ -15,12 +15,11 @@ */ #import -#import "ANAdResponse.h" +#import "ANBaseAdObject.h" -@interface ANCSMVideoAd : NSObject +@interface ANCSMVideoAd : ANBaseAdObject @property (nonatomic, readwrite, strong) NSDictionary *adDictionary; -@property (nonatomic, readwrite, strong) ANAdResponse *adResponse; @end diff --git a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m index ab67e34c6..321522464 100644 --- a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m +++ b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m @@ -241,7 +241,7 @@ - (void)processResponseData:(NSData *)data memberId = [[NSString stringWithFormat:@"%@",adObject[kANUniversalTagAdServerResponseKeyAdsBuyerMemberId]] integerValue]; } - + //Initialise AdResponse object to expose all the public facing APIs from the UTv3 response ANAdResponse *adResponse = [[ANAdResponse alloc] init]; adResponse.creativeId = creativeId; adResponse.placementId = placementId; @@ -249,7 +249,6 @@ - (void)processResponseData:(NSData *)data adResponse.contentSource = contentSource; adResponse.memberId = memberId; - // RTB if ([contentSource isEqualToString:kANUniversalTagAdServerResponseKeyAdsRTBObject]) { @@ -328,7 +327,6 @@ - (void)processResponseData:(NSData *)data } else if([adType isEqualToString:kANUniversalTagAdServerResponseKeyVideoObject]) { ANCSMVideoAd *csmVideoAd = [[self class] videoCSMAdFromCSMObject:adObject withTagObject:firstTag]; if(csmVideoAd){ - csmVideoAd.adResponse = adResponse; [self.ads addObject:csmVideoAd]; } }else{ From 56709377f3a37f786f6fc46b09b8ca67c40a1b2e Mon Sep 17 00:00:00 2001 From: Akash Verma Date: Wed, 6 Nov 2019 19:14:35 +0530 Subject: [PATCH 14/35] Testcases added --- .../FunctionalTests/ANAdResponseTestCase.m | 329 ++++++++++++++++++ .../UnitTestApp.xcodeproj/project.pbxproj | 20 ++ .../StubResponse/ANAdResponseCSM_Banner.json | 92 +++++ .../StubResponse/ANAdResponseRTB_Banner.json | 41 +++ .../StubResponse/ANAdResponseRTB_Native.json | 75 ++++ .../StubResponse/ANAdResponseRTB_Video.json | 38 ++ 6 files changed, 595 insertions(+) create mode 100644 tests/UnitTestApp/FunctionalTests/ANAdResponseTestCase.m create mode 100644 tests/UnitTestApp/UnitTestApp/SharedMockFiles/StubResponse/ANAdResponseCSM_Banner.json create mode 100644 tests/UnitTestApp/UnitTestApp/SharedMockFiles/StubResponse/ANAdResponseRTB_Banner.json create mode 100644 tests/UnitTestApp/UnitTestApp/SharedMockFiles/StubResponse/ANAdResponseRTB_Native.json create mode 100644 tests/UnitTestApp/UnitTestApp/SharedMockFiles/StubResponse/ANAdResponseRTB_Video.json diff --git a/tests/UnitTestApp/FunctionalTests/ANAdResponseTestCase.m b/tests/UnitTestApp/FunctionalTests/ANAdResponseTestCase.m new file mode 100644 index 000000000..08a35d7ab --- /dev/null +++ b/tests/UnitTestApp/FunctionalTests/ANAdResponseTestCase.m @@ -0,0 +1,329 @@ +/* Copyright 2019 APPNEXUS INC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +#import +#import + +#import "ANHTTPStubbingManager.h" +#import "ANBannerAdView+ANTest.h" +#import "ANSDKSettings+PrivateMethods.h" +#import "ANTestGlobal.h" +#import "ANInterstitialAd.h" +#import "ANInterstitialAd+ANTest.h" +#import "ANNativeAdResponse.h" +#import "ANNativeAdRequest+ANTest.h" +#import "ANInstreamVideoAd.h" +#import "ANInstreamVideoAd+Test.h" +#import "ANVideoAdPlayer.h" + +@interface ANAdResponseTestCase : XCTestCase + +@property (nonatomic, readwrite, strong) ANBannerAdView *banner; +@property (nonatomic, readwrite, strong) ANInterstitialAd *interstitial; +@property (nonatomic, readwrite, strong) ANNativeAdRequest *adRequest; +@property (nonatomic, readwrite, strong) ANNativeAdResponse *adResponse; +@property (nonatomic, readwrite, strong) ANInstreamVideoAd *instreamVideoAd; +@property (nonatomic, readwrite) BOOL receiveAdSuccess; +@property (nonatomic, readwrite) BOOL receiveAdFailure; +@property (nonatomic, strong) XCTestExpectation *loadAdResponseReceivedExpectation; +@property (nonatomic, strong) XCTestExpectation *loadAdResponseFailedExpectation; +@end +@implementation ANAdResponseTestCase + +#pragma mark - Test lifecycle. + +- (void)setUp { + [super setUp]; + [[ANHTTPStubbingManager sharedStubbingManager] enable]; + [ANHTTPStubbingManager sharedStubbingManager].ignoreUnstubbedRequests = YES; + self.receiveAdSuccess = NO; + self.receiveAdFailure = NO; +} + +- (void)tearDown { + [super tearDown]; + [self clearSetupBannerAd]; + [self clearSetupInterstitialAd]; + [[ANHTTPStubbingManager sharedStubbingManager] disable]; + [[ANHTTPStubbingManager sharedStubbingManager] removeAllStubs]; + self.loadAdResponseReceivedExpectation = nil; +} + + +- (void)clearSetupBannerAd { + self.banner = nil; + self.banner.delegate = nil; + self.banner.appEventDelegate = nil; + [self.banner removeFromSuperview]; + self.banner = nil; +} + +-(void) setupBannerAd{ + [self clearSetupBannerAd]; + self.banner = [[ANBannerAdView alloc] initWithFrame:CGRectMake(0, 0, 320, 480) + placementId:@"13653381" + adSize:CGSizeMake(320, 480)]; + self.banner.autoRefreshInterval = 0; + self.banner.delegate = self; + self.banner.rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController; + [[UIApplication sharedApplication].keyWindow.rootViewController.view addSubview:self.banner]; +} + +- (void)clearSetupInterstitialAd { + self.interstitial = nil; + [self.interstitial removeFromSuperview]; +} + +-(void) setupInterstitialAd{ + [self clearSetupInterstitialAd]; + self.interstitial = [[ANInterstitialAd alloc] initWithPlacementId:@"1"]; + self.interstitial.delegate = self; +} + +- (void)clearSetupNativeAd { + self.adRequest = nil; + self.adResponse = nil; +} + +-(void) setupNativeAd{ + [self clearSetupNativeAd]; + self.adRequest = [[ANNativeAdRequest alloc] init]; + self.adRequest.delegate = self; +} + +- (void)clearSetupInstreamAd { + self.instreamVideoAd = nil; + self.instreamVideoAd.adPlayer = nil; +} +-(void) setupInstreamAd { + [self clearSetupInstreamAd]; + self.instreamVideoAd = [[ANInstreamVideoAd alloc] initWithPlacementId:@"12534678"]; + self.instreamVideoAd.adPlayer = [[ANVideoAdPlayer alloc] init]; + self.instreamVideoAd.adPlayer.videoDuration = 10; + self.instreamVideoAd.adPlayer.creativeURL = @"http://sampletag.com"; + self.instreamVideoAd.adPlayer.vastURLContent = @"http://sampletag.com"; + self.instreamVideoAd.adPlayer.vastXMLContent = @"http://sampletag.com"; +} + + +#pragma mark - Test methods. + +- (void)testAdResponseWithRTBBannerAd { + + [self setupBannerAd]; + [self stubRequestWithResponse:@"ANAdResponseRTB_Banner"]; + [self.banner loadAd]; + + self.loadAdResponseReceivedExpectation = [self expectationWithDescription:@"Waiting for adDidReceiveAd to be received"]; + [self waitForExpectationsWithTimeout:2 * kAppNexusRequestTimeoutInterval + handler:^(NSError *error) { + + }]; + XCTAssertEqualObjects(self.banner.adResponse.creativeId, @"163051950"); + XCTAssertEqualObjects(self.banner.adResponse.placementId, @"16392991"); + XCTAssertTrue(self.banner.adResponse.memberId == 10094); + XCTAssertTrue(self.banner.adResponse.adType == ANAdTypeBanner); + XCTAssertEqualObjects(self.banner.adResponse.contentSource, @"rtb"); + XCTAssertNil(self.banner.adResponse.networkName); + +} + +- (void)testAdResponseWithCSMBannerAd { + + [self setupBannerAd]; + [self stubRequestWithResponse:@"ANAdResponseCSM_Banner"]; + [self.banner loadAd]; + + self.loadAdResponseReceivedExpectation = [self expectationWithDescription:@"Waiting for adDidReceiveAd to be received"]; + [self waitForExpectationsWithTimeout:2 * kAppNexusRequestTimeoutInterval + handler:^(NSError *error) { + + }]; + XCTAssertEqualObjects(self.banner.adResponse.creativeId, @"187027997"); + XCTAssertEqualObjects(self.banner.adResponse.placementId, @"17432496"); + XCTAssertTrue(self.banner.adResponse.memberId == 958); + XCTAssertTrue(self.banner.adResponse.adType == ANAdTypeBanner); + XCTAssertEqualObjects(self.banner.adResponse.contentSource, @"csm"); + XCTAssertEqualObjects(self.banner.adResponse.networkName, @"ANAdAdapterBannerDFP"); + +} + +- (void) testAdResponseWithBannerNativeAd +{ + [self setupBannerAd]; + self.banner.shouldAllowNativeDemand = YES; + self.banner.enableNativeRendering = YES; + [self.banner setAdSize:CGSizeMake(300, 250)]; + [self stubRequestWithResponse:@"ANAdResponseRTB_Native"]; + [self.banner loadAd]; + self.loadAdResponseReceivedExpectation = [self expectationWithDescription:@"Waiting for adDidReceiveAd to be received"]; + [self waitForExpectationsWithTimeout:2 * kAppNexusRequestTimeoutInterval + handler:^(NSError *error) { + + }]; + XCTAssertEqualObjects(self.banner.adResponse.creativeId, @"162039377"); + XCTAssertEqualObjects(self.banner.adResponse.placementId, @"16392991"); + XCTAssertTrue(self.banner.adResponse.memberId == 10094); + XCTAssertTrue(self.banner.adResponse.adType == ANAdTypeNative); + XCTAssertEqualObjects(self.banner.adResponse.contentSource, @"rtb"); + XCTAssertNil(self.banner.adResponse.networkName); +} + +- (void) testAdResponseWithBannerVideoAd +{ + [self setupBannerAd]; + self.banner.shouldAllowVideoDemand = YES; + [self.banner setAdSize:CGSizeMake(300, 250)]; + [self stubRequestWithResponse:@"ANAdResponseRTB_Video"]; + [self.banner loadAd]; + self.loadAdResponseReceivedExpectation = [self expectationWithDescription:@"Waiting for adDidReceiveAd to be received"]; + [self waitForExpectationsWithTimeout:2 * kAppNexusRequestTimeoutInterval + handler:^(NSError *error) { + + }]; + XCTAssertEqualObjects(self.banner.adResponse.creativeId, @"162035356"); + XCTAssertEqualObjects(self.banner.adResponse.placementId, @"16392991"); + XCTAssertTrue(self.banner.adResponse.memberId == 10094); + XCTAssertTrue(self.banner.adResponse.adType == ANAdTypeVideo); + XCTAssertEqualObjects(self.banner.adResponse.contentSource, @"rtb"); + XCTAssertNil(self.banner.adResponse.networkName); +} + +- (void)testAdResponseWithInterstitialAd { + + [self setupInterstitialAd]; + [self stubRequestWithResponse:@"ANAdResponseRTB_Banner"]; + [self.interstitial loadAd]; + + self.loadAdResponseReceivedExpectation = [self expectationWithDescription:@"Waiting for adDidReceiveAd to be received"]; + [self waitForExpectationsWithTimeout:2 * kAppNexusRequestTimeoutInterval + handler:^(NSError *error) { + + }]; + XCTAssertEqualObjects(self.interstitial.adResponse.creativeId, @"163051950"); + XCTAssertEqualObjects(self.interstitial.adResponse.placementId, @"16392991"); + XCTAssertTrue(self.interstitial.adResponse.memberId == 10094); + XCTAssertTrue(self.interstitial.adResponse.adType == ANAdTypeBanner); + XCTAssertEqualObjects(self.interstitial.adResponse.contentSource, @"rtb"); + XCTAssertNil(self.interstitial.adResponse.networkName); + +} + +- (void)testAdResponseWithNativeAd { + [self setupNativeAd]; + [self stubRequestWithResponse:@"ANAdResponseRTB_Native"]; + [self.adRequest loadAd]; + self.adRequest.shouldLoadIconImage = YES; + self.loadAdResponseReceivedExpectation = [self expectationWithDescription:@"Waiting for adDidReceiveAd to be received"]; + [self waitForExpectationsWithTimeout:2 * kAppNexusRequestTimeoutInterval + handler:^(NSError *error) { + + }]; + XCTAssertEqualObjects(self.adResponse.adResponse.creativeId, @"162039377"); + XCTAssertEqualObjects(self.adResponse.adResponse.placementId, @"16392991"); + XCTAssertTrue(self.adResponse.adResponse.memberId == 10094); + XCTAssertTrue(self.adResponse.adResponse.adType == ANAdTypeNative); + XCTAssertEqualObjects(self.adResponse.adResponse.contentSource, @"rtb"); + XCTAssertNil(self.adResponse.adResponse.networkName); +} + +- (void) testAdResponseWithInstreamAd +{ + [self setupInstreamAd]; + [self stubRequestWithResponse:@"ANAdResponseRTB_Video"]; + [self.instreamVideoAd loadAdWithDelegate:self]; + self.loadAdResponseReceivedExpectation = [self expectationWithDescription:@"Waiting for adDidReceiveAd to be received"]; + [self waitForExpectationsWithTimeout:2 * kAppNexusRequestTimeoutInterval + handler:^(NSError *error) { + + }]; + XCTAssertEqualObjects(self.instreamVideoAd.adResponse.creativeId, @"162035356"); + XCTAssertEqualObjects(self.instreamVideoAd.adResponse.placementId, @"16392991"); + XCTAssertTrue(self.instreamVideoAd.adResponse.memberId == 10094); + XCTAssertTrue(self.instreamVideoAd.adResponse.adType == ANAdTypeVideo); + XCTAssertEqualObjects(self.instreamVideoAd.adResponse.contentSource, @"rtb"); + XCTAssertNil(self.instreamVideoAd.adResponse.networkName); +} + +#pragma mark - Stubbing + +- (void) stubRequestWithResponse:(NSString *)responseName { + NSBundle *currentBundle = [NSBundle bundleForClass:[self class]]; + NSString *baseResponse = [NSString stringWithContentsOfFile: [currentBundle pathForResource:responseName + ofType:@"json" ] + encoding: NSUTF8StringEncoding + error: nil ]; + + ANURLConnectionStub *requestStub = [[ANURLConnectionStub alloc] init]; + + requestStub.requestURL = [[[ANSDKSettings sharedInstance] baseUrlConfig] utAdRequestBaseUrl]; + requestStub.responseCode = 200; + requestStub.responseBody = baseResponse; + + [[ANHTTPStubbingManager sharedStubbingManager] addStub:requestStub]; +} + +- (void)fulfillExpectation:(XCTestExpectation *)expectation +{ + [expectation fulfill]; +} + +- (void)waitForTimeInterval:(NSTimeInterval)delay +{ + XCTestExpectation *expectation = [self expectationWithDescription:@"wait"]; + [self performSelector:@selector(fulfillExpectation:) withObject:expectation afterDelay:delay]; + + [self waitForExpectationsWithTimeout:delay + 1 handler:nil]; +} + +#pragma mark - ANAdDelegate + +- (void)adDidReceiveAd:(id)ad +{ + [self.loadAdResponseReceivedExpectation fulfill]; + self.receiveAdSuccess = YES; + if ([ad isKindOfClass:[ANInterstitialAd class]]) { + [self.interstitial displayAdFromViewController:[UIApplication sharedApplication].keyWindow.rootViewController]; + } +} + + +- (void)ad:(id)ad requestFailedWithError:(NSError *)error +{ + TESTTRACEM(@"error.info=%@", error.userInfo); + + [self.loadAdResponseReceivedExpectation fulfill]; + [self.loadAdResponseFailedExpectation fulfill]; + self.receiveAdFailure = YES; +} + +#pragma mark - ANNativeAdRequestDelegate + +- (void)adRequest:(ANNativeAdRequest *)request didReceiveResponse:(ANNativeAdResponse *)response +{ + self.adResponse = response; + [self.loadAdResponseReceivedExpectation fulfill]; + self.receiveAdSuccess = YES; +} + +- (void)adRequest:(ANNativeAdRequest *)request didFailToLoadWithError:(NSError *)error +{ + TESTTRACEM(@"error.info=%@", error.userInfo); + + [self.loadAdResponseReceivedExpectation fulfill]; + [self.loadAdResponseFailedExpectation fulfill]; + self.receiveAdFailure = YES; +} +@end diff --git a/tests/UnitTestApp/UnitTestApp.xcodeproj/project.pbxproj b/tests/UnitTestApp/UnitTestApp.xcodeproj/project.pbxproj index 197a7a1b5..12b98d87b 100644 --- a/tests/UnitTestApp/UnitTestApp.xcodeproj/project.pbxproj +++ b/tests/UnitTestApp/UnitTestApp.xcodeproj/project.pbxproj @@ -297,6 +297,11 @@ 97B3C8EF223FA311005B2DB8 /* NSURLSessionConfiguration+ANProtocols.m in Sources */ = {isa = PBXBuildFile; fileRef = 97B3C8DD223FA311005B2DB8 /* NSURLSessionConfiguration+ANProtocols.m */; }; 97B3C8F0223FA311005B2DB8 /* SDKValidationURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 97B3C8ED223FA311005B2DB8 /* SDKValidationURLProtocol.m */; }; 97E3447B2281856A008C3C0F /* ANVideoPlayerSettingsDefaultTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 97E3447A2281856A008C3C0F /* ANVideoPlayerSettingsDefaultTestCase.m */; }; + 97FFD04A2372D49400412B20 /* ANAdResponseTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 97FFD0492372D49400412B20 /* ANAdResponseTestCase.m */; }; + 97FFD0522372DA7900412B20 /* ANAdResponseRTB_Banner.json in Resources */ = {isa = PBXBuildFile; fileRef = 97FFD04D2372DA7700412B20 /* ANAdResponseRTB_Banner.json */; }; + 97FFD0532372DA7900412B20 /* ANAdResponseCSM_Banner.json in Resources */ = {isa = PBXBuildFile; fileRef = 97FFD04E2372DA7700412B20 /* ANAdResponseCSM_Banner.json */; }; + 97FFD0552372DA7900412B20 /* ANAdResponseRTB_Native.json in Resources */ = {isa = PBXBuildFile; fileRef = 97FFD0502372DA7900412B20 /* ANAdResponseRTB_Native.json */; }; + 97FFD0562372DA7900412B20 /* ANAdResponseRTB_Video.json in Resources */ = {isa = PBXBuildFile; fileRef = 97FFD0512372DA7900412B20 /* ANAdResponseRTB_Video.json */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -672,6 +677,11 @@ 97B3C8ED223FA311005B2DB8 /* SDKValidationURLProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDKValidationURLProtocol.m; sourceTree = ""; }; 97B3C8EE223FA311005B2DB8 /* SDKValidationURLProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDKValidationURLProtocol.h; sourceTree = ""; }; 97E3447A2281856A008C3C0F /* ANVideoPlayerSettingsDefaultTestCase.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ANVideoPlayerSettingsDefaultTestCase.m; sourceTree = ""; }; + 97FFD0492372D49400412B20 /* ANAdResponseTestCase.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ANAdResponseTestCase.m; sourceTree = ""; }; + 97FFD04D2372DA7700412B20 /* ANAdResponseRTB_Banner.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = ANAdResponseRTB_Banner.json; sourceTree = ""; }; + 97FFD04E2372DA7700412B20 /* ANAdResponseCSM_Banner.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = ANAdResponseCSM_Banner.json; sourceTree = ""; }; + 97FFD0502372DA7900412B20 /* ANAdResponseRTB_Native.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = ANAdResponseRTB_Native.json; sourceTree = ""; }; + 97FFD0512372DA7900412B20 /* ANAdResponseRTB_Video.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = ANAdResponseRTB_Video.json; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1092,6 +1102,7 @@ 0EEFE1AE220089FB002B5F5F /* MediationCallbacksTests.m */, 0EEFE1B422008A1A002B5F5F /* MRAIDTests.m */, 0EEFE190220080DE002B5F5F /* OutstreamVideoAdClassObjectFromUTResponseTests.m */, + 97FFD0492372D49400412B20 /* ANAdResponseTestCase.m */, ); path = FunctionalTests; sourceTree = ""; @@ -1150,6 +1161,10 @@ 0EEFE10822005532002B5F5F /* StubResponse */ = { isa = PBXGroup; children = ( + 97FFD04E2372DA7700412B20 /* ANAdResponseCSM_Banner.json */, + 97FFD04D2372DA7700412B20 /* ANAdResponseRTB_Banner.json */, + 97FFD0502372DA7900412B20 /* ANAdResponseRTB_Native.json */, + 97FFD0512372DA7900412B20 /* ANAdResponseRTB_Video.json */, 60F8A80723280EC10030D53D /* ANJAMDeviceIdResponse.json */, 60F8A80523280EC10030D53D /* ANJAMDispatchAppEventResponse.json */, 60F8A80B23280EC10030D53D /* ANJAMExternalBrowserResponse.json */, @@ -1596,6 +1611,7 @@ 0E1D14B422784C9500343050 /* appnexus_bannerNative_rendering.json in Resources */, 0E1D14B522784C9500343050 /* appnexus_bannerNative_renderingInvalidURL.json in Resources */, 0EEFE19B2200813F002B5F5F /* appnexus_standard_response.json in Resources */, + 97FFD0552372DA7900412B20 /* ANAdResponseRTB_Native.json in Resources */, 0EEFE1A72200821F002B5F5F /* BannerMediationFailRTBVideoSuccess.json in Resources */, 0EEFE1EC2200976D002B5F5F /* bannerNative_basic_banner.json in Resources */, 0EEFE1EA2200975A002B5F5F /* bannerNative_native_mediation.json in Resources */, @@ -1607,16 +1623,19 @@ 979EA16B223BB575009B79B7 /* OMID_Native_CSMResponse.json in Resources */, 979EA16D223BB575009B79B7 /* OMID_Native_RTBResponse.json in Resources */, 0EEFE1FD22009CDB002B5F5F /* OMID_TestResponse.json in Resources */, + 97FFD0522372DA7900412B20 /* ANAdResponseRTB_Banner.json in Resources */, 0EEFE1F222009819002B5F5F /* SecondPriceForDFPParamIsUnset.json in Resources */, 0EEFE1F022009802002B5F5F /* SecondPriceForDFPSuccess.json in Resources */, 0EEFE1A3220081C0002B5F5F /* SuccessfulAllowMagicSizeBannerObjectResponse.json in Resources */, 0EEFE1A9220082F9002B5F5F /* SuccessfulANRTBVideoAdWithoutCreativeIdResponse.json in Resources */, 0EEFE17022007317002B5F5F /* SuccessfulInstreamVideoAdResponse.json in Resources */, + 97FFD0562372DA7900412B20 /* ANAdResponseRTB_Video.json in Resources */, 0EEFE1A1220081B3002B5F5F /* SuccessfulLocationCreativeForBannerAdResponse.json in Resources */, 0EEFE1E8220096A9002B5F5F /* SuccessfulMRAIDListenerResponse.json in Resources */, 0EEFE1A52200820F002B5F5F /* SuccessfulOutstreamBannerVideoResponse.json in Resources */, 0EEFE1EE22009797002B5F5F /* SuccessfulOutstreamVideoResponse.json in Resources */, 0E4701622237A31C005CFFAC /* SuccessfulRTBShouldResizeAdToFitContainer.json in Resources */, + 97FFD0532372DA7900412B20 /* ANAdResponseCSM_Banner.json in Resources */, 0E7BC1BC229E91E9002F41FF /* SuccessfulSquareInstreamVideoAdResponse.json in Resources */, 0EEFE18C220078B8002B5F5F /* SuccessfulStandardAdFromRTBObjectResponse.json in Resources */, 0E7BC1BA229E905F002F41FF /* SuccessfulVerticalVideoAdResponse.json in Resources */, @@ -1800,6 +1819,7 @@ 0E8C97D021FF32EC005D1F0E /* ANTestGlobal.m in Sources */, 0E8C97A621FF32EC005D1F0E /* ANTrackerManager+ANTest.m in Sources */, 0EEFE1602200715C002B5F5F /* ANTrackerManagerTestCase.m in Sources */, + 97FFD04A2372D49400412B20 /* ANAdResponseTestCase.m in Sources */, 0EEFE1DD22008E6D002B5F5F /* ANUniversalAdFetcher+ANTest.m in Sources */, 0EEFE15E2200706A002B5F5F /* ANUniversalTagRequestBuilderFunctionalTests.m in Sources */, 0E8C97A321FF32EC005D1F0E /* ANURLConnectionStub+NSURLSessionConfiguration.m in Sources */, diff --git a/tests/UnitTestApp/UnitTestApp/SharedMockFiles/StubResponse/ANAdResponseCSM_Banner.json b/tests/UnitTestApp/UnitTestApp/SharedMockFiles/StubResponse/ANAdResponseCSM_Banner.json new file mode 100644 index 000000000..7557fbfbc --- /dev/null +++ b/tests/UnitTestApp/UnitTestApp/SharedMockFiles/StubResponse/ANAdResponseCSM_Banner.json @@ -0,0 +1,92 @@ +{ + "version": "3.0.0", + "tags": [ + { + "tag_id": 17432496, + "auction_id": "8250270890488509817", + "nobid": false, + "no_ad_url": "http://nym1-mobile.adnxs.com/it?an_audit=0&referrer=itunes.apple.com%2Fus%2Fapp%2Fappnexus-sdk-app%2Fid736869833&e=wqT_3QL6B6D6AwAAAwDWAAUBCIrWiu4FEPnqwIKctba_chj-6KyalfKf9HEqNgkAAAkCABEJBwgAABkJCQjgPyEJCQgAACkRCQAxCQnwfeA_MLD_pwg4vgdAvgdIAFAAWNyFc2AAaJFAeACAAQGKAQCSAQNFVVKYAawCoAH6AagBBrABALgBAcABAMgBAtABANgBAOABAPABAIoCO3VmKCdhJywgNDc0MDUzLCAxNTczMDM4ODU4KTt1ZigncicsIDE4NzAyNzk5NywgMR0f8PWSArUCIVVEN1VMQWlkcTlRUUVKMmtsMWtZQUNEY2hYTXdBRGdBUUFSSXZnZFFzUC1uQ0ZnQVlPWUhhQUJ3UW5nQWdBRlNpQUVBa0FFQW1BRUFvQUVCcUFFRHNBRUF1UUdXRjZnXzNQWWdRTUVCbGhlb1A5ejJJRURKQVVYZTZibVNKUHNfMlFFQUFBQUFBQUR3UC1BQkFQVUIzcllIUVpnQ0FLQUNBTFVDQUFBQUFMMENBQUFBQU9BQ0FPZ0NBUGdDQUlBREFaZ0RBYWdEbmF2VUVMb0RDVTVaVFRJNk5EQTVOT0FEbFJXSUJBQ1FCQUNZQkFIQkIFRQkBCHlRUQkJAQEETkUNiShDQUdrRFlCQUR4QgEYDQFYLUFRQWlBWC1Idy4umgKJASFRQV9PMVE2OQEkM0lWeklBUW9BRA1MXEFBVVFEb0pUbGxOTWpvME1EazBRSlVWUxF4DFBBX1URDAxBQUFXHQwAWR0MAGEdDABjDQyoZ0JwQWVBQS7YAugH4ALH0wHqAjRpdHVuZXMuYXBwbGUuY29tL3VzL2FwcAEE8J9uZXh1cy1zZGstYXBwL2lkNzM2ODY5ODMzgAMBiAMBkAMAmAMXoAMBqgMAwAOsAsgDAdgD-aN64AMA6AMC-AMAgAQAkgQGL3V0L3YzmAQAogQMMTAuNzUuMTAuMTE5qAT01wOyBBAIABABGKwCIPoBKAAwADgCuAQAwAQAyAQA0gQNOTU4I05ZTTI6NDA5NNoEAggA4AQB8ASdpJdZggUJFZAgiAUBmAUAoAX_EQEUAcAFAMkFaTwU8D_SBQkJCQx4AADYBQHgBQHwBfT3BvoFBAgAEACQBgCYBgC4BgDBBgklNPC_yAYA0AbWAtoGFgoQCRQZAVAQABgA4AYB8gYCCACABwGIBwCgBwE.&s=55307358571e64e4071bf217385ffcc2b06b18df", + "timeout_ms": 10000, + "ad_profile_id": 27079, + "rtb_video_fallback": false, + "ads": [ + { + "content_source": "csm", + "ad_type": "banner", + "buyer_member_id": 958, + "creative_id": 187027997, + "media_type_id": 1, + "media_subtype_id": 1, + "brand_category_id": 53, + "client_initiated_ad_counting": false, + "viewability": { + "config": "
" + }, + "csm": { + "banner": { + "content": "
", + "width": 300, + "height": 250 + }, + "timeout_ms": 500, + "handler": [ + { + "second_price": "0.03", + "param": "{\"optimized\":true}", + "height": "250", + "width": "300", + "id": "/19968336/second-price-app-event_new", + "type": "ios", + "class": "ANAdAdapterBannerDFP" + }, + { + "second_price": "0.03", + "param": "{\"optimized\":true}", + "height": "250", + "width": "300", + "id": "/19968336/second-price-app-event_new", + "type": "android", + "class": "com.appnexus.opensdk.mediatedviews.DFPBanner" + } + ], + "trackers": [ + { + "impression_urls": [ + "http://nym1-mobile.adnxs.com/it?an_audit=0&referrer=itunes.apple.com%2Fus%2Fapp%2Fappnexus-sdk-app%2Fid736869833&e=wqT_3QKCCOgCBAAAAwDWAAUBCIrWiu4FEPnqwIKctba_chj-6KyalfKf9HEqNglmiGNd3PYgQBFmiGNd3PYgQBkAAAECCOA_IREbACkRCQAxARn0mwEAAOA_MLD_pwg4vgdAvgdIAlCdpJdZWNyFc2AAaJFAeKCSBYABAYoBA1VTRJIBA0VVUpgBrAKgAfoBqAEGsAEAuAEBwAEEyAEC0AEA2AEA4AEA8AEAigI7dWYoJ2EnLCA0NzQwNTMsIDE1NzMwMzg4NTgpO3VmKCdyJywgMTg3MDI3OTk3LCAxNTczMDM4ODU4KTuSArUCIVVEN1VMQWlkcTlRUUVKMmtsMWtZQUNEY2hYTXdBRGdBUUFSSXZnZFFzUC1uQ0ZnQVlPWUhhQUJ3UW5nQWdBRlNpQUVBa0FFQW1BRUFvQUVCcUFFRHNBRUF1UUdXRjZnXzNQWWdRTUVCbGhlb1A5ejJJRURKQVVYZTZibVNKUHNfMlFFQUFBQUFBQUR3UC1BQkFQVUIzcllIUVpnQ0FLQUNBTFVDQUFBQUFMMENBQUFBQU9BQ0FPZ0NBUGdDQUlBREFaZ0RBYWdEbmF2VUVMb0RDVTVaVFRJNk5EQTVOT0FEbFJXSUJBQ1FCQUNZQkFIQkJBQUFBQUFBQUFBQXlRUUFBQUFBBQ0ITkVFBQgsQUNBR2tEWUJBRHhCCREFAWAtQVFBaUFYLUh3Li6aAokBIVFBX08xUWlkLjkBJDNJVnpJQVFvQUQNTGBBQVVRRG9KVGxsTk1qbzBNRGswUUpVVlNRBVQUQUFQQV9VEQwMQUFBVx0MAFkdDABhHQwAYw0MqGdCcEFlQUEu2ALoB-ACx9MB6gI0aXR1bmVzLmFwcGxlLmNvbS91cy9hcHABBPCfbmV4dXMtc2RrLWFwcC9pZDczNjg2OTgzM4ADAYgDAZADAJgDF6ADAaoDAMADrALIAwHYA_mjeuADAOgDAvgDAIAEAJIEBi91dC92M5gEAKIEDDEwLjc1LjEwLjExOagE9NcDsgQQCAAQARisAiD6ASgAMAA4ArgEAMAEAMgEANIEDTk1OCNOWU0yOjQwOTTaBAIIAeAEAfAEnaSXWYIFCRWQIIgFAZgFAKAF_xEBFAHABQDJBWlEFPA_0gUJCQkMeAAA2AUB4AUB8AX09wb6BQQIABAAkAYAmAYAuAYAwQYJJTTwP8gGANAG1gLaBhYKEAkUGQFQEAAYAOAGAfIGAggAgAcBiAcAoAcB&s=b18b8b56bf105e61f3edbe6c0da2c3117e6af5f2" + ], + "video_events": {} + } + ], + "request_url": "http://nym1-mobile.adnxs.com/mediation/v2/log_req?info=LwAAAAMABQEFAQiK1oruBRD56sCCnLW2v3IYvgchZohjXdz2IEAonaSXWTAQOAA.&s=7786be3bf04dc2ec36699d1c5ea16d50bb75c940", + "response_url": "http://nym1-mobile.adnxs.com/mediation/v2/log_resp?info=LwAAAAMABQEFAQiK1oruBRD56sCCnLW2v3IYvgchZohjXdz2IEAonaSXWTAQOAA.&s=7786be3bf04dc2ec36699d1c5ea16d50bb75c940" + } + }, + { + "content_source": "rtb", + "ad_type": "banner", + "buyer_member_id": 958, + "creative_id": 48514515, + "media_type_id": 1, + "media_subtype_id": 1, + "brand_category_id": 0, + "client_initiated_ad_counting": true, + "rtb": { + "banner": { + "content": "
", + "width": 300, + "height": 250 + }, + "trackers": [ + { + "impression_urls": [ + "http://nym1-mobile.adnxs.com/it?an_audit=0&referrer=itunes.apple.com%2Fus%2Fapp%2Fappnexus-sdk-app%2Fid736869833&e=wqT_3QKACOgABAAAAwDWAAUBCIrWiu4FEPnqwIKctba_chj-6KyalfKf9HEqNgl7FK5H4XqUPxF7FK5H4XqUPxkAAAECCOA_IREbACkRCQAxARnwiwAA4D8wsP-nCDi-B0C-B0gCUNOLkRdY3IVzYABokUB4iqQFgAEBigEDVVNEkgEDRVVSmAGsAqAB-gGoAQawAQC4AQHAAQTIAQLQAQDYAQDgAQDwAQCKAjt1ZignYScsIDExMDc2MTcsIDE1NzMwMzg4NTgpO3VmKCdyJywgNDg1MTQ1MTUsIDE1NzMwDR7w0JICtQIhcmotWmpRaWNuLVVMRU5PTGtSY1lBQ0RjaFhNd0FEZ0FRQVJJdmdkUXNQLW5DRmdBWU9ZSGFBQndLbmlhY0lBQktvZ0JtbkNRQVFDWUFRQ2dBUUdvQVFPd0FRQzVBWkh2Q3ZEaGVwUV93UUdSN3dydzRYcVVQOGtCZW03c1k5Rk44RF9aQVFBQUFBQUFBUEFfNEFFQTlRRUFBQUFBbUFJQW9BSUF0UUlBQUFBQXZRSUFBQUFBNEFJQTZBSUEtQUlBZ0FNQm1BTUJxQU9jAcSQdWdNSlRsbE5Nam8wTURrMDRBT1ZGWWdFQUpBRUFKZ0VBY0VFQQluFEFBQURKQgEHDQEIMFFRCQokSUFhUU5nRUFQRS4sAEw0QkFDSUJmNGaaAokBIWNoS1l3ZzY5AUAzSVZ6SUFRb0FERjdGSzVINAHtBHpvMpEAEFFKVVZTDWgB8QBVEQwMQUFBVx0MAFkdDABhHQwAYw0MqGdCcEFlQUEu2ALoB-ACx9MB6gI0aXR1bmVzLmFwcGxlLmNvbS91cy9hcHABBPCfbmV4dXMtc2RrLWFwcC9pZDczNjg2OTgzM4ADAYgDAZADAJgDF6ADAaoDAMADrALIAwHYA_mjeuADAOgDAvgDAIAEAJIEBi91dC92M5gEAKIEDDEwLjc1LjEwLjExOagE9NcDsgQQCAAQARisAiD6ASgAMAA4ArgEAMAEAMgEANIEDTk1OCNOWU0yOjQwOTTaBAIIAeAEAfAE04uRF4IFCRWQIIgFAZgFAKAF_xEBGAHABQDJBQAFARTwP9IFCQkFC3QAAADYBQHgBQHwBQH6BQQIABAAkAYAmAYAuAYAwQYBH0AAAPA_yAYA0AbWAtoGFgoQADoBAFAQABgA4AYB8gYCCACABwGIBwCgBwE.&s=01342dd560d92162e8e34f6824a9ec3b73695da8" + ], + "video_events": {} + } + ] + } + } + ] + } + ] +} diff --git a/tests/UnitTestApp/UnitTestApp/SharedMockFiles/StubResponse/ANAdResponseRTB_Banner.json b/tests/UnitTestApp/UnitTestApp/SharedMockFiles/StubResponse/ANAdResponseRTB_Banner.json new file mode 100644 index 000000000..9b62193ca --- /dev/null +++ b/tests/UnitTestApp/UnitTestApp/SharedMockFiles/StubResponse/ANAdResponseRTB_Banner.json @@ -0,0 +1,41 @@ +{ + "version": "3.0.0", + "tags": [ + { + "tag_id": 16392991, + "auction_id": "9187200539711848928", + "nobid": false, + "no_ad_url": "http://nym1-mobile.adnxs.com/it?an_audit=0&referrer=itunes.apple.com%2Fus%2Fapp%2Fappnexus-sdk-app%2Fid736869833&e=wqT_3QLICKBIBAAAAwDWAAUBCP-ipOsFEOCDtc7wxt-_fxid8uyihca6iBkqNgkAAAkCABEJBywAABkAAADgUbiuPyEREgApEQkAMREb8IYwn8boBzjuTkDuTkgAUABYzrNsYABopJOGAXgAgAEBigEAkgEDVVNEmAGsAqAB-gGoAQGwAQC4AQHAAQDIAQLQAQDYAQDgAQDwAQCKAll1ZignYScsIDMwMzgzMTQsIDE1NjcxNjY4NDcpO3VmKCdpJywgMjA0ODE5MCwgMTU2NzE2Njg0NykFHTByJywgMTYzMDUxOTUwNh8A8J-SAr0CITFrYVhMQWpNOExFUEVLN3ozMDBZQUNET3Myd3dBRGdBUUFSSTdrNVFuOGJvQjFnQVlPVUJhQUJ3T25qSUY0QUI5QVNJQWNBWGtBRUFtQUVBb0FFQnFBRURzQUVBdVFGMXF3MXNtcG1wUDhFQmRhc05iSnFacVRfSkFVNFRtZ2lsNXRJXzJRRUFBQUFBQUFEd1AtQUJ2b0Y5OVFFBRQobUFJQW9BSUF0UUkFEAB2DQjwWDBBTG1CTmdDd0JmZ0FnRG9BZ0Q0QWdDQUF3R1lBd0dvQTh6d3NRLTZBd2xPV1UweU9qUXdNemJnQTdJUmdBVHEzY2dDaUFUczNjZ0NrQVFBbUFRQndRUUFBBWYUQUFBTWtFAQcJARhEWUJBRHhCCQ0FATQtQVFBmgKJASFxeE9yYjpBATR6ck5zSUFRb0FER2FtWgUCVHBQem9KVGxsTk1qbzBNRE0yUUxJUlMRcAxQQV9VEQwMQUFBVx0MAFkdDABhHQwAYx0M9F4BZUFBLtgCAOACyqhN6gI0aXR1bmVzLmFwcGxlLmNvbS91cy9hcHAvYXBwbmV4dXMtc2RrLWFwcC9pZDczNjg2OTgzM4ADAIgDAZADAJgDF6ADAaoDAMADrALIAwDSAyoIABIkNTk0NjFERDQtQ0E4NC00N0Q1LUE1REQtQzJFREE1QTU1MTIwGAHYA_mjeuADAOgDAvgDAIAEAJIEBi91dC92M5gEAKIEDDEwLjc1LjEwLjExOagE04UEsgQNCAAQARjAAiAyMAA4ArgEAMAEAMgEANIEDzEwMDk0I05ZTTI6NDAzNtoEAggA4AQB8ASu899NggUJNzM2ODY5ODMziAUBmAUAoAX___________8BwAUAyQUAAAAAAADwP9IFCQkAAAAAAAAAANgFAeAFAfAFAfoFBAgAEACQBgCYBgC4BgDBBgAAAAAAAPC_yAYA0AbWM9oGFgoQAAAAAAAAAUcJAUQQABgA4AYB8gYCCACABwGIBwA.&s=8bb274a1bd6f52a51340cc0e2f126465b1de49b8", + "timeout_ms": 0, + "ad_profile_id": 1266762, + "rtb_video_fallback": false, + "ads": [ + { + "content_source": "rtb", + "ad_type": "banner", + "buyer_member_id": 10094, + "creative_id": 163051950, + "media_type_id": 1, + "media_subtype_id": 1, + "brand_category_id": 0, + "client_initiated_ad_counting": true, + "rtb": { + "banner": { + "content": " adResponseElements. --- .../Categories/ANAdView+PrivateMethods.h | 2 +- sdk/sourcefiles/internal/ANAdView.m | 14 +++++++------- sdk/sourcefiles/internal/ANBannerAdView.m | 12 ++++++------ sdk/sourcefiles/internal/ANInterstitialAd.m | 2 +- .../native/internal/ANNativeAdRequest.m | 4 ++-- .../native/internal/ANNativeStandardAdResponse.m | 2 +- sdk/sourcefiles/video/ANInstreamVideoAd.m | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h index 8293f0a44..f5fbd4065 100644 --- a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h +++ b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h @@ -38,7 +38,7 @@ - (void)loadAdFromVast: (nonnull NSString *)xml width: (int)width height: (int)height; -- (void)setAdResponse:(nonnull ANAdResponseElements *)adResponseElements; +- (void)setAdResponseElements:(nonnull ANAdResponseElements *)adResponseElements; - (void)setCreativeId:(nonnull NSString *)creativeId; diff --git a/sdk/sourcefiles/internal/ANAdView.m b/sdk/sourcefiles/internal/ANAdView.m index d1bdf8069..cf371e507 100644 --- a/sdk/sourcefiles/internal/ANAdView.m +++ b/sdk/sourcefiles/internal/ANAdView.m @@ -81,7 +81,7 @@ @implementation ANAdView @synthesize clickThroughAction = __clickThroughAction; @synthesize landingPageLoadsInBackground = __landingPageLoadsInBackground; -@synthesize adResponseElements = __adResponse; +@synthesize adResponseElements = __adResponseElements; #pragma mark - Initialization @@ -245,14 +245,14 @@ - (void)setAdType:(ANAdType)adType } } -- (void)setAdResponse:(ANAdResponseElements *)adResponseElements { +- (void)setAdResponseElements:(ANAdResponseElements *)adResponseElements { if (!adResponseElements) { ANLogError(@"Could not set adResponseElements"); return; } - if (adResponseElements != __adResponse) { + if (adResponseElements != __adResponseElements) { ANLogDebug(@"Setting adResponseElements to %@", adResponseElements); - __adResponse = adResponseElements; + __adResponseElements = adResponseElements; } } @@ -381,8 +381,8 @@ - (void)setClickThroughAction:(ANClickThroughAction)clickThroughAction #pragma mark - ANAdProtocol: Getter methods - (nullable ANAdResponseElements *)adResponseElements { - ANLogDebug(@"ANAdResponse returned %@", __adResponse); - return __adResponse; + ANLogDebug(@"ANAdResponse returned %@", __adResponseElements); + return __adResponseElements; } - (nullable NSString *)placementId { @@ -599,7 +599,7 @@ - (void)adInteractionDidEnd { ANLogDebug(@""); - if (ANAdTypeVideo != __adResponse.adType) { + if (ANAdTypeVideo != __adResponseElements.adType) { [self.universalAdFetcher restartAutoRefreshTimer]; [self.universalAdFetcher startAutoRefreshTimer]; } diff --git a/sdk/sourcefiles/internal/ANBannerAdView.m b/sdk/sourcefiles/internal/ANBannerAdView.m index 804d06db8..73d3a30e6 100644 --- a/sdk/sourcefiles/internal/ANBannerAdView.m +++ b/sdk/sourcefiles/internal/ANBannerAdView.m @@ -83,7 +83,7 @@ @implementation ANBannerAdView @synthesize shouldAllowNativeDemand = _shouldAllowNativeDemand; @synthesize nativeAdRendererId = _nativeAdRendererId; @synthesize enableNativeRendering = _enableNativeRendering; -@synthesize adResponseElements = _adResponse; +@synthesize adResponseElements = _adResponseElements; @synthesize minDuration = __minDuration; @synthesize maxDuration = __maxDuration; @@ -367,9 +367,9 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR self.contentView = nil; self.impressionURLs = nil; - _adResponse = (ANAdResponseElements *) [ANGlobal valueOfGetterProperty:kANAdResponseElements forObject:adObjectHandler]; - if (_adResponse) { - [self setAdResponse:_adResponse]; + _adResponseElements = (ANAdResponseElements *) [ANGlobal valueOfGetterProperty:kANAdResponseElements forObject:adObjectHandler]; + if (_adResponseElements) { + [self setAdResponseElements:_adResponseElements]; } NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:adObjectHandler]; @@ -405,7 +405,7 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR } [self adDidReceiveAd:self]; - if (_adResponse.adType == ANAdTypeBanner && !([adObjectHandler isKindOfClass:[ANNativeStandardAdResponse class]])) + if (_adResponseElements.adType == ANAdTypeBanner && !([adObjectHandler isKindOfClass:[ANNativeStandardAdResponse class]])) { self.impressionURLs = (NSArray *) [ANGlobal valueOfGetterProperty:kANImpressionUrls forObject:adObjectHandler]; @@ -549,7 +549,7 @@ - (UIViewController *)displayController - (void)didMoveToWindow { - if (self.contentView && ( _adResponse.adType == ANAdTypeBanner)) { + if (self.contentView && ( _adResponseElements.adType == ANAdTypeBanner)) { [ANTrackerManager fireTrackerURLArray:self.impressionURLs]; self.impressionURLs = nil; diff --git a/sdk/sourcefiles/internal/ANInterstitialAd.m b/sdk/sourcefiles/internal/ANInterstitialAd.m index f71192789..1569c000d 100644 --- a/sdk/sourcefiles/internal/ANInterstitialAd.m +++ b/sdk/sourcefiles/internal/ANInterstitialAd.m @@ -318,7 +318,7 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR } ANAdResponseElements *adResponseElements = (ANAdResponseElements *) [ANGlobal valueOfGetterProperty:kANAdResponseElements forObject:response.adObjectHandler]; if (adResponseElements) { - [self setAdResponse:adResponseElements]; + [self setAdResponseElements:adResponseElements]; } NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:response.adObjectHandler]; if(creativeId){ diff --git a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m index b87a9d7f9..7c6e45375 100644 --- a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m +++ b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m @@ -163,7 +163,7 @@ -(void)didFinishRequestWithResponse: (nonnull ANAdFetcherResponse *)response if (nativeResponse.adResponseElements == nil) { ANAdResponseElements *adResponseElements = (ANAdResponseElements *) [ANGlobal valueOfGetterProperty:kANAdResponseElements forObject:response.adObjectHandler]; if (adResponseElements) { - [self setAdResponse:adResponseElements onObject:nativeResponse forKeyPath:kANAdResponseElements]; + [self setAdResponseElements:adResponseElements onObject:nativeResponse forKeyPath:kANAdResponseElements]; } } // @@ -262,7 +262,7 @@ - (void)setCreativeId:(NSString *)creativeId [object setValue:creativeId forKeyPath:keyPath]; } -- (void)setAdResponse:(ANAdResponseElements *)adResponseElements +- (void)setAdResponseElements:(ANAdResponseElements *)adResponseElements onObject:(id)object forKeyPath:(NSString *)keyPath { [object setValue:adResponseElements forKeyPath:keyPath]; diff --git a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m index 49c1c8ff2..8db0540e7 100644 --- a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m +++ b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m @@ -65,7 +65,7 @@ @implementation ANNativeStandardAdResponse @synthesize privacyLink = _privacyLink; @synthesize nativeRenderingUrl = _nativeRenderingUrl; @synthesize nativeRenderingObject = _nativeRenderingObject; -@synthesize adResponseElements = _adResponse; +@synthesize adResponseElements = _adResponseElements; #pragma mark - Lifecycle. diff --git a/sdk/sourcefiles/video/ANInstreamVideoAd.m b/sdk/sourcefiles/video/ANInstreamVideoAd.m index b3b0254db..c3039a608 100644 --- a/sdk/sourcefiles/video/ANInstreamVideoAd.m +++ b/sdk/sourcefiles/video/ANInstreamVideoAd.m @@ -409,7 +409,7 @@ - (void) universalAdFetcher: (ANUniversalAdFetcher *)fetcher ANAdResponseElements *adResponseElements = (ANAdResponseElements *) [ANGlobal valueOfGetterProperty:kANAdResponseElements forObject:response.adObjectHandler]; if (adResponseElements) { - [self setAdResponse:adResponseElements]; + [self setAdResponseElements:adResponseElements]; } NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:response.adObjectHandler]; From c4cfca43d456288124283eef3b764454d516e7e9 Mon Sep 17 00:00:00 2001 From: David Reeder Date: Wed, 5 Feb 2020 20:14:42 -0500 Subject: [PATCH 19/35] Remove changes to public API delegate adRequestFailedWithError:(NSError *)error. Update adResponseElement definition in ANAdProtocol.h to be readwrite. --- sdk/sourcefiles/ANAdProtocol.h | 10 ++++++---- .../internal/ANAdFetcherBase+PrivateMethods.h | 2 +- sdk/sourcefiles/internal/ANAdFetcherBase.m | 6 +++--- sdk/sourcefiles/internal/ANAdView.m | 8 +++++--- sdk/sourcefiles/internal/ANBannerAdView.m | 3 +++ sdk/sourcefiles/internal/ANInterstitialAd.m | 2 ++ sdk/sourcefiles/internal/ANMultiAdRequest.m | 4 ++-- sdk/sourcefiles/internal/ANNativeAdFetcher.m | 6 +++--- sdk/sourcefiles/internal/ANUniversalAdFetcher.m | 6 +++--- .../MARTestMockMediation/DefaultPlacementLogic.m | 12 +++++++++--- .../FunctionalTests/MediationCallbacksTests.m | 5 ++--- .../OutstreamVideoAdClassObjectFromUTResponseTests.m | 2 +- .../UnitMockFiles/UnitTestShared/ANBaseTestCase.m | 3 +-- .../UnitTests/ANUniversalAdFetcherTests.m | 2 +- tests/UnitTestApp/UnitTests/MediationTests.m | 2 +- 15 files changed, 43 insertions(+), 30 deletions(-) diff --git a/sdk/sourcefiles/ANAdProtocol.h b/sdk/sourcefiles/ANAdProtocol.h index fb44110a0..d7697e72f 100644 --- a/sdk/sourcefiles/ANAdProtocol.h +++ b/sdk/sourcefiles/ANAdProtocol.h @@ -232,10 +232,12 @@ /** - An AppNexus Single Unified object that will contain all the common fields of all the ads types + * An AppNexus Single Unified object that will contain all the common fields of all the ads types + * + * adResponseElements should be accessible from response Object only -- ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). + * It is placed into ANAdProtocol instead of ANAdProtocolFoundation to avoid adResponseElements being accessed through ANNativeAdRequest. */ -// ANAdResponse should be accessible from response Object only(like. ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). It is placed into ANAdProtocol instead of ANAdProtocolFoundation to avoid adResponseElements being accessed through ANNativeAdRequest. -@property (nonatomic, readonly, strong, nullable) ANAdResponseElements *adResponseElements; +@property (nonatomic, readwrite, strong, nullable) ANAdResponseElements *adResponseElements; @end @@ -286,7 +288,7 @@ /** Sent when the ad request to the server has failed. */ -- (void)ad:(nonnull id)ad requestFailedWithError:(nonnull NSError *)error andAdResponseElements:(nullable ANAdResponseElements *)adResponseElements; +- (void)ad:(nonnull id)ad requestFailedWithError:(nonnull NSError *)error; /** diff --git a/sdk/sourcefiles/internal/ANAdFetcherBase+PrivateMethods.h b/sdk/sourcefiles/internal/ANAdFetcherBase+PrivateMethods.h index 50d93257a..027e31e54 100644 --- a/sdk/sourcefiles/internal/ANAdFetcherBase+PrivateMethods.h +++ b/sdk/sourcefiles/internal/ANAdFetcherBase+PrivateMethods.h @@ -25,7 +25,7 @@ - (void)continueWaterfall; -- (void)finishRequestWithError:(NSError *)error andAdResponse:(ANAdResponseElements *)adReponse; +- (void)finishRequestWithError:(NSError *)error andAdResponseElements:(ANAdResponseElements *)adResponseElements; - (void)restartAutoRefreshTimer; @end diff --git a/sdk/sourcefiles/internal/ANAdFetcherBase.m b/sdk/sourcefiles/internal/ANAdFetcherBase.m index 4ef45f9d6..f0b954337 100644 --- a/sdk/sourcefiles/internal/ANAdFetcherBase.m +++ b/sdk/sourcefiles/internal/ANAdFetcherBase.m @@ -211,7 +211,7 @@ - (void)prepareForWaterfallWithAdServerResponseTag: (NSDictionary)ad { [super adDidReceiveAd:ad]; } -- (void)ad:(id)ad requestFailedWithError:(NSError *)error andAdReponseElements:(ANAdResponseElements *)adResponseElements +- (void)ad:(id)ad requestFailedWithError:(NSError *)error { if (self.adFailedToLoadCalled) { self.adFailedMultiple = YES; } - [super ad:ad requestFailedWithError:error andAdResponseElements:nil]; - //FIX -- jow to use responseeleents? + [super ad:ad requestFailedWithError:error]; } diff --git a/tests/UnitTestApp/FunctionalTests/OutstreamVideoAdClassObjectFromUTResponseTests.m b/tests/UnitTestApp/FunctionalTests/OutstreamVideoAdClassObjectFromUTResponseTests.m index 6dbb2783b..d99c5d5af 100644 --- a/tests/UnitTestApp/FunctionalTests/OutstreamVideoAdClassObjectFromUTResponseTests.m +++ b/tests/UnitTestApp/FunctionalTests/OutstreamVideoAdClassObjectFromUTResponseTests.m @@ -212,7 +212,7 @@ - (void)adInteractionDidEnd { //EMPTY } -- (void)adRequestFailedWithError:(NSError *)error andAdResponseElements:(ANAdResponseElements *)adResponseElements +- (void)adRequestFailedWithError:(NSError *)error { //EMPTY } diff --git a/tests/UnitTestApp/UnitTestApp/UnitMockFiles/UnitTestShared/ANBaseTestCase.m b/tests/UnitTestApp/UnitTestApp/UnitMockFiles/UnitTestShared/ANBaseTestCase.m index c4519b8f7..3835b71b3 100644 --- a/tests/UnitTestApp/UnitTestApp/UnitMockFiles/UnitTestShared/ANBaseTestCase.m +++ b/tests/UnitTestApp/UnitTestApp/UnitMockFiles/UnitTestShared/ANBaseTestCase.m @@ -178,12 +178,11 @@ - (void)adDidReceiveAd:(id)ad { } -- (void)ad:(id)ad requestFailedWithError:(NSError *)error andAdResponseElements:(nullable ANAdResponseElements *)adResponseElements +- (void)ad:(id)ad requestFailedWithError:(NSError *)error { NSLog(@"ad:requestFailedWithError callback called"); _adFailedToLoadCalled = YES; _testComplete = YES; - //FIX -- use adResponseElements } - (void)adFailedToDisplay:(ANInterstitialAd *)ad { diff --git a/tests/UnitTestApp/UnitTests/ANUniversalAdFetcherTests.m b/tests/UnitTestApp/UnitTests/ANUniversalAdFetcherTests.m index d3649fa81..a9abc60f6 100644 --- a/tests/UnitTestApp/UnitTests/ANUniversalAdFetcherTests.m +++ b/tests/UnitTestApp/UnitTests/ANUniversalAdFetcherTests.m @@ -167,7 +167,7 @@ - (void)adInteractionDidEnd { } -- (void)adRequestFailedWithError:(NSError *)error andAdResponseElements:(ANAdResponseElements *)adResponseElements +- (void)adRequestFailedWithError:(NSError *)error { } diff --git a/tests/UnitTestApp/UnitTests/MediationTests.m b/tests/UnitTestApp/UnitTests/MediationTests.m index e852491fd..62ba5059c 100644 --- a/tests/UnitTestApp/UnitTests/MediationTests.m +++ b/tests/UnitTestApp/UnitTests/MediationTests.m @@ -222,7 +222,7 @@ - (void)adWillLeaveApplication {}; - (void)adFailedToDisplay {}; - (void)adDidReceiveAppEvent:(NSString *)name withData:(NSString *)data {}; - (void)adDidReceiveAd {}; -- (void)adRequestFailedWithError:(NSError *)error andAdResponseElements:(ANAdResponseElements *)adResponseElements {}; +- (void)adRequestFailedWithError:(NSError *)error {}; - (void)adInteractionDidBegin {}; - (void)adInteractionDidEnd {}; From 2ab641328a90beb436098f7cf395f1296f74b94c Mon Sep 17 00:00:00 2001 From: David Reeder Date: Thu, 6 Feb 2020 18:34:46 -0500 Subject: [PATCH 20/35] Complete all tests that expect nobid. Discovered and fixed corner case where ANBannerAdView cached fetcher with wrong internal configuration. --- sdk/sourcefiles/internal/ANAdView.m | 13 +++++ .../DefaultPlacementLogic.m | 50 +++++++++++++------ 2 files changed, 47 insertions(+), 16 deletions(-) diff --git a/sdk/sourcefiles/internal/ANAdView.m b/sdk/sourcefiles/internal/ANAdView.m index 74602593c..db18cc0a7 100644 --- a/sdk/sourcefiles/internal/ANAdView.m +++ b/sdk/sourcefiles/internal/ANAdView.m @@ -375,7 +375,20 @@ - (void)setClickThroughAction:(ANClickThroughAction)clickThroughAction __clickThroughAction = clickThroughAction; } +/** + * universalAdFetcher getter returns fetcher conditional upon whether marManager is set. + * Therefore, universalAdFetcher must be cleared anytime marManager is set to a different value. + * universalAdFetcher will be lazily recreated next time it is needed. + */ +- (void)setMarManager:(ANMultiAdRequest *)marManager +{ + if (self.universalAdFetcher && (marManager != _marManager)) { + [self.universalAdFetcher stopAdLoad]; + self.universalAdFetcher = nil; + } + _marManager = marManager; +} #pragma mark - ANAdProtocol: Getter methods diff --git a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m index ecec0960d..73fb9f50f 100644 --- a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m +++ b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m @@ -83,6 +83,12 @@ @implementation DefaultPlacementLogic - (void)setUp { + self.adUnitsForTest = [[MARAdUnits alloc] initWithDelegate:self]; + + self.adUnitsForTest.banner.shouldServePublicServiceAnnouncements = NO; + + + // self.publisherIDWithNobid = 1456489; self.inventoryCodeWithNobidGood = @"pascal_med_rect"; self.inventoryCodeWithNobidBad = @"this_is_a_badInventoryCode"; @@ -129,14 +135,10 @@ - (void)clearCounters #pragma mark - Tests. -- (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithAndWithoutMAR +- (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithoutMAR { TMARK(); - self.adUnitsForTest = [[MARAdUnits alloc] initWithDelegate:self]; - ANBannerAdView *banner = self.adUnitsForTest.banner; - banner.shouldServePublicServiceAnnouncements = NO; - // ANBannerAdView, receiving nobid, without MAR association. @@ -174,15 +176,18 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithAndWithoutMAR XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); XCTAssertTrue([self.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); +} +- (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR +{ + ANBannerAdView *banner = self.adUnitsForTest.banner; // ANBannerAdView, receiving nobid, associated with MAR, loaded via MAR. // self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault delegate: self - adUnits: banner, nil]; - + adUnits: self.adUnitsForTest.banner, nil]; [self clearCounters]; [banner setInventoryCode:self.inventoryCodeWithNobidGood memberId:self.adUnitsForTest.memberIDDefault]; @@ -203,16 +208,17 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithAndWithoutMAR self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; - XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + _AdUnit_countOfReceiveFailures, 1); XCTAssertTrue([self.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); // [self clearCounters]; + [self.mar removeAdUnit:self.adUnitsForTest.banner]; self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault publisherId: self.publisherIDWithNobid delegate: self - adUnits: banner, nil]; + adUnits: self.adUnitsForTest.banner, nil]; [banner setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; [self.mar load]; @@ -222,16 +228,21 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithAndWithoutMAR XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); XCTAssertTrue([self.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); +} +- (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently +{ + ANBannerAdView *banner = self.adUnitsForTest.banner; - + // ANBannerAdView, receiving nobid, associated with MAR, loaded independently. // [self clearCounters]; + [self.mar removeAdUnit:self.adUnitsForTest.banner]; self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault delegate: self - adUnits: banner, nil]; + adUnits: self.adUnitsForTest.banner, nil]; [banner setInventoryCode:self.inventoryCodeWithNobidGood memberId:self.adUnitsForTest.memberIDDefault]; [banner loadAd]; @@ -251,24 +262,25 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithAndWithoutMAR self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; - XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); XCTAssertTrue([self.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); // [self clearCounters]; + [self.mar removeAdUnit:self.adUnitsForTest.banner]; self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault publisherId: self.publisherIDWithNobid delegate: self - adUnits: banner, nil]; + adUnits: self.adUnitsForTest.banner, nil]; - [banner setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; - [banner loadAd]; + [self.adUnitsForTest.banner setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [self.adUnitsForTest.banner loadAd]; self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; - XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); XCTAssertTrue([self.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } @@ -302,6 +314,9 @@ - (void)adDidReceiveAd:(nonnull id)ad { TINFO(@"%@", [MARHelper adunitDescription:ad]); + ANAdView *adview = (ANAdView *)ad; + self.adResponseElements = adview.adResponseElements; + self.AdUnit_countOfReceiveSuccesses += 1; [self.expectationAdUnitLoadResponseOrFailure fulfill]; } @@ -311,6 +326,9 @@ - (void) ad: (nonnull id)loadInstance { TINFO(@"%@", [MARHelper adunitDescription:loadInstance]); + ANNativeAdResponse *nativead = (ANNativeAdResponse *)loadInstance; + self.adResponseElements = nativead.adResponseElements; + self.AdUnit_countOfReceiveSuccesses += 1; [self.expectationAdUnitLoadResponseOrFailure fulfill]; } From de406c11630715bc6232ad962a6ed7483224358f Mon Sep 17 00:00:00 2001 From: David Reeder Date: Fri, 7 Feb 2020 12:46:45 -0500 Subject: [PATCH 21/35] Fix ANMultiAdRequest corner case where fetcher is not recreated. REVIEWERS Primary: Abhishek, Akash, Kowshick, Punnaghai Secondary: Abhas, Wei DESCRIPTION This update handles the case where an AdUnit derived from ANAdView executes loadAd before being included in an instance of ANMultiAdRequest. Or vice versa, where the AdUnit is removed from the MAR instance after being loaded once by the MAR instance. The problem is that the fetcher is defined at the time of the load, and the definition is specific to whether the internal property marManager is defined. The solution is to stop and free the fetcher whenever marManager is assigned. --- sdk/sourcefiles/internal/ANAdView.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sdk/sourcefiles/internal/ANAdView.m b/sdk/sourcefiles/internal/ANAdView.m index dbe25c27d..7f191b7df 100644 --- a/sdk/sourcefiles/internal/ANAdView.m +++ b/sdk/sourcefiles/internal/ANAdView.m @@ -361,6 +361,21 @@ - (void)setClickThroughAction:(ANClickThroughAction)clickThroughAction __clickThroughAction = clickThroughAction; } +/** + * universalAdFetcher getter returns fetcher conditional upon whether marManager is set. + * Therefore, universalAdFetcher must be cleared anytime marManager is set to a different value. + * universalAdFetcher will be lazily recreated next time it is needed. + */ +- (void)setMarManager:(ANMultiAdRequest *)marManager +{ + if (self.universalAdFetcher && (marManager != _marManager)) { + [self.universalAdFetcher stopAdLoad]; + self.universalAdFetcher = nil; + } + + _marManager = marManager; +} + From dd747cb44534e5c2ddcf834fb57f028e627ecc32 Mon Sep 17 00:00:00 2001 From: David Reeder Date: Fri, 7 Feb 2020 16:13:11 -0500 Subject: [PATCH 22/35] Remove fix for lazy evaluation of fetcher in AdUnit definition. This fix has been delayed until another time. See https://jira.xandr-services.com/browse/MS-4198 . --- sdk/sourcefiles/internal/ANAdView.m | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/sdk/sourcefiles/internal/ANAdView.m b/sdk/sourcefiles/internal/ANAdView.m index db18cc0a7..74602593c 100644 --- a/sdk/sourcefiles/internal/ANAdView.m +++ b/sdk/sourcefiles/internal/ANAdView.m @@ -375,20 +375,7 @@ - (void)setClickThroughAction:(ANClickThroughAction)clickThroughAction __clickThroughAction = clickThroughAction; } -/** - * universalAdFetcher getter returns fetcher conditional upon whether marManager is set. - * Therefore, universalAdFetcher must be cleared anytime marManager is set to a different value. - * universalAdFetcher will be lazily recreated next time it is needed. - */ -- (void)setMarManager:(ANMultiAdRequest *)marManager -{ - if (self.universalAdFetcher && (marManager != _marManager)) { - [self.universalAdFetcher stopAdLoad]; - self.universalAdFetcher = nil; - } - _marManager = marManager; -} #pragma mark - ANAdProtocol: Getter methods From 34cb1fcda878c53dce6533059125e906031c0549 Mon Sep 17 00:00:00 2001 From: David Reeder Date: Fri, 7 Feb 2020 22:45:16 -0500 Subject: [PATCH 23/35] Rename ANAdResponseElements --> ANAdResponseInfo. --- sdk/AppNexusNativeSDK/AppNexusNativeSDK.h | 2 +- sdk/AppNexusSDK.xcodeproj/project.pbxproj | 24 ++--- sdk/AppNexusSDK/AppNexusSDK.h | 2 +- sdk/sourcefiles/ANAdProtocol.h | 8 +- ...dResponseElements.h => ANAdResponseInfo.h} | 2 +- .../Categories/ANAdView+PrivateMethods.h | 2 +- .../internal/ANAdFetcherBase+PrivateMethods.h | 2 +- sdk/sourcefiles/internal/ANAdFetcherBase.m | 10 +- .../internal/ANAdFetcherResponse.h | 6 +- ...dResponseElements.m => ANAdResponseInfo.m} | 4 +- sdk/sourcefiles/internal/ANAdView.m | 28 ++--- .../internal/ANAdViewInternalDelegate.h | 2 +- sdk/sourcefiles/internal/ANBannerAdView.m | 16 +-- sdk/sourcefiles/internal/ANBaseAdObject.h | 4 +- sdk/sourcefiles/internal/ANGlobal.h | 2 +- sdk/sourcefiles/internal/ANInterstitialAd.m | 9 +- sdk/sourcefiles/internal/ANNativeAdFetcher.m | 6 +- .../internal/ANUniversalAdFetcher.m | 6 +- .../internal/ANUniversalTagAdServerResponse.m | 20 ++-- .../internal/MRAID/ANMRAIDContainerView.m | 4 +- sdk/sourcefiles/native/ANNativeAdResponse.h | 2 +- .../native/internal/ANNativeAdRequest.m | 12 +-- .../native/internal/ANNativeAdResponse.m | 2 +- .../internal/ANNativeStandardAdResponse.h | 2 +- .../internal/ANNativeStandardAdResponse.m | 2 +- sdk/sourcefiles/video/ANInstreamVideoAd.m | 8 +- .../FunctionalTests/ANAdResponseTestCase.m | 90 ++++++++-------- .../ANNativeAdRequestTestCase.m | 102 +++++++++--------- .../FunctionalTests/ANOMIDNativeTestCase.m | 10 +- .../DefaultPlacementLogic.m | 32 +++--- .../FunctionalTests/MediationCallbacksTests.m | 2 +- .../NativeSDKTestAppTests.m | 44 ++++---- .../UnitTestShared/ANBaseTestCase.h | 2 +- 33 files changed, 234 insertions(+), 235 deletions(-) rename sdk/sourcefiles/{ANAdResponseElements.h => ANAdResponseInfo.h} (97%) rename sdk/sourcefiles/internal/{ANAdResponseElements.m => ANAdResponseInfo.m} (90%) diff --git a/sdk/AppNexusNativeSDK/AppNexusNativeSDK.h b/sdk/AppNexusNativeSDK/AppNexusNativeSDK.h index fa5160703..03058f9eb 100644 --- a/sdk/AppNexusNativeSDK/AppNexusNativeSDK.h +++ b/sdk/AppNexusNativeSDK/AppNexusNativeSDK.h @@ -39,7 +39,7 @@ FOUNDATION_EXPORT const unsigned char AppNexusNativeSDKVersionString[]; #import #import -#import +#import #import #import diff --git a/sdk/AppNexusSDK.xcodeproj/project.pbxproj b/sdk/AppNexusSDK.xcodeproj/project.pbxproj index c02cfe420..9230ab9fe 100644 --- a/sdk/AppNexusSDK.xcodeproj/project.pbxproj +++ b/sdk/AppNexusSDK.xcodeproj/project.pbxproj @@ -227,10 +227,10 @@ 8AFC046F1A2E75AE00BEA485 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AFC046E1A2E75AE00BEA485 /* AdSupport.framework */; }; 8AFC04711A2E760800BEA485 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AFC04701A2E760800BEA485 /* MessageUI.framework */; }; 8AFC04731A2E78E400BEA485 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AFC04721A2E78E400BEA485 /* StoreKit.framework */; }; - 9706554F232B93A200D484D4 /* ANAdResponseElements.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANAdResponseElements.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 97065550232B93A200D484D4 /* ANAdResponseElements.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANAdResponseElements.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 97065551232B93A200D484D4 /* ANAdResponseElements.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANAdResponseElements.m */; }; - 97065552232B93A200D484D4 /* ANAdResponseElements.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANAdResponseElements.m */; }; + 9706554F232B93A200D484D4 /* ANAdResponseInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANAdResponseInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 97065550232B93A200D484D4 /* ANAdResponseInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 9706554D232B93A200D484D4 /* ANAdResponseInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 97065551232B93A200D484D4 /* ANAdResponseInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANAdResponseInfo.m */; }; + 97065552232B93A200D484D4 /* ANAdResponseInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 9706554E232B93A200D484D4 /* ANAdResponseInfo.m */; }; 972025CE222FD90E00C13454 /* ANVerificationScriptResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 97EC51EB2229782B00B740DF /* ANVerificationScriptResource.h */; settings = {ATTRIBUTES = (Private, ); }; }; 973B23AB238D1E4C00717D67 /* ANUSPrivacySettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 973B23A9238D1E4C00717D67 /* ANUSPrivacySettings.h */; settings = {ATTRIBUTES = (Public, ); }; }; 973B23AC238D1E4C00717D67 /* ANUSPrivacySettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 973B23A9238D1E4C00717D67 /* ANUSPrivacySettings.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -526,8 +526,8 @@ 8AFC046E1A2E75AE00BEA485 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; 8AFC04701A2E760800BEA485 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; }; 8AFC04721A2E78E400BEA485 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; - 9706554D232B93A200D484D4 /* ANAdResponseElements.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ANAdResponseElements.h; sourceTree = ""; }; - 9706554E232B93A200D484D4 /* ANAdResponseElements.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ANAdResponseElements.m; sourceTree = ""; }; + 9706554D232B93A200D484D4 /* ANAdResponseInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ANAdResponseInfo.h; sourceTree = ""; }; + 9706554E232B93A200D484D4 /* ANAdResponseInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ANAdResponseInfo.m; sourceTree = ""; }; 973B23A9238D1E4C00717D67 /* ANUSPrivacySettings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ANUSPrivacySettings.h; sourceTree = ""; }; 973B23AA238D1E4C00717D67 /* ANUSPrivacySettings.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ANUSPrivacySettings.m; sourceTree = ""; }; 97A590D2228EBBD600D1C75C /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; @@ -644,7 +644,7 @@ 00D6B04320D1BAB9007A3439 /* Viewability */, 8ABB76691A00385C00FEAD9D /* ANAdConstants.h */, ECE4EA8D194B768A0069D934 /* ANAdProtocol.h */, - 9706554D232B93A200D484D4 /* ANAdResponseElements.h */, + 9706554D232B93A200D484D4 /* ANAdResponseInfo.h */, ECE4EA8E194B768A0069D934 /* ANAdView.h */, ECE4EA8F194B768A0069D934 /* ANBannerAdView.h */, ECE4EA90194B768A0069D934 /* ANCustomAdapter.h */, @@ -808,7 +808,7 @@ 4FE7CE781F2FD6A100A5044A /* universalTag */, 4F131E8A1F71CCE50019FDAC /* ANAdFetcherResponse.h */, 4F131E8B1F71CCE50019FDAC /* ANAdFetcherResponse.m */, - 9706554E232B93A200D484D4 /* ANAdResponseElements.m */, + 9706554E232B93A200D484D4 /* ANAdResponseInfo.m */, 8AD618A41981C11F00AC0780 /* ANAdView.m */, 8AD618A51981C11F00AC0780 /* ANAdViewInternalDelegate.h */, 8AC7C5361A3B5CEF00AA5548 /* ANAdWebViewController.h */, @@ -986,7 +986,7 @@ 006F6B9E2295F72A003D2DF0 /* ANAdFetcherBase.h in Headers */, 607A21141F85557E00BD8353 /* ANAdFetcherResponse.h in Headers */, 8A9AEDB21A1BE8C200C58BDA /* ANAdProtocol.h in Headers */, - 9706554F232B93A200D484D4 /* ANAdResponseElements.h in Headers */, + 9706554F232B93A200D484D4 /* ANAdResponseInfo.h in Headers */, 8AE5E11E1A2FDC7700FDE858 /* ANAdView+PrivateMethods.h in Headers */, 8A9AEDB31A1BE8C200C58BDA /* ANAdView.h in Headers */, 8A9AEDCE1A1BF88200C58BDA /* ANAdViewInternalDelegate.h in Headers */, @@ -1079,7 +1079,7 @@ 4F06400923A2E7DC00E7920A /* ANAdFetcherBase.h in Headers */, F5731B7A228C94720012B134 /* ANAdFetcherResponse.h in Headers */, F5731BBE228C99BC0012B134 /* ANAdProtocol.h in Headers */, - 97065550232B93A200D484D4 /* ANAdResponseElements.h in Headers */, + 97065550232B93A200D484D4 /* ANAdResponseInfo.h in Headers */, F5731B5D228C8DF50012B134 /* ANBaseAdObject.h in Headers */, F5731B6B228C8E3E0012B134 /* ANBaseUrlConfig.h in Headers */, F5731B81228C94C70012B134 /* ANBrowserViewController.h in Headers */, @@ -1287,7 +1287,7 @@ files = ( 006F6B9B2295F70E003D2DF0 /* ANAdFetcherBase.m in Sources */, 607A20FE1F85540800BD8353 /* ANAdFetcherResponse.m in Sources */, - 97065551232B93A200D484D4 /* ANAdResponseElements.m in Sources */, + 97065551232B93A200D484D4 /* ANAdResponseInfo.m in Sources */, 8A9AEDF01A1BF99D00C58BDA /* ANAdView.m in Sources */, 8AE7AD9F1A7AC4F6009E2F2F /* ANAdWebViewController.m in Sources */, 8A9AEDF21A1BF99D00C58BDA /* ANANJAMImplementation.m in Sources */, @@ -1368,7 +1368,7 @@ files = ( 4F06400823A2E7D700E7920A /* ANAdFetcherBase.m in Sources */, F5731B79228C94700012B134 /* ANAdFetcherResponse.m in Sources */, - 97065552232B93A200D484D4 /* ANAdResponseElements.m in Sources */, + 97065552232B93A200D484D4 /* ANAdResponseInfo.m in Sources */, F5731B5E228C8DFA0012B134 /* ANBaseAdObject.m in Sources */, F5731B82228C94CC0012B134 /* ANBrowserViewController.m in Sources */, F5731B56228C8DD50012B134 /* ANCarrierObserver.m in Sources */, diff --git a/sdk/AppNexusSDK/AppNexusSDK.h b/sdk/AppNexusSDK/AppNexusSDK.h index 3d538358c..97001fd66 100644 --- a/sdk/AppNexusSDK/AppNexusSDK.h +++ b/sdk/AppNexusSDK/AppNexusSDK.h @@ -43,7 +43,7 @@ FOUNDATION_EXPORT const unsigned char AppNexusSDKVersionString[]; #import #import -#import +#import #import #import diff --git a/sdk/sourcefiles/ANAdProtocol.h b/sdk/sourcefiles/ANAdProtocol.h index d7697e72f..4f050fe5d 100644 --- a/sdk/sourcefiles/ANAdProtocol.h +++ b/sdk/sourcefiles/ANAdProtocol.h @@ -19,7 +19,7 @@ #import "ANAdConstants.h" #import "ANLocation.h" -#import "ANAdResponseElements.h" +#import "ANAdResponseInfo.h" @class ANLocation; @@ -234,10 +234,10 @@ /** * An AppNexus Single Unified object that will contain all the common fields of all the ads types * - * adResponseElements should be accessible from response Object only -- ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). - * It is placed into ANAdProtocol instead of ANAdProtocolFoundation to avoid adResponseElements being accessed through ANNativeAdRequest. + * adResponseInfo should be accessible from response Object only -- ANBannerAdView, ANInterstitialAd, ANInstreamVideoAd and ANNativeAdResponse). + * It is placed into ANAdProtocol instead of ANAdProtocolFoundation to avoid adResponseInfo being accessed through ANNativeAdRequest. */ -@property (nonatomic, readwrite, strong, nullable) ANAdResponseElements *adResponseElements; +@property (nonatomic, readwrite, strong, nullable) ANAdResponseInfo *adResponseInfo; @end diff --git a/sdk/sourcefiles/ANAdResponseElements.h b/sdk/sourcefiles/ANAdResponseInfo.h similarity index 97% rename from sdk/sourcefiles/ANAdResponseElements.h rename to sdk/sourcefiles/ANAdResponseInfo.h index b8b250fc1..c3ea82d1d 100644 --- a/sdk/sourcefiles/ANAdResponseElements.h +++ b/sdk/sourcefiles/ANAdResponseInfo.h @@ -16,7 +16,7 @@ #import #import "ANAdConstants.h" -@interface ANAdResponseElements : NSObject +@interface ANAdResponseInfo : NSObject /** An AppNexus creativeID for the current creative that is displayed */ diff --git a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h index f5fbd4065..94a902361 100644 --- a/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h +++ b/sdk/sourcefiles/Categories/ANAdView+PrivateMethods.h @@ -38,7 +38,7 @@ - (void)loadAdFromVast: (nonnull NSString *)xml width: (int)width height: (int)height; -- (void)setAdResponseElements:(nonnull ANAdResponseElements *)adResponseElements; +- (void)setAdResponseInfo:(nonnull ANAdResponseInfo *)adResponseInfo; - (void)setCreativeId:(nonnull NSString *)creativeId; diff --git a/sdk/sourcefiles/internal/ANAdFetcherBase+PrivateMethods.h b/sdk/sourcefiles/internal/ANAdFetcherBase+PrivateMethods.h index 027e31e54..3ddf4a832 100644 --- a/sdk/sourcefiles/internal/ANAdFetcherBase+PrivateMethods.h +++ b/sdk/sourcefiles/internal/ANAdFetcherBase+PrivateMethods.h @@ -25,7 +25,7 @@ - (void)continueWaterfall; -- (void)finishRequestWithError:(NSError *)error andAdResponseElements:(ANAdResponseElements *)adResponseElements; +- (void)finishRequestWithError:(NSError *)error andAdResponseInfo:(ANAdResponseInfo *)adResponseInfo; - (void)restartAutoRefreshTimer; @end diff --git a/sdk/sourcefiles/internal/ANAdFetcherBase.m b/sdk/sourcefiles/internal/ANAdFetcherBase.m index f0b954337..ad5f8bd55 100644 --- a/sdk/sourcefiles/internal/ANAdFetcherBase.m +++ b/sdk/sourcefiles/internal/ANAdFetcherBase.m @@ -211,7 +211,7 @@ - (void)prepareForWaterfallWithAdServerResponseTag: (NSDictionary -#import "ANAdResponseElements.h" +#import "ANAdResponseInfo.h" @@ -27,8 +27,8 @@ @property (nonatomic, readonly, strong, nullable) id adObjectHandler; @property (nonatomic, readonly, strong, nullable) NSError *error; -@property (nonatomic, readwrite, strong, nullable) ANAdResponseElements *adResponseElements; - ///FIX -- here on error; in adObjecgHandler on success? SEE kANAdResponseElements +@property (nonatomic, readwrite, strong, nullable) ANAdResponseInfo *adResponseInfo; + ///FIX -- here on error; in adObjecgHandler on success? SEE kANAdResponseInfo // diff --git a/sdk/sourcefiles/internal/ANAdResponseElements.m b/sdk/sourcefiles/internal/ANAdResponseInfo.m similarity index 90% rename from sdk/sourcefiles/internal/ANAdResponseElements.m rename to sdk/sourcefiles/internal/ANAdResponseInfo.m index f9044f6e4..a0424f4ea 100644 --- a/sdk/sourcefiles/internal/ANAdResponseElements.m +++ b/sdk/sourcefiles/internal/ANAdResponseInfo.m @@ -13,9 +13,9 @@ limitations under the License. */ -#import "ANAdResponseElements.h" +#import "ANAdResponseInfo.h" -@implementation ANAdResponseElements +@implementation ANAdResponseInfo @synthesize creativeId, adType, memberId, placementId, contentSource, networkName; diff --git a/sdk/sourcefiles/internal/ANAdView.m b/sdk/sourcefiles/internal/ANAdView.m index 74602593c..b2afa1e74 100644 --- a/sdk/sourcefiles/internal/ANAdView.m +++ b/sdk/sourcefiles/internal/ANAdView.m @@ -81,7 +81,7 @@ @implementation ANAdView @synthesize clickThroughAction = __clickThroughAction; @synthesize landingPageLoadsInBackground = __landingPageLoadsInBackground; -@synthesize adResponseElements = __adResponseElements; +@synthesize adResponseInfo = __adResponseInfo; #pragma mark - Initialization @@ -164,7 +164,7 @@ - (BOOL) errorCheckConfiguration // if (error) { ANLogError(@"%@", errorString); - [self adRequestFailedWithError:error andAdResponseElements:nil]; + [self adRequestFailedWithError:error andAdResponseInfo:nil]; return NO; } @@ -245,14 +245,14 @@ - (void)setAdType:(ANAdType)adType } } -- (void)setAdResponseElements:(ANAdResponseElements *)adResponseElements { - if (!adResponseElements) { - ANLogError(@"Could not set adResponseElements"); +- (void)setAdResponseInfo:(ANAdResponseInfo *)adResponseInfo { + if (!adResponseInfo) { + ANLogError(@"Could not set adResponseInfo"); return; } - if (adResponseElements != __adResponseElements) { - ANLogDebug(@"Setting adResponseElements to %@", adResponseElements); - __adResponseElements = adResponseElements; + if (adResponseInfo != __adResponseInfo) { + ANLogDebug(@"Setting adResponseInfo to %@", adResponseInfo); + __adResponseInfo = adResponseInfo; } } @@ -380,9 +380,9 @@ - (void)setClickThroughAction:(ANClickThroughAction)clickThroughAction #pragma mark - ANAdProtocol: Getter methods -- (nullable ANAdResponseElements *)adResponseElements { - ANLogDebug(@"ANAdResponse returned %@", __adResponseElements); - return __adResponseElements; +- (nullable ANAdResponseInfo *)adResponseInfo { + ANLogDebug(@"ANAdResponse returned %@", __adResponseInfo); + return __adResponseInfo; } - (nullable NSString *)placementId { @@ -580,10 +580,10 @@ - (void)ad:(id)loadInstance didReceiveNativeAd:(id)responseInstance } } -- (void)adRequestFailedWithError:(NSError *)error andAdResponseElements:(ANAdResponseElements *)adResponseElements +- (void)adRequestFailedWithError:(NSError *)error andAdResponseInfo:(ANAdResponseInfo *)adResponseInfo { ANLogMark(); - [self setAdResponseElements:adResponseElements]; + [self setAdResponseInfo:adResponseInfo]; if ([self.delegate respondsToSelector:@selector(ad:requestFailedWithError:)]) { [self.delegate ad:self requestFailedWithError:error]; @@ -601,7 +601,7 @@ - (void)adInteractionDidEnd { ANLogDebug(@""); - if (ANAdTypeVideo != __adResponseElements.adType) { + if (ANAdTypeVideo != __adResponseInfo.adType) { [self.universalAdFetcher restartAutoRefreshTimer]; [self.universalAdFetcher startAutoRefreshTimer]; } diff --git a/sdk/sourcefiles/internal/ANAdViewInternalDelegate.h b/sdk/sourcefiles/internal/ANAdViewInternalDelegate.h index 364532429..06458929b 100644 --- a/sdk/sourcefiles/internal/ANAdViewInternalDelegate.h +++ b/sdk/sourcefiles/internal/ANAdViewInternalDelegate.h @@ -34,7 +34,7 @@ - (void)ad:(id)loadInstance didReceiveNativeAd:(id)responseInstance; @required -- (void)adRequestFailedWithError:(NSError *)error andAdResponseElements:(ANAdResponseElements *)adResponseElements; +- (void)adRequestFailedWithError:(NSError *)error andAdResponseInfo:(ANAdResponseInfo *)adResponseInfo; - (void)adWasClicked; - (void)adWillPresent; diff --git a/sdk/sourcefiles/internal/ANBannerAdView.m b/sdk/sourcefiles/internal/ANBannerAdView.m index 3e4e1461c..75177558d 100644 --- a/sdk/sourcefiles/internal/ANBannerAdView.m +++ b/sdk/sourcefiles/internal/ANBannerAdView.m @@ -84,7 +84,7 @@ @implementation ANBannerAdView @synthesize shouldAllowNativeDemand = _shouldAllowNativeDemand; @synthesize nativeAdRendererId = _nativeAdRendererId; @synthesize enableNativeRendering = _enableNativeRendering; -@synthesize adResponseElements = _adResponseElements; +@synthesize adResponseInfo = _adResponseInfo; @synthesize minDuration = __minDuration; @synthesize maxDuration = __maxDuration; @@ -368,9 +368,9 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR self.contentView = nil; self.impressionURLs = nil; - _adResponseElements = (ANAdResponseElements *) [ANGlobal valueOfGetterProperty:kANAdResponseElements forObject:adObjectHandler]; - if (_adResponseElements) { - [self setAdResponseElements:_adResponseElements]; + _adResponseInfo = (ANAdResponseInfo *) [ANGlobal valueOfGetterProperty:kANAdResponseInfo forObject:adObjectHandler]; + if (_adResponseInfo) { + [self setAdResponseInfo:_adResponseInfo]; } NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:adObjectHandler]; @@ -406,7 +406,7 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR } [self adDidReceiveAd:self]; - if (_adResponseElements.adType == ANAdTypeBanner && !([adObjectHandler isKindOfClass:[ANNativeStandardAdResponse class]])) + if (_adResponseInfo.adType == ANAdTypeBanner && !([adObjectHandler isKindOfClass:[ANNativeStandardAdResponse class]])) { self.impressionURLs = (NSArray *) [ANGlobal valueOfGetterProperty:kANImpressionUrls forObject:adObjectHandler]; @@ -458,8 +458,8 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR if (error) { self.contentView = nil; -// [self setAdResponseElements:response.adResponseElements]; //FIX -- handle in anadview? - [self adRequestFailedWithError:error andAdResponseElements:response.adResponseElements]; +// [self setAdResponseInfo:response.adResponseInfo]; //FIX -- handle in anadview? + [self adRequestFailedWithError:error andAdResponseInfo:response.adResponseInfo]; } } @@ -552,7 +552,7 @@ - (UIViewController *)displayController - (void)didMoveToWindow { - if (self.contentView && ( _adResponseElements.adType == ANAdTypeBanner)) { + if (self.contentView && ( _adResponseInfo.adType == ANAdTypeBanner)) { [ANTrackerManager fireTrackerURLArray:self.impressionURLs]; self.impressionURLs = nil; diff --git a/sdk/sourcefiles/internal/ANBaseAdObject.h b/sdk/sourcefiles/internal/ANBaseAdObject.h index 9731f2165..d5195be3e 100644 --- a/sdk/sourcefiles/internal/ANBaseAdObject.h +++ b/sdk/sourcefiles/internal/ANBaseAdObject.h @@ -14,7 +14,7 @@ */ #import -#import "ANAdResponseElements.h" +#import "ANAdResponseInfo.h" @interface ANBaseAdObject : NSObject @@ -26,6 +26,6 @@ @property (nonatomic, readwrite, strong) NSString *adType; @property (nonatomic, readwrite, strong) NSString *creativeId; @property (nonatomic, readwrite, strong) NSArray *impressionUrls; -@property (nonatomic, readwrite, strong) ANAdResponseElements *adResponseElements; +@property (nonatomic, readwrite, strong) ANAdResponseInfo *adResponseInfo; @end diff --git a/sdk/sourcefiles/internal/ANGlobal.h b/sdk/sourcefiles/internal/ANGlobal.h index 43f037d42..3c813c66e 100644 --- a/sdk/sourcefiles/internal/ANGlobal.h +++ b/sdk/sourcefiles/internal/ANGlobal.h @@ -81,7 +81,7 @@ extern NSString * __nonnull const kANUniversalAdFetcherAdResponseKey; static NSString * __nonnull const kANCreativeId = @"creativeId"; static NSString * __nonnull const kANImpressionUrls = @"impressionUrls"; static NSString * __nonnull const kANAspectRatio = @"aspectRatio"; -static NSString * __nonnull const kANAdResponseElements = @"adResponseElements"; +static NSString * __nonnull const kANAdResponseInfo = @"adResponseInfo"; #pragma mark - Banner AutoRefresh diff --git a/sdk/sourcefiles/internal/ANInterstitialAd.m b/sdk/sourcefiles/internal/ANInterstitialAd.m index a3e4994a5..8a1482a17 100644 --- a/sdk/sourcefiles/internal/ANInterstitialAd.m +++ b/sdk/sourcefiles/internal/ANInterstitialAd.m @@ -314,13 +314,12 @@ - (void)displayAdFromViewController:(nonnull UIViewController *)controller{ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithResponse:(ANAdFetcherResponse *)response { if (!response.isSuccessful) { -// [self setAdResponseElements:response.adResponseElements]; //FIX -- handle in anadview? - [self adRequestFailedWithError:response.error andAdResponseElements:response.adResponseElements]; + [self adRequestFailedWithError:response.error andAdResponseInfo:response.adResponseInfo]; return; } - ANAdResponseElements *adResponseElements = (ANAdResponseElements *) [ANGlobal valueOfGetterProperty:kANAdResponseElements forObject:response.adObjectHandler]; - if (adResponseElements) { - [self setAdResponseElements:adResponseElements]; + ANAdResponseInfo *adResponseInfo = (ANAdResponseInfo *) [ANGlobal valueOfGetterProperty:kANAdResponseInfo forObject:response.adObjectHandler]; + if (adResponseInfo) { + [self setAdResponseInfo:adResponseInfo]; } NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:response.adObjectHandler]; if(creativeId){ diff --git a/sdk/sourcefiles/internal/ANNativeAdFetcher.m b/sdk/sourcefiles/internal/ANNativeAdFetcher.m index 18597d1c7..e6d73fa5e 100644 --- a/sdk/sourcefiles/internal/ANNativeAdFetcher.m +++ b/sdk/sourcefiles/internal/ANNativeAdFetcher.m @@ -68,12 +68,12 @@ - (void)clearMediationController { #pragma mark - UT ad response processing methods -- (void)finishRequestWithError:(NSError *)error andAdResponseElements:(ANAdResponseElements *)adResponseElements +- (void)finishRequestWithError:(NSError *)error andAdResponseInfo:(ANAdResponseInfo *)adResponseInfo { self.isFetcherLoading = NO; ANLogInfo(@"No ad received. Error: %@", error.localizedDescription); ANAdFetcherResponse *response = [ANAdFetcherResponse responseWithError:error]; - response.adResponseElements = adResponseElements; + response.adResponseInfo = adResponseInfo; [self processFinalResponse:response]; } @@ -107,7 +107,7 @@ - (void)continueWaterfall ANLogDebug(@"(no_ad_url, %@)", self.noAdUrl); [ANTrackerManager fireTrackerURL:self.noAdUrl]; } - [self finishRequestWithError:ANError(@"response_no_ads", ANAdResponseUnableToFill) andAdResponseElements:nil]; + [self finishRequestWithError:ANError(@"response_no_ads", ANAdResponseUnableToFill) andAdResponseInfo:nil]; return; } diff --git a/sdk/sourcefiles/internal/ANUniversalAdFetcher.m b/sdk/sourcefiles/internal/ANUniversalAdFetcher.m index ee9001400..f4d816077 100644 --- a/sdk/sourcefiles/internal/ANUniversalAdFetcher.m +++ b/sdk/sourcefiles/internal/ANUniversalAdFetcher.m @@ -134,7 +134,7 @@ - (void)stopAdLoad #pragma mark - Ad Response -- (void)finishRequestWithError:(NSError *)error andAdResponseElements:(ANAdResponseElements *)adResponseElements +- (void)finishRequestWithError:(NSError *)error andAdResponseInfo:(ANAdResponseInfo *)adResponseInfo { self.isFetcherLoading = NO; @@ -146,7 +146,7 @@ - (void)finishRequestWithError:(NSError *)error andAdResponseElements:(ANAdRespo } ANAdFetcherResponse *response = [ANAdFetcherResponse responseWithError:error]; - response.adResponseElements = adResponseElements; + response.adResponseInfo = adResponseInfo; [self processFinalResponse:response]; } @@ -252,7 +252,7 @@ - (void)continueWaterfall ANLogDebug(@"(no_ad_url, %@)", self.noAdUrl); [ANTrackerManager fireTrackerURL:self.noAdUrl]; } - [self finishRequestWithError:ANError(@"response_no_ads", ANAdResponseUnableToFill) andAdResponseElements:nil]; + [self finishRequestWithError:ANError(@"response_no_ads", ANAdResponseUnableToFill) andAdResponseInfo:nil]; return; } diff --git a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m index 1adcd117e..8df315b5b 100644 --- a/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m +++ b/sdk/sourcefiles/internal/ANUniversalTagAdServerResponse.m @@ -25,7 +25,7 @@ #import "ANAdConstants.h" #import "ANNativeStandardAdResponse.h" #import "ANNativeAdResponse+PrivateMethods.h" -#import "ANAdResponseElements.h" +#import "ANAdResponseInfo.h" #import "ANGlobal.h" @@ -256,12 +256,12 @@ + (nullable ANStandardAd *)generateStandardAdUnitFromHTMLContent: (nonnull NSStr } //Initialise AdResponse object to expose all the public facing APIs from the UTv3 response - ANAdResponseElements *adResponseElements = [[ANAdResponseElements alloc] init]; - adResponseElements.creativeId = creativeId; - adResponseElements.placementId = placementId; - adResponseElements.adType = [ANGlobal adTypeStringToEnum:adType]; - adResponseElements.contentSource = contentSource; - adResponseElements.memberId = memberId; + ANAdResponseInfo *adResponseInfo = [[ANAdResponseInfo alloc] init]; + adResponseInfo.creativeId = creativeId; + adResponseInfo.placementId = placementId; + adResponseInfo.adType = [ANGlobal adTypeStringToEnum:adType]; + adResponseInfo.contentSource = contentSource; + adResponseInfo.memberId = memberId; // RTB @@ -292,7 +292,7 @@ + (nullable ANStandardAd *)generateStandardAdUnitFromHTMLContent: (nonnull NSStr ANNativeStandardAdResponse *nativeAd = [[self class] nativeAdFromRTBObject:rtbObject]; if (nativeAd) { nativeAd.creativeId = creativeId; - nativeAd.adResponseElements = adResponseElements; + nativeAd.adResponseInfo = adResponseInfo; if(adObject[kANUniversalTagAdServerResponseKeyAdsRendererUrl] != nil) { NSString * nativeRenderingUrl = [NSString stringWithFormat:@"%@",adObject[kANUniversalTagAdServerResponseKeyAdsRendererUrl]]; @@ -334,7 +334,7 @@ + (nullable ANStandardAd *)generateStandardAdUnitFromHTMLContent: (nonnull NSStr } mediatedAd.creativeId = creativeId; if (mediatedAd.className.length > 0) { - adResponseElements.networkName = mediatedAd.className; + adResponseInfo.networkName = mediatedAd.className; [arrayOfAdUnits addObject:mediatedAd]; } } @@ -375,7 +375,7 @@ + (nullable ANStandardAd *)generateStandardAdUnitFromHTMLContent: (nonnull NSStr if ([lastAdsObject isKindOfClass:[ANBaseAdObject class]]) { ANBaseAdObject *baseAdObject = (ANBaseAdObject *)lastAdsObject; baseAdObject.adType = [adType copy]; - baseAdObject.adResponseElements = adResponseElements; + baseAdObject.adResponseInfo = adResponseInfo; } } diff --git a/sdk/sourcefiles/internal/MRAID/ANMRAIDContainerView.m b/sdk/sourcefiles/internal/MRAID/ANMRAIDContainerView.m index 9a4cb2f67..36c3881ef 100644 --- a/sdk/sourcefiles/internal/MRAID/ANMRAIDContainerView.m +++ b/sdk/sourcefiles/internal/MRAID/ANMRAIDContainerView.m @@ -955,8 +955,8 @@ - (void)videoAdReady - (void)videoAdLoadFailed:(NSError *)error { - if ([self.adViewDelegate respondsToSelector:@selector(adRequestFailedWithError:andAdResponseElements:)]) { - [self.adViewDelegate adRequestFailedWithError:error andAdResponseElements:nil]; + if ([self.adViewDelegate respondsToSelector:@selector(adRequestFailedWithError:andAdResponseInfo:)]) { + [self.adViewDelegate adRequestFailedWithError:error andAdResponseInfo:nil]; //FIX -- update videoAdLoadFailed:withAdResponseElements: ?? } } diff --git a/sdk/sourcefiles/native/ANNativeAdResponse.h b/sdk/sourcefiles/native/ANNativeAdResponse.h index d4826003d..e89b1662b 100644 --- a/sdk/sourcefiles/native/ANNativeAdResponse.h +++ b/sdk/sourcefiles/native/ANNativeAdResponse.h @@ -128,7 +128,7 @@ extern NSString * __nonnull const kANNativeElementObject; /** An AppNexus Single Unified object that will contain all the common fields of all the ads types */ -@property (nonatomic, readonly, strong, nullable) ANAdResponseElements *adResponseElements; +@property (nonatomic, readonly, strong, nullable) ANAdResponseInfo *adResponseInfo; /*! diff --git a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m index 7c6e45375..5155acccf 100644 --- a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m +++ b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m @@ -160,10 +160,10 @@ -(void)didFinishRequestWithResponse: (nonnull ANAdFetcherResponse *)response ANNativeAdResponse *nativeResponse = (ANNativeAdResponse *)response.adObject; // In case of Mediation - if (nativeResponse.adResponseElements == nil) { - ANAdResponseElements *adResponseElements = (ANAdResponseElements *) [ANGlobal valueOfGetterProperty:kANAdResponseElements forObject:response.adObjectHandler]; - if (adResponseElements) { - [self setAdResponseElements:adResponseElements onObject:nativeResponse forKeyPath:kANAdResponseElements]; + if (nativeResponse.adResponseInfo == nil) { + ANAdResponseInfo *adResponseInfo = (ANAdResponseInfo *) [ANGlobal valueOfGetterProperty:kANAdResponseInfo forObject:response.adObjectHandler]; + if (adResponseInfo) { + [self setAdResponseInfo:adResponseInfo onObject:nativeResponse forKeyPath:kANAdResponseInfo]; } } // @@ -262,10 +262,10 @@ - (void)setCreativeId:(NSString *)creativeId [object setValue:creativeId forKeyPath:keyPath]; } -- (void)setAdResponseElements:(ANAdResponseElements *)adResponseElements +- (void)setAdResponseInfo:(ANAdResponseInfo *)adResponseInfo onObject:(id)object forKeyPath:(NSString *)keyPath { - [object setValue:adResponseElements forKeyPath:keyPath]; + [object setValue:adResponseInfo forKeyPath:keyPath]; } // RETURN: dispatch_semaphore_t For first time image requests. diff --git a/sdk/sourcefiles/native/internal/ANNativeAdResponse.m b/sdk/sourcefiles/native/internal/ANNativeAdResponse.m index 09971f4cd..e96206be7 100644 --- a/sdk/sourcefiles/native/internal/ANNativeAdResponse.m +++ b/sdk/sourcefiles/native/internal/ANNativeAdResponse.m @@ -52,7 +52,7 @@ @interface ANNativeAdResponse() @property (nonatomic, readwrite, assign) ANNativeAdNetworkCode networkCode; @property (nonatomic, readwrite, strong) OMIDAppnexusAdSession *omidAdSession; @property (nonatomic, readwrite, strong) ANVerificationScriptResource *verificationScriptResource; -@property (nonatomic, readwrite, strong) ANAdResponseElements *adResponseElements; +@property (nonatomic, readwrite, strong) ANAdResponseInfo *adResponseInfo; @end diff --git a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h index d7342adb6..a5b3267df 100644 --- a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h +++ b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.h @@ -40,6 +40,6 @@ @property (nonatomic, readwrite, strong) NSString *privacyLink; @property (nonatomic, readwrite, strong) NSString *nativeRenderingUrl; @property (nonatomic, readwrite, strong) NSString *nativeRenderingObject; -@property (nonatomic, readwrite, strong) ANAdResponseElements *adResponseElements; +@property (nonatomic, readwrite, strong) ANAdResponseInfo *adResponseInfo; @end diff --git a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m index 8db0540e7..0e158c6e7 100644 --- a/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m +++ b/sdk/sourcefiles/native/internal/ANNativeStandardAdResponse.m @@ -65,7 +65,7 @@ @implementation ANNativeStandardAdResponse @synthesize privacyLink = _privacyLink; @synthesize nativeRenderingUrl = _nativeRenderingUrl; @synthesize nativeRenderingObject = _nativeRenderingObject; -@synthesize adResponseElements = _adResponseElements; +@synthesize adResponseInfo = _adResponseInfo; #pragma mark - Lifecycle. diff --git a/sdk/sourcefiles/video/ANInstreamVideoAd.m b/sdk/sourcefiles/video/ANInstreamVideoAd.m index c3039a608..73001fbec 100644 --- a/sdk/sourcefiles/video/ANInstreamVideoAd.m +++ b/sdk/sourcefiles/video/ANInstreamVideoAd.m @@ -407,16 +407,16 @@ - (void) universalAdFetcher: (ANUniversalAdFetcher *)fetcher self.adPlayer = (ANVideoAdPlayer *) response.adObject; self.adPlayer.delegate = self; - ANAdResponseElements *adResponseElements = (ANAdResponseElements *) [ANGlobal valueOfGetterProperty:kANAdResponseElements forObject:response.adObjectHandler]; - if (adResponseElements) { - [self setAdResponseElements:adResponseElements]; + ANAdResponseInfo *adResponseInfo = (ANAdResponseInfo *) [ANGlobal valueOfGetterProperty:kANAdResponseInfo forObject:response.adObjectHandler]; + if (adResponseInfo) { + [self setAdResponseInfo:adResponseInfo]; } NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:response.adObjectHandler]; if(creativeId){ [self setCreativeId:creativeId]; } - //TBD -- remove and use ANAdResponseElements instead? + //TBD -- remove and use ANAdResponseInfo instead? [self videoAdReady]; diff --git a/tests/UnitTestApp/FunctionalTests/ANAdResponseTestCase.m b/tests/UnitTestApp/FunctionalTests/ANAdResponseTestCase.m index 73ed00f21..5bc5618ea 100644 --- a/tests/UnitTestApp/FunctionalTests/ANAdResponseTestCase.m +++ b/tests/UnitTestApp/FunctionalTests/ANAdResponseTestCase.m @@ -33,7 +33,7 @@ @interface ANAdResponseTestCase : XCTestCase)ad requestFailedWithError:(NSError *)error - (void)adRequest:(ANNativeAdRequest *)request didReceiveResponse:(ANNativeAdResponse *)response { - self.adResponseElements = response; + self.adResponseInfo = response; [self.loadAdResponseReceivedExpectation fulfill]; self.receiveAdSuccess = YES; } diff --git a/tests/UnitTestApp/FunctionalTests/ANNativeAdRequestTestCase.m b/tests/UnitTestApp/FunctionalTests/ANNativeAdRequestTestCase.m index d6861526c..da34bce9f 100644 --- a/tests/UnitTestApp/FunctionalTests/ANNativeAdRequestTestCase.m +++ b/tests/UnitTestApp/FunctionalTests/ANNativeAdRequestTestCase.m @@ -35,7 +35,7 @@ @interface ANNativeAdRequestTestCase : XCTestCase @property (nonatomic, readwrite, strong) ANNativeAdRequest *adRequest; -@property (nonatomic, readwrite, strong) ANNativeAdResponse *adResponseElements; +@property (nonatomic, readwrite, strong) ANNativeAdResponse *adResponseInfo; @property (nonatomic) NSURLRequest *request; @property (nonatomic, readwrite, strong) NSError *adRequestError; @@ -72,7 +72,7 @@ - (void)tearDown { self.adRequest = nil; self.delegateCallbackExpectation = nil; self.successfulAdCall = NO; - self.adResponseElements = nil; + self.adResponseInfo = nil; self.adRequestError = nil; [ANHTTPStubbingManager sharedStubbingManager].broadcastRequests = NO; @@ -159,11 +159,11 @@ - (void)testNativeVideoObject { handler:nil]; [self validateGenericNativeAdObject]; - XCTAssertNotNil(self.adResponseElements.iconImageURL); - XCTAssertNotNil(self.adResponseElements.vastXML); - XCTAssertNotNil(self.adResponseElements.privacyLink); - XCTAssertGreaterThan(self.adResponseElements.iconImageSize.width, 0); - XCTAssertGreaterThan(self.adResponseElements.iconImageSize.height, 0); + XCTAssertNotNil(self.adResponseInfo.iconImageURL); + XCTAssertNotNil(self.adResponseInfo.vastXML); + XCTAssertNotNil(self.adResponseInfo.privacyLink); + XCTAssertGreaterThan(self.adResponseInfo.iconImageSize.width, 0); + XCTAssertGreaterThan(self.adResponseInfo.iconImageSize.height, 0); } - (void)testSetInventoryCodeAndMemberIdOnlyOnNative { @@ -232,12 +232,12 @@ - (void)testAppNexusWithMainImageLoad { handler:nil]; [self validateGenericNativeAdObject]; - XCTAssertEqual(self.adResponseElements.networkCode, ANNativeAdNetworkCodeAppNexus); - XCTAssertNil(self.adResponseElements.iconImage); - XCTAssertEqual(self.adResponseElements.mainImageSize.width, 300); - XCTAssertEqual(self.adResponseElements.mainImageSize.height, 250); - self.adResponseElements.mainImageURL ? XCTAssertNotNil(self.adResponseElements.mainImage) : XCTAssertNil(self.adResponseElements.mainImage); - self.adResponseElements.mainImageURL ? XCTAssertTrue([self.adResponseElements.mainImage isKindOfClass:[UIImage class]]) : nil; + XCTAssertEqual(self.adResponseInfo.networkCode, ANNativeAdNetworkCodeAppNexus); + XCTAssertNil(self.adResponseInfo.iconImage); + XCTAssertEqual(self.adResponseInfo.mainImageSize.width, 300); + XCTAssertEqual(self.adResponseInfo.mainImageSize.height, 250); + self.adResponseInfo.mainImageURL ? XCTAssertNotNil(self.adResponseInfo.mainImage) : XCTAssertNil(self.adResponseInfo.mainImage); + self.adResponseInfo.mainImageURL ? XCTAssertTrue([self.adResponseInfo.mainImage isKindOfClass:[UIImage class]]) : nil; } - (void)testAppNexusWithAdditionalDescription { @@ -249,8 +249,8 @@ - (void)testAppNexusWithAdditionalDescription { handler:nil]; [self validateGenericNativeAdObject]; - XCTAssertEqual(self.adResponseElements.networkCode, ANNativeAdNetworkCodeAppNexus); - XCTAssertNotNil(self.adResponseElements.additionalDescription); + XCTAssertEqual(self.adResponseInfo.networkCode, ANNativeAdNetworkCodeAppNexus); + XCTAssertNotNil(self.adResponseInfo.additionalDescription); } - (void)testFacebook { @@ -261,10 +261,10 @@ - (void)testFacebook { handler:nil]; if (self.successfulAdCall) { [self validateGenericNativeAdObject]; - XCTAssertEqual(self.adResponseElements.networkCode, ANNativeAdNetworkCodeFacebook); - XCTAssertNil(self.adResponseElements.iconImage); - XCTAssertNil(self.adResponseElements.mainImage); - XCTAssertEqualObjects(self.adResponseElements.creativeId, @"111"); + XCTAssertEqual(self.adResponseInfo.networkCode, ANNativeAdNetworkCodeFacebook); + XCTAssertNil(self.adResponseInfo.iconImage); + XCTAssertNil(self.adResponseInfo.mainImage); + XCTAssertEqualObjects(self.adResponseInfo.creativeId, @"111"); } else { XCTAssertNotNil(self.adRequestError); } @@ -279,10 +279,10 @@ - (void)testFacebookWithIconImageLoad { handler:nil]; if (self.successfulAdCall) { [self validateGenericNativeAdObject]; - XCTAssertEqual(self.adResponseElements.networkCode, ANNativeAdNetworkCodeFacebook); - self.adResponseElements.iconImageURL ? XCTAssertNotNil(self.adResponseElements.iconImage) : XCTAssertNil(self.adResponseElements.iconImage); - self.adResponseElements.iconImageURL ? XCTAssertTrue([self.adResponseElements.iconImage isKindOfClass:[UIImage class]]) : nil; - XCTAssertNil(self.adResponseElements.mainImage); + XCTAssertEqual(self.adResponseInfo.networkCode, ANNativeAdNetworkCodeFacebook); + self.adResponseInfo.iconImageURL ? XCTAssertNotNil(self.adResponseInfo.iconImage) : XCTAssertNil(self.adResponseInfo.iconImage); + self.adResponseInfo.iconImageURL ? XCTAssertTrue([self.adResponseInfo.iconImage isKindOfClass:[UIImage class]]) : nil; + XCTAssertNil(self.adResponseInfo.mainImage); } else { XCTAssertNotNil(self.adRequestError); } @@ -306,9 +306,9 @@ - (void)testWaterfallMediationAdapterEndingInFacebook { handler:nil]; if (self.successfulAdCall) { [self validateGenericNativeAdObject]; - XCTAssertEqual(self.adResponseElements.networkCode, ANNativeAdNetworkCodeFacebook); - XCTAssertNil(self.adResponseElements.iconImage); - XCTAssertNil(self.adResponseElements.mainImage); + XCTAssertEqual(self.adResponseInfo.networkCode, ANNativeAdNetworkCodeFacebook); + XCTAssertNil(self.adResponseInfo.iconImage); + XCTAssertNil(self.adResponseInfo.mainImage); } else { XCTAssertNotNil(self.adRequestError); } @@ -332,11 +332,11 @@ - (void)testCustomAdapterFailToStandardResponse { [self waitForExpectationsWithTimeout:2 * kAppNexusRequestTimeoutInterval handler:nil]; [self validateGenericNativeAdObject]; - XCTAssertEqual(self.adResponseElements.networkCode, ANNativeAdNetworkCodeAppNexus); - XCTAssertNil(self.adResponseElements.iconImage); - XCTAssertEqualObjects(self.adResponseElements.creativeId, @"125"); - self.adResponseElements.mainImageURL ? XCTAssertNotNil(self.adResponseElements.mainImage) : XCTAssertNil(self.adResponseElements.mainImage); - self.adResponseElements.mainImageURL ? XCTAssertTrue([self.adResponseElements.mainImage isKindOfClass:[UIImage class]]) : nil; + XCTAssertEqual(self.adResponseInfo.networkCode, ANNativeAdNetworkCodeAppNexus); + XCTAssertNil(self.adResponseInfo.iconImage); + XCTAssertEqualObjects(self.adResponseInfo.creativeId, @"125"); + self.adResponseInfo.mainImageURL ? XCTAssertNotNil(self.adResponseInfo.mainImage) : XCTAssertNil(self.adResponseInfo.mainImage); + self.adResponseInfo.mainImageURL ? XCTAssertTrue([self.adResponseInfo.mainImage isKindOfClass:[UIImage class]]) : nil; } - (void)testMediatedResponseInvalidType { @@ -391,8 +391,8 @@ - (void)testBackgroundLoadVersusForegroundNotification // XCTAssertTrue(self.successfulAdCall); - XCTAssertNotNil(self.adResponseElements.mainImage); - XCTAssertNotNil(self.adResponseElements.iconImage); + XCTAssertNotNil(self.adResponseInfo.mainImage); + XCTAssertNotNil(self.adResponseInfo.iconImage); } @@ -401,30 +401,30 @@ - (void)testBackgroundLoadVersusForegroundNotification #pragma mark - Helper methods. - (void)validateGenericNativeAdObject { - XCTAssertNotNil(self.adResponseElements); - if (self.adResponseElements.title) { - XCTAssert([self.adResponseElements.title isKindOfClass:[NSString class]]); + XCTAssertNotNil(self.adResponseInfo); + if (self.adResponseInfo.title) { + XCTAssert([self.adResponseInfo.title isKindOfClass:[NSString class]]); } - if (self.adResponseElements.body) { - XCTAssert([self.adResponseElements.body isKindOfClass:[NSString class]]); + if (self.adResponseInfo.body) { + XCTAssert([self.adResponseInfo.body isKindOfClass:[NSString class]]); } - if (self.adResponseElements.callToAction) { - XCTAssert([self.adResponseElements.body isKindOfClass:[NSString class]]); + if (self.adResponseInfo.callToAction) { + XCTAssert([self.adResponseInfo.body isKindOfClass:[NSString class]]); } - if (self.adResponseElements.rating) { - XCTAssert([self.adResponseElements.rating isKindOfClass:[ANNativeAdStarRating class]]); + if (self.adResponseInfo.rating) { + XCTAssert([self.adResponseInfo.rating isKindOfClass:[ANNativeAdStarRating class]]); } - if (self.adResponseElements.mainImageURL) { - XCTAssert([self.adResponseElements.mainImageURL isKindOfClass:[NSURL class]]); + if (self.adResponseInfo.mainImageURL) { + XCTAssert([self.adResponseInfo.mainImageURL isKindOfClass:[NSURL class]]); } - if (self.adResponseElements.iconImageURL) { - XCTAssert([self.adResponseElements.iconImageURL isKindOfClass:[NSURL class]]); + if (self.adResponseInfo.iconImageURL) { + XCTAssert([self.adResponseInfo.iconImageURL isKindOfClass:[NSURL class]]); } - if (self.adResponseElements.customElements) { - XCTAssert([self.adResponseElements.customElements isKindOfClass:[NSDictionary class]]); + if (self.adResponseInfo.customElements) { + XCTAssert([self.adResponseInfo.customElements isKindOfClass:[NSDictionary class]]); } - if (self.adResponseElements.creativeId) { - XCTAssert([self.adResponseElements.creativeId isKindOfClass:[NSString class]]); + if (self.adResponseInfo.creativeId) { + XCTAssert([self.adResponseInfo.creativeId isKindOfClass:[NSString class]]); } } @@ -446,7 +446,7 @@ - (void)adRequest:(ANNativeAdRequest *)request didReceiveResponse:(ANNativeAdRes // - self.adResponseElements = response; + self.adResponseInfo = response; self.successfulAdCall = YES; [self.delegateCallbackExpectation fulfill]; } diff --git a/tests/UnitTestApp/FunctionalTests/ANOMIDNativeTestCase.m b/tests/UnitTestApp/FunctionalTests/ANOMIDNativeTestCase.m index cfd442a2d..7a839d1fa 100644 --- a/tests/UnitTestApp/FunctionalTests/ANOMIDNativeTestCase.m +++ b/tests/UnitTestApp/FunctionalTests/ANOMIDNativeTestCase.m @@ -27,7 +27,7 @@ @interface ANOMIDNativeTestCase : XCTestCase @property (nonatomic, readwrite, strong) ANNativeAdRequest *adRequest; -@property (nonatomic, readwrite, strong) ANNativeAdResponse *adResponseElements; +@property (nonatomic, readwrite, strong) ANNativeAdResponse *adResponseInfo; @property (nonatomic, readwrite, strong) XCTestExpectation *delegateCallbackExpectation; @property (nonatomic, readwrite, strong) NSMutableString *requestData; @@ -67,7 +67,7 @@ - (void)testOMIDSessionIsNotNill { self.delegateCallbackExpectation = [self expectationWithDescription:NSStringFromSelector(_cmd)]; [self waitForExpectationsWithTimeout:2 * kAppNexusRequestTimeoutInterval handler:nil]; - XCTAssertNotNil(self.adResponseElements.omidAdSession); + XCTAssertNotNil(self.adResponseInfo.omidAdSession); } - (void)testOMIDSDKValidation{ @@ -96,7 +96,7 @@ - (void)testOMIDSessionFinish{ XCTAssertTrue([self.requestData containsString:@"partnerVersion"]); XCTAssertTrue([self.requestData containsString:AN_SDK_VERSION]); XCTAssertTrue([self.requestData containsString:@"impression"]); - [self.adResponseElements unregisterViewFromTracking]; + [self.adResponseInfo unregisterViewFromTracking]; [XCTestCase delayForTimeInterval:5]; XCTAssertTrue([self.requestData containsString:@"sessionFinish"]); } @@ -106,10 +106,10 @@ - (void)testOMIDSessionFinish{ - (void)adRequest:(ANNativeAdRequest *)request didReceiveResponse:(ANNativeAdResponse *)response { - self.adResponseElements = response; + self.adResponseInfo = response; NSError *registerError; UIViewController *rvc = [UIApplication sharedApplication].keyWindow.rootViewController; - [self.adResponseElements registerViewForTracking:rvc.view withRootViewController:rvc clickableViews:nil error:®isterError]; + [self.adResponseInfo registerViewForTracking:rvc.view withRootViewController:rvc clickableViews:nil error:®isterError]; [self.delegateCallbackExpectation fulfill]; } diff --git a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m index 73fb9f50f..a69564780 100644 --- a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m +++ b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m @@ -24,7 +24,7 @@ #import "ANNativeAdRequest.h" #import "ANMultiAdRequest.h" -#import "ANAdResponseElements.h" +#import "ANAdResponseInfo.h" @@ -32,7 +32,7 @@ @interface DefaultPlacementLogic : XCTestCase @property (nonatomic, readwrite, strong, nullable) MARAdUnits *adUnitsForTest; -@property (nonatomic, readwrite, strong, nullable) ANAdResponseElements *adResponseElements; +@property (nonatomic, readwrite, strong, nullable) ANAdResponseInfo *adResponseInfo; @property (nonatomic, strong, readwrite, nullable) ANHTTPStubbingManager *httpStubManager; @@ -128,7 +128,7 @@ - (void)clearCounters self.expectationMARLoadCompletionOrFailure = nil; self.expectationAdUnitLoadResponseOrFailure = nil; - self.adResponseElements = nil; + self.adResponseInfo = nil; } @@ -150,7 +150,7 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithoutMAR [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); - XCTAssertTrue([banner.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); + XCTAssertTrue([banner.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); // [self clearCounters]; @@ -162,7 +162,7 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithoutMAR [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); - XCTAssertTrue([self.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); // [self clearCounters]; @@ -175,7 +175,7 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithoutMAR [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); - XCTAssertTrue([self.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR @@ -197,7 +197,7 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); - XCTAssertTrue([self.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); // [self clearCounters]; @@ -209,7 +209,7 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + _AdUnit_countOfReceiveFailures, 1); - XCTAssertTrue([self.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); // [self clearCounters]; @@ -227,7 +227,7 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); - XCTAssertTrue([self.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently @@ -251,7 +251,7 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); - XCTAssertTrue([self.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); // [self clearCounters]; @@ -263,7 +263,7 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); - XCTAssertTrue([self.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); // [self clearCounters]; @@ -281,7 +281,7 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); - XCTAssertTrue([self.adResponseElements.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } @@ -315,7 +315,7 @@ - (void)adDidReceiveAd:(nonnull id)ad TINFO(@"%@", [MARHelper adunitDescription:ad]); ANAdView *adview = (ANAdView *)ad; - self.adResponseElements = adview.adResponseElements; + self.adResponseInfo = adview.adResponseInfo; self.AdUnit_countOfReceiveSuccesses += 1; [self.expectationAdUnitLoadResponseOrFailure fulfill]; @@ -327,7 +327,7 @@ - (void) ad: (nonnull id)loadInstance TINFO(@"%@", [MARHelper adunitDescription:loadInstance]); ANNativeAdResponse *nativead = (ANNativeAdResponse *)loadInstance; - self.adResponseElements = nativead.adResponseElements; + self.adResponseInfo = nativead.adResponseInfo; self.AdUnit_countOfReceiveSuccesses += 1; [self.expectationAdUnitLoadResponseOrFailure fulfill]; @@ -340,10 +340,10 @@ - (void)ad:(nonnull id)ad requestFailedWithError:(NSError *)error if ([ad isKindOfClass:[ANAdView class]]) { ANAdView *adview = (ANAdView *)ad; - self.adResponseElements = adview.adResponseElements; + self.adResponseInfo = adview.adResponseInfo; } else { ANNativeAdResponse *nativead = (ANNativeAdResponse *)ad; - self.adResponseElements = nativead.adResponseElements; + self.adResponseInfo = nativead.adResponseInfo; } self.AdUnit_countOfReceiveFailures += 1; diff --git a/tests/UnitTestApp/FunctionalTests/MediationCallbacksTests.m b/tests/UnitTestApp/FunctionalTests/MediationCallbacksTests.m index 5d3b82d31..7ad77b876 100644 --- a/tests/UnitTestApp/FunctionalTests/MediationCallbacksTests.m +++ b/tests/UnitTestApp/FunctionalTests/MediationCallbacksTests.m @@ -16,7 +16,7 @@ #import "ANBaseTestCase.h" #import "ANMockMediationAdapterTimeout.h" #import "ANHTTPStubbingManager.h" -#import "ANAdResponseElements.h" +#import "ANAdResponseInfo.h" float const MEDIATION_CALLBACKS_TESTS_TIMEOUT = 5.0; // seconds diff --git a/tests/UnitTestApp/NativeSDKTestAppTests/NativeSDKTestAppTests.m b/tests/UnitTestApp/NativeSDKTestAppTests/NativeSDKTestAppTests.m index 207ec425c..b7b8c5cf0 100644 --- a/tests/UnitTestApp/NativeSDKTestAppTests/NativeSDKTestAppTests.m +++ b/tests/UnitTestApp/NativeSDKTestAppTests/NativeSDKTestAppTests.m @@ -26,7 +26,7 @@ @interface NativeSDKTestAppTests : XCTestCase @property (nonatomic, readwrite, strong) ANNativeAdRequest *adRequest; -@property (nonatomic, readwrite, strong) ANNativeAdResponse *adResponseElements; +@property (nonatomic, readwrite, strong) ANNativeAdResponse *adResponseInfo; @property (nonatomic) NSURLRequest *request; @property (nonatomic, readwrite, strong) NSError *adRequestError; @@ -58,7 +58,7 @@ - (void)tearDown { self.adRequest = nil; self.delegateCallbackExpectation = nil; - self.adResponseElements = nil; + self.adResponseInfo = nil; self.adRequestError = nil; [ANHTTPStubbingManager sharedStubbingManager].broadcastRequests = NO; @@ -79,7 +79,7 @@ - (void)testNativeSDKRTBAd { handler:nil]; [self validateGenericNativeAdObject]; - XCTAssertEqual(self.adResponseElements.networkCode, ANNativeAdNetworkCodeAppNexus); + XCTAssertEqual(self.adResponseInfo.networkCode, ANNativeAdNetworkCodeAppNexus); } @@ -93,7 +93,7 @@ - (void)testNativeSDKCSMAd { handler:nil]; - XCTAssertNotNil(self.adResponseElements); + XCTAssertNotNil(self.adResponseInfo); XCTAssertNil(self.adRequestError); } @@ -102,44 +102,44 @@ - (void)testNativeSDKCSMAd { #pragma mark - Helper methods. - (void)validateGenericNativeAdObject { - // XCTAssertNotNil(self.adResponseElements); - if (self.adResponseElements.title) { - XCTAssert([self.adResponseElements.title isKindOfClass:[NSString class]]); + // XCTAssertNotNil(self.adResponseInfo); + if (self.adResponseInfo.title) { + XCTAssert([self.adResponseInfo.title isKindOfClass:[NSString class]]); }else{ XCTAssertTrue(false); } - if (self.adResponseElements.body) { - XCTAssert([self.adResponseElements.body isKindOfClass:[NSString class]]); + if (self.adResponseInfo.body) { + XCTAssert([self.adResponseInfo.body isKindOfClass:[NSString class]]); }else{ XCTAssertTrue(false); } - if (self.adResponseElements.callToAction) { - XCTAssert([self.adResponseElements.body isKindOfClass:[NSString class]]); + if (self.adResponseInfo.callToAction) { + XCTAssert([self.adResponseInfo.body isKindOfClass:[NSString class]]); }else{ XCTAssertTrue(false); } - if (self.adResponseElements.rating) { - XCTAssert([self.adResponseElements.rating isKindOfClass:[ANNativeAdStarRating class]]); + if (self.adResponseInfo.rating) { + XCTAssert([self.adResponseInfo.rating isKindOfClass:[ANNativeAdStarRating class]]); }else{ XCTAssertTrue(false); } - if (self.adResponseElements.mainImageURL) { - XCTAssert([self.adResponseElements.mainImageURL isKindOfClass:[NSURL class]]); + if (self.adResponseInfo.mainImageURL) { + XCTAssert([self.adResponseInfo.mainImageURL isKindOfClass:[NSURL class]]); }else{ XCTAssertTrue(false); } - if (self.adResponseElements.iconImageURL) { - XCTAssert([self.adResponseElements.iconImageURL isKindOfClass:[NSURL class]]); + if (self.adResponseInfo.iconImageURL) { + XCTAssert([self.adResponseInfo.iconImageURL isKindOfClass:[NSURL class]]); }else{ XCTAssertTrue(false); } - if (self.adResponseElements.customElements) { - XCTAssert([self.adResponseElements.customElements isKindOfClass:[NSDictionary class]]); + if (self.adResponseInfo.customElements) { + XCTAssert([self.adResponseInfo.customElements isKindOfClass:[NSDictionary class]]); }else{ XCTAssertTrue(false); } - if (self.adResponseElements.creativeId) { - XCTAssert([self.adResponseElements.creativeId isKindOfClass:[NSString class]]); + if (self.adResponseInfo.creativeId) { + XCTAssert([self.adResponseInfo.creativeId isKindOfClass:[NSString class]]); }else{ XCTAssertTrue(false); } @@ -152,7 +152,7 @@ - (void)validateGenericNativeAdObject { - (void)adRequest:(ANNativeAdRequest *)request didReceiveResponse:(ANNativeAdResponse *)response { - self.adResponseElements = response; + self.adResponseInfo = response; [self.delegateCallbackExpectation fulfill]; } diff --git a/tests/UnitTestApp/UnitTestApp/UnitMockFiles/UnitTestShared/ANBaseTestCase.h b/tests/UnitTestApp/UnitTestApp/UnitMockFiles/UnitTestShared/ANBaseTestCase.h index 6ec68e942..2ded2ba53 100644 --- a/tests/UnitTestApp/UnitTestApp/UnitMockFiles/UnitTestShared/ANBaseTestCase.h +++ b/tests/UnitTestApp/UnitTestApp/UnitMockFiles/UnitTestShared/ANBaseTestCase.h @@ -19,7 +19,7 @@ #import "ANInterstitialAd.h" #import "ANCustomAdapter.h" -#import "ANAdResponseElements.h" +#import "ANAdResponseInfo.h" #import "ANTestResponses.h" #import "ANGlobal.h" From 4af8dfcd99df441ad412cadbab76fe768e2bb561 Mon Sep 17 00:00:00 2001 From: David Reeder Date: Fri, 7 Feb 2020 23:22:54 -0500 Subject: [PATCH 24/35] Demonstrate that some UnitTestApp tests fail without [AdUnit setMarManager:]. --- sdk/sourcefiles/internal/ANAdView.m | 15 +++++++++++++++ .../MARTestMockMediation/DefaultPlacementLogic.m | 3 --- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/sdk/sourcefiles/internal/ANAdView.m b/sdk/sourcefiles/internal/ANAdView.m index b2afa1e74..131884212 100644 --- a/sdk/sourcefiles/internal/ANAdView.m +++ b/sdk/sourcefiles/internal/ANAdView.m @@ -375,6 +375,21 @@ - (void)setClickThroughAction:(ANClickThroughAction)clickThroughAction __clickThroughAction = clickThroughAction; } +///** +// * universalAdFetcher getter returns fetcher conditional upon whether marManager is set. +// * Therefore, universalAdFetcher must be cleared anytime marManager is set to a different value. +// * universalAdFetcher will be lazily recreated next time it is needed. +// */ +//- (void)setMarManager:(ANMultiAdRequest *)marManager +//{ +// if (self.universalAdFetcher && (marManager != _marManager)) { +// [self.universalAdFetcher stopAdLoad]; +// self.universalAdFetcher = nil; +// } +// +// _marManager = marManager; +//} + diff --git a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m index a69564780..87c3a4310 100644 --- a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m +++ b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m @@ -237,9 +237,6 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently // ANBannerAdView, receiving nobid, associated with MAR, loaded independently. // - [self clearCounters]; - [self.mar removeAdUnit:self.adUnitsForTest.banner]; - self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault delegate: self adUnits: self.adUnitsForTest.banner, nil]; From db431a50419359b5f6c4be28afbda0151045fe69 Mon Sep 17 00:00:00 2001 From: David Reeder Date: Fri, 7 Feb 2020 23:35:32 -0500 Subject: [PATCH 25/35] Add tests with ANInterstitialAd: * testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithoutMAR * testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR * testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently --- .../DefaultPlacementLogic.m | 153 +++++++++++++++++- 1 file changed, 150 insertions(+), 3 deletions(-) diff --git a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m index 87c3a4310..5de9b61b4 100644 --- a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m +++ b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m @@ -135,7 +135,7 @@ - (void)clearCounters #pragma mark - Tests. -- (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithoutMAR +- (void)FIXtestBannerAdUnitForDefaultTagIDResponseViaNobidWithoutMAR { TMARK(); ANBannerAdView *banner = self.adUnitsForTest.banner; @@ -178,7 +178,7 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithoutMAR XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR +- (void)FIXtestBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR { ANBannerAdView *banner = self.adUnitsForTest.banner; @@ -230,7 +230,7 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently +- (void)FIXtestBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently { ANBannerAdView *banner = self.adUnitsForTest.banner; @@ -282,6 +282,153 @@ - (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently } +- (void)testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithoutMAR +{ +TMARK(); + ANInterstitialAd *interstitial = self.adUnitsForTest.interstitial; + + + // ANInterstitialAd, receiving nobid, without MAR association. + // + [interstitial setInventoryCode:self.inventoryCodeWithNobidGood memberId:self.adUnitsForTest.memberIDDefault]; + [interstitial loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([interstitial.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); + + // + [self clearCounters]; + + [interstitial setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [interstitial loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); + + // + [self clearCounters]; + + [interstitial setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [interstitial setPublisherId:self.publisherIDWithNobid]; + [interstitial loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); +} + +- (void)testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR +{ + ANInterstitialAd *interstitial = self.adUnitsForTest.interstitial; + + + // ANInterstitialAd, receiving nobid, associated with MAR, loaded via MAR. + // + self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault + delegate: self + adUnits: self.adUnitsForTest.interstitial, nil]; + [self clearCounters]; + + [interstitial setInventoryCode:self.inventoryCodeWithNobidGood memberId:self.adUnitsForTest.memberIDDefault]; + [self.mar load]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); + + // + [self clearCounters]; + + [interstitial setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [self.mar load]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + _AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); + + // + [self clearCounters]; + [self.mar removeAdUnit:self.adUnitsForTest.interstitial]; + + self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault + publisherId: self.publisherIDWithNobid + delegate: self + adUnits: self.adUnitsForTest.interstitial, nil]; + + [interstitial setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [self.mar load]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); +} + +- (void)testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently +{ + ANInterstitialAd *interstitial = self.adUnitsForTest.interstitial; + + + // ANInterstitialAd, receiving nobid, associated with MAR, loaded independently. + // + self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault + delegate: self + adUnits: self.adUnitsForTest.interstitial, nil]; + + [interstitial setInventoryCode:self.inventoryCodeWithNobidGood memberId:self.adUnitsForTest.memberIDDefault]; + [interstitial loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); + + // + [self clearCounters]; + + [interstitial setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [interstitial loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); + + // + [self clearCounters]; + [self.mar removeAdUnit:self.adUnitsForTest.interstitial]; + + self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault + publisherId: self.publisherIDWithNobid + delegate: self + adUnits: self.adUnitsForTest.interstitial, nil]; + + [self.adUnitsForTest.interstitial setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [self.adUnitsForTest.interstitial loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); +} + + #pragma mark - ANMultiAdRequestDelegate. From 8abd468b2b07b96ec4848fd4d146f034b54923f8 Mon Sep 17 00:00:00 2001 From: David Reeder Date: Sat, 8 Feb 2020 00:46:18 -0500 Subject: [PATCH 26/35] Add tests with ANInterstitialAd: * testVideoAdUnitForDefaultTagIDResponseViaNobidWithoutMAR * testVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR * testVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently --- .../internal/ANAdWebViewController.h | 2 +- sdk/sourcefiles/internal/ANVideoAdProcessor.m | 4 +- .../internal/MRAID/ANMRAIDContainerView.m | 5 +- sdk/sourcefiles/video/ANInstreamVideoAd.m | 16 +- sdk/sourcefiles/video/ANVideoAdPlayer.h | 5 +- sdk/sourcefiles/video/ANVideoAdPlayer.m | 4 +- .../DefaultPlacementLogic.m | 152 +++++++++++++++++- ...eamVideoAdClassObjectFromUTResponseTests.m | 3 +- 8 files changed, 170 insertions(+), 21 deletions(-) diff --git a/sdk/sourcefiles/internal/ANAdWebViewController.h b/sdk/sourcefiles/internal/ANAdWebViewController.h index af6041f16..f63f3ce00 100644 --- a/sdk/sourcefiles/internal/ANAdWebViewController.h +++ b/sdk/sourcefiles/internal/ANAdWebViewController.h @@ -161,7 +161,7 @@ @protocol ANAdWebViewControllerVideoDelegate -(void) videoAdReady; --(void) videoAdLoadFailed:(NSError *)error; +-(void) videoAdLoadFailed:(NSError *)error withAdResponseInfo:(ANAdResponseInfo *)adResponseInfo; - (void) videoAdError:(NSError *)error; - (void) videoAdPlayerFullScreenEntered: (ANAdWebViewController *)videoAd; diff --git a/sdk/sourcefiles/internal/ANVideoAdProcessor.m b/sdk/sourcefiles/internal/ANVideoAdProcessor.m index f86ea5dbe..b6c1c0eda 100644 --- a/sdk/sourcefiles/internal/ANVideoAdProcessor.m +++ b/sdk/sourcefiles/internal/ANVideoAdProcessor.m @@ -91,8 +91,8 @@ -(void) videoAdReady { } --(void) videoAdLoadFailed:(nonnull NSError *)error{ - +-(void) videoAdLoadFailed:(nonnull NSError *)error withAdResponseInfo:(nullable ANAdResponseInfo *)adResponseInfo +{ [self.adPlayer setDelegate:nil]; if([self.delegate respondsToSelector:@selector(videoAdProcessor:didFailVideoProcessing:)]){ diff --git a/sdk/sourcefiles/internal/MRAID/ANMRAIDContainerView.m b/sdk/sourcefiles/internal/MRAID/ANMRAIDContainerView.m index 36c3881ef..a87c7728a 100644 --- a/sdk/sourcefiles/internal/MRAID/ANMRAIDContainerView.m +++ b/sdk/sourcefiles/internal/MRAID/ANMRAIDContainerView.m @@ -953,11 +953,10 @@ - (void)videoAdReady [self didCompleteFirstLoadFromWebViewController:self.webViewController]; } -- (void)videoAdLoadFailed:(NSError *)error +- (void)videoAdLoadFailed:(NSError *)error withAdResponseInfo:(ANAdResponseInfo *)adResponseInfo { if ([self.adViewDelegate respondsToSelector:@selector(adRequestFailedWithError:andAdResponseInfo:)]) { - [self.adViewDelegate adRequestFailedWithError:error andAdResponseInfo:nil]; - //FIX -- update videoAdLoadFailed:withAdResponseElements: ?? + [self.adViewDelegate adRequestFailedWithError:error andAdResponseInfo:adResponseInfo]; } } diff --git a/sdk/sourcefiles/video/ANInstreamVideoAd.m b/sdk/sourcefiles/video/ANInstreamVideoAd.m index 73001fbec..6c7cb191a 100644 --- a/sdk/sourcefiles/video/ANInstreamVideoAd.m +++ b/sdk/sourcefiles/video/ANInstreamVideoAd.m @@ -226,19 +226,20 @@ -(void) videoAdReady } } --(void) videoAdLoadFailed:(nonnull NSError *)error +-(void) videoAdLoadFailed:(nonnull NSError *)error withAdResponseInfo:(ANAdResponseInfo *)adResponseInfo { self.didVideoTagFail = YES; self.descriptionOfFailure = nil; self.failureNSError = error; + [self setAdResponseInfo:adResponseInfo]; + ANLogError(@"Delegate indicates FAILURE."); [self removeAd]; if ([self.loadDelegate respondsToSelector:@selector(ad:requestFailedWithError:)]) { [self.loadDelegate ad:self requestFailedWithError:self.failureNSError]; - //FIX -- need return responseelements? ?? } } @@ -413,16 +414,15 @@ - (void) universalAdFetcher: (ANUniversalAdFetcher *)fetcher } NSString *creativeId = (NSString *) [ANGlobal valueOfGetterProperty:kANCreativeId forObject:response.adObjectHandler]; - if(creativeId){ - [self setCreativeId:creativeId]; - } - //TBD -- remove and use ANAdResponseInfo instead? + if(creativeId){ + [self setCreativeId:creativeId]; + } - [self videoAdReady]; + [self videoAdReady]; }else if(!response.isSuccessful && (response.adObject == nil)){ - [self videoAdLoadFailed:ANError(@"video_adfetch_failed", ANAdResponseBadFormat)]; + [self videoAdLoadFailed:ANError(@"video_adfetch_failed", ANAdResponseBadFormat) withAdResponseInfo:response.adResponseInfo]; return; } } diff --git a/sdk/sourcefiles/video/ANVideoAdPlayer.h b/sdk/sourcefiles/video/ANVideoAdPlayer.h index 8f2cd6502..bf7e28ef4 100644 --- a/sdk/sourcefiles/video/ANVideoAdPlayer.h +++ b/sdk/sourcefiles/video/ANVideoAdPlayer.h @@ -15,10 +15,13 @@ #import #import + #import "WKWebView+ANCategory.h" #import "ANAdConstants.h" #import +#import "ANAdResponseInfo.h" + typedef NS_ENUM(NSUInteger, ANVideoAdPlayerTracker) { @@ -44,7 +47,7 @@ typedef NS_ENUM(NSUInteger, ANVideoAdPlayerEvent) { @protocol ANVideoAdPlayerDelegate -(void) videoAdReady; --(void) videoAdLoadFailed:(nonnull NSError *)error; +-(void) videoAdLoadFailed:(nonnull NSError *)error withAdResponseInfo:(nullable ANAdResponseInfo *)adResponseInfo; @optional diff --git a/sdk/sourcefiles/video/ANVideoAdPlayer.m b/sdk/sourcefiles/video/ANVideoAdPlayer.m index 4e51ef6e4..69dde98de 100644 --- a/sdk/sourcefiles/video/ANVideoAdPlayer.m +++ b/sdk/sourcefiles/video/ANVideoAdPlayer.m @@ -362,9 +362,9 @@ - (void)userContentController:(WKUserContentController *)userContentController d //we need to remove the webview to makesure we dont get any other response from the loaded index.html page [self removePlayer]; ANLogInfo(@"video player error"); - if([self.delegate respondsToSelector:@selector(videoAdLoadFailed:)]){ + if([self.delegate respondsToSelector:@selector(videoAdLoadFailed:withAdResponseInfo:)]){ NSError *error = ANError(@"Timeout reached while parsing VAST", ANAdResponseInternalError); - [self.delegate videoAdLoadFailed:error]; + [self.delegate videoAdLoadFailed:error withAdResponseInfo:nil]; } } else if([eventName isEqualToString:@"audio-mute"]){ diff --git a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m index 5de9b61b4..a27cc91cf 100644 --- a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m +++ b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m @@ -282,7 +282,7 @@ - (void)FIXtestBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdent } -- (void)testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithoutMAR +- (void)FIXtestInterstitialAdUnitForDefaultTagIDResponseViaNobidWithoutMAR { TMARK(); ANInterstitialAd *interstitial = self.adUnitsForTest.interstitial; @@ -325,7 +325,7 @@ - (void)testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithoutMAR XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR +- (void)FIXtestInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR { ANInterstitialAd *interstitial = self.adUnitsForTest.interstitial; @@ -377,7 +377,7 @@ - (void)testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently +- (void)FIXtestInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently { ANInterstitialAd *interstitial = self.adUnitsForTest.interstitial; @@ -428,6 +428,152 @@ - (void)testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepd XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } +- (void)testVideoAdUnitForDefaultTagIDResponseViaNobidWithoutMAR +{ +TMARK(); + ANInstreamVideoAd *instreamVideo = self.adUnitsForTest.instreamVideo; + + + // ANInstreamVideoAd, receiving nobid, without MAR association. + // + [instreamVideo setInventoryCode:self.inventoryCodeWithNobidGood memberId:self.adUnitsForTest.memberIDDefault]; + [instreamVideo loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([instreamVideo.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); + + // + [self clearCounters]; + + [instreamVideo setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [instreamVideo loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); + + // + [self clearCounters]; + + [instreamVideo setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [instreamVideo setPublisherId:self.publisherIDWithNobid]; + [instreamVideo loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); +} + +- (void)testVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR +{ + ANInstreamVideoAd *instreamVideo = self.adUnitsForTest.instreamVideo; + + + // ANInstreamVideoAd, receiving nobid, associated with MAR, loaded via MAR. + // + self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault + delegate: self + adUnits: self.adUnitsForTest.instreamVideo, nil]; + [self clearCounters]; + + [instreamVideo setInventoryCode:self.inventoryCodeWithNobidGood memberId:self.adUnitsForTest.memberIDDefault]; + [self.mar load]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); + + // + [self clearCounters]; + + [instreamVideo setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [self.mar load]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + _AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); + + // + [self clearCounters]; + [self.mar removeAdUnit:self.adUnitsForTest.instreamVideo]; + + self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault + publisherId: self.publisherIDWithNobid + delegate: self + adUnits: self.adUnitsForTest.instreamVideo, nil]; + + [instreamVideo setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [self.mar load]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); +} + +- (void)testVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently +{ + ANInstreamVideoAd *instreamVideo = self.adUnitsForTest.instreamVideo; + + + // ANInstreamVideoAd, receiving nobid, associated with MAR, loaded independently. + // + self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault + delegate: self + adUnits: self.adUnitsForTest.instreamVideo, nil]; + + [instreamVideo setInventoryCode:self.inventoryCodeWithNobidGood memberId:self.adUnitsForTest.memberIDDefault]; + [instreamVideo loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); + + // + [self clearCounters]; + + [instreamVideo setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [instreamVideo loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); + + // + [self clearCounters]; + [self.mar removeAdUnit:self.adUnitsForTest.instreamVideo]; + + self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault + publisherId: self.publisherIDWithNobid + delegate: self + adUnits: self.adUnitsForTest.instreamVideo, nil]; + + [self.adUnitsForTest.instreamVideo setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [self.adUnitsForTest.instreamVideo loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); +} + diff --git a/tests/UnitTestApp/FunctionalTests/OutstreamVideoAdClassObjectFromUTResponseTests.m b/tests/UnitTestApp/FunctionalTests/OutstreamVideoAdClassObjectFromUTResponseTests.m index d99c5d5af..7fca7c736 100644 --- a/tests/UnitTestApp/FunctionalTests/OutstreamVideoAdClassObjectFromUTResponseTests.m +++ b/tests/UnitTestApp/FunctionalTests/OutstreamVideoAdClassObjectFromUTResponseTests.m @@ -127,7 +127,8 @@ - (void) stubRequestWithResponse:(NSString *)responseName { #pragma mark - ANVideoAdPlayerDelegate. -- (void)videoAdLoadFailed:(NSError *)error { +- (void)videoAdLoadFailed:(NSError *)error withAdResponseInfo:(ANAdResponseInfo *)adResponseInfo +{ TESTTRACE(); } From 5fda0812af55c41916cdcdb39ec0dc53929dc0d6 Mon Sep 17 00:00:00 2001 From: David Reeder Date: Sat, 8 Feb 2020 02:15:16 -0500 Subject: [PATCH 27/35] Add tests with ANNativeAdRequest:: * testNativeAdUnitForDefaultTagIDResponseViaNobidWithoutMAR * testNativeAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR * testNativeAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently --- sdk/sourcefiles/native/ANNativeAdRequest.h | 2 +- .../native/internal/ANNativeAdRequest.m | 4 +- .../DefaultPlacementLogic.m | 201 +++++++++++++++--- 3 files changed, 176 insertions(+), 31 deletions(-) diff --git a/sdk/sourcefiles/native/ANNativeAdRequest.h b/sdk/sourcefiles/native/ANNativeAdRequest.h index f10137e82..54f51eed5 100644 --- a/sdk/sourcefiles/native/ANNativeAdRequest.h +++ b/sdk/sourcefiles/native/ANNativeAdRequest.h @@ -102,6 +102,6 @@ * Called when a native ad request was unsuccessful. * @see ANAdResponseCode in ANAdConstants.h for possible error code values. */ -- (void)adRequest:(nonnull ANNativeAdRequest *)request didFailToLoadWithError:(nonnull NSError *)error; +- (void)adRequest:(nonnull ANNativeAdRequest *)request didFailToLoadWithError:(nonnull NSError *)error withAdResponseInfo:(nullable ANAdResponseInfo *)adResponseInfo; @end diff --git a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m index 5155acccf..157e15a39 100644 --- a/sdk/sourcefiles/native/internal/ANNativeAdRequest.m +++ b/sdk/sourcefiles/native/internal/ANNativeAdRequest.m @@ -147,8 +147,8 @@ -(void)didFinishRequestWithResponse: (nonnull ANAdFetcherResponse *)response } if (error) { - if ([self.delegate respondsToSelector:@selector(adRequest:didFailToLoadWithError:)]) { - [self.delegate adRequest:self didFailToLoadWithError:error]; + if ([self.delegate respondsToSelector:@selector(adRequest:didFailToLoadWithError:withAdResponseInfo:)]) { + [self.delegate adRequest:self didFailToLoadWithError:error withAdResponseInfo:response.adResponseInfo]; } return; diff --git a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m index a27cc91cf..af828d77a 100644 --- a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m +++ b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m @@ -28,7 +28,7 @@ -@interface DefaultPlacementLogic : XCTestCase +@interface DefaultPlacementLogic : XCTestCase @property (nonatomic, readwrite, strong, nullable) MARAdUnits *adUnitsForTest; @@ -40,9 +40,7 @@ @interface DefaultPlacementLogic : XCTestCase // @property (nonatomic, readwrite, strong, nullable) ANMultiAdRequest *mar; -@property (nonatomic, readwrite, strong, nullable) ANBannerAdView *bannerAd1; -@property (nonatomic, readwrite, strong, nullable) ANNativeAdRequest *nativeAdRequest1; - +@property (nonatomic, readwrite, strong, nullable) ANNativeAdResponse *nativeResponse; // @property (nonatomic, readwrite) NSUInteger MAR_countOfCompletionSuccesses; @@ -64,16 +62,6 @@ @interface DefaultPlacementLogic : XCTestCase @property (nonatomic, readwrite, strong) NSString *placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined; -//@property (nonatomic, readwrite) NSUInteger publisherIDWithSuccess; -//@property (nonatomic, readwrite, strong) NSString *inventoryCodeWithSuccessGood; -//@property (nonatomic, readwrite, strong) NSString *inventoryCodeWithSuccessBad; -// -//@property (nonatomic, readwrite, strong) NSString *placementIDSuccessResponseWhenAllIsCorrect; -//@property (nonatomic, readwrite, strong) NSString *placementIDSuccessResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined; -//@property (nonatomic, readwrite, strong) NSString *placementIDSuccessResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined; - //FIX -- use these properties. - -@property (nonatomic, readwrite) NSUInteger publisherIDWeirdMaskedValue; @end @@ -98,16 +86,6 @@ - (void)setUp self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined = @"17383879"; -// self.publisherIDWithSuccess = FIX; -// self.inventoryCodeWithSuccessGood = @"FIX"; -// self.inventoryCodeWithSuccessBad = @"FIX"; -// -// self.placementIDSuccessResponseWhenAllIsCorrect = @"FIX"; -// self.placementIDSuccessResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined = @"FIX"; -// self.placementIDSuccessResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined = @"FIX"; - - self.publisherIDWeirdMaskedValue = 99009900; - // self.httpStubManager = [ANHTTPStubbingManager sharedStubbingManager]; self.httpStubManager.ignoreUnstubbedRequests = YES; @@ -128,6 +106,8 @@ - (void)clearCounters self.expectationMARLoadCompletionOrFailure = nil; self.expectationAdUnitLoadResponseOrFailure = nil; + self.nativeResponse = nil; + self.adResponseInfo = nil; } @@ -428,7 +408,7 @@ - (void)FIXtestInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedInd XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)testVideoAdUnitForDefaultTagIDResponseViaNobidWithoutMAR +- (void)FIXtestVideoAdUnitForDefaultTagIDResponseViaNobidWithoutMAR { TMARK(); ANInstreamVideoAd *instreamVideo = self.adUnitsForTest.instreamVideo; @@ -471,7 +451,7 @@ - (void)testVideoAdUnitForDefaultTagIDResponseViaNobidWithoutMAR XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)testVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR +- (void)FIXtestVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR { ANInstreamVideoAd *instreamVideo = self.adUnitsForTest.instreamVideo; @@ -523,7 +503,7 @@ - (void)testVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)testVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently +- (void)FIXtestVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently { ANInstreamVideoAd *instreamVideo = self.adUnitsForTest.instreamVideo; @@ -574,6 +554,167 @@ - (void)testVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } +- (void)testNativeAdUnitForDefaultTagIDResponseViaNobidWithoutMAR +{ +TMARK(); + ANNativeAdRequest *native = self.adUnitsForTest.native; + + + // ANNativeAdRequest, receiving nobid, without MAR association. + // + [native setInventoryCode:self.inventoryCodeWithNobidGood memberId:self.adUnitsForTest.memberIDDefault]; + [native loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); + + // + [self clearCounters]; + + [native setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [native loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); + + // + [self clearCounters]; + + [native setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [native setPublisherId:self.publisherIDWithNobid]; + [native loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); +} + +- (void)testNativeAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR +{ + ANNativeAdRequest *native = self.adUnitsForTest.native; + + + // ANNativeAdRequest, receiving nobid, associated with MAR, loaded via MAR. + // + self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault + delegate: self + adUnits: self.adUnitsForTest.native, nil]; + [self clearCounters]; + + [native setInventoryCode:self.inventoryCodeWithNobidGood memberId:self.adUnitsForTest.memberIDDefault]; + [self.mar load]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); + + // + [self clearCounters]; + + [native setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [self.mar load]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + _AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); + + // + [self clearCounters]; + [self.mar removeAdUnit:self.adUnitsForTest.native]; + + self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault + publisherId: self.publisherIDWithNobid + delegate: self + adUnits: self.adUnitsForTest.native, nil]; + + [native setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [self.mar load]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); + + if (self.adResponseInfo) { + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); + } else { + XCTAssertTrue([self.nativeResponse.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); + } +} + +- (void)testNativeAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently +{ + ANNativeAdRequest *native = self.adUnitsForTest.native; + + + // ANNativeAdRequest, receiving nobid, associated with MAR, loaded independently. + // + self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault + delegate: self + adUnits: self.adUnitsForTest.native, nil]; + + [native setInventoryCode:self.inventoryCodeWithNobidGood memberId:self.adUnitsForTest.memberIDDefault]; + [native loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenAllIsCorrect]); + + // + [self clearCounters]; + + [native setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [native loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); + + if (self.adResponseInfo) { + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); + } else { + XCTAssertTrue([self.nativeResponse.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsNOTDefined]); + } + + // + [self clearCounters]; + [self.mar removeAdUnit:self.adUnitsForTest.native]; + + self.mar = [[ANMultiAdRequest alloc] initWithMemberId: self.adUnitsForTest.memberIDDefault + publisherId: self.publisherIDWithNobid + delegate: self + adUnits: self.adUnitsForTest.native, nil]; + + [self.adUnitsForTest.native setInventoryCode:self.inventoryCodeWithNobidBad memberId:self.adUnitsForTest.memberIDDefault]; + [self.adUnitsForTest.native loadAd]; + + self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; + [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; + + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); + + if (self.adResponseInfo) { + XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); + } else { + XCTAssertTrue([self.nativeResponse.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); + } +} + @@ -688,14 +829,18 @@ - (void)adRequest:(nonnull ANNativeAdRequest *)request didReceiveResponse:(nonnu { TINFO(@"%@", [MARHelper adunitDescription:request]); + self.nativeResponse = response; + self.AdUnit_countOfReceiveSuccesses += 1; [self.expectationAdUnitLoadResponseOrFailure fulfill]; } -- (void)adRequest:(nonnull ANNativeAdRequest *)request didFailToLoadWithError:(nonnull NSError *)error +- (void)adRequest:(nonnull ANNativeAdRequest *)request didFailToLoadWithError:(nonnull NSError *)error withAdResponseInfo:(nullable ANAdResponseInfo *)adResponseInfo { TERROR(@"%@ -- %@", [MARHelper adunitDescription:request], error.userInfo); + self.adResponseInfo = adResponseInfo; + self.AdUnit_countOfReceiveFailures += 1; [self.expectationAdUnitLoadResponseOrFailure fulfill]; } From 9715ed3f8615da5d1cb0665163c6535cbcbe003a Mon Sep 17 00:00:00 2001 From: David Reeder Date: Sat, 8 Feb 2020 02:20:57 -0500 Subject: [PATCH 28/35] Enable all tests in FunctionalTests:DefaultPlacementLogic suite. --- .../internal/ANAdFetcherResponse.h | 1 - sdk/sourcefiles/internal/ANBannerAdView.m | 1 - .../DefaultPlacementLogic.m | 20 +++++++++---------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/sdk/sourcefiles/internal/ANAdFetcherResponse.h b/sdk/sourcefiles/internal/ANAdFetcherResponse.h index 24bac9bd5..7185214c8 100644 --- a/sdk/sourcefiles/internal/ANAdFetcherResponse.h +++ b/sdk/sourcefiles/internal/ANAdFetcherResponse.h @@ -28,7 +28,6 @@ @property (nonatomic, readonly, strong, nullable) NSError *error; @property (nonatomic, readwrite, strong, nullable) ANAdResponseInfo *adResponseInfo; - ///FIX -- here on error; in adObjecgHandler on success? SEE kANAdResponseInfo // diff --git a/sdk/sourcefiles/internal/ANBannerAdView.m b/sdk/sourcefiles/internal/ANBannerAdView.m index 75177558d..d082c88be 100644 --- a/sdk/sourcefiles/internal/ANBannerAdView.m +++ b/sdk/sourcefiles/internal/ANBannerAdView.m @@ -458,7 +458,6 @@ - (void)universalAdFetcher:(ANUniversalAdFetcher *)fetcher didFinishRequestWithR if (error) { self.contentView = nil; -// [self setAdResponseInfo:response.adResponseInfo]; //FIX -- handle in anadview? [self adRequestFailedWithError:error andAdResponseInfo:response.adResponseInfo]; } diff --git a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m index af828d77a..59ecfdb91 100644 --- a/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m +++ b/tests/UnitTestApp/FunctionalTests/MARTestCase/MARTestMockMediation/DefaultPlacementLogic.m @@ -115,7 +115,7 @@ - (void)clearCounters #pragma mark - Tests. -- (void)FIXtestBannerAdUnitForDefaultTagIDResponseViaNobidWithoutMAR +- (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithoutMAR { TMARK(); ANBannerAdView *banner = self.adUnitsForTest.banner; @@ -154,11 +154,11 @@ - (void)FIXtestBannerAdUnitForDefaultTagIDResponseViaNobidWithoutMAR self.expectationAdUnitLoadResponseOrFailure = [self expectationWithDescription:@"EXPECTATION: expectationAdUnitLoadResponseOrFailure"]; [self waitForExpectationsWithTimeout:kWaitLong handler:nil]; - XCTAssertEqual(self.AdUnit_countOfReceiveFailures, 1); + XCTAssertEqual(self.AdUnit_countOfReceiveSuccesses + self.AdUnit_countOfReceiveFailures, 1); XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)FIXtestBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR +- (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR { ANBannerAdView *banner = self.adUnitsForTest.banner; @@ -210,7 +210,7 @@ - (void)FIXtestBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)FIXtestBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently +- (void)testBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently { ANBannerAdView *banner = self.adUnitsForTest.banner; @@ -262,7 +262,7 @@ - (void)FIXtestBannerAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdent } -- (void)FIXtestInterstitialAdUnitForDefaultTagIDResponseViaNobidWithoutMAR +- (void)testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithoutMAR { TMARK(); ANInterstitialAd *interstitial = self.adUnitsForTest.interstitial; @@ -305,7 +305,7 @@ - (void)FIXtestInterstitialAdUnitForDefaultTagIDResponseViaNobidWithoutMAR XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)FIXtestInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR +- (void)testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR { ANInterstitialAd *interstitial = self.adUnitsForTest.interstitial; @@ -357,7 +357,7 @@ - (void)FIXtestInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByM XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)FIXtestInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently +- (void)testInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently { ANInterstitialAd *interstitial = self.adUnitsForTest.interstitial; @@ -408,7 +408,7 @@ - (void)FIXtestInterstitialAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedInd XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)FIXtestVideoAdUnitForDefaultTagIDResponseViaNobidWithoutMAR +- (void)testVideoAdUnitForDefaultTagIDResponseViaNobidWithoutMAR { TMARK(); ANInstreamVideoAd *instreamVideo = self.adUnitsForTest.instreamVideo; @@ -451,7 +451,7 @@ - (void)FIXtestVideoAdUnitForDefaultTagIDResponseViaNobidWithoutMAR XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)FIXtestVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR +- (void)testVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR { ANInstreamVideoAd *instreamVideo = self.adUnitsForTest.instreamVideo; @@ -503,7 +503,7 @@ - (void)FIXtestVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedByMAR XCTAssertTrue([self.adResponseInfo.placementId isEqualToString:self.placementIDNobidResponseWhenInventoryCodeIsWrongAndPublisherIDIsDefined]); } -- (void)FIXtestVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently +- (void)testVideoAdUnitForDefaultTagIDResponseViaNobidWithMARLoadedIndepdently { ANInstreamVideoAd *instreamVideo = self.adUnitsForTest.instreamVideo; From 303e9088b1922fd1252470ea19f3f1d677f73dd3 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Date: Mon, 10 Feb 2020 17:09:50 +0000 Subject: [PATCH 29/35] OMID Session Start Event Squashed commit of the following: commit d5293da719019178a3e84702b171bed58eb896b1 Author: Abhishek Sharma Date: Mon Feb 10 16:09:39 2020 +0530 MVP update with Master commit 354eed23b9d5df50b8246ab09d30fd767854fbf1 Author: Abhishek Sharma Date: Tue Feb 4 19:21:13 2020 +0530 Updated MVP --- sdk/sourcefiles/Resources/MobileVastPlayer.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sdk/sourcefiles/Resources/MobileVastPlayer.js b/sdk/sourcefiles/Resources/MobileVastPlayer.js index 259090001..d4f66bb37 100644 --- a/sdk/sourcefiles/Resources/MobileVastPlayer.js +++ b/sdk/sourcefiles/Resources/MobileVastPlayer.js @@ -1,4 +1,4 @@ -/*! (c)2019 AppNexus, Inc. v1.5.1 +/*! (c)2020 AppNexus, Inc. v1.5.1 This code contains portions of Video.js modified by AppNexus. Video.js is Copyright Brightcove, Inc. and Licensed under the Apache License, Version 2.0 (the “License”); you may not use Video.js except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. @@ -37,19 +37,19 @@ Permission is here by granted, free of charge, to any person obtaining a copy of The above copyright notice and this permission 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. */ -var APNVideo_MobileVastPlayer=function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){function i(e,t){if(!e)return null;for(var n=0;n0){var r=Number(i.substring(0,i.length-2));t-=2*r,n-=2*r}k.style.width=t+"px",k.style.height=n+"px";var a=u(T);e("repositionPlayer: targetDiv absolute posiotion ="+a.left+", "+a.top),k.style.left=a.left+"px",k.style.top=a.top+"px",e("repositionPlayer: size = "+t+", "+n),S.overlayPlayer?N.resizePlayer(t,n):N.resizeVideo(null,!1,null)}}function a(t){e("Resize event happend"),k&&N&&(O?(O=!1,S.fitInContainer&&(k.style.zIndex=R),setTimeout(function(){r(),"click"!==S.initialPlayback&&N.play()},100)):r()),G&&G(t)}function c(t){switch(e("Got notification: "+t),t){case"leaveFullscreen":q();break;default:e("Unknown player notification: "+t)}}function u(e){for(var t=0,n=0;e&&"BODY"!==e.tagName&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);){var i=document.defaultView.getComputedStyle(e,null).position;if(i&&""!==i&&"static"!==i)break;t+=e.offsetLeft-e.scrollLeft+e.clientLeft,n+=e.offsetTop-e.scrollTop+e.clientTop,e=e.offsetParent}return{left:t,top:n}}function p(){var t,n=function(){try{var e=navigator.platform,t=navigator.userAgent,n=navigator.appVersion;if(/iP(hone|od|ad)/.test(e)&&!/CriOS/.test(t)){var i=n.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(i[1],10),parseInt(i[2],10),parseInt(i[3]||0,10)]}return[0,0,0]}catch(o){return[0,0,0]}};try{t=n()[0]>=8&&S.enableInlineVideoForIos===!0}catch(i){e(i)}return t}function h(e){var t=document.defaultView.getComputedStyle(e,null).zIndex;return"auto"!==t?t:0}function m(e,t){if(!e.children)return t;for(var n=Math.max(t,h(e)),i=0;i-1||navigator.appVersion.indexOf("Android")>-1}function y(){return navigator.userAgent.indexOf("Chrome")>-1}function A(){var e=navigator.appVersion.indexOf("Chrome/");if(e>=0){var t=navigator.appVersion.substr(e+7);return e=t.indexOf("."),e>0?Number(t.substr(0,e)):0}return 0}function b(n,i,r){e("play function called"),P=!1,j=3e3,S.vpaidTimeout&&(j=S.vpaidTimeout),x=null,_=!1,V=!1,r&&(_=r),i&&(x=function(e,t){t=t?t:{};var n={event:e,params:t};i(n)}),f()&&(S.showFullScreenButton===!0?S.allowFullscreen=!0:S.allowFullscreen=!1),v()&&(S.enableInlineVideoForIos=!1),e("options before PlayerDefaultOption: ",JSON.stringify(S)),S=s(S),e("options after PlayerDefaultOption: ",JSON.stringify(S)),S.width=n.offsetWidth,S.height=n.offsetHeight;var a=n.style.borderWidth;if(a&&a.length>0){var l=Number(a.substring(0,a.length-2));S.width-=2*l,S.height-=2*l}S.playerHeight=S.height,p()&&(S.playerHeight-=30),o()&&(S.fullscreenMode=!0),e("offsetWidth="+n.offsetWidth+", offsetHeight="+n.offsetHeight+", borderWidth="+n.style.borderWidth);var h=document.createElement("div");h.style.width=S.width+"px",S.fitInContainer?h.style.height=S.height+"px":S.cachePlayer&&S.overlayPlayer?h.style.height="1px":h.style.height=S.height+"px",h.style.backgroundColor="black",h.id=n.id+"_overlay_"+(new Date).getTime();var b=u(n);e("targetDiv absolute posiotion ="+b.left+", "+b.top),h.style.position="absolute",h.style.left=b.left+"px",h.style.top=b.top+"px",S.fitInContainer?h.style.zIndex=Math.max(100,m(n,0)+1):(R=Math.max(100,m(n,0)+1),S.cachePlayer&&S.overlayPlayer?h.style.zIndex=0:h.style.zIndex=R),n.appendChild(h),e("player container offsetLeft = "+h.offsetLeft+", offsetTop = "+h.offsetTop),k=h,T=n,E=(new Date).getTime(),e("timeToReady = "+j+", start time = "+E),C=setTimeout(function(){P||(z(!1),x&&x("Timed-out",{}))},j);var w=function(n,i){e("VastPlayer > cbRenderVideo called");try{e("VastPlayer > cbRenderVideo options: ",JSON.stringify(i))}catch(o){}t(i)};I.cbRenderVideo=w,I.cbWhenDestroy=z,I.cbWhenReady=J,I.cbWhenQuartile=U,I.cbWhenVideoComplete=F,I.cbWhenSkipped=B,I.cbWhenFullScreen=W,I.cbWhenAudio=$,I.cbWhenClickOpenUrl=H,I.cbCoreVideoEvent=L,S.playerNotification=c,S.overlayPlayer&&(S.hasOwnProperty("allowFullscreen")||(S.allowFullscreen=!1)),e("VP >> before options.initialAudio = "+S.initialAudio),"auto"===S.initialPlayback&&"on"===S.initialAudio&&g()&&y()&&A()>=53&&(S.showMute=!0,S.showVolume=!0),e("VP >> after options.initialAudio = "+S.initialAudio),d(k,S,I)}e("VERSION 1.4.15");var k,T,w,E,S={},I={},C=null,P=!1,j=3e3,x=null,_=!1,V=!1,D=null,M=!1,N=null,O=!1,R=0,U=function(t){e("VastPlayer > cbWhenQuartile "+t),x(t,{})},L=function(e,t){var n={type:e,name:t};if("AdHandler"===n.type&&"video_impression"===n.name)try{var i=new CustomEvent("outstream-impression");k.dispatchEvent(i)}catch(o){error(o)}for(var r=[{type:"AdHandler",name:"video_start",mappedEventName:"videoStart"},{type:"AdHandler",name:"rewind",mappedEventName:"videoRewind"},{type:"AdHandler",name:"video_fullscreen_enter",mappedEventName:"video-fullscreen-enter"},{type:"AdHandler",name:"video_fullscreen_exit",mappedEventName:"video-fullscreen-exit"}],a=0;a cbWhenVideoComplete "+t),x(t,{})},B=function(t){e("VastPlayer > cbWhenSkipped "+t),x(t,{})},$=function(t){e("VastPlayer > cbWhenAudio "+t),x(t,{})},H=function(e){x(e,{})},W=function(t){e("VastPlayer > cbWhenFullScreen "+t),x(t,{})},z=function(t,n,i){e("VastPlayer > cbTerminate isError: "+t);var r="unknown";k&&(r=k.id.toString()),e("VastPlayer > cbTerminate: bTerminated = "+V+", targetElement id = "+r),M=!1,V||(V=!0,n||q(),!i&&o()&&S.overlayPlayer&&q(),k&&(N&&(N.isPlayingVideo&&(e("VastPlayer > cbTerminate: pause ad"),N.pause()),k.style.height="1px",N.resizePlayer(1,1)),setTimeout(function(){k&&(k.innerHTML="",T.removeChild(k)),k=null},2e3)),x&&t&&x("video-error",{}))},q=function(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen()},J=function(t){var n,i,r,a,s;n=t&&t.options&&t.options.video&&t.options.video.url?t.options.video.url:"",i=t&&t.options&&t.options.data&&t.options.data.vastDurationMsec?t.options.data.vastDurationMsec:0,r=t&&t.options&&t.options.finalVastXml?t.options.finalVastXml:"",a=t&&t.options&&t.options.finalVastUri?t.options.finalVastUri:"",s=t&&t.getFinalAspectRatio()?t.getFinalAspectRatio():"",V||(P=!0,N=t,e("VastPlayer > cbWhenReady in "+((new Date).getTime()-E)+" msecs"),x&&x("adReady",{creativeUrl:n,duration:i,vastXML:r,vastCreativeUrl:a,aspectRatio:s}),"click"===S.initialPlayback||S.cachePlayer||(o()&&S.overlayPlayer?S.forceAdInFullscreen?(O=!0,q()):(k&&(k.style.width="1px",k.style.height="1px"),z(!1,!0,!0)):N.play()))},G=null;document.body.onresize&&(G=document.body.onresize),window.onresize=a,this.playVast=function(t,n,o,r,a){e("VP >> playVast function called playerId = "+this.vastPlayerId),z(!1,!0),i(),S=n,S.vastXml=o,b(t,r,a)},this.playAdObject=function(t,n,o,r,a){e("VP >> playAdObject function called playerId = "+this.vastPlayerId+", cache mode = "+n.cachePlayer),z(!1,!0),i(),S=n,"string"==typeof o?S.vastXml=o:(S.useAdObj=!0,S.adObj=o),b(t,r,a)},this.stop=function(){C&&(clearTimeout(C),C=null),z(!1)},this.removeFromPage=function(){C&&(clearTimeout(C),C=null),V=!0,k&&(k.innerHTML="",T.removeChild(k),k=null)},this.play=function(){e("VP >> play function called playerId = "+this.vastPlayerId),N&&(S.cachePlayer=!1,o()&&S.overlayPlayer?S.forceAdInFullscreen?(O=!0,q()):z(!1,!0,!0):(k&&S.fitInContainer===!1&&(k.style.zIndex=R),r(),"click"!==S.initialPlayback&&N.play()))},this.sendPlay=function(){e("VP >> sendPlay function called playerID = "+this.vastPlayerId),N&&!N.isPlayingVideo&&N.play()},this.sendPause=function(){e("VP >> sendPause function called playerID = "+this.vastPlayerId),N&&N.isPlayingVideo&&N.pause()},this.handleFullscreen=function(e){N&&(e?T.requestFullscreen?T.requestFullscreen():T.webkitRequestFullscreen?T.webkitRequestFullscreen():T.mozRequestFullScreen?T.mozRequestFullScreen():T.msRequestFullscreen&&T.msRequestFullscreen():document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen())},this.vastPlayerId=(new Date).getTime(),this.isTerminated=function(){return V},this.getIsVideoPlaying=function(){var e=!(!N||!N.isPlayingVideo);return e},this.getCurrentPlayHeadTime=function(){var e=0;return w&&w.adVideoPlayer&&"function"==typeof w.adVideoPlayer.player&&(e=1e3*w.adVideoPlayer.player().currentTime(),e=parseInt&&"function"==typeof parseInt?parseInt(e):e),e}};e.exports={playAdObject:function(e,t,n,i,o){var a=r(t.targetElementId,t.cachePlayer);a&&a.playAdObject(e,t,n,i,o)},playVast:function(e,t,n,i,o){var a=r(t.targetElementId);a&&a.playVast(e,t,n,i,o)},loadAndPlayVast:function(e,t,i,o,a){var s=n(29);s.load(i,function(s,l){if(s||0===l.length){var d=n(28);d.logDebug("Failed to load "+i,"Vast Video Player")}else{var c=r(t.targetElementId);c&&c.playVast(e,t,l,o,a)}})},stop:function(e,t){var n=o(e.id,t);n&&n.stop()},removeFromPage:function(e){var t=o(e);t&&t.removeFromPage()},play:function(e,t){var n=i(e,t);n&&n.play()},sendPlay:function(e){var t=o(e);t&&t.sendPlay()},sendPause:function(e){var t=o(e);t&&t.sendPause()},handleFullscreen:function(e,t){var n=o(e);n&&n.handleFullscreen(t)},getCurrentPlayHeadTime:function(e){var t=o(e);if(t)return t.getCurrentPlayHeadTime()},getIsVideoPlaying:function(e){var t=o(e);if(t)return t.getIsVideoPlaying()}}},function(e,t){var n=function(e){function t(e){return"object"==typeof e}function n(e){return null===e}function i(e){var o,r,a;for(r=1;r-1},T=["AdPaused","AdVolumeChange"],w=["AdLoaded","AdStopped","AdSkippableStateChange","AdLinearChange","AdDurationChange","AdRemainingTimeChange","AdLog","AdError"],E=1,S=402,I=900,C=405,P={initialPlayback:"auto",initialAudio:"off",skippable:{enabled:!0,allowOverride:!1,videoThreshold:15,videoOffset:5,skipLocation:"top-left",skipText:"Video can be skipped in %%TIME%% seconds",skipButtonText:"SKIP"},adText:"Ad",showMute:!0,showVolume:!0,showProgressBar:!0,showPlayToggle:!0,showBigPlayButton:!0,allowFullscreen:!0,playerSkin:{customPlayerSkin:"",controlBarHeight:30,topDividerColor:"#606060",bottomDividerColor:"#606060",topDividerWidth:1,bottomDividerWidth:1,videoBackgroundColor:"#000000"},disableCollapse:{enabled:!1,replay:!1},endCard:{enabled:!1,clickable:!0,color:"",imageUrl:"",imageWidth:"",imageHeight:"",showCompanion:!0},enableInlineVideoForIos:!0,delayExpandUntilVPAIDInit:!1,delayExpandUntilVPAIDImpression:!1,flash:{swf:"http://acdn.adnxs.com/video/player/vastPlayer/AppnexusFlashPlayer.swf"},vpaidTimeout:5e3,waterfallTimeout:3e4,waterfallSteps:-1,fixedSizePlayer:!0,disableTopBar:!1,sideStream:{enabled:!1,position:"bottom-right",xOffset:0,yOffset:0,space:"empty",dynamicBigPlayButtonOnSideStream:!0},sideStreamObject:{},preloadInlineAudioForIos:!1,controlBarPosition:"over",customPlayerSkinCss:"",customButton:{enabled:!1,url:"",altText:"",imageSrc:"",imgWidth:50,imgHeight:30},enableNativeInline:!1,androidDSOverride:!1,cbNotification:function(){},parentIframeIsModal:!1,learnMore:{enabled:!1,clickToPause:!0,text:"Learn More",separator:"-"},playerContextId:"anadvideoplayer",data:{skipOffset:"",durationMsec:null,skipOffsetMsec:null,isVastVideoSkippable:!1,vastProgressEvent:{},vastDurationMsec:null,adIcons:null},test:function(){}},j={externalNameOfVideoPlayer:v,videoPlayerObj:i,autoplayHandler:h,mobileSupport:h,customSkinning:u,options:{},adVideoPlayer:{},callbackForAdUnit:{},vpaidData:{},iframeVideoWrapper:{},isPlayingVideo:!1,isDoneInitialPlay:!1,isFullscreen:!1,heightOffset:0,explicitPaused:!1,aspectRatio:0,finalAspectRatio:0,videoObjectId:{},isViewable:!1,isSkipped:!1,isCompleted:!1,isMuted:!1,isExplicitMuted:!1,hasBeenUnmuted:!1,isChrome:navigator.userAgent.indexOf("Chrome")>-1,videojs_vpaid:r,overlayPlayer:!1,forceToSkip:!1,ExtendDefaultOption:a,delayEventHandler:null,pausedByViewability:!1,mutedByVisibility:!1,gotAdImpressionForFlash:!1,gotAdStartedForFlash:!1,isReadyToExpandForMobile:!1,isAlreadyPlaingForVPAID:!1,isSideStreamActivated:!1,isExpanded:!0,isVideoCompleteInjected:!1,isFullscreenToggled:!1,toggleWindowFocus:!0,viewabilityTracking:null,isDoneFirstLoadStart:!1,flashBlockerTimeout:null,startedReplay:!1,Utils:l,isAlreadyStart:!1,isEnded:!1,blockTrackingUserActivity:!1,videoId:"",divIdForVideo:"",init:function(e){var t=a(P,e);return this.options=t,"boolean"==typeof this.options.disableCollapse&&(this.options.disableCollapse={enabled:this.options.disableCollapse,replay:!1}),this.options.skippable.allowOverride===!0&&(this.options.skippable.videoThreshold=0,this.options.skippable.enabled=!0),this.delayEventHandler=new d,this.delayEventHandler.suppress(this.options.delayExpandUntilVPAIDImpression),this.delayEventHandler.start(),this.viewabilityTracking=new p,t},getValueFromPlayer:function(e){var t=0;try{"controlBar.height"===e&&this.adVideoPlayer&&this.adVideoPlayer.controlBar&&this.adVideoPlayer.controlBar.height&&"function"==typeof this.adVideoPlayer.controlBar.height&&"html5"===this.decidePlayer(this.options.requiredPlayer)&&(t=this.adVideoPlayer.controlBar.height())}catch(n){b(n)}return t},decidePlayer:function(e){var t="",n="flash",i="html5",o=function(){var e=navigator.appVersion.indexOf("Mobile"),t=navigator.appVersion.indexOf("Android");return e>-1||t>-1},r=this.options.playerTechnology;if(r&&r.length&&1===r.length)switch(e){case 1:t=i;break;case 2:t=n;break;case 0:t=r[0]===i?i:n}if(r&&r.length&&2===r.length)switch(e){case 1:t=i;break;case 2:t=n;break;case 0:t=i}return o()&&(t=i),t},buildPlayer:function(e,t){var n=this;if(t.waterfallStepId&&A("CHECKING AUTOPLAY FOR WATERFALL STEP: "+t.waterfallStepId),"html5"===this.decidePlayer(t.requiredPlayer)&&this.autoplayHandler&&!t.overlayPlayer){var i,o=function(i){var o=n.autoplayHandler.videoPolicy;switch(i){case o.allowAutoplay:break;case o.stopMediaWithSound:"on"===t.initialAudio?("auto"!==t.initialPlayback&&"mouseover"!==t.initialPlayback||(t.initialAudio="off",t.audioOnMouseover=!1),t.isWaterfall===!0&&(t.adAttempt>0?(t.initialAudio="off",t.audioOnMouseover=!1):t.audioOnMouseover=!0)):"auto"!==t.initialPlayback&&"mouseover"!==t.initialPlayback||(t.audioOnMouseover=!1);break;case o.neverAutoplay:t.initialPlayback="click",t.isWaterfall&&(t.isWaterfall=!1,t.stopWaterfall=!0)}t.waterfallStepId&&A("BUILDING PLAYER FOR WATERFALL STEP: "+t.waterfallStepId),n.buildPlayerCallback(e,t)};i=!h.isMobile()&&("on"===t.initialAudio||t.audioOnMouseover===!0),n.autoplayHandler.getAutoplayPolicy(o,i)}else n.buildPlayerCallback(e,t)},buildPlayerCallback:function(e,t){this.callbackForAdUnit=e,t.hasOwnProperty("overlayPlayer")&&(this.overlayPlayer=t.overlayPlayer,t.hasOwnProperty("fullscreenMode")&&(t.allowFullscreen=!1)),k()&&"flash"===this.decidePlayer(this.options.requiredPlayer)||this.options.targetElement&&!this.options.firstAdAttempted&&(this.options.targetElement.style.visibility="hidden"),"flash"===this.decidePlayer(this.options.requiredPlayer)&&(this.options.disableCollapse.replay=!1);var n=(new Date).getTime()+Math.floor(1e4*Math.random()),i="APNVideo_Player_"+n;this.externalNameOfVideoPlayer=i,o(e,t,this)},getPlayerStatus:function(){},notifyPlayer:function(e,t){this.adVideoPlayer.handleAdUnitNotification({name:e,value:t})},load:function(){if("html5"===this.decidePlayer(this.options.requiredPlayer)){A("load video");try{this.adVideoPlayer&&void 0!==this.adVideoPlayer&&this.adVideoPlayer.load&&"function"==typeof this.adVideoPlayer.load&&(this.options.delayExpandUntilVPAIDImpression&&this.adVideoPlayer.player()&&this.adVideoPlayer.player().autoplay()&&this.adVideoPlayer.player().autoplay(!1),this.adVideoPlayer.load())}catch(e){b(e)}}},replay:function(){this.isEnded&&(this.dispatchEventToAdunit({name:"rewind"}),this.startedReplay=!0,this.isEnded=!1,this.explicitPlay(),this.adVideoPlayer.controlBar.playToggle&&this.adVideoPlayer.controlBar.playToggle.el()&&this.adVideoPlayer.controlBar.playToggle.el().style&&(this.adVideoPlayer.controlBar.playToggle.el().style["pointer-events"]=""),this.options.sideStream&&this.options.sideStream.wasEnabled===!0&&(this.options.sideStream.enabled=!0,delete this.options.sideStream.wasEnabled),this.options.endCard&&this.options.endCard.enabled&&(this.actualPlayByVideoJS(),l.isIos()||this.adVideoPlayer.bigPlayButton.show()))},actualPlayByVideoJS:function(){this.adVideoPlayer.play(),this.options.vpaid&&this.adVideoPlayer.trigger("handleManualUserInActive")},play:function(){if(this.isEnded!==!0){var e=h.isMobile()&&h.iOSversion()[0]>=10&&this.options.enableInlineVideoForIos===!1;if(e){var t=this;t.overlayPlayer?t.options.targetElement.style.overflow="":setTimeout(function(){t.options.targetElement.style.overflow=""},t.options.expandTime)}this.isAlreadyPlaingForVPAID=!0,this.isCompleted||(A("play video"),this.isDoneInitialPlay?"html5"===this.decidePlayer(this.options.requiredPlayer)?this.isPlayingVideo||this.dispatchEventToAdunit({name:"video_resume"}):this.isPlayingVideo||this.dispatchEventToAdunit({name:"video_resume"}):this.options.vpaid||(this.dispatchEventToAdunit({name:"video_start"}),this.dispatchEventToAdunit({name:"video_impression"})),this.options.vpaid&&this.isIosInlineRequired()?this.isDoneInitialPlay?this.actualPlayByVideoJS():this.adVideoPlayer.trigger("play"):this.options.vpaid&&this.options.overlayPlayer&&h.isIOS()&&h.iOSversion()[0]<10&&!this.isDoneInitialPlay?this.adVideoPlayer.trigger("play"):this.options.vpaid&&this.options.overlayPlayer&&navigator.appVersion.indexOf("Android")>-1&&this.options.enableWaterfall&&!this.isDoneInitialPlay?this.adVideoPlayer.trigger("play"):this.actualPlayByVideoJS(),"html5"===this.decidePlayer(this.options.requiredPlayer)||(this.isPlayingVideo=!0),this.isDoneInitialPlay=!0,this.isEnded=!1)}},resetVpaid:function(){this.dispatchEventToAdunit({name:"reset"})},pause:function(){this.isPlayingVideo&&(A("pause video"),this.adVideoPlayer.pause(),this.options.vpaid&&this.adVideoPlayer.trigger("handleManualUserActive"),this.isCompleted||this.isEnded||this.dispatchEventToAdunit({name:"video_pause"}))},explicitPause:function(){A("explicit pause video"),this.explicitPaused=!0,this.pause()},explicitPlay:function(){A("explicit play video"),this.explicitPaused=!1,this.play()},mute:function(){this.isMuted||(A("mute audio"),"html5"===this.decidePlayer(this.options.requiredPlayer)?(this.adVideoPlayer.muted(!0),this.dispatchEventToAdunit({name:"video_mute"})):this.adVideoPlayer.mute(),this.isMuted=!0)},explicitMute:function(){A("explicit mute video"),this.isExplicitMuted=!0,this.mute()},unmute:function(){!this.isExplicitMuted&&this.isMuted&&(A("unmute audio"),"html5"===this.decidePlayer(this.options.requiredPlayer)?(this.adVideoPlayer.muted()===!0&&this.adVideoPlayer.muted(!1),(this.isMuted||"off"===this.options.initialAudio)&&this.dispatchEventToAdunit({name:"video_unmute"})):(this.adVideoPlayer.unmute(),this.hasBeenUnmuted=!0),this.isMuted=!1)},explicitUnmute:function(){this.isExplicitMuted=!1,this.unmute()},resizeVideoWithDimensions:function(e,t){var n=this;this.options.width=e,this.options.height=t,n.resizeVideo(n.aspectRatio)},mouseIn:function(){this.adVideoPlayer.mouseIn()},mouseOut:function(){this.adVideoPlayer.mouseOut()},destroy:function(e,t){this.isPlayingVideo=!1,this.adVideoPlayer.pause(),this.isCompleted===!1&&(this.options.vpaid===!1?this.dispatchEventToAdunit({name:"video_skip"}):this.options.vpaid===!0&&this.isSkipped===!1&&this.dispatchEventToAdunit({name:"video_skip"})),"function"==typeof this.callbackForAdUnit.cbWhenSkipped&&this.callbackForAdUnit.cbWhenSkipped("video-skip"),this.isSkipped=!0,this.verificationManager&&this.verificationManager.destroy(),A("destroy");var n=I;"function"==typeof this.callbackForAdUnit.cbWhenDestroy&&(this.overlayPlayer?e&&t?this.callbackForAdUnit.cbWhenDestroy({type:E,code:n,message:t},!0,this.options):this.callbackForAdUnit.cbWhenDestroy(null,!0,this.options):e&&t?this.callbackForAdUnit.cbWhenDestroy({type:E,code:n,message:t},null,this.options):this.callbackForAdUnit.cbWhenDestroy(null,null,this.options))},destroyWithoutSkip:function(e,t,n,i){try{var o=this,r=function(){o.isPlayingVideo=!1,o.adVideoPlayer&&o.adVideoPlayer.pause&&"function"==typeof o.adVideoPlayer.pause&&o.adVideoPlayer.pause(),o.verificationManager&&o.verificationManager.destroy(),A("destroy without skip: "+o.options.iframeVideoWrapperId);var r=i||I;"function"==typeof o.callbackForAdUnit.cbWhenDestroy&&(o.overlayPlayer?e&&t?(n&&(r=S),o.callbackForAdUnit.cbWhenDestroy({type:E,code:r,message:t},!0,o.options)):o.callbackForAdUnit.cbWhenDestroy(null,!0,o.options):e&&t?(n&&(r=S),o.callbackForAdUnit.cbWhenDestroy({type:E,code:r,message:t},null,o.options)):o.callbackForAdUnit.cbWhenDestroy(null,null,o.options))};o.options.disableCollapseForDelay&&o.options.disableCollapseForDelay>0?setTimeout(r,o.options.disableCollapseForDelay):r()}catch(a){b("failed to destroy/notify by "+a)}},getVideoObject:function(){return this.adVideoPlayer},handleFlashPlay:function(){var e=this,t=function(){e.resizeVideo(e.aspectRatio),A("flash player is ready to play"),e.callbackForAdUnit.cbWhenReady&&e.callbackForAdUnit.cbWhenReady(e)};e.isChrome?(e.setChromeSize(),setTimeout(t,100)):t()},handlePlayerNotification:function(e){"video_time"!==e.name&&A("Got notification from player = "+e.name);var t=this,n={flash_is_respondble:function(){t.flashBlockerTimeout&&(clearTimeout(t.flashBlockerTimeout),t.flashBlockerTimeout=null),A("Flash is respondble")},canplay:function(){if(t.flashBlockerTimeout&&(clearTimeout(t.flashBlockerTimeout),t.flashBlockerTimeout=null,A("Flash is respondble")),t.options.hasOwnProperty("overlayPlayer"))try{t.adVideoPlayer.setDOMPlayerIdAndSize(t.adVideoPlayer.id,t.options.width,t.options.height)}catch(n){A("Failed to execute setDOMPlayerIdAndSize(...) on Flash Player")}if(t.options.vpaid)try{var i=t.adVideoPlayer.getCompanionsXml();i&&i.length>0&&(e.companionAds=i)}catch(o){}t.options.vpaid&&t.options.delayExpandUntilVPAIDImpression?t.actualPlayByVideoJS():t.handleFlashPlay()},video_failed:function(){t.flashBlockerTimeout&&(clearTimeout(t.flashBlockerTimeout),t.flashBlockerTimeout=null,A("Flash is respondble")),t.destroyWithoutSkip(!0,m,null,C)},video_timeout:function(){t.destroyWithoutSkip(!0,m,!0,S)},video_bitrate:function(){var t=e.bandwidth;A("bandwidth from flash : "+t)},video_impression:function(){},video_mute:function(){e.hasOwnProperty("value")&&!e.value&&(e.name="video_unmute"),e.hasOwnProperty("value")&&(t.isMuted=e.value)},video_click:function(){e.hasOwnProperty("playerHandles")?e.playerHandles?e.hasOwnProperty("url")&&e.url.length>0?t.click(e.url):t.click():t.dispatchEventToAdunit({name:"ad-click",trackClick:!0}):t.click()},video_complete:function(){t.isCompleted=!0,t.options.disableCollapse.enabled||t.destroyWithoutSkip()},video_fullscreen:function(){t.isFullscreen?setTimeout(function(){t.isFullscreen=!t.isFullscreen},1e3):t.isFullscreen=!t.isFullscreen},quartile_event:function(){},video_pause:function(){},video_start:function(){t.isDoneInitialPlay||"auto"===t.options.initialPlayback||t.play()},video_time:function(){},video_resume:function(){},video_stopped:function(){t.destroyWithoutSkip()},video_skipped:function(){t.destroy()},video_ratio:function(){},video_heightOffset:function(){t.heightOffset=e.heightOffset},video_paused_by_user:function(){t.explicitPause()},video_resumed_by_user:function(){A("received video_resumed_by_user from Flash"),t.requiredForFlashVpaid()?t.isVpaidFlashVideoPlaying===!1?(A("call explicitPlay by video_Resumed_by_user event"),t.explicitPlay()):A("do nothing because of isVpaidFlashVideoPlaying:true"):t.explicitPlay()},video_progress:function(){if(e&&e.offset)return void t.dispatchEventToAdunit({name:e.offset},function(){A("handle video_progress by flash : "+e.offset)})}};if(t.isDoneInitialPlay||"video_mute"!==e.name){var i=n[e.name];i&&void 0!==i&&i(),"video_pause"!==e.name&&"video_resume"!==e.name&&"video_impression"!==e.name&&"video_start"!==e.name&&"video_failed"!==e.name&&"video_timeout"!==e.name&&this.dispatchEventToAdunit(e),"video_impression"!==e.name&&"video_start"!==e.name||!t.options.vpaid||this.dispatchEventToAdunit(e)}},handleOverlayNotification:function(e){A("Got overlay notification from player = "+e.name);var t=this,n={leaveFullscreen:function(){t.options.hasOwnProperty("playerNotification")&&t.options.playerNotification("leaveFullscreen")}},i=n[e.name];i&&void 0!==i&&i()},requiredForFlashVpaid:function(){return"flash"===this.decidePlayer(this.options.requiredPlayer)&&this.options.vpaid===!0},notifyVpaidEvent:function(e){var t=this;if(t.requiredForFlashVpaid()&&("AdPaused"===e&&(A("received VPAID AdPaused from Flash"),t.isVpaidFlashVideoPlaying=!1,t.isPlayingVideo=!1,A("set isVpaidFlashVideoPlaying = false"),A("set isPlayingVideo = false")),"AdPlaying"===e&&(A("received VPAID AdPlaying from Flash"),t.isVpaidFlashVideoPlaying=!0,t.isPlayingVideo=!0,A("set isVpaidFlashVideoPlaying = true"),A("set isPlayingVideo = true"))),"flash"===t.decidePlayer(t.options.requiredPlayer)&&t.options.delayExpandUntilVPAIDImpression&&("AdVideoStart"===e&&t.adVideoPlayer.pause(),"AdImpression"===e&&(t.gotAdImpressionForFlash=!0),"AdStarted"===e&&(t.gotAdStartedForFlash=!0),t.gotAdImpressionForFlash&&t.gotAdStartedForFlash&&(t.handleFlashPlay(),t.gotAdImpressionForFlash=!1,t.gotAdStartedForFlash=!1)),!(t.options.delayExpandUntilVPAIDImpression&&t.delayEventHandler.isSuppress&&T.indexOf(e)>=0)){if("AdVolumeChange"===e){var n="html5"===this.decidePlayer(this.options.requiredPlayer);if(n){var i=t.adVideoPlayer.player().muted(),o=t.adVideoPlayer.player().volume();i?i&&(A("set VPAID AdVolumeChange video_mute"),this.dispatchEventToAdunit({name:"video_mute"})):o>0&&(A("set VPAID AdVolumeChange video_unmute"),this.dispatchEventToAdunit({name:"video_unmute"}))}}w.indexOf(e)>=0||w.indexOf("vpaid."+e)>=0?t.notifyVpaidEvent_internal(e):t.delayEventHandler.push(function(){t.notifyVpaidEvent_internal(e)})}},notifyVpaidEvent_internal:function(e){this.options.cbNotification&&this.options.cbNotification("VPAID",e,this.options.targetId),this.options.cbApnVastPlayer&&this.options.cbApnVastPlayer(e)},setChromeSize:function(){this.adVideoPlayer.width="0px",this.adVideoPlayer.height="0px",this.adVideoPlayer.style.width="0px",this.adVideoPlayer.style.height="0px",this.options.targetElement.style.visibility="visible"},click:function(e,t){if(!this.isDoneInitialPlay)return void this.play();this.isIosInlineRequired()===!1&&(this.pause(),this.toggleWindowFocus=!1);var n=!1;if(this.options.useCustomOpenForClickthrough){var i=this.options.clickUrls[0];e&&(i=e),n=!0,this.dispatchEventToAdunit({name:"video_click_open_url",url:i})}else if(e)n=!0,window.open(e);else if(this.options.clickUrls[0]){n=!0;var o=this.options.clickUrls[0];window.open(o)}"undefined"!=typeof t&&t!==!0||this.dispatchEventToAdunit({name:"ad-click",trackClick:n})},getRapamsAndExtensions:function(){var e=this.options.extensions&&this.options.extensions.length>0?""+this.options.extensions+"":"";return{adParameters:this.options.adParameters,extensions:e}},handleViewability:function(e,t,n){var i=this.options&&this.options.viewability&&this.options.viewability.config,o=e&&e.name?e.name:null;"fullscreenchange"!==o&&"video_fullscreen"!==o||(o=this.isFullscreen?"fullscreen":"exitFullscreen"),n||"video_duration"!==o||(this.isAlreadyStart=!0);var r=function(){var i;i=n?this.adVideoPlayer&&this.adVideoPlayer.player&&"function"==typeof this.adVideoPlayer.player&&this.adVideoPlayer.player().duration():e.duration,(!i||void 0===i||i<=0)&&(i=-2),i===-2&&(this.options&&this.options.data&&this.options.data.vastDurationMsec?(i=this.options.data.vastDurationMsec/1e3,(!i||null===i||i<=0)&&(i=-2)):i=-2);var r=this.options.width,a=this.options.height;if(this.viewabilityTracking.init(this.options,i,r,a,t),n)if(this.options.expandable)this.options.vpaid===!0&&"video_start"===o&&this.viewabilityTracking.invokeEvent("expand"),this.options.vpaid===!1&&"loadstart"===o&&this.viewabilityTracking.invokeEvent("expand"),this.viewabilityTracking.invokeEvent(o);else{if(this.options.overlayPlayer&&l.isMobile()&&this.options.delayStartViewability)return;this.viewabilityTracking.invokeEvent(o)}else this.isAlreadyStart&&(this.options.expandable&&this.viewabilityTracking.invokeEvent("expand"),this.viewabilityTracking.invokeEvent("video_start"))},a=function(){if(this.viewabilityTracking&&this.viewabilityTracking.isReady){ -if(n===!1&&"expand"===o&&this.options.expandable)return;"force_start_viewability"===o&&this.options.delayStartViewability?(this.options.delayStartViewability=!1,this.viewabilityTracking.invokeEvent("video_start")):this.viewabilityTracking.invokeEvent(o)}};if(o&&i){var s=this.blockTrackingUserActivity&&("video_resume"===o||"video_pause"===o||"video_mute"===o||"video_unmute"===o);s||(o===t?r.apply(this):a.apply(this))}},findPathForViewability:function(e){var t,n="html5"===this.decidePlayer(this.options.requiredPlayer);if(n){if(t=!this.options.expandable||"undefined"!=typeof this.options.isExpanded&&this.options.isExpanded!==!1?"video_start":"expand",e&&e.name&&e.name===t){if(this.isDoneFirstLoadStart)return;this.isDoneFirstLoadStart=!0}this.handleViewability(e,t,n)}else{if(t="video_duration",e&&"video_start"===e.name)return;e&&e.name&&e.name===t?this.isDoneFirstLoadStart||(this.isDoneFirstLoadStart=!0,this.handleViewability(e,t,n)):this.handleViewability(e,t,n)}},dispatchEventToAdunit:function(e,t){var n=this;if("video_start"===e.name&&n.iframeVideoWrapper.contentDocument){var i=n.iframeVideoWrapper.contentDocument.getElementById(n.divIdForVideo),o=n.iframeVideoWrapper.contentDocument.getElementById(n.videoId);i.style.background=n.options.playerSkin.videoBackgroundColor,o.style.background=n.options.playerSkin.videoBackgroundColor,h.isIOS()&&n.isIosInlineRequired()&&(o.style.opacity=0)}if("video_complete"===e.name&&(void 0===e.obj&&(e.obj={}),e.obj.videoAdPending=this.options.disableCollapse.replay),"video_fullscreen"===e.name&&"flash"===this.decidePlayer(this.options.requiredPlayer)?setTimeout(function(){var t={name:e.name,user:e.user,value:e.value};n.findPathForViewability(t)},1500):this.findPathForViewability(e),(this.startedReplay===!0||this.isEnded)&&this.options.disableCollapse.replay===!0)if(this.startedReplay===!1&&"rewind"===e.name);else{if("video_complete"===e.name&&"function"==typeof t)return void t();if("ad-click"!==e.name&&e.name.indexOf("IconClick")===-1)return void this.callbackForAdUnit.cbForHandlingDispatchedEvent(e,!0)}"video_skip"===e.name&&c.pushAndCheck(this.options.targetElement.id+"_dispatchEventToAdunit",e.name)===!1||"video_complete"===e.name&&this.isVideoCompleteInjected===!0&&this.options.disableCollapse.replay===!1||(e&&"video_time"!==e.name&&A("(push)"+e.name),this.delayEventHandler.push(function(){n.dispatchEventToAdunit_internal(e,t)}),"video_complete"===e.name&&(this.isVideoCompleteInjected=!0))},dispatchEventToAdunit_internal:function(e,t){if(!this.isCompleted||"video_complete"===e.name||"ad-click"===e.name||"video_skip"===e.name||this.startedReplay){var n=this;if(e&&"video_time"!==e.name&&A("invoke callback : "+JSON.stringify(e)),this.options.hasOwnProperty("overlayPlayer")&&this.options.hiddenControls&&(("firstplay"===e.name&&!this.options.vpaid||"video_impression"===e.name&&this.options.vpaid)&&(!l.isMobile()||"click"!==this.options.initialPlayback&&"mouseover"!==this.options.initialPlayback?h.isIOS()&&h.iOSversion()[0]<10&&"auto"===this.options.initialPlayback&&(this.adVideoPlayer.controlBar.el_.style.removeProperty("display"),delete this.options.hiddenControls):(this.adVideoPlayer.controlBar.el_.style.removeProperty("display"),delete this.options.hiddenControls)),"video_resume"===e.name&&this.options.vpaid&&l.isMobile()&&(this.adVideoPlayer.controlBar.el_.style.removeProperty("display"),delete this.options.hiddenControls)),this.callbackForAdUnit.cbForHandlingDispatchedEvent&&"video_time"!==e.name){if("video_pause"===e.name&&(this.isPlayingVideo=!1),"video_play"!==e.name&&"video_start"!==e.name&&"firstplay"!==e.name||(this.isPlayingVideo=!0,this.isDoneInitialPlay=!0),"video_fullscreen"===e.name)return void setTimeout(function(){e.fullscreenStatus=n.isFullscreen?"enter":"exit",n.callbackForAdUnit.cbForHandlingDispatchedEvent(e)},1500);"function"==typeof t&&t();var i=this.blockTrackingUserActivity&&("video_resume"===e.name||"video_pause"===e.name||"video_mute"===e.name||"video_unmute"===e.name);if(i||(e.player=this,this.callbackForAdUnit.cbForHandlingDispatchedEvent(e)),this.verificationManager){var o=this.prepareOmidEventData(e);o.name&&this.verificationManager.dispatchEvent(o.name,o.data)}}this.options.vpaid===!0&&"video_skip"===e.name&&(this.isSkipped=!0)}},resolveMacro:function(e){switch(e){case"MEDIAPLAYHEAD":return this.options.hasOwnProperty("mediaPlayhead")&&"number"==typeof this.options.mediaPlayhead?l.convertTimeSecondsToString(this.options.mediaPlayhead):-1;case"BREAKPOSITION":return this.options.breakPosition?this.options.breakPosition:-1;case"ADCOUNT":return 1;case"PLACEMENTTYPE":return this.options.overlayPlayer?1:this.options.expandable?3:-1;case"CLIENTUA":return this.options.clientUA?this.options.clientUA:"unknown unknown";case"DEVICEIP":return-1;case"PLAYERCAPABILITIES":var t=[];return this.options.skippable&&this.options.skippable.enabled&&t.push("skip"),this.options.showMute&&t.push("mute"),"auto"===this.options.initialPlayback&&("on"===this.options.initialAudio?t.push("autoplay"):t.push("mautoplay")),this.options.allowFullscreen&&t.push("fullscreen"),t.push("icon"),t.join();case"CLICKTYPE":return this.options.clickUrls&&this.options.clickUrls[0]?1:this.options.learnMore.enabled?2:0;case"PLAYERSTATE":var n=[];return this.isSkipped&&n.push("skipped"),this.isMuted&&n.push("muted"),"auto"===this.options.initialPlayback&&("on"===this.options.initialAudio?n.push("autoplayed"):n.push("mautoplayed")),this.adVideoPlayer.isFullscreen&&"function"==typeof this.adVideoPlayer.isFullscreen&&this.adVideoPlayer.isFullscreen()&&n.push("fullscreen"),n.join();case"PLAYERSIZE":return this.options.width+","+this.options.height;case"ADPLAYHEAD":if(this.adVideoPlayer.currentTime&&"function"==typeof this.adVideoPlayer.currentTime){var i=this.adVideoPlayer.currentTime();return l.convertTimeSecondsToString(i)}return-1;case"ASSETURI":return this.options.video.url;case"PODSEQUENCE":return-1;case"LIMITADTRACKING":return 0;default:return-1}},prepareOmidEventData:function(e){var t={error:"sessionError",impression:"impression",video_impression:"impression",video_start:"start","video-first-quartile":"firstQuartile","video-mid":"midpoint","video-third-quartile":"thirdQuartile",video_complete:"complete",video_pause:"pause",video_resume:"resume","user-close":"skipped",video_skip:"skipped",video_skipped:"skipped","audio-mute":"volumeChange","audio-unmute":"volumeChange",video_mute:"volumeChange",video_unmute:"volumeChange",fullscreenchange:"playerStateChange",video_fullscreen:"playerStateChange","video-exit-fullscreen":"playerStateChange","ad-expand":"playerStateChange","ad-collapse":"playerStateChange","ad-click":"adUserInteraction","user-accept-invitation":"adUserInteraction"},n=t.hasOwnProperty(e.name)?t[e.name]:"",i={name:n},o=null;switch(n){case"sessionError":o={},o.errorType=e.code,o.message=e.message;break;case"start":o={},this.options.data.durationMsec?o.duration=this.options.data.durationMsec/1e3:this.adVideoPlayer&&this.adVideoPlayer.player&&"function"==typeof this.adVideoPlayer.player?o.duration=this.adVideoPlayer.player().duration()/1e3:o.duration=-2,this.adVideoPlayer&&this.adVideoPlayer.player&&"function"==typeof this.adVideoPlayer.player?o.videoPlayerVolume=this.adVideoPlayer.player().volume():o.videoPlayerVolume=-1;break;case"volumeChange":o={},"audio-mute"===e.name||"video_mute"===e.name?o.videoPlayerVolume=0:this.adVideoPlayer&&this.adVideoPlayer.player&&"function"==typeof this.adVideoPlayer.player?o.videoPlayerVolume=this.adVideoPlayer.player().volume():o.videoPlayerVolume=-1;break;case"playerStateChange":o={},"video-fullscreen"===e.name||"fullscreenchange"===e.name&&"enter"===e.fullscreenStatus?o.state=this.adVideoPlayer.isFullscreen?"fullscreen":"normal":"video-exit-fullscreen"===e.name||"fullscreenchange"===e.name&&"exit"===e.fullscreenStatus?o.state="normal":"ad-collapse"===e.name?o.state="collapsed":o.state="normal";break;case"adUserInteraction":o={},"ad-click"===e.name?o.interactionType="click":o.interactionType="invitationAccept"}return o&&(i.data=o),i},resizeVideo:function(e,t,n){s.resizeVideo(e,t,this,n)},resizeVideoForSideStream:function(e,t,n){s.resizeVideoForSideStream(this,e,t,n)},isIosInlineRequired:function(){return this.autoplayHandler.isIosInlineRequired(this.options.enableInlineVideoForIos)},resizePlayer:function(e,t){s.resizePlayer(e,t,this)},getFinalSize:function(){return s.getFinalSize(this)},setVastAttribute:function(e){var t,n=this.options;t=e?e:this.adVideoPlayer&&this.adVideoPlayer.player?this.adVideoPlayer.player().duration():0,n.data.durationMsec=null!==t?Math.round(1e3*t):0;var i=this.Utils.getMsecTime(n.data.skipOffset,n.data.durationMsec);n.data.skipOffset&&i>=0?(n.data.isVastVideoSkippable=!0,n.data.skipOffsetMsec=i):n.data.skipOffsetMsec=null;var o=n.data.vastProgressEvent;if(o&&"object"==typeof o)for(var r in o){var a=this.Utils.getMsecTime(r.replace(/progress_/g,""),n.data.durationMsec);o[r]=a}},disableTrackingUserActivity:function(e){this.blockTrackingUserActivity=e,this.adVideoPlayer&&this.adVideoPlayer.bigPlayButton&&(this.adVideoPlayer.bigPlayButton.el_.style.opacity=e===!0?0:1)},delayEventsTracking:function(e,t){this.callbackForAdUnit.cbDelayEventsTracking&&this.callbackForAdUnit.cbDelayEventsTracking(e,t)},notifyOverlayPlayerVideoPaused:function(){this.options.tmpActiveListener&&this.options.cbApnVastPlayer&&this.options.cbApnVastPlayer("apn-video-paused-by-device")},checkWhenVideoPausedByDevice:function(e){if(this.options.overlayPlayer&&this.options.cbApnVastPlayer&&this.iframeVideoWrapper&&this.iframeVideoWrapper.contentDocument){var t=null;if("string"==typeof this.videoObjectId)t=this.iframeVideoWrapper.contentDocument.getElementById(this.videoObjectId);else{var n=this.iframeVideoWrapper.contentDocument.getElementsByTagName("VIDEO");if(n&&n.length>0)for(var i=0;i0){t=n[i];break}}if(t)return e?(this.options.tmpActiveListener=!0,t.addEventListener("pause",this.notifyOverlayPlayerVideoPaused.bind(this))):(delete this.options.tmpActiveListener,t.removeEventListener("pause",this.notifyOverlayPlayerVideoPaused.bind(this))),!0}return!0},forceStartViewability:function(){this.findPathForViewability({name:"force_start_viewability"})},log:A,debug:A,test:function(e,t){var n=this.options;if(n&&n.test&&n.test[e]&&"function"==typeof n.test[e]){var i=function(e){console.debug("%c"+e,"background: red; color: white")},o=function(e){console.debug("%c"+e,"background: green; color: white")};try{var r=function(t,n){t?(n=n+" Succeeded"||"Succeeded",o("Unit Test ["+e+"] : "+n)):(n=n+" failed"||"Assertion failed",i("Unit Test ["+e+"] : "+n))},a=function(t){console.debug("%cUnit Test Log : ["+e+"] : "+t,"background: gray; color: white")};n.test[e](t,r,a)}catch(s){i("unit test failed due to : "+s)}}},setFinalAspectRatio:function(e){this.finalAspectRatio=e},getFinalAspectRatio:function(){return this.finalAspectRatio}};e.exports=j,window[v]=j},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;(function(module){function _handleMultipleEvents(e,t,n,i){vjs.arr.forEach(n,function(n){e(t,n,i)})}function _logType(e,t){return}document.createElement("video"),document.createElement("audio"),document.createElement("track");var global_options,vjs=function(e,t,n){global_options=t;var i;if("string"==typeof e){if(0===e.indexOf("#")&&(e=e.slice(1)),vjs.players[e])return t&&vjs.log.warn('Player "'+e+'" is already initialised. Options will not be applied.'),n&&vjs.players[e].ready(n),vjs.players[e];i=vjs.el(e)}else i=e;if(!i||!i.nodeName)throw new TypeError("The element or ID supplied is not valid. (videojs)");return i.player||new vjs.Player(i,t,n)},videojs=window.videojs_apn=vjs;vjs.CDN_VERSION="GENERATED_CDN_VSN",vjs.ACCESS_PROTOCOL="https:"==document.location.protocol?"https://":"http://",vjs.VERSION="GENERATED_FULL_VSN",vjs.options={techOrder:["html5","flash"],html5:{},flash:{},width:300,height:150,defaultVolume:0,playbackRates:[],inactivityTimeout:500,children:{mediaLoader:{},posterImage:{},loadingSpinner:{},textTrackDisplay:{},bigPlayButton:{},controlBar:{},errorDisplay:{},textTrackSettings:{}},language:document.getElementsByTagName("html")[0].getAttribute("lang")||navigator.languages&&navigator.languages[0]||navigator.userLanguage||navigator.language||"en",languages:{},notSupportedMessage:"No compatible source was found for this video."},"GENERATED_CDN_VSN"!==vjs.CDN_VERSION&&(videojs.options.flash.swf=vjs.ACCESS_PROTOCOL+"vjs.zencdn.net/"+vjs.CDN_VERSION+"/video-js.swf"),vjs.addLanguage=function(e,t){return void 0!==vjs.options.languages[e]?vjs.options.languages[e]=vjs.util.mergeOptions(vjs.options.languages[e],t):vjs.options.languages[e]=t,vjs.options.languages},vjs.players={},__webpack_require__(5).amd?(__WEBPACK_AMD_DEFINE_ARRAY__=[],__WEBPACK_AMD_DEFINE_RESULT__=function(){return videojs}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))):module.exports=videojs,vjs.CoreObject=vjs.CoreObject=function(){},vjs.CoreObject.extend=function(e){var t,n;e=e||{},t=e.init||e.init||this.prototype.init||this.prototype.init||function(){},n=function(){t.apply(this,arguments)},n.prototype=vjs.obj.create(this.prototype),n.prototype.constructor=n,n.extend=vjs.CoreObject.extend,n.create=vjs.CoreObject.create;for(var i in e)e.hasOwnProperty(i)&&(n.prototype[i]=e[i]);return n},vjs.CoreObject.create=function(){var e=vjs.obj.create(this.prototype);return this.apply(e,arguments),e},vjs.on=function(e,t,n){if(vjs.obj.isArray(t))return _handleMultipleEvents(vjs.on,e,t,n);var i=vjs.getData(e);i.handlers||(i.handlers={}),i.handlers[t]||(i.handlers[t]=[]),n.guid||(n.guid=vjs.guid++),i.handlers[t].push(n),i.dispatcher||(i.disabled=!1,i.dispatcher=function(t){if(!i.disabled){t=vjs.fixEvent(t);var n=i.handlers[t.type];if(n)for(var o=n.slice(0),r=0,a=o.length;r=0;i--)n[i]===t&&n.splice(i,1);e.className=n.join(" ")}},vjs.TEST_VID=vjs.createEl("video"),function(){var e=document.createElement("track");e.kind="captions",e.srclang="en",e.label="English",vjs.TEST_VID.appendChild(e)}(),vjs.USER_AGENT=navigator.userAgent,vjs.IS_IPHONE=/iPhone/i.test(vjs.USER_AGENT),vjs.IS_IPAD=/iPad/i.test(vjs.USER_AGENT),vjs.IS_IPOD=/iPod/i.test(vjs.USER_AGENT),vjs.IS_IOS=vjs.IS_IPHONE||vjs.IS_IPAD||vjs.IS_IPOD,vjs.IOS_VERSION=function(){var e=vjs.USER_AGENT.match(/OS (\d+)_/i);if(e&&e[1])return e[1]}(),vjs.IS_ANDROID=/Android/i.test(vjs.USER_AGENT),vjs.ANDROID_VERSION=function(){var e,t,n=vjs.USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);return n?(e=n[1]&&parseFloat(n[1]),t=n[2]&&parseFloat(n[2]),e&&t?parseFloat(n[1]+"."+n[2]):e?e:null):null}(),vjs.IS_OLD_ANDROID=vjs.IS_ANDROID&&/webkit/i.test(vjs.USER_AGENT)&&vjs.ANDROID_VERSION<2.3,vjs.IS_FIREFOX=/Firefox/i.test(vjs.USER_AGENT),vjs.IS_CHROME=/Chrome/i.test(vjs.USER_AGENT),vjs.IS_IE8=/MSIE\s8\.0/.test(vjs.USER_AGENT),vjs.TOUCH_ENABLED=!!("ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),vjs.BACKGROUND_SIZE_SUPPORTED="backgroundSize"in vjs.TEST_VID.style,vjs.setElementAttributes=function(e,t){vjs.obj.each(t,function(t,n){null===n||"undefined"==typeof n||n===!1?e.removeAttribute(t):e.setAttribute(t,n===!0?"":n)})},vjs.getElementAttributes=function(e){var t,n,i,o,r;if(t={},n=",autoplay,controls,loop,muted,default,",e&&e.attributes&&e.attributes.length>0){i=e.attributes;for(var a=i.length-1;a>=0;a--)o=i[a].name,r=i[a].value,"boolean"!=typeof e[o]&&n.indexOf(","+o+",")===-1||(r=null!==r),t[o]=r}return t},vjs.getComputedDimension=function(e,t){var n="";return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,"").getPropertyValue(t):e.currentStyle&&(n=e["client"+t.substr(0,1).toUpperCase()+t.substr(1)]+"px"),n},vjs.insertFirst=function(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},vjs.browser={},vjs.el=function(e){return 0===e.indexOf("#")&&(e=e.slice(1)),document.getElementById(e)},vjs.formatTime=function(e,t){t=t||e;var n=Math.floor(e%60),i=Math.floor(e/60%60),o=Math.floor(e/3600),r=Math.floor(t/60%60),a=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(o=i=n="-"),o=o>0||a>0?o+":":"",i=((o||r>=10)&&i<10?"0"+i:i)+":",n=n<10?"0"+n:n,o+i+n},vjs.blockTextSelection=function(){document.body.focus(),document.onselectstart=function(){return!1}},vjs.unblockTextSelection=function(){document.onselectstart=function(){return!0}},vjs.trim=function(e){return(e+"").replace(/^\s+|\s+$/g,"")},vjs.round=function(e,t){return t||(t=0),Math.round(e*Math.pow(10,t))/Math.pow(10,t)},vjs.createTimeRange=function(e,t){return void 0===e&&void 0===t?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:1,start:function(){return e},end:function(){return t}}},vjs.setLocalStorage=function(e,t){try{var n=window.localStorage||!1;if(!n)return;n[e]=t}catch(i){22==i.code||1014==i.code?vjs.log("LocalStorage Full (VideoJS)",i):18==i.code?vjs.log("LocalStorage not allowed (VideoJS)",i):vjs.log("LocalStorage Error (VideoJS)",i)}},vjs.getAbsoluteURL=function(e){return e.match(/^https?:\/\//)||(e=vjs.createEl("div",{innerHTML:'x'}).firstChild.href),e},vjs.parseUrl=function(e){var t,n,i,o,r;o=["protocol","hostname","port","pathname","search","hash","host"],n=vjs.createEl("a",{href:e}),i=""===n.host&&"file:"!==n.protocol,i&&(t=vjs.createEl("div"),t.innerHTML='',n=t.firstChild,t.setAttribute("style","display:none; position:absolute;"),document.body.appendChild(t)),r={};for(var a=0;a=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.off(),this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),vjs.removeData(this.el_),this.el_=null},vjs.Component.prototype.player_=!0,vjs.Component.prototype.player=function(){return this.player_},vjs.Component.prototype.options_,vjs.Component.prototype.options=function(e){return void 0===e?this.options_:this.options_=vjs.util.mergeOptions(this.options_,e)},vjs.Component.prototype.el_,vjs.Component.prototype.createEl=function(e,t){return vjs.createEl(e,t)},vjs.Component.prototype.localize=function(e){var t=this.player_.language(),n=this.player_.languages();return n&&n[t]&&n[t][e]?n[t][e]:e},vjs.Component.prototype.el=function(){return this.el_},vjs.Component.prototype.contentEl_,vjs.Component.prototype.contentEl=function(){return this.contentEl_||this.el_},vjs.Component.prototype.id_,vjs.Component.prototype.id=function(){return this.id_},vjs.Component.prototype.name_,vjs.Component.prototype.name=function(){return this.name_},vjs.Component.prototype.children_,vjs.Component.prototype.children=function(){return this.children_},vjs.Component.prototype.childIndex_,vjs.Component.prototype.getChildById=function(e){return this.childIndex_[e]},vjs.Component.prototype.childNameIndex_,vjs.Component.prototype.getChild=function(e){return this.childNameIndex_[e]},vjs.Component.prototype.addChild=function(e,t){var n,i,o;return"string"==typeof e?(o=e,t=t||{},i=t.componentClass||vjs.capitalize(o),t.name=o,n=new window.videojs_apn[i](this.player_||this,t)):n=e,this.children_.push(n),"function"==typeof n.id&&(this.childIndex_[n.id()]=n),o=o||n.name&&n.name(),o&&(this.childNameIndex_[o]=n),"function"==typeof n.el&&n.el()&&this.contentEl().appendChild(n.el()),n},vjs.Component.prototype.removeChild=function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,n=this.children_.length-1;n>=0;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,1);break}if(t){this.childIndex_[e.id()]=null,this.childNameIndex_[e.name()]=null;var i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},vjs.Component.prototype.initChildren=function(){var e,t,n,i,o,r,a;if(e=this,t=e.options(),n=t.children)if(a=function(n,i){void 0!==t[n]&&(i=t[n]),i!==!1&&(e[n]=e.addChild(n,i))},vjs.obj.isArray(n))for(var s=0;s0){for(var t=0,n=e.length;t1?i=!1:t&&(r=e.touches[0].pageX-t.pageX,a=e.touches[0].pageY-t.pageY,s=Math.sqrt(r*r+a*a),s>l&&(i=!1))}),o=function(){i=!1},this.on("touchleave",o),this.on("touchcancel",o),this.on("touchend",function(o){t=null,i===!0&&(n=(new Date).getTime()-e,n0){var r=Number(i.substring(0,i.length-2));t-=2*r,n-=2*r}T.style.width=t+"px",T.style.height=n+"px";var a=u(k);e("repositionPlayer: targetDiv absolute posiotion ="+a.left+", "+a.top),T.style.left=a.left+"px",T.style.top=a.top+"px",e("repositionPlayer: size = "+t+", "+n),S.overlayPlayer?N.resizePlayer(t,n):N.resizeVideo(null,!1,null)}}function a(t){e("Resize event happend"),T&&N&&(O?(O=!1,S.fitInContainer&&(T.style.zIndex=R),setTimeout(function(){r(),"click"!==S.initialPlayback&&N.play()},100)):r()),J&&J(t)}function c(t){switch(e("Got notification: "+t),t){case"leaveFullscreen":q();break;default:e("Unknown player notification: "+t)}}function u(e){for(var t=0,n=0;e&&"BODY"!==e.tagName&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);){var i=document.defaultView.getComputedStyle(e,null).position;if(i&&""!==i&&"static"!==i)break;t+=e.offsetLeft-e.scrollLeft+e.clientLeft,n+=e.offsetTop-e.scrollTop+e.clientTop,e=e.offsetParent}return{left:t,top:n}}function p(){var t,n=function(){try{var e=navigator.platform,t=navigator.userAgent,n=navigator.appVersion;if(/iP(hone|od|ad)/.test(e)&&!/CriOS/.test(t)){var i=n.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(i[1],10),parseInt(i[2],10),parseInt(i[3]||0,10)]}return[0,0,0]}catch(o){return[0,0,0]}};try{t=n()[0]>=8&&S.enableInlineVideoForIos===!0}catch(i){e(i)}return t}function h(e){var t=document.defaultView.getComputedStyle(e,null).zIndex;return"auto"!==t?t:0}function m(e,t){if(!e.children)return t;for(var n=Math.max(t,h(e)),i=0;i-1||navigator.appVersion.indexOf("Android")>-1}function y(){return navigator.userAgent.indexOf("Chrome")>-1}function A(){var e=navigator.appVersion.indexOf("Chrome/");if(e>=0){var t=navigator.appVersion.substr(e+7);return e=t.indexOf("."),e>0?Number(t.substr(0,e)):0}return 0}function b(n,i,r){e("play function called"),j=!1,P=3e3,S.vpaidTimeout&&(P=S.vpaidTimeout),x=null,V=!1,_=!1,r&&(V=r),i&&(x=function(e,t){t=t?t:{};var n={event:e,params:t};i(n)}),v()&&(S.showFullScreenButton===!0?S.allowFullscreen=!0:S.allowFullscreen=!1),f()&&(S.enableInlineVideoForIos=!1),e("options before PlayerDefaultOption: ",JSON.stringify(S)),S=s(S),e("options after PlayerDefaultOption: ",JSON.stringify(S)),S.width=n.offsetWidth,S.height=n.offsetHeight;var a=n.style.borderWidth;if(a&&a.length>0){var l=Number(a.substring(0,a.length-2));S.width-=2*l,S.height-=2*l}S.playerHeight=S.height,p()&&(S.playerHeight-=30),o()&&(S.fullscreenMode=!0),e("offsetWidth="+n.offsetWidth+", offsetHeight="+n.offsetHeight+", borderWidth="+n.style.borderWidth);var h=document.createElement("div");h.style.width=S.width+"px",S.fitInContainer?h.style.height=S.height+"px":S.cachePlayer&&S.overlayPlayer?h.style.height="1px":h.style.height=S.height+"px",h.style.backgroundColor="black",h.id=n.id+"_overlay_"+(new Date).getTime();var b=u(n);e("targetDiv absolute posiotion ="+b.left+", "+b.top),h.style.position="absolute",h.style.left=b.left+"px",h.style.top=b.top+"px",S.fitInContainer?h.style.zIndex=Math.max(100,m(n,0)+1):(R=Math.max(100,m(n,0)+1),S.cachePlayer&&S.overlayPlayer?h.style.zIndex=0:h.style.zIndex=R),n.appendChild(h),e("player container offsetLeft = "+h.offsetLeft+", offsetTop = "+h.offsetTop),T=h,k=n,w=(new Date).getTime(),e("timeToReady = "+P+", start time = "+w),C=setTimeout(function(){j||(z(!1),x&&x("Timed-out",{}))},P);var E=function(n,i){e("VastPlayer > cbRenderVideo called");try{e("VastPlayer > cbRenderVideo options: ",JSON.stringify(i))}catch(o){}t(i)};I.cbRenderVideo=E,I.cbWhenDestroy=z,I.cbWhenReady=G,I.cbWhenQuartile=U,I.cbWhenVideoComplete=B,I.cbWhenSkipped=$,I.cbWhenFullScreen=W,I.cbWhenAudio=F,I.cbWhenClickOpenUrl=H,I.cbCoreVideoEvent=L,S.playerNotification=c,S.overlayPlayer&&(S.hasOwnProperty("allowFullscreen")||(S.allowFullscreen=!1)),e("VP >> before options.initialAudio = "+S.initialAudio),"auto"===S.initialPlayback&&"on"===S.initialAudio&&g()&&y()&&A()>=53&&(S.showMute=!0,S.showVolume=!0),e("VP >> after options.initialAudio = "+S.initialAudio),d(T,S,I)}e("VERSION 1.4.15");var T,k,E,w,S={},I={},C=null,j=!1,P=3e3,x=null,V=!1,_=!1,D=null,M=!1,N=null,O=!1,R=0,U=function(t){e("VastPlayer > cbWhenQuartile "+t),x(t,{})},L=function(e,t){var n={type:e,name:t};if("AdHandler"===n.type&&"video_impression"===n.name)try{var i=new CustomEvent("outstream-impression");T.dispatchEvent(i)}catch(o){error(o)}for(var r=[{type:"AdHandler",name:"video_start",mappedEventName:"videoStart"},{type:"AdHandler",name:"rewind",mappedEventName:"videoRewind"},{type:"AdHandler",name:"video_fullscreen_enter",mappedEventName:"video-fullscreen-enter"},{type:"AdHandler",name:"video_fullscreen_exit",mappedEventName:"video-fullscreen-exit"}],a=0;a cbWhenVideoComplete "+t),x(t,{})},$=function(t){e("VastPlayer > cbWhenSkipped "+t),x(t,{})},F=function(t){e("VastPlayer > cbWhenAudio "+t),x(t,{})},H=function(e){x(e,{})},W=function(t){e("VastPlayer > cbWhenFullScreen "+t),x(t,{})},z=function(t,n,i){e("VastPlayer > cbTerminate isError: "+t);var r="unknown";T&&(r=T.id.toString()),e("VastPlayer > cbTerminate: bTerminated = "+_+", targetElement id = "+r),M=!1,_||(_=!0,n||q(),!i&&o()&&S.overlayPlayer&&q(),T&&(N&&(N.isPlayingVideo&&(e("VastPlayer > cbTerminate: pause ad"),N.pause()),T.style.height="1px",N.resizePlayer(1,1)),setTimeout(function(){T&&(T.innerHTML="",k.removeChild(T)),T=null},2e3)),x&&t&&x("video-error",{}))},q=function(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen()},G=function(t){var n,i,r,a,s;n=t&&t.options&&t.options.video&&t.options.video.url?t.options.video.url:"",i=t&&t.options&&t.options.data&&t.options.data.vastDurationMsec?t.options.data.vastDurationMsec:0,r=t&&t.options&&t.options.finalVastXml?t.options.finalVastXml:"",a=t&&t.options&&t.options.finalVastUri?t.options.finalVastUri:"",s=t&&t.getFinalAspectRatio()?t.getFinalAspectRatio():"",_||(j=!0,N=t,e("VastPlayer > cbWhenReady in "+((new Date).getTime()-w)+" msecs"),x&&x("adReady",{creativeUrl:n,duration:i,vastXML:r,vastCreativeUrl:a,aspectRatio:s}),"click"===S.initialPlayback||S.cachePlayer||(o()&&S.overlayPlayer?S.forceAdInFullscreen?(O=!0,q()):(T&&(T.style.width="1px",T.style.height="1px"),z(!1,!0,!0)):N.play()))},J=null;document.body.onresize&&(J=document.body.onresize),window.onresize=a,this.playVast=function(t,n,o,r,a){e("VP >> playVast function called playerId = "+this.vastPlayerId),z(!1,!0),i(),S=n,S.vastXml=o,b(t,r,a)},this.playAdObject=function(t,n,o,r,a){e("VP >> playAdObject function called playerId = "+this.vastPlayerId+", cache mode = "+n.cachePlayer),z(!1,!0),i(),S=n,"string"==typeof o?S.vastXml=o:(S.useAdObj=!0,S.adObj=o),b(t,r,a)},this.stop=function(){C&&(clearTimeout(C),C=null),z(!1)},this.removeFromPage=function(){C&&(clearTimeout(C),C=null),_=!0,T&&(T.innerHTML="",k.removeChild(T),T=null)},this.play=function(){e("VP >> play function called playerId = "+this.vastPlayerId),N&&(S.cachePlayer=!1,o()&&S.overlayPlayer?S.forceAdInFullscreen?(O=!0,q()):z(!1,!0,!0):(T&&S.fitInContainer===!1&&(T.style.zIndex=R),r(),"click"!==S.initialPlayback&&N.play()))},this.sendPlay=function(){e("VP >> sendPlay function called playerID = "+this.vastPlayerId),N&&!N.isPlayingVideo&&N.play()},this.sendPause=function(){e("VP >> sendPause function called playerID = "+this.vastPlayerId),N&&N.isPlayingVideo&&N.pause()},this.handleFullscreen=function(e){N&&(e?k.requestFullscreen?k.requestFullscreen():k.webkitRequestFullscreen?k.webkitRequestFullscreen():k.mozRequestFullScreen?k.mozRequestFullScreen():k.msRequestFullscreen&&k.msRequestFullscreen():document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen())},this.vastPlayerId=(new Date).getTime(),this.isTerminated=function(){return _},this.getIsVideoPlaying=function(){var e=!(!N||!N.isPlayingVideo);return e},this.getCurrentPlayHeadTime=function(){var e=0;return E&&E.adVideoPlayer&&"function"==typeof E.adVideoPlayer.player&&(e=1e3*E.adVideoPlayer.player().currentTime(),e=parseInt&&"function"==typeof parseInt?parseInt(e):e),e}};e.exports={playAdObject:function(e,t,n,i,o){var a=r(t.targetElementId,t.cachePlayer);a&&a.playAdObject(e,t,n,i,o)},playVast:function(e,t,n,i,o){var a=r(t.targetElementId);a&&a.playVast(e,t,n,i,o)},loadAndPlayVast:function(e,t,i,o,a){var s=n(29);s.load(i,function(s,l){if(s||0===l.length){var d=n(28);d.logDebug("Failed to load "+i,"Vast Video Player")}else{var c=r(t.targetElementId);c&&c.playVast(e,t,l,o,a)}})},stop:function(e,t){var n=o(e.id,t);n&&n.stop()},removeFromPage:function(e){var t=o(e);t&&t.removeFromPage()},play:function(e,t){var n=i(e,t);n&&n.play()},sendPlay:function(e){var t=o(e);t&&t.sendPlay()},sendPause:function(e){var t=o(e);t&&t.sendPause()},handleFullscreen:function(e,t){var n=o(e);n&&n.handleFullscreen(t)},getCurrentPlayHeadTime:function(e){var t=o(e);if(t)return t.getCurrentPlayHeadTime()},getIsVideoPlaying:function(e){var t=o(e);if(t)return t.getIsVideoPlaying()}}},function(e,t){var n=function(e){function t(e){return"object"==typeof e}function n(e){return null===e}function i(e){var o,r,a;for(r=1;r-1},k=["AdPaused","AdVolumeChange"],E=["AdLoaded","AdStopped","AdSkippableStateChange","AdLinearChange","AdDurationChange","AdRemainingTimeChange","AdLog","AdError"],w=1,S=402,I=900,C=405,j={initialPlayback:"auto",initialAudio:"off",skippable:{enabled:!0,allowOverride:!1,videoThreshold:15,videoOffset:5,skipLocation:"top-left",skipText:"Video can be skipped in %%TIME%% seconds",skipButtonText:"SKIP"},adText:"Ad",showMute:!0,showVolume:!0,showProgressBar:!0,showPlayToggle:!0,showBigPlayButton:!0,allowFullscreen:!0,playerSkin:{customPlayerSkin:"",controlBarHeight:30,topDividerColor:"#606060",bottomDividerColor:"#606060",topDividerWidth:1,bottomDividerWidth:1,videoBackgroundColor:"#000000"},disableCollapse:{enabled:!1,replay:!1},endCard:{enabled:!1,clickable:!0,color:"",imageUrl:"",imageWidth:"",imageHeight:"",showCompanion:!0},enableInlineVideoForIos:!0,delayExpandUntilVPAIDInit:!1,delayExpandUntilVPAIDImpression:!1,flash:{swf:"http://acdn.adnxs.com/video/player/vastPlayer/AppnexusFlashPlayer.swf"},vpaidTimeout:5e3,waterfallTimeout:3e4,waterfallSteps:-1,fixedSizePlayer:!0,disableTopBar:!1,sideStream:{enabled:!1,position:"bottom-right",xOffset:0,yOffset:0,space:"empty",dynamicBigPlayButtonOnSideStream:!0},sideStreamObject:{},preloadInlineAudioForIos:!1,controlBarPosition:"over",customPlayerSkinCss:"",customButton:{enabled:!1,url:"",altText:"",imageSrc:"",imgWidth:50,imgHeight:30},enableNativeInline:!1,androidDSOverride:!1,cbNotification:function(){},parentIframeIsModal:!1,learnMore:{enabled:!1,clickToPause:!0,text:"Learn More",separator:"-"},playerContextId:"anadvideoplayer",data:{skipOffset:"",durationMsec:null,skipOffsetMsec:null,isVastVideoSkippable:!1,vastProgressEvent:{},vastDurationMsec:null,adIcons:null},test:function(){}},P={externalNameOfVideoPlayer:f,videoPlayerObj:i,autoplayHandler:h,mobileSupport:h,customSkinning:u,options:{},adVideoPlayer:{},callbackForAdUnit:{},vpaidData:{},iframeVideoWrapper:{},isPlayingVideo:!1,isDoneInitialPlay:!1,isFullscreen:!1,heightOffset:0,explicitPaused:!1,aspectRatio:0,finalAspectRatio:0,videoObjectId:{},isViewable:!1,isSkipped:!1,isCompleted:!1,isMuted:!1,isExplicitMuted:!1,hasBeenUnmuted:!1,isChrome:navigator.userAgent.indexOf("Chrome")>-1,videojs_vpaid:r,overlayPlayer:!1,forceToSkip:!1,ExtendDefaultOption:a,delayEventHandler:null,pausedByViewability:!1,mutedByVisibility:!1,gotAdImpressionForFlash:!1,gotAdStartedForFlash:!1,isReadyToExpandForMobile:!1,isAlreadyPlaingForVPAID:!1,isSideStreamActivated:!1,isExpanded:!0,isVideoCompleteInjected:!1,isFullscreenToggled:!1,toggleWindowFocus:!0,viewabilityTracking:null,isDoneFirstLoadStart:!1,flashBlockerTimeout:null,startedReplay:!1,Utils:l,isAlreadyStart:!1,isEnded:!1,blockTrackingUserActivity:!1,videoId:"",divIdForVideo:"",init:function(e){var t=a(j,e);return this.options=t,"boolean"==typeof this.options.disableCollapse&&(this.options.disableCollapse={enabled:this.options.disableCollapse,replay:!1}),this.options.skippable.allowOverride===!0&&(this.options.skippable.videoThreshold=0,this.options.skippable.enabled=!0),this.delayEventHandler=new d,this.delayEventHandler.suppress(this.options.delayExpandUntilVPAIDImpression),this.delayEventHandler.start(),this.viewabilityTracking=new p,t},getValueFromPlayer:function(e){var t=0;try{"controlBar.height"===e&&this.adVideoPlayer&&this.adVideoPlayer.controlBar&&this.adVideoPlayer.controlBar.height&&"function"==typeof this.adVideoPlayer.controlBar.height&&"html5"===this.decidePlayer(this.options.requiredPlayer)&&(t=this.adVideoPlayer.controlBar.height())}catch(n){b(n)}return t},decidePlayer:function(e){var t="",n="flash",i="html5",o=function(){var e=navigator.appVersion.indexOf("Mobile"),t=navigator.appVersion.indexOf("Android");return e>-1||t>-1},r=this.options.playerTechnology;if(r&&r.length&&1===r.length)switch(e){case 1:t=i;break;case 2:t=n;break;case 0:t=r[0]===i?i:n}if(r&&r.length&&2===r.length)switch(e){case 1:t=i;break;case 2:t=n;break;case 0:t=i}return o()&&(t=i),t},buildPlayer:function(e,t){var n=this;if(t.waterfallStepId&&A("CHECKING AUTOPLAY FOR WATERFALL STEP: "+t.waterfallStepId),"html5"===this.decidePlayer(t.requiredPlayer)&&this.autoplayHandler&&!t.overlayPlayer){var i,o=function(i){var o=n.autoplayHandler.videoPolicy;switch(i){case o.allowAutoplay:break;case o.stopMediaWithSound:"on"===t.initialAudio?("auto"!==t.initialPlayback&&"mouseover"!==t.initialPlayback||(t.initialAudio="off",t.audioOnMouseover=!1),t.isWaterfall===!0&&(t.adAttempt>0?(t.initialAudio="off",t.audioOnMouseover=!1):t.audioOnMouseover=!0)):"auto"!==t.initialPlayback&&"mouseover"!==t.initialPlayback||(t.audioOnMouseover=!1);break;case o.neverAutoplay:t.initialPlayback="click",t.isWaterfall&&(t.isWaterfall=!1,t.stopWaterfall=!0)}t.waterfallStepId&&A("BUILDING PLAYER FOR WATERFALL STEP: "+t.waterfallStepId),n.buildPlayerCallback(e,t)};i=!h.isMobile()&&("on"===t.initialAudio||t.audioOnMouseover===!0),n.autoplayHandler.getAutoplayPolicy(o,i)}else n.buildPlayerCallback(e,t)},buildPlayerCallback:function(e,t){this.callbackForAdUnit=e,t.hasOwnProperty("overlayPlayer")&&(this.overlayPlayer=t.overlayPlayer,t.hasOwnProperty("fullscreenMode")&&(t.allowFullscreen=!1)),T()&&"flash"===this.decidePlayer(this.options.requiredPlayer)||this.options.targetElement&&!this.options.firstAdAttempted&&(this.options.targetElement.style.visibility="hidden"),"flash"===this.decidePlayer(this.options.requiredPlayer)&&(this.options.disableCollapse.replay=!1);var n=(new Date).getTime()+Math.floor(1e4*Math.random()),i="APNVideo_Player_"+n;this.externalNameOfVideoPlayer=i,o(e,t,this)},getPlayerStatus:function(){},notifyPlayer:function(e,t){this.adVideoPlayer.handleAdUnitNotification({name:e,value:t})},load:function(){if("html5"===this.decidePlayer(this.options.requiredPlayer)){A("load video");try{this.adVideoPlayer&&void 0!==this.adVideoPlayer&&this.adVideoPlayer.load&&"function"==typeof this.adVideoPlayer.load&&(this.options.delayExpandUntilVPAIDImpression&&this.adVideoPlayer.player()&&this.adVideoPlayer.player().autoplay()&&this.adVideoPlayer.player().autoplay(!1),this.adVideoPlayer.load())}catch(e){b(e)}}},replay:function(){this.isEnded&&(this.dispatchEventToAdunit({name:"rewind"}),this.startedReplay=!0,this.isEnded=!1,this.explicitPlay(),this.adVideoPlayer.controlBar.playToggle&&this.adVideoPlayer.controlBar.playToggle.el()&&this.adVideoPlayer.controlBar.playToggle.el().style&&(this.adVideoPlayer.controlBar.playToggle.el().style["pointer-events"]=""),this.options.sideStream&&this.options.sideStream.wasEnabled===!0&&(this.options.sideStream.enabled=!0,delete this.options.sideStream.wasEnabled),this.options.endCard&&this.options.endCard.enabled&&(this.actualPlayByVideoJS(),l.isIos()||this.adVideoPlayer.bigPlayButton.show()))},actualPlayByVideoJS:function(){this.adVideoPlayer.play(),this.options.vpaid&&this.adVideoPlayer.trigger("handleManualUserInActive")},play:function(){if(this.isEnded!==!0){var e=h.isMobile()&&h.iOSversion()[0]>=10&&this.options.enableInlineVideoForIos===!1;if(e){var t=this;t.overlayPlayer?t.options.targetElement.style.overflow="":setTimeout(function(){t.options.targetElement.style.overflow=""},t.options.expandTime)}this.isAlreadyPlaingForVPAID=!0,this.isCompleted||(A("play video"),this.isDoneInitialPlay?"html5"===this.decidePlayer(this.options.requiredPlayer)?this.isPlayingVideo||this.dispatchEventToAdunit({name:"video_resume"}):this.isPlayingVideo||this.dispatchEventToAdunit({name:"video_resume"}):this.options.vpaid||(this.dispatchEventToAdunit({name:"video_start"}),this.dispatchEventToAdunit({name:"video_impression"})),this.options.vpaid&&this.isIosInlineRequired()?this.isDoneInitialPlay?this.actualPlayByVideoJS():this.adVideoPlayer.trigger("play"):this.options.vpaid&&this.options.overlayPlayer&&h.isIOS()&&h.iOSversion()[0]<10&&!this.isDoneInitialPlay?this.adVideoPlayer.trigger("play"):this.options.vpaid&&this.options.overlayPlayer&&navigator.appVersion.indexOf("Android")>-1&&this.options.enableWaterfall&&!this.isDoneInitialPlay?this.adVideoPlayer.trigger("play"):this.actualPlayByVideoJS(),"html5"===this.decidePlayer(this.options.requiredPlayer)||(this.isPlayingVideo=!0),this.isDoneInitialPlay=!0,this.isEnded=!1)}},resetVpaid:function(){this.dispatchEventToAdunit({name:"reset"})},pause:function(){this.isPlayingVideo&&(A("pause video"),this.adVideoPlayer.pause(),this.options.vpaid&&this.adVideoPlayer.trigger("handleManualUserActive"),this.isCompleted||this.isEnded||this.dispatchEventToAdunit({name:"video_pause"}))},explicitPause:function(){A("explicit pause video"),this.explicitPaused=!0,this.pause()},explicitPlay:function(){A("explicit play video"),this.explicitPaused=!1,this.play()},mute:function(){this.isMuted||(A("mute audio"),"html5"===this.decidePlayer(this.options.requiredPlayer)?(this.adVideoPlayer.muted(!0),this.dispatchEventToAdunit({name:"video_mute"})):this.adVideoPlayer.mute(),this.isMuted=!0)},explicitMute:function(){A("explicit mute video"),this.isExplicitMuted=!0,this.mute()},unmute:function(){!this.isExplicitMuted&&this.isMuted&&(A("unmute audio"),"html5"===this.decidePlayer(this.options.requiredPlayer)?(this.adVideoPlayer.muted()===!0&&this.adVideoPlayer.muted(!1),(this.isMuted||"off"===this.options.initialAudio)&&this.dispatchEventToAdunit({name:"video_unmute"})):(this.adVideoPlayer.unmute(),this.hasBeenUnmuted=!0),this.isMuted=!1)},explicitUnmute:function(){this.isExplicitMuted=!1,this.unmute()},resizeVideoWithDimensions:function(e,t){var n=this;this.options.width=e,this.options.height=t,n.resizeVideo(n.aspectRatio)},mouseIn:function(){this.adVideoPlayer.mouseIn()},mouseOut:function(){this.adVideoPlayer.mouseOut()},destroy:function(e,t){this.isPlayingVideo=!1,this.adVideoPlayer.pause(),this.isCompleted===!1&&(this.options.vpaid===!1?this.dispatchEventToAdunit({name:"video_skip"}):this.options.vpaid===!0&&this.isSkipped===!1&&this.dispatchEventToAdunit({name:"video_skip"})),"function"==typeof this.callbackForAdUnit.cbWhenSkipped&&this.callbackForAdUnit.cbWhenSkipped("video-skip"),this.isSkipped=!0,this.verificationManager&&this.verificationManager.destroy(),A("destroy");var n=I;"function"==typeof this.callbackForAdUnit.cbWhenDestroy&&(this.overlayPlayer?e&&t?this.callbackForAdUnit.cbWhenDestroy({type:w,code:n,message:t},!0,this.options):this.callbackForAdUnit.cbWhenDestroy(null,!0,this.options):e&&t?this.callbackForAdUnit.cbWhenDestroy({type:w,code:n,message:t},null,this.options):this.callbackForAdUnit.cbWhenDestroy(null,null,this.options))},destroyWithoutSkip:function(e,t,n,i){try{var o=this,r=function(){o.isPlayingVideo=!1,o.adVideoPlayer&&o.adVideoPlayer.pause&&"function"==typeof o.adVideoPlayer.pause&&o.adVideoPlayer.pause(),o.verificationManager&&o.verificationManager.destroy(),A("destroy without skip: "+o.options.iframeVideoWrapperId);var r=i||I;"function"==typeof o.callbackForAdUnit.cbWhenDestroy&&(o.overlayPlayer?e&&t?(n&&(r=S),o.callbackForAdUnit.cbWhenDestroy({type:w,code:r,message:t},!0,o.options)):o.callbackForAdUnit.cbWhenDestroy(null,!0,o.options):e&&t?(n&&(r=S),o.callbackForAdUnit.cbWhenDestroy({type:w,code:r,message:t},null,o.options)):o.callbackForAdUnit.cbWhenDestroy(null,null,o.options))};o.options.disableCollapseForDelay&&o.options.disableCollapseForDelay>0?setTimeout(r,o.options.disableCollapseForDelay):r()}catch(a){b("failed to destroy/notify by "+a)}},getVideoObject:function(){return this.adVideoPlayer},handleFlashPlay:function(){var e=this,t=function(){e.resizeVideo(e.aspectRatio),A("flash player is ready to play"),e.callbackForAdUnit.cbWhenReady&&e.callbackForAdUnit.cbWhenReady(e)};e.isChrome?(e.setChromeSize(),setTimeout(t,100)):t()},handlePlayerNotification:function(e){"video_time"!==e.name&&A("Got notification from player = "+e.name);var t=this,n={flash_is_respondble:function(){t.flashBlockerTimeout&&(clearTimeout(t.flashBlockerTimeout),t.flashBlockerTimeout=null),A("Flash is respondble")},canplay:function(){if(t.flashBlockerTimeout&&(clearTimeout(t.flashBlockerTimeout),t.flashBlockerTimeout=null,A("Flash is respondble")),t.options.hasOwnProperty("overlayPlayer"))try{t.adVideoPlayer.setDOMPlayerIdAndSize(t.adVideoPlayer.id,t.options.width,t.options.height)}catch(n){A("Failed to execute setDOMPlayerIdAndSize(...) on Flash Player")}if(t.options.vpaid)try{var i=t.adVideoPlayer.getCompanionsXml();i&&i.length>0&&(e.companionAds=i)}catch(o){}t.options.vpaid&&t.options.delayExpandUntilVPAIDImpression?t.actualPlayByVideoJS():t.handleFlashPlay()},video_failed:function(){t.flashBlockerTimeout&&(clearTimeout(t.flashBlockerTimeout),t.flashBlockerTimeout=null,A("Flash is respondble")),t.destroyWithoutSkip(!0,m,null,C)},video_timeout:function(){t.destroyWithoutSkip(!0,m,!0,S)},video_bitrate:function(){var t=e.bandwidth;A("bandwidth from flash : "+t)},video_impression:function(){},video_mute:function(){e.hasOwnProperty("value")&&!e.value&&(e.name="video_unmute"),e.hasOwnProperty("value")&&(t.isMuted=e.value)},video_click:function(){e.hasOwnProperty("playerHandles")?e.playerHandles?e.hasOwnProperty("url")&&e.url.length>0?t.click(e.url):t.click():t.dispatchEventToAdunit({name:"ad-click",trackClick:!0}):t.click()},video_complete:function(){t.isCompleted=!0,t.options.disableCollapse.enabled||t.destroyWithoutSkip()},video_fullscreen:function(){t.isFullscreen?setTimeout(function(){t.isFullscreen=!t.isFullscreen},1e3):t.isFullscreen=!t.isFullscreen},quartile_event:function(){},video_pause:function(){},video_start:function(){t.isDoneInitialPlay||"auto"===t.options.initialPlayback||t.play()},video_time:function(){},video_resume:function(){},video_stopped:function(){t.destroyWithoutSkip()},video_skipped:function(){t.destroy()},video_ratio:function(){},video_heightOffset:function(){t.heightOffset=e.heightOffset},video_paused_by_user:function(){t.explicitPause()},video_resumed_by_user:function(){A("received video_resumed_by_user from Flash"),t.requiredForFlashVpaid()?t.isVpaidFlashVideoPlaying===!1?(A("call explicitPlay by video_Resumed_by_user event"),t.explicitPlay()):A("do nothing because of isVpaidFlashVideoPlaying:true"):t.explicitPlay()},video_progress:function(){if(e&&e.offset)return void t.dispatchEventToAdunit({name:e.offset},function(){A("handle video_progress by flash : "+e.offset)})}};if(t.isDoneInitialPlay||"video_mute"!==e.name){var i=n[e.name];i&&void 0!==i&&i(),"video_pause"!==e.name&&"video_resume"!==e.name&&"video_impression"!==e.name&&"video_start"!==e.name&&"video_failed"!==e.name&&"video_timeout"!==e.name&&this.dispatchEventToAdunit(e),"video_impression"!==e.name&&"video_start"!==e.name||!t.options.vpaid||this.dispatchEventToAdunit(e)}},handleOverlayNotification:function(e){A("Got overlay notification from player = "+e.name);var t=this,n={leaveFullscreen:function(){t.options.hasOwnProperty("playerNotification")&&t.options.playerNotification("leaveFullscreen")}},i=n[e.name];i&&void 0!==i&&i()},requiredForFlashVpaid:function(){return"flash"===this.decidePlayer(this.options.requiredPlayer)&&this.options.vpaid===!0},notifyVpaidEvent:function(e){var t=this;if(t.requiredForFlashVpaid()&&("AdPaused"===e&&(A("received VPAID AdPaused from Flash"),t.isVpaidFlashVideoPlaying=!1,t.isPlayingVideo=!1,A("set isVpaidFlashVideoPlaying = false"),A("set isPlayingVideo = false")),"AdPlaying"===e&&(A("received VPAID AdPlaying from Flash"),t.isVpaidFlashVideoPlaying=!0,t.isPlayingVideo=!0,A("set isVpaidFlashVideoPlaying = true"),A("set isPlayingVideo = true"))),"flash"===t.decidePlayer(t.options.requiredPlayer)&&t.options.delayExpandUntilVPAIDImpression&&("AdVideoStart"===e&&t.adVideoPlayer.pause(),"AdImpression"===e&&(t.gotAdImpressionForFlash=!0),"AdStarted"===e&&(t.gotAdStartedForFlash=!0),t.gotAdImpressionForFlash&&t.gotAdStartedForFlash&&(t.handleFlashPlay(),t.gotAdImpressionForFlash=!1,t.gotAdStartedForFlash=!1)),!(t.options.delayExpandUntilVPAIDImpression&&t.delayEventHandler.isSuppress&&k.indexOf(e)>=0)){if("AdVolumeChange"===e){var n="html5"===this.decidePlayer(this.options.requiredPlayer);if(n){var i=t.adVideoPlayer.player().muted(),o=t.adVideoPlayer.player().volume();i?i&&(A("set VPAID AdVolumeChange video_mute"),this.dispatchEventToAdunit({name:"video_mute"})):o>0&&(A("set VPAID AdVolumeChange video_unmute"),this.dispatchEventToAdunit({name:"video_unmute"}))}}E.indexOf(e)>=0||E.indexOf("vpaid."+e)>=0?t.notifyVpaidEvent_internal(e):t.delayEventHandler.push(function(){t.notifyVpaidEvent_internal(e)})}},notifyVpaidEvent_internal:function(e){this.options.cbNotification&&this.options.cbNotification("VPAID",e,this.options.targetId),this.options.cbApnVastPlayer&&this.options.cbApnVastPlayer(e)},setChromeSize:function(){this.adVideoPlayer.width="0px",this.adVideoPlayer.height="0px",this.adVideoPlayer.style.width="0px",this.adVideoPlayer.style.height="0px",this.options.targetElement.style.visibility="visible"},click:function(e,t){if(!this.isDoneInitialPlay)return void this.play();this.isIosInlineRequired()===!1&&(this.pause(),this.toggleWindowFocus=!1);var n=!1;if(this.options.useCustomOpenForClickthrough){var i=this.options.clickUrls[0];e&&(i=e),n=!0,this.dispatchEventToAdunit({name:"video_click_open_url",url:i})}else if(e)n=!0,window.open(e);else if(this.options.clickUrls[0]){n=!0;var o=this.options.clickUrls[0];window.open(o)}"undefined"!=typeof t&&t!==!0||this.dispatchEventToAdunit({name:"ad-click",trackClick:n})},getRapamsAndExtensions:function(){var e=this.options.extensions&&this.options.extensions.length>0?""+this.options.extensions+"":"";return{adParameters:this.options.adParameters,extensions:e}},handleViewability:function(e,t,n){var i=this.options&&this.options.viewability&&this.options.viewability.config,o=e&&e.name?e.name:null;"fullscreenchange"!==o&&"video_fullscreen"!==o||(o=this.isFullscreen?"fullscreen":"exitFullscreen"),n||"video_duration"!==o||(this.isAlreadyStart=!0);var r=function(){var i;i=n?this.adVideoPlayer&&this.adVideoPlayer.player&&"function"==typeof this.adVideoPlayer.player&&this.adVideoPlayer.player().duration():e.duration,(!i||void 0===i||i<=0)&&(i=-2),i===-2&&(this.options&&this.options.data&&this.options.data.vastDurationMsec?(i=this.options.data.vastDurationMsec/1e3,(!i||null===i||i<=0)&&(i=-2)):i=-2);var r=this.options.width,a=this.options.height;if(this.viewabilityTracking.init(this.options,i,r,a,t),n)if(this.options.expandable)this.options.vpaid===!0&&"video_start"===o&&this.viewabilityTracking.invokeEvent("expand"),this.options.vpaid===!1&&"loadstart"===o&&this.viewabilityTracking.invokeEvent("expand"),this.viewabilityTracking.invokeEvent(o);else{if(this.options.overlayPlayer&&l.isMobile()&&this.options.delayStartViewability)return;this.viewabilityTracking.invokeEvent(o)}else this.isAlreadyStart&&(this.options.expandable&&this.viewabilityTracking.invokeEvent("expand"),this.viewabilityTracking.invokeEvent("video_start"))},a=function(){if(this.viewabilityTracking&&this.viewabilityTracking.isReady){ +if(n===!1&&"expand"===o&&this.options.expandable)return;"force_start_viewability"===o&&this.options.delayStartViewability?(this.options.delayStartViewability=!1,this.viewabilityTracking.invokeEvent("video_start")):this.viewabilityTracking.invokeEvent(o)}};if(o&&i){var s=this.blockTrackingUserActivity&&("video_resume"===o||"video_pause"===o||"video_mute"===o||"video_unmute"===o);s||(o===t?r.apply(this):a.apply(this))}},findPathForViewability:function(e){var t,n="html5"===this.decidePlayer(this.options.requiredPlayer);if(n){if(t=!this.options.expandable||"undefined"!=typeof this.options.isExpanded&&this.options.isExpanded!==!1?"video_start":"expand",e&&e.name&&e.name===t){if(this.isDoneFirstLoadStart)return;this.isDoneFirstLoadStart=!0}this.handleViewability(e,t,n)}else{if(t="video_duration",e&&"video_start"===e.name)return;e&&e.name&&e.name===t?this.isDoneFirstLoadStart||(this.isDoneFirstLoadStart=!0,this.handleViewability(e,t,n)):this.handleViewability(e,t,n)}},dispatchEventToAdunit:function(e,t){var n=this;if("video_start"===e.name&&n.iframeVideoWrapper.contentDocument){var i=n.iframeVideoWrapper.contentDocument.getElementById(n.divIdForVideo),o=n.iframeVideoWrapper.contentDocument.getElementById(n.videoId);i.style.background=n.options.playerSkin.videoBackgroundColor,o.style.background=n.options.playerSkin.videoBackgroundColor,h.isIOS()&&n.isIosInlineRequired()&&(o.style.opacity=0)}if("video_complete"===e.name&&(void 0===e.obj&&(e.obj={}),e.obj.videoAdPending=this.options.disableCollapse.replay),"video_fullscreen"===e.name&&"flash"===this.decidePlayer(this.options.requiredPlayer)?setTimeout(function(){var t={name:e.name,user:e.user,value:e.value};n.findPathForViewability(t)},1500):this.findPathForViewability(e),(this.startedReplay===!0||this.isEnded)&&this.options.disableCollapse.replay===!0)if(this.startedReplay===!1&&"rewind"===e.name);else{if("video_complete"===e.name&&"function"==typeof t)return void t();if("ad-click"!==e.name&&e.name.indexOf("IconClick")===-1)return void this.callbackForAdUnit.cbForHandlingDispatchedEvent(e,!0)}"video_skip"===e.name&&c.pushAndCheck(this.options.targetElement.id+"_dispatchEventToAdunit",e.name)===!1||"video_complete"===e.name&&this.isVideoCompleteInjected===!0&&this.options.disableCollapse.replay===!1||(e&&"video_time"!==e.name&&A("(push)"+e.name),this.delayEventHandler.push(function(){n.dispatchEventToAdunit_internal(e,t)}),"video_complete"===e.name&&(this.isVideoCompleteInjected=!0))},dispatchEventToAdunit_internal:function(e,t){if(!this.isCompleted||"video_complete"===e.name||"ad-click"===e.name||"video_skip"===e.name||this.startedReplay){var n=this;if(e&&"video_time"!==e.name&&A("invoke callback : "+JSON.stringify(e)),this.options.hasOwnProperty("overlayPlayer")&&this.options.hiddenControls&&(("firstplay"===e.name&&!this.options.vpaid||"video_impression"===e.name&&this.options.vpaid)&&(!l.isMobile()||"click"!==this.options.initialPlayback&&"mouseover"!==this.options.initialPlayback?h.isIOS()&&h.iOSversion()[0]<10&&"auto"===this.options.initialPlayback&&(this.adVideoPlayer.controlBar.el_.style.removeProperty("display"),delete this.options.hiddenControls):(this.adVideoPlayer.controlBar.el_.style.removeProperty("display"),delete this.options.hiddenControls)),"video_resume"===e.name&&this.options.vpaid&&l.isMobile()&&(this.adVideoPlayer.controlBar.el_.style.removeProperty("display"),delete this.options.hiddenControls)),this.callbackForAdUnit.cbForHandlingDispatchedEvent&&"video_time"!==e.name){if("video_pause"===e.name&&(this.isPlayingVideo=!1),"video_play"!==e.name&&"video_start"!==e.name&&"firstplay"!==e.name||(this.isPlayingVideo=!0,this.isDoneInitialPlay=!0),"video_fullscreen"===e.name)return void setTimeout(function(){e.fullscreenStatus=n.isFullscreen?"enter":"exit",n.callbackForAdUnit.cbForHandlingDispatchedEvent(e)},1500);"function"==typeof t&&t();var i=this.blockTrackingUserActivity&&("video_resume"===e.name||"video_pause"===e.name||"video_mute"===e.name||"video_unmute"===e.name);if(i||(e.player=this,this.callbackForAdUnit.cbForHandlingDispatchedEvent(e)),this.verificationManager){var o=this.prepareOmidEventData(e);o.name&&this.verificationManager.dispatchEvent(o.name,o.data)}}this.options.vpaid===!0&&"video_skip"===e.name&&(this.isSkipped=!0)}},resolveMacro:function(e){switch(e){case"MEDIAPLAYHEAD":return this.options.hasOwnProperty("mediaPlayhead")&&"number"==typeof this.options.mediaPlayhead?l.convertTimeSecondsToString(this.options.mediaPlayhead):-1;case"BREAKPOSITION":return this.options.breakPosition?this.options.breakPosition:-1;case"ADCOUNT":return 1;case"PLACEMENTTYPE":return this.options.overlayPlayer?1:this.options.expandable?3:-1;case"CLIENTUA":return this.options.clientUA?this.options.clientUA:"unknown unknown";case"DEVICEIP":return-1;case"PLAYERCAPABILITIES":var t=[];return this.options.skippable&&this.options.skippable.enabled&&t.push("skip"),this.options.showMute&&t.push("mute"),"auto"===this.options.initialPlayback&&("on"===this.options.initialAudio?t.push("autoplay"):t.push("mautoplay")),this.options.allowFullscreen&&t.push("fullscreen"),t.push("icon"),t.join();case"CLICKTYPE":return this.options.clickUrls&&this.options.clickUrls[0]?1:this.options.learnMore.enabled?2:0;case"PLAYERSTATE":var n=[];return this.isSkipped&&n.push("skipped"),this.isMuted&&n.push("muted"),"auto"===this.options.initialPlayback&&("on"===this.options.initialAudio?n.push("autoplayed"):n.push("mautoplayed")),this.adVideoPlayer.isFullscreen&&"function"==typeof this.adVideoPlayer.isFullscreen&&this.adVideoPlayer.isFullscreen()&&n.push("fullscreen"),n.join();case"PLAYERSIZE":return this.options.width+","+this.options.height;case"ADPLAYHEAD":if(this.adVideoPlayer.currentTime&&"function"==typeof this.adVideoPlayer.currentTime){var i=this.adVideoPlayer.currentTime();return l.convertTimeSecondsToString(i)}return-1;case"ASSETURI":return this.options.video.url;case"PODSEQUENCE":return-1;case"LIMITADTRACKING":return 0;default:return-1}},prepareOmidEventData:function(e){var t={error:"sessionError",impression:"impression",video_impression:"impression",video_start:"start","video-first-quartile":"firstQuartile","video-mid":"midpoint","video-third-quartile":"thirdQuartile",video_complete:"complete",video_pause:"pause",video_resume:"resume","user-close":"skipped",video_skip:"skipped",video_skipped:"skipped","audio-mute":"volumeChange","audio-unmute":"volumeChange",video_mute:"volumeChange",video_unmute:"volumeChange",fullscreenchange:"playerStateChange",video_fullscreen:"playerStateChange","video-exit-fullscreen":"playerStateChange","ad-expand":"playerStateChange","ad-collapse":"playerStateChange","ad-click":"adUserInteraction","user-accept-invitation":"adUserInteraction"},n=t.hasOwnProperty(e.name)?t[e.name]:"",i={name:n},o=null;switch(n){case"sessionError":o={},o.errorType=e.code,o.message=e.message;break;case"start":o={},this.options.data.durationMsec?o.duration=this.options.data.durationMsec/1e3:this.adVideoPlayer&&this.adVideoPlayer.player&&"function"==typeof this.adVideoPlayer.player?o.duration=this.adVideoPlayer.player().duration()/1e3:o.duration=-2,this.adVideoPlayer&&this.adVideoPlayer.player&&"function"==typeof this.adVideoPlayer.player?o.videoPlayerVolume=this.adVideoPlayer.player().volume():o.videoPlayerVolume=-1;break;case"volumeChange":o={},"audio-mute"===e.name||"video_mute"===e.name?o.videoPlayerVolume=0:this.adVideoPlayer&&this.adVideoPlayer.player&&"function"==typeof this.adVideoPlayer.player?o.videoPlayerVolume=this.adVideoPlayer.player().volume():o.videoPlayerVolume=-1;break;case"playerStateChange":o={},"video-fullscreen"===e.name||"fullscreenchange"===e.name&&"enter"===e.fullscreenStatus?o.state=this.adVideoPlayer.isFullscreen?"fullscreen":"normal":"video-exit-fullscreen"===e.name||"fullscreenchange"===e.name&&"exit"===e.fullscreenStatus?o.state="normal":"ad-collapse"===e.name?o.state="collapsed":o.state="normal";break;case"adUserInteraction":o={},"ad-click"===e.name?o.interactionType="click":o.interactionType="invitationAccept"}return o&&(i.data=o),i},resizeVideo:function(e,t,n){s.resizeVideo(e,t,this,n)},resizeVideoForSideStream:function(e,t,n){s.resizeVideoForSideStream(this,e,t,n)},isIosInlineRequired:function(){return this.autoplayHandler.isIosInlineRequired(this.options.enableInlineVideoForIos)},resizePlayer:function(e,t){s.resizePlayer(e,t,this)},getFinalSize:function(){return s.getFinalSize(this)},setVastAttribute:function(e){var t,n=this.options;t=e?e:this.adVideoPlayer&&this.adVideoPlayer.player?this.adVideoPlayer.player().duration():0,n.data.durationMsec=null!==t?Math.round(1e3*t):0;var i=this.Utils.getMsecTime(n.data.skipOffset,n.data.durationMsec);n.data.skipOffset&&i>=0?(n.data.isVastVideoSkippable=!0,n.data.skipOffsetMsec=i):n.data.skipOffsetMsec=null;var o=n.data.vastProgressEvent;if(o&&"object"==typeof o)for(var r in o){var a=this.Utils.getMsecTime(r.replace(/progress_/g,""),n.data.durationMsec);o[r]=a}},disableTrackingUserActivity:function(e){this.blockTrackingUserActivity=e,this.adVideoPlayer&&this.adVideoPlayer.bigPlayButton&&(this.adVideoPlayer.bigPlayButton.el_.style.opacity=e===!0?0:1)},delayEventsTracking:function(e,t){this.callbackForAdUnit.cbDelayEventsTracking&&this.callbackForAdUnit.cbDelayEventsTracking(e,t)},notifyOverlayPlayerVideoPaused:function(){this.options.tmpActiveListener&&this.options.cbApnVastPlayer&&this.options.cbApnVastPlayer("apn-video-paused-by-device")},checkWhenVideoPausedByDevice:function(e){if(this.options.overlayPlayer&&this.options.cbApnVastPlayer&&this.iframeVideoWrapper&&this.iframeVideoWrapper.contentDocument){var t=null;if("string"==typeof this.videoObjectId)t=this.iframeVideoWrapper.contentDocument.getElementById(this.videoObjectId);else{var n=this.iframeVideoWrapper.contentDocument.getElementsByTagName("VIDEO");if(n&&n.length>0)for(var i=0;i0){t=n[i];break}}if(t)return e?(this.options.tmpActiveListener=!0,t.addEventListener("pause",this.notifyOverlayPlayerVideoPaused.bind(this))):(delete this.options.tmpActiveListener,t.removeEventListener("pause",this.notifyOverlayPlayerVideoPaused.bind(this))),!0}return!0},forceStartViewability:function(){this.findPathForViewability({name:"force_start_viewability"})},log:A,debug:A,test:function(e,t){var n=this.options;if(n&&n.test&&n.test[e]&&"function"==typeof n.test[e]){var i=function(e){console.debug("%c"+e,"background: red; color: white")},o=function(e){console.debug("%c"+e,"background: green; color: white")};try{var r=function(t,n){t?(n=n+" Succeeded"||"Succeeded",o("Unit Test ["+e+"] : "+n)):(n=n+" failed"||"Assertion failed",i("Unit Test ["+e+"] : "+n))},a=function(t){console.debug("%cUnit Test Log : ["+e+"] : "+t,"background: gray; color: white")};n.test[e](t,r,a)}catch(s){i("unit test failed due to : "+s)}}},setFinalAspectRatio:function(e){this.finalAspectRatio=e},getFinalAspectRatio:function(){return this.finalAspectRatio}};e.exports=P,window[f]=P},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;(function(module){function _handleMultipleEvents(e,t,n,i){vjs.arr.forEach(n,function(n){e(t,n,i)})}function _logType(e,t){return}document.createElement("video"),document.createElement("audio"),document.createElement("track");var global_options,vjs=function(e,t,n){global_options=t;var i;if("string"==typeof e){if(0===e.indexOf("#")&&(e=e.slice(1)),vjs.players[e])return t&&vjs.log.warn('Player "'+e+'" is already initialised. Options will not be applied.'),n&&vjs.players[e].ready(n),vjs.players[e];i=vjs.el(e)}else i=e;if(!i||!i.nodeName)throw new TypeError("The element or ID supplied is not valid. (videojs)");return i.player||new vjs.Player(i,t,n)},videojs=window.videojs_apn=vjs;vjs.CDN_VERSION="GENERATED_CDN_VSN",vjs.ACCESS_PROTOCOL="https:"==document.location.protocol?"https://":"http://",vjs.VERSION="GENERATED_FULL_VSN",vjs.options={techOrder:["html5","flash"],html5:{},flash:{},width:300,height:150,defaultVolume:0,playbackRates:[],inactivityTimeout:500,children:{mediaLoader:{},posterImage:{},loadingSpinner:{},textTrackDisplay:{},bigPlayButton:{},controlBar:{},errorDisplay:{},textTrackSettings:{}},language:document.getElementsByTagName("html")[0].getAttribute("lang")||navigator.languages&&navigator.languages[0]||navigator.userLanguage||navigator.language||"en",languages:{},notSupportedMessage:"No compatible source was found for this video."},"GENERATED_CDN_VSN"!==vjs.CDN_VERSION&&(videojs.options.flash.swf=vjs.ACCESS_PROTOCOL+"vjs.zencdn.net/"+vjs.CDN_VERSION+"/video-js.swf"),vjs.addLanguage=function(e,t){return void 0!==vjs.options.languages[e]?vjs.options.languages[e]=vjs.util.mergeOptions(vjs.options.languages[e],t):vjs.options.languages[e]=t,vjs.options.languages},vjs.players={},__webpack_require__(5).amd?(__WEBPACK_AMD_DEFINE_ARRAY__=[],__WEBPACK_AMD_DEFINE_RESULT__=function(){return videojs}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))):module.exports=videojs,vjs.CoreObject=vjs.CoreObject=function(){},vjs.CoreObject.extend=function(e){var t,n;e=e||{},t=e.init||e.init||this.prototype.init||this.prototype.init||function(){},n=function(){t.apply(this,arguments)},n.prototype=vjs.obj.create(this.prototype),n.prototype.constructor=n,n.extend=vjs.CoreObject.extend,n.create=vjs.CoreObject.create;for(var i in e)e.hasOwnProperty(i)&&(n.prototype[i]=e[i]);return n},vjs.CoreObject.create=function(){var e=vjs.obj.create(this.prototype);return this.apply(e,arguments),e},vjs.on=function(e,t,n){if(vjs.obj.isArray(t))return _handleMultipleEvents(vjs.on,e,t,n);var i=vjs.getData(e);i.handlers||(i.handlers={}),i.handlers[t]||(i.handlers[t]=[]),n.guid||(n.guid=vjs.guid++),i.handlers[t].push(n),i.dispatcher||(i.disabled=!1,i.dispatcher=function(t){if(!i.disabled){t=vjs.fixEvent(t);var n=i.handlers[t.type];if(n)for(var o=n.slice(0),r=0,a=o.length;r=0;i--)n[i]===t&&n.splice(i,1);e.className=n.join(" ")}},vjs.TEST_VID=vjs.createEl("video"),function(){var e=document.createElement("track");e.kind="captions",e.srclang="en",e.label="English",vjs.TEST_VID.appendChild(e)}(),vjs.USER_AGENT=navigator.userAgent,vjs.IS_IPHONE=/iPhone/i.test(vjs.USER_AGENT),vjs.IS_IPAD=/iPad/i.test(vjs.USER_AGENT),vjs.IS_IPOD=/iPod/i.test(vjs.USER_AGENT),vjs.IS_IOS=vjs.IS_IPHONE||vjs.IS_IPAD||vjs.IS_IPOD,vjs.IOS_VERSION=function(){var e=vjs.USER_AGENT.match(/OS (\d+)_/i);if(e&&e[1])return e[1]}(),vjs.IS_ANDROID=/Android/i.test(vjs.USER_AGENT),vjs.ANDROID_VERSION=function(){var e,t,n=vjs.USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);return n?(e=n[1]&&parseFloat(n[1]),t=n[2]&&parseFloat(n[2]),e&&t?parseFloat(n[1]+"."+n[2]):e?e:null):null}(),vjs.IS_OLD_ANDROID=vjs.IS_ANDROID&&/webkit/i.test(vjs.USER_AGENT)&&vjs.ANDROID_VERSION<2.3,vjs.IS_FIREFOX=/Firefox/i.test(vjs.USER_AGENT),vjs.IS_CHROME=/Chrome/i.test(vjs.USER_AGENT),vjs.IS_IE8=/MSIE\s8\.0/.test(vjs.USER_AGENT),vjs.TOUCH_ENABLED=!!("ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),vjs.BACKGROUND_SIZE_SUPPORTED="backgroundSize"in vjs.TEST_VID.style,vjs.setElementAttributes=function(e,t){vjs.obj.each(t,function(t,n){null===n||"undefined"==typeof n||n===!1?e.removeAttribute(t):e.setAttribute(t,n===!0?"":n)})},vjs.getElementAttributes=function(e){var t,n,i,o,r;if(t={},n=",autoplay,controls,loop,muted,default,",e&&e.attributes&&e.attributes.length>0){i=e.attributes;for(var a=i.length-1;a>=0;a--)o=i[a].name,r=i[a].value,"boolean"!=typeof e[o]&&n.indexOf(","+o+",")===-1||(r=null!==r),t[o]=r}return t},vjs.getComputedDimension=function(e,t){var n="";return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,"").getPropertyValue(t):e.currentStyle&&(n=e["client"+t.substr(0,1).toUpperCase()+t.substr(1)]+"px"),n},vjs.insertFirst=function(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)},vjs.browser={},vjs.el=function(e){return 0===e.indexOf("#")&&(e=e.slice(1)),document.getElementById(e)},vjs.formatTime=function(e,t){t=t||e;var n=Math.floor(e%60),i=Math.floor(e/60%60),o=Math.floor(e/3600),r=Math.floor(t/60%60),a=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(o=i=n="-"),o=o>0||a>0?o+":":"",i=((o||r>=10)&&i<10?"0"+i:i)+":",n=n<10?"0"+n:n,o+i+n},vjs.blockTextSelection=function(){document.body.focus(),document.onselectstart=function(){return!1}},vjs.unblockTextSelection=function(){document.onselectstart=function(){return!0}},vjs.trim=function(e){return(e+"").replace(/^\s+|\s+$/g,"")},vjs.round=function(e,t){return t||(t=0),Math.round(e*Math.pow(10,t))/Math.pow(10,t)},vjs.createTimeRange=function(e,t){return void 0===e&&void 0===t?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:1,start:function(){return e},end:function(){return t}}},vjs.setLocalStorage=function(e,t){try{var n=window.localStorage||!1;if(!n)return;n[e]=t}catch(i){22==i.code||1014==i.code?vjs.log("LocalStorage Full (VideoJS)",i):18==i.code?vjs.log("LocalStorage not allowed (VideoJS)",i):vjs.log("LocalStorage Error (VideoJS)",i)}},vjs.getAbsoluteURL=function(e){return e.match(/^https?:\/\//)||(e=vjs.createEl("div",{innerHTML:'x'}).firstChild.href),e},vjs.parseUrl=function(e){var t,n,i,o,r;o=["protocol","hostname","port","pathname","search","hash","host"],n=vjs.createEl("a",{href:e}),i=""===n.host&&"file:"!==n.protocol,i&&(t=vjs.createEl("div"),t.innerHTML='',n=t.firstChild,t.setAttribute("style","display:none; position:absolute;"),document.body.appendChild(t)),r={};for(var a=0;a=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.off(),this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),vjs.removeData(this.el_),this.el_=null},vjs.Component.prototype.player_=!0,vjs.Component.prototype.player=function(){return this.player_},vjs.Component.prototype.options_,vjs.Component.prototype.options=function(e){return void 0===e?this.options_:this.options_=vjs.util.mergeOptions(this.options_,e)},vjs.Component.prototype.el_,vjs.Component.prototype.createEl=function(e,t){return vjs.createEl(e,t)},vjs.Component.prototype.localize=function(e){var t=this.player_.language(),n=this.player_.languages();return n&&n[t]&&n[t][e]?n[t][e]:e},vjs.Component.prototype.el=function(){return this.el_},vjs.Component.prototype.contentEl_,vjs.Component.prototype.contentEl=function(){return this.contentEl_||this.el_},vjs.Component.prototype.id_,vjs.Component.prototype.id=function(){return this.id_},vjs.Component.prototype.name_,vjs.Component.prototype.name=function(){return this.name_},vjs.Component.prototype.children_,vjs.Component.prototype.children=function(){return this.children_},vjs.Component.prototype.childIndex_,vjs.Component.prototype.getChildById=function(e){return this.childIndex_[e]},vjs.Component.prototype.childNameIndex_,vjs.Component.prototype.getChild=function(e){return this.childNameIndex_[e]},vjs.Component.prototype.addChild=function(e,t){var n,i,o;return"string"==typeof e?(o=e,t=t||{},i=t.componentClass||vjs.capitalize(o),t.name=o,n=new window.videojs_apn[i](this.player_||this,t)):n=e,this.children_.push(n),"function"==typeof n.id&&(this.childIndex_[n.id()]=n),o=o||n.name&&n.name(),o&&(this.childNameIndex_[o]=n),"function"==typeof n.el&&n.el()&&this.contentEl().appendChild(n.el()),n},vjs.Component.prototype.removeChild=function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,n=this.children_.length-1;n>=0;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,1);break}if(t){this.childIndex_[e.id()]=null,this.childNameIndex_[e.name()]=null;var i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},vjs.Component.prototype.initChildren=function(){var e,t,n,i,o,r,a;if(e=this,t=e.options(),n=t.children)if(a=function(n,i){void 0!==t[n]&&(i=t[n]),i!==!1&&(e[n]=e.addChild(n,i))},vjs.obj.isArray(n))for(var s=0;s0){for(var t=0,n=e.length;t1?i=!1:t&&(r=e.touches[0].pageX-t.pageX,a=e.touches[0].pageY-t.pageY,s=Math.sqrt(r*r+a*a),s>l&&(i=!1))}),o=function(){i=!1},this.on("touchleave",o),this.on("touchcancel",o),this.on("touchend",function(o){t=null,i===!0&&(n=(new Date).getTime()-e,n'+this.defaultValue+""},t),vjs.Component.prototype.createEl.call(this,"div",t)},vjs.Menu=vjs.Component.extend(),vjs.Menu.prototype.addItem=function(e){this.addChild(e),e.on("click",vjs.bind(this,function(){this.unlockShowing()}))},vjs.Menu.prototype.createEl=function(){var e=this.options().contentElType||"ul";this.contentEl_=vjs.createEl(e,{className:"vjs-menu-content"});var t=vjs.Component.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),vjs.on(t,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),t},vjs.MenuItem=vjs.Button.extend({init:function(e,t){vjs.Button.call(this,e,t),this.selected(t.selected)}}),vjs.MenuItem.prototype.createEl=function(e,t){return vjs.Button.prototype.createEl.call(this,"li",vjs.obj.merge({className:"vjs-menu-item",innerHTML:this.localize(this.options_.label)},t))},vjs.MenuItem.prototype.onClick=function(){this.selected(!0)},vjs.MenuItem.prototype.selected=function(e){e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-selected",!0)):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-selected",!1))},vjs.MenuButton=vjs.Button.extend({init:function(e,t){vjs.Button.call(this,e,t),this.update(),this.on("keydown",this.onKeyPress),this.el_.setAttribute("aria-haspopup",!0),this.el_.setAttribute("role","button")}}),vjs.MenuButton.prototype.update=function(){var e=this.createMenu();this.menu&&this.removeChild(this.menu),this.menu=e,this.addChild(e),this.items&&0===this.items.length?this.hide():this.items&&this.items.length>1&&this.show()},vjs.MenuButton.prototype.buttonPressed_=!1,vjs.MenuButton.prototype.createMenu=function(){var e=new vjs.Menu(this.player_);if(this.options().title&&e.contentEl().appendChild(vjs.createEl("li",{className:"vjs-menu-title",innerHTML:vjs.capitalize(this.options().title),tabindex:-1})),this.items=this.createItems(),this.items)for(var t=0;t0&&this.items[0].el().focus()},vjs.MenuButton.prototype.unpressButton=function(){this.buttonPressed_=!1,this.menu.unlockShowing(),this.el_.setAttribute("aria-pressed",!1)},vjs.MediaError=function(e){"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:"object"==typeof e&&vjs.obj.merge(this,e),this.message||(this.message="")},vjs.MediaError.prototype.code=0,vjs.MediaError.prototype.message="",vjs.MediaError.prototype.status=null,vjs.MediaError.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],vjs.MediaError.defaultMessages={1:"You aborted the video playback",2:"A network error caused the video download to fail part-way.",3:"The video playback was aborted due to a corruption problem or because the video used features your browser did not support.",4:"The video could not be loaded, either because the server or network failed or because the format is not supported.",5:"The video is encrypted and we do not have the keys to decrypt it."};for(var errNum=0;errNum9},vjs.Player.prototype.languages_,vjs.Player.prototype.languages=function(){return this.languages_},vjs.Player.prototype.options_=vjs.options,vjs.Player.prototype.dispose=function(){this.trigger("dispose"),this.off("dispose"),vjs.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech&&this.tech.dispose(),vjs.Component.prototype.dispose.call(this)},vjs.Player.prototype.getTagSettings=function(e){var t,n,i={sources:[],tracks:[]};if(t=vjs.getElementAttributes(e),n=t["data-setup"],null!==n&&vjs.obj.merge(t,vjs.JSON.parse(n||"{}")),vjs.obj.merge(i,t),e.hasChildNodes()){var o,r,a,s,l;for(o=e.childNodes,s=0,l=o.length;s0&&(i.startTime=this.cache_.currentTime),this.cache_.src=t.src),this.tech=new window.videojs_apn[e](this,i),this.tech.ready(n)},vjs.Player.prototype.unloadTech=function(){this.isReady_=!1,this.tech.dispose(),this.tech=!1},vjs.Player.prototype.onLoadStart=function(){this.removeClass("vjs-ended"),this.error(null),this.paused()?this.hasStarted(!1):this.trigger("firstplay")},vjs.Player.prototype.hasStarted_=!1,vjs.Player.prototype.hasStarted=function(e){return void 0!==e?(this.hasStarted_!==e&&(this.hasStarted_=e,e?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started")),this):this.hasStarted_},vjs.Player.prototype.onLoadedMetaData,vjs.Player.prototype.onLoadedData,vjs.Player.prototype.onLoadedAllData,vjs.Player.prototype.onPlay=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0)},vjs.Player.prototype.onWaiting=function(){this.addClass("vjs-waiting")},vjs.Player.prototype.onWaitEnd=function(){this.removeClass("vjs-waiting")},vjs.Player.prototype.onSeeking=function(){this.addClass("vjs-seeking")},vjs.Player.prototype.onSeeked=function(){this.removeClass("vjs-seeking")},vjs.Player.prototype.onFirstPlay=function(){this.options_.starttime&&this.currentTime(this.options_.starttime),this.addClass("vjs-has-started")},vjs.Player.prototype.onPause=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused")},vjs.Player.prototype.onTimeUpdate,vjs.Player.prototype.onProgress=function(){1==this.bufferedPercent()&&this.trigger("loadedalldata")},vjs.Player.prototype.onEnded=function(){this.addClass("vjs-ended"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause()},vjs.Player.prototype.onDurationChange=function(){var e=this.techGet("duration");e&&(e<0&&(e=1/0),this.duration(e),e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"))},vjs.Player.prototype.onVolumeChange,vjs.Player.prototype.onFullscreenChange=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},vjs.Player.prototype.onError,vjs.Player.prototype.cache_,vjs.Player.prototype.getCache=function(){return this.cache_},vjs.Player.prototype.techCall=function(e,t){if(this.tech&&!this.tech.isReady_)this.tech.ready(function(){this[e](t)});else try{this.tech[e](t)}catch(n){throw vjs.log(n),n}},vjs.Player.prototype.techGet=function(e){if(this.tech&&this.tech.isReady_)try{return this.tech[e]()}catch(t){throw void 0===this.tech[e]?vjs.log("Video.js: "+e+" method not defined for "+this.techName+" playback technology.",t):"TypeError"==t.name?(vjs.log("Video.js: "+e+" unavailable on "+this.techName+" playback technology element.",t),this.tech.isReady_=!1):vjs.log(t),t}},vjs.Player.prototype.play=function(){return this.techCall("play"),this},vjs.Player.prototype.pause=function(){return this.techCall("pause"),this.trigger("apn-vpaid-pause"),this},vjs.Player.prototype.paused=function(){return this.techGet("paused")!==!1},vjs.Player.prototype.currentTime=function(e){return void 0!==e?(this.techCall("setCurrentTime",e),this):this.cache_.currentTime=this.techGet("currentTime")||0},vjs.Player.prototype.duration=function(e){return void 0!==e?(this.cache_.duration=parseFloat(e),this):(void 0===this.cache_.duration&&this.onDurationChange(),this.cache_.duration||0)},vjs.Player.prototype.remainingTime=function(){return this.duration()-this.currentTime()},vjs.Player.prototype.buffered=function(){var e=this.techGet("buffered");return e&&e.length||(e=vjs.createTimeRange(0,0)),e},vjs.Player.prototype.bufferedPercent=function(){var e,t,n=this.duration(),i=this.buffered(),o=0;if(!n)return 0;for(var r=0;rn&&(t=n),o+=t-e;return o/n},vjs.Player.prototype.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),n=e.end(e.length-1);return n>t&&(n=t),n},vjs.Player.prototype.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall("setVolume",t),vjs.setLocalStorage("volume",t),this):(t=parseFloat(this.techGet("volume")),isNaN(t)?1:t)},vjs.Player.prototype.muted=function(e){if(void 0!==e){var t=vjs.IS_IOS&&this.options_.enableInlineVideoForIos;return t||this.techCall("setMuted",e),this}return this.techGet("muted")||!1},vjs.Player.prototype.supportsFullScreen=function(){return this.techGet("supportsFullScreen")||!1},vjs.Player.prototype.isFullscreen_=!1,vjs.Player.prototype.isFullscreen=function(e){return void 0!==e?(this.isFullscreen_=!!e,this):this.isFullscreen_},vjs.Player.prototype.isFullScreen=function(e){return vjs.log.warn('player.isFullScreen() has been deprecated, use player.isFullscreen() with a lowercase "s")'),this.isFullscreen(e)},vjs.Player.prototype.requestFullscreen=function(){var e=vjs.browser.fullscreenAPI;return this.isFullscreen(!0),e?(vjs.on(document,e.fullscreenchange,vjs.bind(this,function(t){this.isFullscreen(document[e.fullscreenElement]),this.isFullscreen()===!1&&vjs.off(document,e.fullscreenchange,arguments.callee)})),this.el_[e.requestFullscreen](),this.trigger("fullscreenchange")):this.tech.supportsFullScreen()?(this.enterFullWindow(),this.trigger("fullscreenchange")):(this.enterFullWindow(),this.trigger("fullscreenchange")),this},vjs.Player.prototype.requestFullScreen=function(){return vjs.log.warn('player.requestFullScreen() has been deprecated, use player.requestFullscreen() with a lowercase "s")'),this.requestFullscreen()},vjs.Player.prototype.exitFullscreen=function(){var e=vjs.browser.fullscreenAPI;return this.isFullscreen(!1),e?(document[e.exitFullscreen](),this.trigger("fullscreenchange")):this.tech.supportsFullScreen()?(this.exitFullWindow(),this.trigger("fullscreenchange")):(this.exitFullWindow(),this.push("fullscreenchange")),this},vjs.Player.prototype.cancelFullScreen=function(){return vjs.log.warn("player.cancelFullScreen() has been deprecated, use player.exitFullscreen()"),this.exitFullscreen()},vjs.Player.prototype.enterFullWindow=function(){this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,vjs.on(document,"keydown",vjs.bind(this,this.fullWindowOnEscKey)),document.documentElement.style.overflow="hidden",vjs.addClass(document.body,"vjs-full-window"),this.trigger("enterFullWindow")},vjs.Player.prototype.fullWindowOnEscKey=function(e){27===e.keyCode&&(this.isFullscreen()===!0?this.exitFullscreen():this.exitFullWindow())},vjs.Player.prototype.exitFullWindow=function(){this.isFullWindow=!1,vjs.off(document,"keydown",this.fullWindowOnEscKey),document.documentElement.style.overflow=this.docOrigOverflow,vjs.removeClass(document.body,"vjs-full-window"),this.trigger("exitFullWindow")},vjs.Player.prototype.selectSource=function(e){for(var t=0,n=this.options_.techOrder;t=0||(console.log("active:onmouseout:initialize"),s=void 0,l=void 0)},n=function(){e(),this.clearInterval(i),i=this.setInterval(e,250)},o=function(t){e(),this.clearInterval(i)},this.on("mousedown",n),this.on("mousemove",t),this.on("mouseup",o),this.on("mouseover",d),this.on("mouseout",c),this.on("keydown",e),this.on("keyup",e),r=this.setInterval(function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a);var e=this.options().inactivityTimeout;e>0&&(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e))}},250)},vjs.Player.prototype.playbackRate=function(e){return void 0!==e?(this.techCall("setPlaybackRate",e),this):this.tech&&this.tech.featuresPlaybackRate?this.techGet("playbackRate"):1},vjs.Player.prototype.isAudio_=!1,vjs.Player.prototype.isAudio=function(e){return void 0!==e?(this.isAudio_=!!e,this):this.isAudio_},vjs.Player.prototype.networkState=function(){return this.techGet("networkState")},vjs.Player.prototype.readyState=function(){return this.techGet("readyState")},vjs.Player.prototype.textTracks=function(){return this.tech&&this.tech.textTracks()},vjs.Player.prototype.remoteTextTracks=function(){return this.tech&&this.tech.remoteTextTracks()},vjs.Player.prototype.addTextTrack=function(e,t,n){return this.tech&&this.tech.addTextTrack(e,t,n)},vjs.Player.prototype.addRemoteTextTrack=function(e){return this.tech&&this.tech.addRemoteTextTrack(e)},vjs.Player.prototype.removeRemoteTextTrack=function(e){this.tech&&this.tech.removeRemoteTextTrack(e)},vjs.ControlBar=vjs.Component.extend(),vjs.ControlBar.prototype.options_={loadEvent:"play",children:{playToggle:{},currentTimeDisplay:{},timeDivider:{},durationDisplay:{},remainingTimeDisplay:{},progressControl:{},fullscreenToggle:{},volumeControl:{},muteToggle:{},playbackRateMenuButton:{}}},vjs.ControlBar.prototype.createEl=function(){return vjs.createEl("div",{className:"vjs-control-bar"})},vjs.LiveDisplay=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t)}}),vjs.LiveDisplay.prototype.createEl=function(){var e=vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-live-controls vjs-control"});return this.contentEl_=vjs.createEl("div",{className:"vjs-live-display",innerHTML:''+this.localize("Stream Type")+""+this.localize("LIVE"),"aria-live":"off"}),e.appendChild(this.contentEl_),e},vjs.PlayToggle=vjs.Button.extend({init:function(e,t){vjs.Button.call(this,e,t),this.on(e,"play",this.onPlay),this.on(e,"pause",this.onPause)}}),vjs.PlayToggle.prototype.buttonText="Play",vjs.PlayToggle.prototype.buildCSSClass=function(){return"vjs-play-control "+vjs.Button.prototype.buildCSSClass.call(this)},vjs.PlayToggle.prototype.onClick=function(){},vjs.PlayToggle.prototype.onPlay=function(){this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.el_.children[0].children[0].innerHTML=this.localize("Pause")},vjs.PlayToggle.prototype.onPause=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.el_.children[0].children[0].innerHTML=this.localize("Play")},vjs.CurrentTimeDisplay=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t),this.on(e,"timeupdate",this.updateContent)}}),vjs.CurrentTimeDisplay.prototype.createEl=function(){var e=vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-current-time vjs-time-controls vjs-control"});return this.contentEl_=vjs.createEl("div",{className:"vjs-current-time-display",innerHTML:'Current Time 0:00',"aria-live":"off"}),e.appendChild(this.contentEl_),e},vjs.CurrentTimeDisplay.prototype.updateContent=function(){var e=this.player_.scrubbing?this.player_.getCache().currentTime:this.player_.currentTime();this.contentEl_.innerHTML=''+this.localize("Current Time")+" "+vjs.formatTime(e,this.player_.duration())},vjs.DurationDisplay=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t),this.on(e,"timeupdate",this.updateContent),this.on(e,"loadedmetadata",this.updateContent)}}),vjs.DurationDisplay.prototype.createEl=function(){var e=vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-duration vjs-time-controls vjs-control"});return this.contentEl_=vjs.createEl("div",{className:"vjs-duration-display",innerHTML:''+this.localize("Duration Time")+" 0:00","aria-live":"off"}),e.appendChild(this.contentEl_),e},vjs.DurationDisplay.prototype.updateContent=function(){var e=this.player_.duration();e&&(this.contentEl_.innerHTML=''+this.localize("Duration Time")+" "+vjs.formatTime(e))},vjs.TimeDivider=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t)}}),vjs.TimeDivider.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-time-divider",innerHTML:"
/
"})},vjs.RemainingTimeDisplay=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t),this.on(e,"timeupdate",this.updateContent)}}),vjs.RemainingTimeDisplay.prototype.createEl=function(){var e=vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-remaining-time vjs-time-controls vjs-control"});return this.contentEl_=vjs.createEl("div",{className:"vjs-remaining-time-display",innerHTML:''+this.localize("Remaining Time")+" -0:00","aria-live":"off"}),e.appendChild(this.contentEl_),e},vjs.RemainingTimeDisplay.prototype.updateContent=function(){this.player_.duration()&&(this.contentEl_.innerHTML=''+this.localize("Remaining Time")+" -"+vjs.formatTime(this.player_.remainingTime()))},vjs.FullscreenToggle=vjs.Button.extend({init:function(e,t){vjs.Button.call(this,e,t)}}),vjs.FullscreenToggle.prototype.buttonText="Fullscreen",vjs.FullscreenToggle.prototype.buildCSSClass=function(){return"vjs-fullscreen-control "+vjs.Button.prototype.buildCSSClass.call(this)},vjs.FullscreenToggle.prototype.onClick=function(){this.player_.isFullscreen()?(this.player_.exitFullscreen(),this.controlText_.innerHTML=this.localize("Fullscreen")):(this.player_.requestFullscreen(),this.controlText_.innerHTML=this.localize("Non-Fullscreen"))},vjs.ProgressControl=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t)}}),vjs.ProgressControl.prototype.options_={children:{seekBar:{}}},vjs.ProgressControl.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},vjs.SeekBar=vjs.Slider.extend({init:function(e,t){vjs.Slider.call(this,e,t),this.on(e,"timeupdate",this.updateARIAAttributes),e.ready(vjs.bind(this,this.updateARIAAttributes))}}),vjs.SeekBar.prototype.options_={children:{loadProgressBar:{},playProgressBar:{},seekHandle:{}},barName:"playProgressBar",handleName:"seekHandle"},vjs.SeekBar.prototype.playerEvent="timeupdate",vjs.SeekBar.prototype.createEl=function(){return vjs.Slider.prototype.createEl.call(this,"div",{className:"vjs-progress-holder","aria-label":"video progress bar"})},vjs.SeekBar.prototype.updateARIAAttributes=function(){var e=this.player_.scrubbing?this.player_.getCache().currentTime:this.player_.currentTime();this.el_.setAttribute("aria-valuenow",vjs.round(100*this.getPercent(),2)),this.el_.setAttribute("aria-valuetext",vjs.formatTime(e,this.player_.duration()))},vjs.SeekBar.prototype.getPercent=function(){return this.player_.currentTime()/this.player_.duration()},vjs.LoadProgressBar=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t),this.on(e,"progress",this.update)}}),vjs.LoadProgressBar.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-load-progress",innerHTML:''+this.localize("Loaded")+": 0%"})},vjs.LoadProgressBar.prototype.update=function(){var e,t,n,i,o=this.player_.buffered(),r=this.player_.duration(),a=this.player_.bufferedEnd(),s=this.el_.children,l=function(e,t){var n=e/t||0;return 100*n+"%"};for(this.el_.style.width=l(a,r),e=0;eo.length;e--)this.el_.removeChild(s[e-1])},vjs.PlayProgressBar=vjs.Component.extend({ init:function(e,t){vjs.Component.call(this,e,t)}}),vjs.PlayProgressBar.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-play-progress",innerHTML:''+this.localize("Progress")+": 0%"})},vjs.SeekHandle=vjs.SliderHandle.extend({init:function(e,t){vjs.SliderHandle.call(this,e,t),this.on(e,"timeupdate",this.updateContent)}}),vjs.SeekHandle.prototype.defaultValue="00:00",vjs.SeekHandle.prototype.createEl=function(){return vjs.SliderHandle.prototype.createEl.call(this,"div",{className:"vjs-seek-handle","aria-live":"off"})},vjs.SeekHandle.prototype.updateContent=function(){var e=this.player_.scrubbing?this.player_.getCache().currentTime:this.player_.currentTime();this.el_.innerHTML=''+vjs.formatTime(e,this.player_.duration())+""},vjs.VolumeControl=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t),e.tech&&e.tech.featuresVolumeControl===!1&&this.addClass("vjs-hidden"),this.on(e,"loadstart",function(){e.tech.featuresVolumeControl===!1?this.addClass("vjs-hidden"):this.removeClass("vjs-hidden")})}}),vjs.VolumeControl.prototype.options_={children:{volumeBar:{}}},vjs.VolumeControl.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control"})},vjs.VolumeBar=vjs.Slider.extend({init:function(e,t){vjs.Slider.call(this,e,t),this.on(e,"volumechange",this.updateARIAAttributes),e.ready(vjs.bind(this,this.updateARIAAttributes))}}),vjs.VolumeBar.prototype.updateARIAAttributes=function(){this.el_.setAttribute("aria-valuenow",vjs.round(100*this.player_.volume(),2)),this.el_.setAttribute("aria-valuetext",vjs.round(100*this.player_.volume(),2)+"%")},vjs.VolumeBar.prototype.options_={children:{volumeLevel:{},volumeHandle:{}},barName:"volumeLevel",handleName:"volumeHandle"},vjs.VolumeBar.prototype.playerEvent="volumechange",vjs.VolumeBar.prototype.createEl=function(){return vjs.Slider.prototype.createEl.call(this,"div",{className:"vjs-volume-bar","aria-label":"volume level"})},vjs.VolumeBar.prototype.onMouseMove=function(e){if(this.player_.muted(),global_options.hasOwnProperty("overlayPlayer"))e.srcElement&&"VIDEO"!=e.srcElement.tagName&&e.srcElement.className.indexOf("vjs")>=0?"VIDEO"!=e.srcElement.tagName&&e.srcElement.className&&e.srcElement.className.indexOf("vjs")>=0&&this.player_.volume(this.calculateDistance(e)):e.currentTarget&&"VIDEO"!=e.currentTarget.tagName&&e.currentTarget.className&&e.currentTarget.className.indexOf("vjs")>=0&&this.player_.volume(this.calculateDistance(e));else{var t=document.getElementById(global_options.iframeVideoWrapperId).contentWindow.document,n=t.elementFromPoint(e.clientX,e.clientY);n&&"VIDEO"!=n.tagName&&n.className.indexOf("vjs")>=0&&this.player_.volume(this.calculateDistance(e))}},vjs.VolumeBar.prototype.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},vjs.VolumeBar.prototype.stepForward=function(){this.player_.volume(this.player_.volume()+.1)},vjs.VolumeBar.prototype.stepBack=function(){this.player_.volume(this.player_.volume()-.1)},vjs.VolumeLevel=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t)}}),vjs.VolumeLevel.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:''})},vjs.VolumeHandle=vjs.SliderHandle.extend(),vjs.VolumeHandle.prototype.defaultValue="00:00",vjs.VolumeHandle.prototype.createEl=function(){return vjs.SliderHandle.prototype.createEl.call(this,"div",{className:"vjs-volume-handle"})},vjs.MuteToggle=vjs.Button.extend({init:function(e,t){vjs.Button.call(this,e,t),this.on(e,"volumechange",this.update);var n=e.getMuteSettingsForIOS10();e.tech&&e.tech.featuresVolumeControl===!1&&!n&&this.addClass("vjs-hidden"),this.on(e,"loadstart",function(){e.tech.featuresVolumeControl!==!1||n?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")})}}),vjs.MuteToggle.prototype.createEl=function(){return vjs.Button.prototype.createEl.call(this,"div",{className:"vjs-mute-control vjs-control",innerHTML:'
'+this.localize("Mute")+"
"})},vjs.MuteToggle.prototype.onClick=function(){if(this.player_.muted()){var e=this.player_.volume();0===e&&(e=.5,this.player_.volume(e))}this.player_.muted(!this.player_.muted())},vjs.MuteToggle.prototype.update=function(){var e=this.player_.volume(),t=3;if(0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2),this.el_){this.player_.muted()?this.el_.children[0].children[0].innerHTML!=this.localize("Unmute")&&(this.el_.children[0].children[0].innerHTML=this.localize("Unmute")):this.el_.children[0].children[0].innerHTML!=this.localize("Mute")&&(this.el_.children[0].children[0].innerHTML=this.localize("Mute"));for(var n=0;n<4;n++)vjs.removeClass(this.el_,"vjs-vol-"+n);vjs.addClass(this.el_,"vjs-vol-"+t)}},vjs.VolumeMenuButton=vjs.MenuButton.extend({init:function(e,t){vjs.MenuButton.call(this,e,t),this.on(e,"volumechange",this.volumeUpdate),e.tech&&e.tech.featuresVolumeControl===!1&&this.addClass("vjs-hidden"),this.on(e,"loadstart",function(){e.tech.featuresVolumeControl===!1?this.addClass("vjs-hidden"):this.removeClass("vjs-hidden")}),this.addClass("vjs-menu-button")}}),vjs.VolumeMenuButton.prototype.createMenu=function(){var e=new vjs.Menu(this.player_,{contentElType:"div"}),t=new vjs.VolumeBar(this.player_,this.options_.volumeBar);return t.on("focus",function(){e.lockShowing()}),t.on("blur",function(){e.unlockShowing()}),e.addChild(t),e},vjs.VolumeMenuButton.prototype.onClick=function(){vjs.MuteToggle.prototype.onClick.call(this),vjs.MenuButton.prototype.onClick.call(this)},vjs.VolumeMenuButton.prototype.createEl=function(){return vjs.Button.prototype.createEl.call(this,"div",{className:"vjs-volume-menu-button vjs-menu-button vjs-control",innerHTML:'
'+this.localize("Mute")+"
"})},vjs.VolumeMenuButton.prototype.volumeUpdate=vjs.MuteToggle.prototype.update,vjs.PlaybackRateMenuButton=vjs.MenuButton.extend({init:function(e,t){vjs.MenuButton.call(this,e,t),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",this.updateVisibility),this.on(e,"ratechange",this.updateLabel)}}),vjs.PlaybackRateMenuButton.prototype.buttonText="Playback Rate",vjs.PlaybackRateMenuButton.prototype.className="vjs-playback-rate",vjs.PlaybackRateMenuButton.prototype.createEl=function(){var e=vjs.MenuButton.prototype.createEl.call(this);return this.labelEl_=vjs.createEl("div",{className:"vjs-playback-rate-value",innerHTML:1}),e.appendChild(this.labelEl_),e},vjs.PlaybackRateMenuButton.prototype.createMenu=function(){var e=new vjs.Menu(this.player()),t=this.player().options().playbackRates;if(t)for(var n=t.length-1;n>=0;n--)e.addChild(new vjs.PlaybackRateMenuItem(this.player(),{rate:t[n]+"x"}));return e},vjs.PlaybackRateMenuButton.prototype.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},vjs.PlaybackRateMenuButton.prototype.onClick=function(){for(var e=this.player().playbackRate(),t=this.player().options().playbackRates,n=t[0],i=0;ie){n=t[i];break}this.player().playbackRate(n)},vjs.PlaybackRateMenuButton.prototype.playbackRateSupported=function(){return this.player().tech&&this.player().tech.featuresPlaybackRate&&this.player().options().playbackRates&&this.player().options().playbackRates.length>0},vjs.PlaybackRateMenuButton.prototype.updateVisibility=function(){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},vjs.PlaybackRateMenuButton.prototype.updateLabel=function(){this.playbackRateSupported()&&(this.labelEl_.innerHTML=this.player().playbackRate()+"x")},vjs.PlaybackRateMenuItem=vjs.MenuItem.extend({contentElType:"button",init:function(e,t){var n=this.label=t.rate,i=this.rate=parseFloat(n,10);t.label=n,t.selected=1===i,vjs.MenuItem.call(this,e,t),this.on(e,"ratechange",this.update)}}),vjs.PlaybackRateMenuItem.prototype.onClick=function(){vjs.MenuItem.prototype.onClick.call(this),this.player().playbackRate(this.rate)},vjs.PlaybackRateMenuItem.prototype.update=function(){this.selected(this.player().playbackRate()==this.rate)},vjs.PosterImage=vjs.Button.extend({init:function(e,t){vjs.Button.call(this,e,t),this.update(),e.on("posterchange",vjs.bind(this,this.update))}}),vjs.PosterImage.prototype.dispose=function(){this.player().off("posterchange",this.update),vjs.Button.prototype.dispose.call(this)},vjs.PosterImage.prototype.createEl=function(){var e=vjs.createEl("div",{className:"vjs-poster",tabIndex:-1});return vjs.BACKGROUND_SIZE_SUPPORTED||(this.fallbackImg_=vjs.createEl("img"),e.appendChild(this.fallbackImg_)),e},vjs.PosterImage.prototype.update=function(){var e=this.player().poster();this.setSrc(e),e?this.show():this.hide()},vjs.PosterImage.prototype.setSrc=function(e){var t;this.fallbackImg_?this.fallbackImg_.src=e:(t="",e&&(t='url("'+e+'")'),this.el_.style.backgroundImage=t)},vjs.PosterImage.prototype.onClick=function(){this.player_.play()},vjs.LoadingSpinner=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t)}}),vjs.LoadingSpinner.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner"})},vjs.BigPlayButton=vjs.Button.extend(),vjs.BigPlayButton.prototype.createEl=function(){return vjs.Button.prototype.createEl.call(this,"div",{className:"vjs-big-play-button",innerHTML:'',"aria-label":"play video"})},vjs.BigPlayButton.prototype.onClick=function(){},vjs.ErrorDisplay=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t),this.update(),this.on(e,"error",this.update)}}),vjs.ErrorDisplay.prototype.createEl=function(){var e=vjs.Component.prototype.createEl.call(this,"div",{});return this.contentEl_=vjs.createEl("div"),e.appendChild(this.contentEl_),e},vjs.ErrorDisplay.prototype.update=function(){this.player().error()&&(this.contentEl_.innerHTML=this.localize(this.player().error().message))},function(){var e;vjs.MediaTechController=vjs.Component.extend({init:function(e,t,n){t=t||{},t.reportTouchActivity=!1,vjs.Component.call(this,e,t,n),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),this.initControlsListeners(),this.initTextTrackListeners()}}),vjs.MediaTechController.prototype.initControlsListeners=function(){var e,t;e=this.player(),t=function(){e.controls()&&!e.usingNativeControls()&&this.addControlsListeners()},this.ready(t),this.on(e,"controlsenabled",t),this.on(e,"controlsdisabled",this.removeControlsListeners),this.ready(function(){this.networkState&&this.networkState()>0&&this.player().trigger("loadstart")})},vjs.MediaTechController.prototype.addControlsListeners=function(){var e;this.on("mousedown",this.onClick),this.on("touchstart",function(t){e=this.player_.userActive()}),this.on("touchmove",function(t){e&&this.player().reportUserActivity()}),this.on("touchend",function(e){e.preventDefault()}),this.emitTapEvents(),this.on("tap",this.onTap)},vjs.MediaTechController.prototype.removeControlsListeners=function(){this.off("tap"),this.off("touchstart"),this.off("touchmove"),this.off("touchleave"),this.off("touchcancel"),this.off("touchend"),this.off("click"),this.off("mousedown")},vjs.MediaTechController.prototype.onClick=function(e){0===e.button&&this.player().controls()&&(this.player().paused()?this.player().play():this.player().pause())},vjs.MediaTechController.prototype.onTap=function(){this.player().userActive(!this.player().userActive())},vjs.MediaTechController.prototype.manualProgressOn=function(){this.manualProgress=!0,this.trackProgress()},vjs.MediaTechController.prototype.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress()},vjs.MediaTechController.prototype.trackProgress=function(){this.progressInterval=this.setInterval(function(){var e=this.player().bufferedPercent();this.bufferedPercent_!=e&&this.player().trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()},500)},vjs.MediaTechController.prototype.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},vjs.MediaTechController.prototype.manualTimeUpdatesOn=function(){var e=this.player_;this.manualTimeUpdates=!0,this.on(e,"play",this.trackCurrentTime),this.on(e,"pause",this.stopTrackingCurrentTime),this.one("timeupdate",function(){this.featuresTimeupdateEvents=!0,this.manualTimeUpdatesOff()})},vjs.MediaTechController.prototype.manualTimeUpdatesOff=function(){var e=this.player_;this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off(e,"play",this.trackCurrentTime),this.off(e,"pause",this.stopTrackingCurrentTime)},vjs.MediaTechController.prototype.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.player().trigger("timeupdate")},250)},vjs.MediaTechController.prototype.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.player().trigger("timeupdate")},vjs.MediaTechController.prototype.dispose=function(){this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),vjs.Component.prototype.dispose.call(this)},vjs.MediaTechController.prototype.setCurrentTime=function(){this.manualTimeUpdates&&this.player().trigger("timeupdate")},vjs.MediaTechController.prototype.initTextTrackListeners=function(){var e,t=this.player_,n=function(){var e=t.getChild("textTrackDisplay");e&&e.updateDisplay()};e=this.textTracks(),e&&(e.addEventListener("removetrack",n),e.addEventListener("addtrack",n),this.on("dispose",vjs.bind(this,function(){e.removeEventListener("removetrack",n),e.removeEventListener("addtrack",n)})))},vjs.MediaTechController.prototype.emulateTextTracks=function(){var e,t,n=this.player_;!window.WebVTT,t=this.textTracks(),t&&(e=function(){var e,t,i;for(i=n.getChild("textTrackDisplay"),i.updateDisplay(),e=0;e=0;n--){var l=s[n],d={};"undefined"!=typeof r.options_[l]&&(d[l]=r.options_[l]),vjs.setElementAttributes(a,d)}return r.options_.enableNativeInline&&(a.setAttribute("playsinline",""),a.setAttribute("webkit-playsinline","")),a},vjs.Html5.prototype.hideCaptions=function(){for(var e,t=this.el_.querySelectorAll("track"),n=t.length,i={captions:1,subtitles:1};n--;)e=t[n].track,e&&e.kind in i&&!t[n]["default"]&&(e.mode="disabled")},vjs.Html5.prototype.setupTriggers=function(){for(var e=vjs.Html5.Events.length-1;e>=0;e--)this.on(vjs.Html5.Events[e],this.eventHandler)},vjs.Html5.prototype.eventHandler=function(e){"error"==e.type&&this.error()?this.player().error(this.error().code):(e.bubbles=!1,this.player().trigger(e))},vjs.Html5.prototype.useNativeControls=function(){var e,t,n,i,o;e=this,t=this.player(),e.setControls(t.controls()),n=function(){e.setControls(!0)},i=function(){e.setControls(!1)},t.on("controlsenabled",n),t.on("controlsdisabled",i),o=function(){t.off("controlsenabled",n),t.off("controlsdisabled",i)},e.on("dispose",o),t.on("usingcustomcontrols",o),t.usingNativeControls(!0)},vjs.Html5.prototype.play=function(){this.el_.play()},vjs.Html5.prototype.pause=function(){this.el_.pause()},vjs.Html5.prototype.paused=function(){return this.el_.paused},vjs.Html5.prototype.currentTime=function(){return this.el_.currentTime||this.el_.currentTimeForOutstream||0},vjs.Html5.prototype.setCurrentTime=function(e){try{this.el_.currentTimeForOutstream=e,this.el_.currentTime=e}catch(t){vjs.log(t,"Video is not ready. (Video.js)")}},vjs.Html5.prototype.duration=function(){return this.el_.duration||0},vjs.Html5.prototype.buffered=function(){return this.el_.buffered},vjs.Html5.prototype.volume=function(){return this.el_.volume},vjs.Html5.prototype.setVolume=function(e){this.el_.volume=e},vjs.Html5.prototype.muted=function(){return this.el_.muted},vjs.Html5.prototype.setMuted=function(e){this.el_.muted=e},vjs.Html5.prototype.width=function(){return this.el_.offsetWidth},vjs.Html5.prototype.height=function(){return this.el_.offsetHeight},vjs.Html5.prototype.supportsFullScreen=function(){return!("function"!=typeof this.el_.webkitEnterFullScreen||!/Android/.test(vjs.USER_AGENT)&&/Chrome|Mac OS X 10.5/.test(vjs.USER_AGENT))},vjs.Html5.prototype.enterFullScreen=function(){var e=this.el_;"webkitDisplayingFullscreen"in e&&this.one("webkitbeginfullscreen",function(){this.player_.isFullscreen(!0),this.one("webkitendfullscreen",function(){this.player_.isFullscreen(!1),this.player_.trigger("fullscreenchange")}),this.player_.trigger("fullscreenchange")}),e.paused&&e.networkState<=e.HAVE_METADATA?(this.el_.play(),this.setTimeout(function(){e.pause(),e.webkitEnterFullScreen()},0)):e.webkitEnterFullScreen()},vjs.Html5.prototype.exitFullScreen=function(){this.el_.webkitExitFullScreen()},vjs.Html5.prototype.returnOriginalIfBlobURI_=function(e,t){var n=/^blob\:/i;return t&&e&&n.test(e)?t:e},vjs.Html5.prototype.src=function(e){var t=this.el_.src;return void 0===e?this.returnOriginalIfBlobURI_(t,this.source_):void this.setSrc(e)},vjs.Html5.prototype.setSrc=function(e){this.el_.src=e},vjs.Html5.prototype.load=function(){this.el_.load()},vjs.Html5.prototype.currentSrc=function(){var e=this.el_.currentSrc;return this.currentSource_?this.returnOriginalIfBlobURI_(e,this.currentSource_.src):e},vjs.Html5.prototype.poster=function(){return this.el_.poster},vjs.Html5.prototype.setPoster=function(e){this.el_.poster=e},vjs.Html5.prototype.preload=function(){return this.el_.preload},vjs.Html5.prototype.setPreload=function(e){this.el_.preload=e},vjs.Html5.prototype.autoplay=function(){return this.el_.autoplay},vjs.Html5.prototype.setAutoplay=function(e){this.el_.autoplay=e},vjs.Html5.prototype.controls=function(){return this.el_.controls},vjs.Html5.prototype.setControls=function(e){this.el_.controls=!!e},vjs.Html5.prototype.loop=function(){return this.el_.loop},vjs.Html5.prototype.setLoop=function(e){this.el_.loop=e},vjs.Html5.prototype.error=function(){return this.el_.error},vjs.Html5.prototype.seeking=function(){return this.el_.seeking},vjs.Html5.prototype.seekable=function(){return this.el_.seekable},vjs.Html5.prototype.ended=function(){return this.el_.ended},vjs.Html5.prototype.defaultMuted=function(){return this.el_.defaultMuted},vjs.Html5.prototype.playbackRate=function(){return this.el_.playbackRate},vjs.Html5.prototype.setPlaybackRate=function(e){this.el_.playbackRate=e},vjs.Html5.prototype.networkState=function(){return this.el_.networkState},vjs.Html5.prototype.readyState=function(){return this.el_.readyState},vjs.Html5.prototype.textTracks=function(){return this.featuresNativeTextTracks?this.el_.textTracks:vjs.MediaTechController.prototype.textTracks.call(this)},vjs.Html5.prototype.addTextTrack=function(e,t,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,n):vjs.MediaTechController.prototype.addTextTrack.call(this,e,t,n)},vjs.Html5.prototype.addRemoteTextTrack=function(e){if(!this.featuresNativeTextTracks)return vjs.MediaTechController.prototype.addRemoteTextTrack.call(this,e);var t=document.createElement("track");return e=e||{},e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e["default"]&&(t["default"]=e["default"]),e.id&&(t.id=e.id),e.src&&(t.src=e.src),this.el().appendChild(t),"metadata"===t.track.kind?t.track.mode="hidden":t.track.mode="disabled",t.onload=function(){var e=t.track;t.readyState>=2&&("metadata"===e.kind&&"hidden"!==e.mode?e.mode="hidden":"metadata"!==e.kind&&"disabled"!==e.mode&&(e.mode="disabled"),t.onload=null)},this.remoteTextTracks().addTrack_(t.track),t},vjs.Html5.prototype.removeRemoteTextTrack=function(e){if(!this.featuresNativeTextTracks)return vjs.MediaTechController.prototype.removeRemoteTextTrack.call(this,e);var t,n;for(this.remoteTextTracks().removeTrack_(e),t=this.el().querySelectorAll("track"),n=0;n0&&(e="number"!=typeof vjs.TEST_VID.textTracks[0].mode),e&&vjs.IS_FIREFOX&&(e=!1),e},vjs.Html5.prototype.featuresVolumeControl=vjs.Html5.canControlVolume(),vjs.Html5.prototype.featuresPlaybackRate=vjs.Html5.canControlPlaybackRate(),vjs.Html5.prototype.movingMediaElementInDOM=!vjs.IS_IOS,vjs.Html5.prototype.featuresFullscreenResize=!0,vjs.Html5.prototype.featuresProgressEvents=!0,vjs.Html5.prototype.featuresNativeTextTracks=vjs.Html5.supportsNativeTextTracks(),function(){var e,t=/^application\/(?:x-|vnd\.apple\.)mpegurl/i,n=/^video\/mp4/i;vjs.Html5.patchCanPlayType=function(){vjs.ANDROID_VERSION>=4&&(e||(e=vjs.TEST_VID.constructor.prototype.canPlayType),vjs.TEST_VID.constructor.prototype.canPlayType=function(n){return n&&t.test(n)?"maybe":e.call(this,n)}),vjs.IS_OLD_ANDROID&&(e||(e=vjs.TEST_VID.constructor.prototype.canPlayType),vjs.TEST_VID.constructor.prototype.canPlayType=function(t){return t&&n.test(t)?"maybe":e.call(this,t)})},vjs.Html5.unpatchCanPlayType=function(){var t=vjs.TEST_VID.constructor.prototype.canPlayType;return vjs.TEST_VID.constructor.prototype.canPlayType=e,e=null,t},vjs.Html5.patchCanPlayType()}(),vjs.Html5.Events="loadstart,suspend,abort,error,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,playing,waiting,seeking,seeked,ended,durationchange,timeupdate,progress,play,pause,ratechange,volumechange".split(","),vjs.Html5.disposeMediaElement=function(e){if(e){for(e.player=null,e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&!function(){try{e.load()}catch(t){}}()}},vjs.MediaLoader=vjs.Component.extend({init:function(e,t,n){if(vjs.Component.call(this,e,t,n),e.options_.sources&&0!==e.options_.sources.length)e.src(e.options_.sources);else for(var i=0,o=e.options_.techOrder;i=o?i.push(r):r.startTime===r.endTime&&r.startTime<=o&&r.startTime+.5>=o&&i.push(r);if(p=!1,i.length!==this.activeCues_.length)p=!0;else for(e=0;e>>0;if(0===o)return-1;var r=+t||0;if(Math.abs(r)===1/0&&(r=0),r>=o)return-1;for(n=Math.max(r>=0?r:o-Math.abs(r),0);ne?this.show():this.hide()},vjs.SubtitlesButton=vjs.TextTrackButton.extend({init:function(e,t,n){vjs.TextTrackButton.call(this,e,t,n),this.el_.setAttribute("aria-label","Subtitles Menu")}}),vjs.SubtitlesButton.prototype.kind_="subtitles",vjs.SubtitlesButton.prototype.buttonText="Subtitles",vjs.SubtitlesButton.prototype.className="vjs-subtitles-button",vjs.ChaptersButton=vjs.TextTrackButton.extend({init:function(e,t,n){vjs.TextTrackButton.call(this,e,t,n),this.el_.setAttribute("aria-label","Chapters Menu")}}),vjs.ChaptersButton.prototype.kind_="chapters",vjs.ChaptersButton.prototype.buttonText="Chapters",vjs.ChaptersButton.prototype.className="vjs-chapters-button",vjs.ChaptersButton.prototype.createItems=function(){var e,t,n=[];if(t=this.player_.textTracks(),!t)return n;for(var i=0;i0&&this.show(),a},vjs.ChaptersTrackMenuItem=vjs.MenuItem.extend({init:function(e,t){var n=this.track=t.track,i=this.cue=t.cue,o=e.currentTime();t.label=i.text,t.selected=i.startTime<=o&&o
'}vjs.TextTrackSettings=vjs.Component.extend({init:function(e,t){vjs.Component.call(this,e,t),this.hide(),vjs.on(this.el().querySelector(".vjs-done-button"),"click",vjs.bind(this,function(){this.saveSettings(),this.hide()})),vjs.on(this.el().querySelector(".vjs-default-button"),"click",vjs.bind(this,function(){this.el().querySelector(".vjs-fg-color > select").selectedIndex=0,this.el().querySelector(".vjs-bg-color > select").selectedIndex=0,this.el().querySelector(".window-color > select").selectedIndex=0,this.el().querySelector(".vjs-text-opacity > select").selectedIndex=0,this.el().querySelector(".vjs-bg-opacity > select").selectedIndex=0,this.el().querySelector(".vjs-window-opacity > select").selectedIndex=0,this.el().querySelector(".vjs-edge-style select").selectedIndex=0,this.el().querySelector(".vjs-font-family select").selectedIndex=0,this.el().querySelector(".vjs-font-percent select").selectedIndex=2,this.updateDisplay()})),vjs.on(this.el().querySelector(".vjs-fg-color > select"),"change",vjs.bind(this,this.updateDisplay)),vjs.on(this.el().querySelector(".vjs-bg-color > select"),"change",vjs.bind(this,this.updateDisplay)),vjs.on(this.el().querySelector(".window-color > select"),"change",vjs.bind(this,this.updateDisplay)),vjs.on(this.el().querySelector(".vjs-text-opacity > select"),"change",vjs.bind(this,this.updateDisplay)),vjs.on(this.el().querySelector(".vjs-bg-opacity > select"),"change",vjs.bind(this,this.updateDisplay)),vjs.on(this.el().querySelector(".vjs-window-opacity > select"),"change",vjs.bind(this,this.updateDisplay)),vjs.on(this.el().querySelector(".vjs-font-percent select"),"change",vjs.bind(this,this.updateDisplay)),vjs.on(this.el().querySelector(".vjs-edge-style select"),"change",vjs.bind(this,this.updateDisplay)),vjs.on(this.el().querySelector(".vjs-font-family select"),"change",vjs.bind(this,this.updateDisplay)),e.options().persistTextTrackSettings&&this.restoreSettings()}}),vjs.TextTrackSettings.prototype.createEl=function(){return vjs.Component.prototype.createEl.call(this,"div",{className:"vjs-caption-settings vjs-modal-overlay",innerHTML:n()})},vjs.TextTrackSettings.prototype.getValues=function(){var t,n,i,o,r,a,s,l,d,c,u,p;t=this.el(),r=e(t.querySelector(".vjs-edge-style select")),a=e(t.querySelector(".vjs-font-family select")),s=e(t.querySelector(".vjs-fg-color > select")),i=e(t.querySelector(".vjs-text-opacity > select")),l=e(t.querySelector(".vjs-bg-color > select")),n=e(t.querySelector(".vjs-bg-opacity > select")),d=e(t.querySelector(".window-color > select")),o=e(t.querySelector(".vjs-window-opacity > select")),p=window.parseFloat(e(t.querySelector(".vjs-font-percent > select"))),c={backgroundOpacity:n,textOpacity:i,windowOpacity:o,edgeStyle:r,fontFamily:a,color:s,backgroundColor:l,windowColor:d,fontPercent:p};for(u in c)(""===c[u]||"none"===c[u]||"fontPercent"===u&&1===c[u])&&delete c[u];return c},vjs.TextTrackSettings.prototype.setValues=function(e){var n,i=this.el();t(i.querySelector(".vjs-edge-style select"),e.edgeStyle),t(i.querySelector(".vjs-font-family select"),e.fontFamily),t(i.querySelector(".vjs-fg-color > select"),e.color),t(i.querySelector(".vjs-text-opacity > select"),e.textOpacity),t(i.querySelector(".vjs-bg-color > select"),e.backgroundColor),t(i.querySelector(".vjs-bg-opacity > select"),e.backgroundOpacity),t(i.querySelector(".window-color > select"),e.windowColor),t(i.querySelector(".vjs-window-opacity > select"),e.windowOpacity),n=e.fontPercent,n&&(n=n.toFixed(2)),t(i.querySelector(".vjs-font-percent > select"),n)},vjs.TextTrackSettings.prototype.restoreSettings=function(){var e;try{e=JSON.parse(window.localStorage.getItem("vjs-text-track-settings"))}catch(t){}e&&this.setValues(e)},vjs.TextTrackSettings.prototype.saveSettings=function(){var e;if(this.player_.options().persistTextTrackSettings){e=this.getValues();try{vjs.isEmpty(e)?window.localStorage.removeItem("vjs-text-track-settings"):window.localStorage.setItem("vjs-text-track-settings",JSON.stringify(e))}catch(t){}}},vjs.TextTrackSettings.prototype.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}}(),vjs.JSON,"undefined"!=typeof window.JSON&&"function"==typeof window.JSON.parse)vjs.JSON=window.JSON;else{vjs.JSON={};var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;vjs.JSON.parse=function(text,reviver){function walk(e,t){var n,i,o=e[t];if(o&&"object"==typeof o)for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(i=walk(o,n),void 0!==i?o[n]=i:delete o[n]);return reviver.call(e,t,o)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse(): invalid or malformed JSON data")}}vjs.autoSetup=function(){var e,t,n,i,o,r=document.getElementsByTagName("video"),a=document.getElementsByTagName("audio"),s=[];if(r&&r.length>0)for(i=0,o=r.length;i0)for(i=0,o=a.length;i0)for(i=0,o=s.length;i-1||t>-1},m=function(){var e=/iPad|iPhone|iPod/.test(navigator.appVersion);return e},f=function(e){return!!e.isFullscreen||!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)&&(!window.screenTop&&!window.screenY)},v=function(e){switch(e.nativeControlsForTouch=!1,e.controls=!0,e.preload="auto",e.extensions||(e.extensions=""),s.setSizeForInitialRender(e),m()&&e.sideStream&&e.sideStream.enabled===!1&&(e.nonViewableBehavior="pause"),e.initialPlayback){case"auto":e.autoplay=!1;break;case"click":e.autoplay=!1;break;case"mouseover":e.autoplay=!1}e.hasOwnProperty("disableTopBar")||(e.disableTopBar=!1),e.communicator=n.externalNameOfVideoPlayer,(l.isAndroid()||p())&&(e.controlBarPosition="below"),"flash"===n.decidePlayer(e.requiredPlayer)&&(e.controlBarPosition="over");var t=e.endCard;if(t&&t.enabled&&!t.buttons&&(t.buttons=[],t.showDefaultButtons=!0,t.buttons.indexOf("replay")<0&&e.disableCollapse&&e.disableCollapse.replay&&t.buttons.push({type:"replay"}),t.buttons.indexOf("learnMore")<0&&e.learnMore&&e.learnMore.enabled)){var i={type:"learnMore"};e.learnMore.text&&(i.text=e.learnMore.text),t.buttons.push(i)}return e};c=v(c),"off"===c.initialAudio&&(n.isMuted=!0),c.flash=c.flash?c.flash:{swf:"http://video.devnxs.net/players/flash/AppnexusFlashPlayer.swf"},n.options=c;var g=function(e,t){if(c.playOnMouseover===!0){var i=function(){n.isDoneInitialPlay===!0&&!n.explicitPaused&&n.isViewable&&n.isPlayingVideo===!1&&n.play()},o=function(){n.pause()};e.addEventListener("mouseenter",i),e.addEventListener("mouseleave",o)}if(c.audioOnMouseover!==!1){var r,a=0;"number"==typeof c.audioOnMouseover&&(a=c.audioOnMouseover);var s=function(){!n.isFullscreen&&n.isDoneInitialPlay&&(clearTimeout(r),n.mute(),e.removeEventListener("mouseleave",s))},l=function(){n.isFullscreen||!n.isDoneInitialPlay||n.mutedByViewability||(r=setTimeout(function(){n.unmute(),u("unmute by mouseover")},a)),e.addEventListener("mouseleave",s,!1)};p()||(d=setInterval(function(){n&&n.isFullscreen&&s&&e&&e.removeEventListener("mouseleave",s)},500),e.addEventListener("mouseenter",l,!1))}if(c.autoInitialSize&&!h()&&window.addEventListener("resize",function(){if(f(n)!==!0){var e=!(!n.options.sideStreamObject||"function"!=typeof n.options.sideStreamObject.shouldNotResizeWhenSideStreamActivated)&&n.options.sideStreamObject.shouldNotResizeWhenSideStreamActivated();e||c.targetElement&&c.targetElement.style&&c.targetElement.style.height&&0===Number(c.targetElement.style.height.replace("px",""))||setTimeout(function(){if(c.disableCollapse.enabled||!n.isSkipped&&!n.isCompleted){c.width=c.targetElement.offsetWidth;var e=/android/i.test(navigator.userAgent.toLowerCase());e?c.targetElement.style.webkitTransition="height 0s ease":c.targetElement.style.transition="height 0s ease",n.resizeVideo(-1),c.targetElement.style.height=c.height+"px";var t=document.getElementById(n.videoObjectId);t&&void 0!==typeof t&&(t.style.width=c.width,t.style.height=c.height),setTimeout(function(){var t=function(e){return e<0?0:e/1e3},n=t(c.expandTime);n=n<=0?.001:n,e?c.targetElement.style.webkitTransition="height "+n+"s ease":c.targetElement.style.transition="height "+n+"s ease"},500)}},0)}}),"flash"===n.decidePlayer(c.requiredPlayer)&&(e.addEventListener("mouseenter",function(){n.mouseIn()}),e.addEventListener("mouseleave",function(){n.mouseOut()})),e.style.cursor="pointer",t&&void 0!==t){if(m()){var v=!1;t.ontouchmove=function(){v=!0},t.ontouchend=function(e){return v?void(v=!1):void g(e)}}else t.onclick=function(e){g(e)};var g=function(){"html5"!==n.decidePlayer(c.requiredPlayer)||c.vpaid||(c.learnMore.enabled===!0?c.learnMore.clickToPause===!0&&(n.isPlayingVideo?n.explicitPause():n.explicitPlay()):n.click())}}var y=n.options&&n.options.playerSkin&&n.options.playerSkin.customPlayerSkin;m()&&n.overlayPlayer&&n.options&&n.options.enableInlineVideoForIos===!1&&y&&(n.adVideoPlayer.controlBar.fullscreenToggle.dispose(),n.adVideoPlayer.one("playing",function(){n.adVideoPlayer.controlBar.el().style.display="none",setTimeout(function(){n.adVideoPlayer.controlBar.el().style.display="block"},7e3)}))};switch(n.decidePlayer(c.requiredPlayer)){case"html5":p()?new o(n,g).start():new i(n,g).start();break;case"flash":r(n,g)}a.sharedInstance().run(t)};e.exports=p},function(e,t,n){var i=n(8),o=n(9),r=function(e){o.info("Video Player: "+e)};e.exports=function(e,t){var o=this;this.options=e.options,this.an_video_ad_player_id="",this.an_video_ad_player_html5_api_id="",this.targetElement="",this.videojsOrigin=e.videoPlayerObj,this.dispatchEventToAdunit=e.dispatchEventToAdunit.bind(e),this.callbackForAdUnit=e.callbackForAdUnit,this.topChromeHeight=24,this.pendingFullscreenExit=!1,this.bigbuttonUnmuteTimeout=250,this.CONST_MESSAGE_GENERAL_ERROR="General error reported from HTML5 video player",this.adIndicatorTextContent=this.options.adText,this.readyForSkip=!1,this.floatingSkipButton=null,this.floatingAdSkipText=null,this.isIos=i.isIos,this.isAndroid=i.isAndroid,this.isMobile=i.isMobile,this.refreshVideoLookAndFeel=i.refreshVideoLookAndFeel,this.initializeIframeAndVideo=n(10)(o,e).init,this.UIController=n(16)(o,e,t).init,this.displayVolumeControls=n(42)(o).displayVolumeControls,this.start=function(){r("WE ARE USING HTML5 PLAYER");var t=(new Date).getTime()+Math.floor(1e4*Math.random());o.options.techOrder=["html5"],o.options.iframeVideoWrapperId="iframeVideoWrapper_"+t;var n="an_video_ad_player_"+t,i="an_video_ad_player_"+t+"_html5_api";o.an_video_ad_player_id=n,o.an_video_ad_player_html5_api_id=i,e.divIdForVideo=n,e.videoId=i,o.targetElement=o.options.targetElement,o.initializeIframeAndVideo(o.UIController)}}},function(e,t,n){function i(e,t){if(!(e&&t&&e.getBoundingClientRect&&t.getBoundingClientRect))return s("Utils.elementsOverlap expects two html elements"),!1;var n=e.getBoundingClientRect(),i=t.getBoundingClientRect();return!(n.righti.right||n.bottomi.bottom)}var o="PlayerManager_Utils",r=n(9),a=function(e){r.verbose(e,o)},s=function(e){r.info(e,o)},l=function(){var e=/iphone/i.test(navigator.userAgent.toLowerCase());return e},d=function(){var e=l()||/ipad/i.test(navigator.userAgent.toLowerCase());return e},c=function(){return/android/i.test(navigator.userAgent.toLowerCase())},u=function(){return navigator.appVersion.indexOf("Mobile")>-1||navigator.appVersion.indexOf("Android")>-1},p=function(){var e=navigator.userAgent.match(/OS (\d+)_/i);if(e&&e[1])return e[1]},h=function(e,t){!t.isSkipped&&t.isExpanded&&(e.autoInitialSize&&!e.shouldResizeVideoToFillMobileWebview&&(e.width=e.targetElement.offsetWidth),t.resizeVideo(-1,u()),e.targetElement.style.height=e.height+"px")},m=function(e){d()&&e.options.enableInlineVideoForIos&&setTimeout(function(){var t=document.getElementById(e.options.iframeVideoWrapperId);t.style.width="",t.style.height=""},0)},f=function(e,t){var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),n.eventName=t,e.dispatchEvent(n)},v=function(){this.queue=[],this.id="",this.isSuppress=!1,this.isPaused=!1,this.isCompleted=!1;var e=100,t=!1;this.push=function(e){return this.isSuppress===!1&&"function"==typeof e?void e():t?void(t=!1):void(this.isPaused===!1&&this.queue.push(e))},this.start=function(){a("delay event starts");var t=this,n=function(){if(t.isSuppress===!1){var i=t.queue.shift();i&&"function"==typeof i&&i()}setTimeout(function(){t.isCompleted===!1&&n()},e)};n()},this.ImmediateStop=function(){this.isCompleted=!0},this.lazyTerminate=function(){var e=this,t=function(){e.ImmediateStop()};this.queue.push(t)},this.suppress=function(e){this.isSuppress=e},this.clearQueue=function(){this.queue=[]},this.ignoreNextQueue=function(){t=!0}},g=function(e){return"undefined"==typeof e||""===e||e===!1||null===e},y=function(e){if(null===e||void 0===e)return!0;if(0===e.length)return!0;if(""===e)return!0;if("object"!=typeof e)return!1;if(e.length>0)return!1;for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},A=function(){var e={};return{pushAndCheck:function(t,n){var i=t+"_"+n;return!e[i]&&(e[i]=!0,!0)}}},b=function(e){var t=!1;try{t=!isNaN(parseFloat(e))&&isFinite(e)}catch(n){a(n)}return t},k=function(e,t){try{var n=e.indexOf("%");if(n>0){if(t&&t>0){var i=Number(e.substring(0,n));return i>=0&&i<=100?Math.round(t*(i/100)):-1}return-1}n=e.indexOf(".");var o=n>0?Number(e.substring(n+1).substr(0,3)):0;n>0&&(e=e.substring(0,n));var r=e.split(":");if(3===r.length){for(var s=0;s0&&(i+=n+">"),i+=t,c(e)&&console.log(i)}catch(o){c(e)&&console.log(o)}}var p=0,h=1,m=2,f=3,v=4,g=5,y=6,A=6,b="AppNexus_Page_Debug_Log_Level",k=y,T=p,w=T,E=T,S=T,I=T;e.exports={traceAtLevel:function(){try{if(arguments.length>0){var e=arguments[0],t=Array.prototype.slice.call(arguments,1);o.call(this,e,t)}}catch(n){}},always:function(){try{o.call(this,h,Array.prototype.slice.call(arguments))}catch(e){}},error:function(){try{o.call(this,m,Array.prototype.slice.call(arguments))}catch(e){}},log:function(){try{o.call(this,g,Array.prototype.slice.call(arguments))}catch(e){}},warn:function(){try{o.call(this,f,Array.prototype.slice.call(arguments))}catch(e){}},info:function(){try{o.call(this,v,Array.prototype.slice.call(arguments))}catch(e){}},debug:function(){try{o.call(this,y,Array.prototype.slice.call(arguments))}catch(e){}},verbose:function(){try{o.call(this,A,Array.prototype.slice.call(arguments))}catch(e){}},handleLogDebugLegacySupport:function(e,t){try{u(g,e,t)}catch(n){}},setDebugLevel:function(e){try{d(e)}catch(t){}},isTraceLevelActive:function(e){try{return c(e)}catch(t){return!1}},TRACE_LEVEL_ALWAYS:h,TRACE_LEVEL_ERROR:m,TRACE_LEVEL_WARN:f,TRACE_LEVEL_INFO:v,TRACE_LEVEL_LOG:g,TRACE_LEVEL_DEBUG:y,TRACE_LEVEL_VERBOSE:A},l()},function(e,t,n){var i="[PlayerManager_InitializeElements]",o=n(9),r=n(11),a=function(e){o.verbose(i,e)},s=function(e){o.debug(i,e)},l=function(e){o.log(i,e)};e.exports=function(e,t){return{init:function(n){l("init");var i,o=!1;if(t.autoplayHandler.isRequiredFakeAndroidAutoStart(e.options.initialPlayback,e.options.initialAudio,e.options.automatedTestingOnlyAndroidSkipTouchStart,!0)){a("Setting correct iframe for androids 'fake' autostart");for(var d=e.options.targetElement.getElementsByTagName("iframe"),c=0;c-1;v&&t.overlayPlayer===!1?(i.onload=function(){m(),f=!0},setTimeout(function(){f===!1&&(a("destroying due to an error in firefox"),t.destroyWithoutSkip(!0,e.CONST_MESSAGE_GENERAL_ERROR,null,900))},e.options.vpaidTimeout)):m()}}}},function(e,t,n){var i=(n(12),n(14)),o=n(15),r=o.OmidSessionClient.AdSession,a=o.OmidSessionClient.Partner,s=o.OmidSessionClient.Context,l=o.OmidSessionClient.VerificationScriptResource,d=o.OmidSessionClient.AdEvents,c=o.OmidSessionClient.VideoEvents,u="[PlayerManager_Verifications]",p=n(9);e.exports=function(e,t){var n,o,h,m=e,f=t,v=[],g=new i(e,t.player),y=function(e){p.debug(u,"OMID sessionObserver");try{"sessionStart"===e.type?(p.debug(u,"OMID sessionStart"),""!==OMIDVideoEvents().position&&h.loaded({isSkippable:OMIDVideoEvents().isSkippable,isAutoPlay:OMIDVideoEvents().isAutoPlay,position:OMIDVideoEvents().position}),o.impressionOccurred()):"sessionError"===event.type?p.debug(u,"OMID sessionError"):"sessionFinish"===event.type&&p.debug(u,"OMID sessionFinish")}catch(t){p.debug(u,"Failed OMID sessionStart "+t)}};return{init:function(){p.debug(u,"init verifications");for(var e=0;e0)try{if(""!==getOMIDPartner().name&&""!==getOMIDPartner().version){var E=new a(getOMIDPartner().name,getOMIDPartner().version),S=new s(E,v);p.debug(u,"BuildTest::"+f.videoElement),S.setVideoElement(f.videoElement),n=new r(S),o=new d(n),h=new c(n),n.registerSessionObserver(y),p.debug(u,"OMID _adSession"),p.debug(u,n),p.debug(u,h)}}catch(w){p.debug(u,"Failed OMID registerSessionObserver "+w)}},start:function(){p.debug(u,"start verifications")},dispatchEvent:function(e,t){p.debug(u,"try to dispatch OMID event: "+e+", data: ",t);try{"start"===e?h.start(t.duration,t.videoPlayerVolume):"firstQuartile"===e?h.firstQuartile():"thirdQuartile"===e?h.thirdQuartile():"midpoint"===e?h.midpoint():"complete"===e?h.complete():"volumeChange"===e?h.volumeChange(t.videoPlayerVolume):"adUserInteraction"===e?h.adUserInteraction(t.interactionType):"resume"===e?h.resume():"pause"===e?h.pause():"playerStateChange"===e?h.playerStateChange(t.state):"skipped"===e&&h.skipped()}catch(n){p.debug(u,"Failed OMID Video Events "+n)}},destroy:function(){p.debug(u,"destroy verifications")}}}},function(e,t,n){var i=n(13),o="[PlayerManager_Verification_OMID]",r=n(9),a=function(e){r.debug(o,e)};e.exports=function(e,t){function n(){var e=(new Date).getTime(),t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)});return t}function s(e,t){p=e,h=t,v&&u()}function l(e,t){y&&y.addListener(e,t)}function d(){var e={apiVersion:"1.0",environment:"web",accessMode:"full",videElement:f.videoElement,adSessionType:"html",adCount:1,omidJsInfo:{omidImplementer:"videoads-ad-video-player-manager",serviceVersion:"3.5.19"}};return m.adServingId&&(e.adServingId=m.adServingId),e}function c(e){return e===m.vendor?m.verificationParams:null}function u(){r.debug(o,"start OMID session");var e={adSessionId:g,type:"sessionStart",timestamp:Date.now(),data:{context:d()}},t=c(h);t&&(e.data.verificationParameters=t),y=new i(g,p),p(e)}var p,h,m=e,f=t,v=!1,g=n(),y=null,A=[];return{init:function(){r.debug(o,"expose OMID interface"),f.frameWin.omid3p={registerSessionObserver:s,addEventListener:l}},start:function(){v=!0,p&&u()},dispatchEvent:function(e,t){y?(A.length>0&&(A.forEach(function(t){a("dispatch from cache OMID event "+e),y.fireEvent(t.eventName,t.data)}),A=[]),r.debug(o,"dispatch OMID event "+e),y.fireEvent(e,t)):(r.debug(o,"save in cache OMID event "+e),A.push({event:e,data:t}))},destroy:function(){if(r.debug(o,"terminate OMID session"),p&&v){var e={adSessionId:g,type:"sessionFinish",timestamp:Date.now()};p(e)}}}}},function(e,t){e.exports=function(e,t){function n(e,t){return!!e.find(function(e){return t===e})}function i(e){return n(u,e)||n(p,e)||n(h,e)||n(m,e)||n(f,e)}function o(e,t){var n=null;switch(e){case"sessionError":n={},t&&t.type&&(n.errorType=t.type),t&&t.message&&(n.message=t.message);break;case"impression":n={},n.mediaType="video";break;case"loaded":n={},n.skippable=t.skippable,n.skippable&&(n.skipOffset=parseInt(t.skipOffset/1e3+.5)),n.autoPlay=t.autoPlay,n.position=t.position;break;case"start":n={},n.duration=t.duration,n.videoPlayerVolume=t.volume;break;case"volumeChange":n={},n.videoPlayerVolume=t.volume;break;case"playerStateChange":n={},n.state=t.state;break;case"adUsetInteraction":n={},n.interactionType=t.interactionType}return n}function r(e,t){var n={adSessionId:l,type:e,timestamp:Date.now()},i=o(e,t);return i&&(n.data=i),n}function a(e){return"sessionError"===e}function s(e,t){c.hasOwnProperty(e)||(c[e]=[]),c[e].push(t)}var l=e,d=t,c={},u=["sessionStart","sessionError","sessionFinish"],p=["impression"],h=["loaded","start","firstQuartile","midpoint","thirdQuartile","complete","pause","resume","bufferStart","bufferFinish","skipped","volumeChange","playerStateChange","adUserInteraction"],m=["geometryChange"],f=["video"];return{addListener:function(e,t){i(e)&&(n(f,e)?h.forEach(function(e){s(e,t)}):s(e,t))},fireEvent:function(e,t){if(c.hasOwnProperty(e)){var n=r(e,t);a(e)?d(n):c[e].forEach(function(e){e(n)})}}}}},function(e,t,n){var i="[PlayerManager_Verification_Tracking]",o=n(9);e.exports=function(e,t){function n(e,t){var n=e;if(t)for(var i in t)n=n.split("["+i.toUpperCase()+"]").join(encodeURIComponent(t[i]));return n=a(n)}function r(){var e=(new Date).getTime(),t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)});return t}function a(e){for(var n in c)if(e.indexOf("["+n+"]")>=0){var i=c[n];null===i&&(i=t?t.resolveMacro(n):-1),e=e.split("["+n+"]").join(encodeURIComponent(i))}return e}for(var s={},l=0;li)throw Error("Value for "+e+" is outside the range ["+n+","+i+"]")},assertFunction:function(e,t){if(!t)throw Error(e+" must not be truthy.")},assertPositiveNumber:function(e,t){if((0,module$exports$omid$common$argsChecker.assertNumber)(e,t),0>t)throw Error(e+" must be a positive number.")}},module$exports$omid$common$exporter={};module$exports$omid$common$exporter.packageExport=function(e,t,n){(n=void 0===n?module$contents$omid$common$exporter_getOmidExports():n)&&(e=e.split("."),e.slice(0,e.length-1).reduce(module$contents$omid$common$exporter_getOrCreateName,n)[e[e.length-1]]=t)};var module$exports$omid$sessionClient$Partner=function(e,t){module$exports$omid$common$argsChecker.assertTruthyString("Partner.name",e),module$exports$omid$common$argsChecker.assertTruthyString("Partner.version",t),this.name=e,this.version=t};(0,module$exports$omid$common$exporter.packageExport)("OmidSessionClient.Partner",module$exports$omid$sessionClient$Partner);var module$exports$omid$sessionClient$VerificationScriptResource=function(e,t,n){module$exports$omid$common$argsChecker.assertTruthyString("VerificationScriptResource.resourceUrl",e),this.resourceUrl=e,this.vendorKey=t,this.verificationParameters=n};(0,module$exports$omid$common$exporter.packageExport)("OmidSessionClient.VerificationScriptResource",module$exports$omid$sessionClient$VerificationScriptResource);var module$exports$omid$sessionClient$Context=function(e,t){module$exports$omid$common$argsChecker.assertNotNullObject("Context.partner",e),this.partner=e,this.verificationScriptResources=t,this.videoElement=this.slotElement=null};module$exports$omid$sessionClient$Context.prototype.setVideoElement=function(e){module$exports$omid$common$argsChecker.assertNotNullObject("Context.videoElement",e),this.videoElement=e},module$exports$omid$sessionClient$Context.prototype.setSlotElement=function(e){module$exports$omid$common$argsChecker.assertNotNullObject("Context.slotElement",e),this.slotElement=e},(0,module$exports$omid$common$exporter.packageExport)("OmidSessionClient.Context",module$exports$omid$sessionClient$Context);var module$exports$omid$common$OmidGlobalProvider={},module$contents$omid$common$OmidGlobalProvider_globalThis=eval("this");module$exports$omid$common$OmidGlobalProvider.omidGlobal=module$contents$omid$common$OmidGlobalProvider_getOmidGlobal();var module$contents$omid$sessionClient$OmidJsSessionInterface_ExportedNodeKeys={ROOT:"omidSessionInterface",AD_EVENTS:"adEvents",VIDEO_EVENTS:"videoEvents"},module$contents$omid$sessionClient$OmidJsSessionInterface_MethodNameMap={sessionError:"reportError"},module$contents$omid$sessionClient$OmidJsSessionInterface_VideoEventMethodNames=Object.keys(module$exports$omid$common$constants.VideoEventType).map(function(e){return module$exports$omid$common$constants.VideoEventType[e]}),module$contents$omid$sessionClient$OmidJsSessionInterface_AdEventMethodNames=["impressionOccurred"],module$exports$omid$sessionClient$OmidJsSessionInterface=function(e){e=void 0===e?module$exports$omid$common$OmidGlobalProvider.omidGlobal:e,this.interfaceRoot_=e[module$contents$omid$sessionClient$OmidJsSessionInterface_ExportedNodeKeys.ROOT]};module$exports$omid$sessionClient$OmidJsSessionInterface.prototype.isSupported=function(){return null!=this.interfaceRoot_},module$exports$omid$sessionClient$OmidJsSessionInterface.prototype.sendMessage=function(e,t,n){if("registerSessionObserver"==e&&(n=[t]),module$contents$omid$sessionClient$OmidJsSessionInterface_MethodNameMap[e]&&(e=module$contents$omid$sessionClient$OmidJsSessionInterface_MethodNameMap[e]),t=this.interfaceRoot_,0<=module$contents$omid$sessionClient$OmidJsSessionInterface_AdEventMethodNames.indexOf(e)&&(t=t[module$contents$omid$sessionClient$OmidJsSessionInterface_ExportedNodeKeys.AD_EVENTS]),0<=module$contents$omid$sessionClient$OmidJsSessionInterface_VideoEventMethodNames.indexOf(e)&&(t=t[module$contents$omid$sessionClient$OmidJsSessionInterface_ExportedNodeKeys.VIDEO_EVENTS]),t=t[e],!t)throw Error("Unrecognized method name: "+e+".");t.apply(null,$jscomp.arrayFromIterable(n))};var module$exports$omid$common$Rectangle=function(e,t,n,i){this.x=e,this.y=t,this.width=n,this.height=i},module$exports$omid$common$logger={error:function(e){for(var t=[],n=0;no)break;if(i