Skip to content

Commit

Permalink
Merge remote-tracking branch 'mopub/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jindoujiao committed Aug 14, 2017
2 parents cf02e62 + 542a62f commit 89e48aa
Show file tree
Hide file tree
Showing 31 changed files with 547 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#endif

/*
* Please reference the Supported Mediation Partner page at http://bit.ly/2mqsuFH for the
* latest version and ad format certifications.
* Certified with Chartboost 6.6.3
*/
@interface ChartboostInterstitialCustomEvent : MPInterstitialCustomEvent

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#endif

/*
* Please reference the Supported Mediation Partner page at http://bit.ly/2mqsuFH for the
* latest version and ad format certifications.
* Certified with Chartboost 6.6.3
*/
@interface ChartboostRewardedVideoCustomEvent : MPRewardedVideoCustomEvent

Expand Down
11 changes: 8 additions & 3 deletions AdNetworkSupport/Facebook/FacebookBannerCustomEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,24 @@ - (void)dealloc

#pragma mark FBAdViewDelegate methods

- (void)adView:(FBAdView *)adView didFailWithError:(NSError *)error;
- (void)adView:(FBAdView *)adView didFailWithError:(NSError *)error
{
MPLogInfo(@"Facebook banner failed to load with error: %@", error.description);
[self.delegate bannerCustomEvent:self didFailToLoadAdWithError:error];
}

- (void)adViewDidLoad:(FBAdView *)adView;
- (void)adViewDidLoad:(FBAdView *)adView
{
MPLogInfo(@"Facebook banner ad did load");
[self.delegate trackImpression];
[self.delegate bannerCustomEvent:self didLoadAd:adView];
}

- (void)adViewWillLogImpression:(FBAdView *)adView
{
MPLogInfo(@"Facebook banner ad did log impression");
[self.delegate trackImpression];
}

- (void)adViewDidClick:(FBAdView *)adView
{
MPLogInfo(@"Facebook banner ad was clicked");
Expand Down
5 changes: 5 additions & 0 deletions AdNetworkSupport/Facebook/FacebookInterstitialCustomEvent.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ - (void)interstitialAdDidLoad:(FBInterstitialAd *)interstitialAd
[self.delegate interstitialCustomEvent:self didLoadAd:interstitialAd];
}

- (void)interstitialAdWillLogImpression:(FBInterstitialAd *)interstitialAd
{
MPLogInfo(@"Facebook intersitital ad is logging impressions for interstitials");
}

- (void)interstitialAd:(FBInterstitialAd *)interstitialAd didFailWithError:(NSError *)error
{
MPLogInfo(@"Facebook intersitital ad failed to load with error: %@", error.description);
Expand Down
3 changes: 1 addition & 2 deletions AdNetworkSupport/Flurry/FlurryBannerCustomEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
#endif

/*
* Please reference the Supported Mediation Partner page at http://bit.ly/2mqsuFH for the
* latest version and ad format certifications.
* Certified with Flurry 8.0.0
*/
@interface FlurryBannerCustomEvent : MPBannerCustomEvent <FlurryAdBannerDelegate>

Expand Down
3 changes: 1 addition & 2 deletions AdNetworkSupport/Flurry/FlurryInterstitialCustomEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
#endif

/*
* Please reference the Supported Mediation Partner page at http://bit.ly/2mqsuFH for the
* latest version and ad format certifications.
* Certified with Flurry 8.0.0
*/
@interface FlurryInterstitialCustomEvent : MPInterstitialCustomEvent<FlurryAdInterstitialDelegate>

Expand Down
3 changes: 1 addition & 2 deletions AdNetworkSupport/Flurry/FlurryNativeCustomEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
#endif

/*
* Please reference the Supported Mediation Partner page at http://bit.ly/2mqsuFH for the
* latest version and ad format certifications.
* Certified with Flurry 8.0.0
*/
@interface FlurryNativeCustomEvent : MPNativeCustomEvent

Expand Down
3 changes: 1 addition & 2 deletions AdNetworkSupport/Flurry/FlurryNativeVideoAdRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
@class MPStaticNativeAdRendererSettings;

/*
* Please reference the Supported Mediation Partner page at http://bit.ly/2mqsuFH for the
* latest version and ad format certifications.
* Certified with Flurry 8.0.0
*/
@interface FlurryNativeVideoAdRenderer : NSObject <MPNativeAdRenderer>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ - (void)dealloc
self.interstitial.delegate = nil;
}

#pragma mark - IMAdInterstitialDelegate
#pragma mark - GADInterstitialDelegate

- (void)interstitialDidReceiveAd:(GADInterstitial *)interstitial
{
Expand Down Expand Up @@ -121,6 +121,7 @@ - (void)interstitialWillLeaveApplication:(GADInterstitial *)ad
{
MPLogInfo(@"Google AdMob Interstitial will leave application");
[self.delegate interstitialCustomEventDidReceiveTapEvent:self];
[self.delegate interstitialCustomEventWillLeaveApplication:self];
}

@end
41 changes: 23 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
## Version 4.15.0 (June 19th, 2017)
- **Bug Fixes**
- Updated Facebook Audience Network banner and interstitial impression tracking
- Allow taps to pass through the gradient overlays for rewarded videos

## Version 4.14.0 (May 10th, 2017)
- **Features**
- For Rewarded ads, the client-side callback will now be invoked when using server-side rewarding.
- Non-mediated interstitial, rewarded, and native ad placer ads will expire within 4 hours.
- For Rewarded ads, the client-side callback will now be invoked when using server-side rewarding.
- Non-mediated interstitial, rewarded, and native ad placer ads will expire within 4 hours.

- **Bug Fixes**
- Fix old custom events that use the wrong native renderer.
- Replace usage of typeof with __typeof__ for C99 and C11 compliance.
- Fix CFBridgingRetain casting bug.
- Native ad impression tracker will now fire while scrolling.
- Fix HTML click tracker to fire when using window.location and window.open.
- Fix old custom events that use the wrong native renderer.
- Replace usage of typeof with __typeof__ for C99 and C11 compliance.
- Fix CFBridgingRetain casting bug.
- Native ad impression tracker will now fire while scrolling.
- Fix HTML click tracker to fire when using window.location and window.open.

## Version 4.13.1 (April 6th, 2017)
- **Bug Fixes**
- Fixed compile error in the MoPub Base SDK Excluding Native bundle.
- Fixed compile error in the MoPub Base SDK Excluding Native bundle.

## Version 4.13.0 (March 23rd, 2017)
- **Features**
- Added support for mediation of Google AdMob rewarded video demand (Google Mobile Ads SDK v7.19.0).
- Google AdMob native ads mediation is now generally available (Google Mobile Ads SDK v7.19.0).
- Updated the Tapjoy network mediation adapter to support Tapjoy SDK v11.10.0
- Added support for mediation of Google AdMob rewarded video demand (Google Mobile Ads SDK v7.19.0).
- Google AdMob native ads mediation is now generally available (Google Mobile Ads SDK v7.19.0).
- Updated the Tapjoy network mediation adapter to support Tapjoy SDK v11.10.0

- **Bug Fixes**
- Introduced additional preventative measures to improve creative quality.
- Introduced additional preventative measures to improve creative quality.

## Version 4.12.0 (February 9th, 2017)
- **Features**
- Rewarded ad units now support rich media.
- Allow MoPub static native renderer to render Flurry native ads.
- Removed size limit for native ad main images.
- Rewarded ad units now support rich media.
- Allow MoPub static native renderer to render Flurry native ads.
- Removed size limit for native ad main images.

- **Bug Fixes**
- Native video selection logic now filters by supported MIME types.
- Ad placer now supports section count.
- Fix CFStringRef variable initialization.
- Native video selection logic now filters by supported MIME types.
- Ad placer now supports section count.
- Fix CFStringRef variable initialization.

## Version 4.11.1 (November 28th, 2016)
- **App Transport Security Updates**
Expand Down
28 changes: 27 additions & 1 deletion MoPubSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,11 @@
B294E06A1BACDB1E00909531 /* MOPUBNativeVideoAdRendererSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = B294E0661BACDB1E00909531 /* MOPUBNativeVideoAdRendererSettings.m */; };
B294E06B1BACDB1E00909531 /* MOPUBNativeVideoAdRendererSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = B294E0661BACDB1E00909531 /* MOPUBNativeVideoAdRendererSettings.m */; };
B2C14D8A1C98C3B600F3D554 /* CedarApplicationDelegate+MPSpecs.m in Sources */ = {isa = PBXBuildFile; fileRef = B2C14D891C98C3B600F3D554 /* CedarApplicationDelegate+MPSpecs.m */; };
B2D54B561ED20521004E3C7B /* MOPUBExperimentProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = B2D54B551ED20521004E3C7B /* MOPUBExperimentProvider.m */; };
B2D54B621ED2058E004E3C7B /* SafariServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2D54B611ED2058E004E3C7B /* SafariServices.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
B2D54B651ED20B80004E3C7B /* MPAdConfiguration+Testing.m in Sources */ = {isa = PBXBuildFile; fileRef = B2D54B641ED20B80004E3C7B /* MPAdConfiguration+Testing.m */; };
B2D54B671ED20C95004E3C7B /* MOPUBExperimentProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B2D54B661ED20C95004E3C7B /* MOPUBExperimentProviderTests.m */; };
B2D54B691ED20FA1004E3C7B /* MPURLResolverTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B2D54B681ED20FA1004E3C7B /* MPURLResolverTests.m */; };
B2E3F54E1BAB8529000BB32D /* MOPUBNativeVideoAdRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E3F53C1BAB8529000BB32D /* MOPUBNativeVideoAdRenderer.m */; };
B2E3F54F1BAB8529000BB32D /* MOPUBNativeVideoAdRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E3F53C1BAB8529000BB32D /* MOPUBNativeVideoAdRenderer.m */; };
B2E3F5501BAB8529000BB32D /* MOPUBNativeVideoAdRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E3F53C1BAB8529000BB32D /* MOPUBNativeVideoAdRenderer.m */; };
Expand Down Expand Up @@ -2029,6 +2034,7 @@
B257A3061BA3911300F5D320 /* MPUnmutedBtn.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MPUnmutedBtn.png; sourceTree = "<group>"; };
B257A3071BA3911300F5D320 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
B257A3081BA3911300F5D320 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
B2745AA41EEB195300A86A5B /* MOPUBExperimentProvider+Testing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MOPUBExperimentProvider+Testing.h"; sourceTree = "<group>"; };
B27783881CE3BA5C00BAB0B1 /* MPRewardedVideoConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPRewardedVideoConnection.h; sourceTree = "<group>"; };
B27783891CE3BA5C00BAB0B1 /* MPRewardedVideoConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPRewardedVideoConnection.m; sourceTree = "<group>"; };
B27783A01CE3D47400BAB0B1 /* MPRewardedVideoConnectionSpec.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MPRewardedVideoConnectionSpec.mm; sourceTree = "<group>"; };
Expand All @@ -2040,6 +2046,13 @@
B294E0661BACDB1E00909531 /* MOPUBNativeVideoAdRendererSettings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MOPUBNativeVideoAdRendererSettings.m; sourceTree = "<group>"; };
B2C14D881C98C3B600F3D554 /* CedarApplicationDelegate+MPSpecs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CedarApplicationDelegate+MPSpecs.h"; sourceTree = "<group>"; };
B2C14D891C98C3B600F3D554 /* CedarApplicationDelegate+MPSpecs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CedarApplicationDelegate+MPSpecs.m"; sourceTree = "<group>"; };
B2D54B541ED20521004E3C7B /* MOPUBExperimentProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MOPUBExperimentProvider.h; path = Internal/Utility/MOPUBExperimentProvider.h; sourceTree = "<group>"; };
B2D54B551ED20521004E3C7B /* MOPUBExperimentProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MOPUBExperimentProvider.m; path = Internal/Utility/MOPUBExperimentProvider.m; sourceTree = "<group>"; };
B2D54B611ED2058E004E3C7B /* SafariServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SafariServices.framework; path = System/Library/Frameworks/SafariServices.framework; sourceTree = SDKROOT; };
B2D54B631ED20B80004E3C7B /* MPAdConfiguration+Testing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MPAdConfiguration+Testing.h"; sourceTree = "<group>"; };
B2D54B641ED20B80004E3C7B /* MPAdConfiguration+Testing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MPAdConfiguration+Testing.m"; sourceTree = "<group>"; };
B2D54B661ED20C95004E3C7B /* MOPUBExperimentProviderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MOPUBExperimentProviderTests.m; sourceTree = "<group>"; };
B2D54B681ED20FA1004E3C7B /* MPURLResolverTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPURLResolverTests.m; sourceTree = "<group>"; };
B2E3F53B1BAB8529000BB32D /* MOPUBNativeVideoAdRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MOPUBNativeVideoAdRenderer.h; sourceTree = "<group>"; };
B2E3F53C1BAB8529000BB32D /* MOPUBNativeVideoAdRenderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MOPUBNativeVideoAdRenderer.m; sourceTree = "<group>"; };
B2E47F641C7E362A00DE5EA6 /* MPMoPubRewardedVideoCustomEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPMoPubRewardedVideoCustomEvent.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2132,6 +2145,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B2D54B621ED2058E004E3C7B /* SafariServices.framework in Frameworks */,
BC8621371DCBE0EC0012275D /* MediaPlayer.framework in Frameworks */,
BC8621361DCBE0DA0012275D /* SystemConfiguration.framework in Frameworks */,
BC8621351DCBE0C70012275D /* MessageUI.framework in Frameworks */,
Expand Down Expand Up @@ -2258,6 +2272,8 @@
2AF177321E9846A000A600BD /* MPRewardedVideoAdapterTests.m */,
2A922D391E9C4CF900F83923 /* MPInterstitialCustomEventAdapterTests.m */,
2AFF1BA61EC289E600495994 /* MPRealTimeTimerTests.m */,
B2D54B661ED20C95004E3C7B /* MOPUBExperimentProviderTests.m */,
B2D54B681ED20FA1004E3C7B /* MPURLResolverTests.m */,
);
path = MoPubSDKTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -3060,6 +3076,7 @@
AEF1F32A16EF9AD700273462 /* Frameworks */ = {
isa = PBXGroup;
children = (
B2D54B611ED2058E004E3C7B /* SafariServices.framework */,
BC86212F1DCBE0590012275D /* CoreMotion.framework */,
BC86212A1DCBE00D0012275D /* AVKit.framework */,
AEE38886171F4EEE0019601C /* AddressBook.framework */,
Expand Down Expand Up @@ -3099,6 +3116,8 @@
AEF9D4C6171CA895005AAA5A /* MoPubSDK */ = {
isa = PBXGroup;
children = (
B2D54B541ED20521004E3C7B /* MOPUBExperimentProvider.h */,
B2D54B551ED20521004E3C7B /* MOPUBExperimentProvider.m */,
B27114991B8549ED0066CE82 /* NativeVideo */,
57ACE3ED1AA7E8D900A05633 /* RewardedVideo */,
A77FBED818C533B400531E8A /* Native Ads */,
Expand Down Expand Up @@ -3865,8 +3884,8 @@
BCAED25F1DF628D400D45480 /* MPMoPubRewardedPlayableCustomEvent+Testing.h */,
BCAED2601DF628D400D45480 /* MPMoPubRewardedPlayableCustomEvent+Testing.m */,
BC246A771E5675CB00CEFA33 /* MPRewardedVideoAdManager+Testing.h */,
BC246A781E5675CB00CEFA33 /* MPRewardedVideoAdManager+Testing.m */,
BCAC6F6C1E5D0730002B2656 /* MPRewardedVideo+Testing.h */,
BC246A781E5675CB00CEFA33 /* MPRewardedVideoAdManager+Testing.m */,
BCAC6F6D1E5D0730002B2656 /* MPRewardedVideo+Testing.m */,
BCB43DCC1E5F932000A95E22 /* NSURLComponents+Testing.h */,
BCB43DCD1E5F932000A95E22 /* NSURLComponents+Testing.m */,
Expand All @@ -3878,6 +3897,9 @@
2AB6301B1E9C2D0C00B0DDC7 /* MPConstants+Testing.m */,
2AE45D3C1E9D8FFA00ED5DD2 /* MPInterstitialCustomEventAdapter+Testing.h */,
2AE45D3D1E9D8FFA00ED5DD2 /* MPInterstitialCustomEventAdapter+Testing.m */,
B2D54B631ED20B80004E3C7B /* MPAdConfiguration+Testing.h */,
B2D54B641ED20B80004E3C7B /* MPAdConfiguration+Testing.m */,
B2745AA41EEB195300A86A5B /* MOPUBExperimentProvider+Testing.h */,
);
name = Categories;
sourceTree = "<group>";
Expand Down Expand Up @@ -4385,13 +4407,16 @@
BC08C7831E36AD7C00444F16 /* MPVASTLinearAdTests.m in Sources */,
2AE45D3E1E9D8FFA00ED5DD2 /* MPInterstitialCustomEventAdapter+Testing.m in Sources */,
2AF177441E984DED00A600BD /* MPRewardedVideoAdapterDelegateHandler.m in Sources */,
B2D54B671ED20C95004E3C7B /* MOPUBExperimentProviderTests.m in Sources */,
B23C3B641E3588190003D79E /* MPAdConfigurationFactory.m in Sources */,
BCAED2541DF6194E00D45480 /* MPMoPubRewardedPlayableCustomEventTests.m in Sources */,
B2D54B691ED20FA1004E3C7B /* MPURLResolverTests.m in Sources */,
BC246A7C1E56795000CEFA33 /* MPRewardedVideoDelegateHandler.m in Sources */,
2AE45D3B1E9D882B00ED5DD2 /* MPInterstitialAdapterDelegateHandler.m in Sources */,
BCAED2611DF628D400D45480 /* MPMoPubRewardedPlayableCustomEvent+Testing.m in Sources */,
BC246A6C1E5672AA00CEFA33 /* MPRewardedVideoAdManagerTests.m in Sources */,
BCAC6F5E1E5CF6F5002B2656 /* MPRewardedVideoTests.m in Sources */,
B2D54B651ED20B80004E3C7B /* MPAdConfiguration+Testing.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -4582,6 +4607,7 @@
AE515F47171F1B110086B464 /* MPBaseBannerAdapter.m in Sources */,
B294E0681BACDB1E00909531 /* MOPUBNativeVideoAdRendererSettings.m in Sources */,
A7759F061A1EB19500087E00 /* MPGeolocationProvider.m in Sources */,
B2D54B561ED20521004E3C7B /* MOPUBExperimentProvider.m in Sources */,
57E6B8801BA25B4B001FE403 /* MPNativeAd+Internal.m in Sources */,
573A82F71B8E488400ED4067 /* MPNativeView.m in Sources */,
A776A5561B5DDFD800095706 /* MPVASTCompanionAd.m in Sources */,
Expand Down
2 changes: 2 additions & 0 deletions MoPubSDK/Internal/Common/MPAdConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ extern NSString * const kAdTypeClear;
extern NSString * const kAdTypeNative;
extern NSString * const kAdTypeNativeVideo;

extern NSString * const kClickthroughExperimentBrowserAgent;

@interface MPAdConfiguration : NSObject

@property (nonatomic, assign) MPAdType adType;
Expand Down
25 changes: 25 additions & 0 deletions MoPubSDK/Internal/Common/MPAdConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import "math.h"
#import "NSJSONSerialization+MPAdditions.h"
#import "MPRewardedVideoReward.h"
#import "MOPUBExperimentProvider.h"

#if MP_HAS_NATIVE_PACKAGE
#import "MPVASTTrackingEvent.h"
Expand Down Expand Up @@ -73,11 +74,16 @@
NSString * const kNativeVideoTrackerEventDictionaryKey = @"event";
NSString * const kNativeVideoTrackerTextDictionaryKey = @"text";

// clickthrough experiment
NSString * const kClickthroughExperimentBrowserAgent = @"X-Browser-Agent";
static const NSInteger kMaximumVariantForClickthroughExperiment = 2;


@interface MPAdConfiguration ()

@property (nonatomic, copy) NSString *adResponseHTMLString;
@property (nonatomic, strong, readwrite) NSArray *availableRewards;
@property (nonatomic) MOPUBDisplayAgentType clickthroughExperimentBrowserAgent;

- (MPAdType)adTypeFromHeaders:(NSDictionary *)headers;
- (NSString *)networkTypeFromHeaders:(NSDictionary *)headers;
Expand Down Expand Up @@ -199,6 +205,10 @@ - (id)initWithHeaders:(NSDictionary *)headers data:(NSData *)data
// rewarded playables
self.rewardedPlayableDuration = [self timeIntervalFromHeaders:headers forKey:kRewardedPlayableDurationHeaderKey];
self.rewardedPlayableShouldRewardOnClick = [[headers objectForKey:kRewardedPlayableRewardOnClickHeaderKey] boolValue];

// clickthrough experiment
self.clickthroughExperimentBrowserAgent = [self clickthroughExperimentVariantFromHeaders:headers forKey:kClickthroughExperimentBrowserAgent];
[MOPUBExperimentProvider setDisplayAgentFromAdServer:self.clickthroughExperimentBrowserAgent];
}
return self;
}
Expand Down Expand Up @@ -466,4 +476,19 @@ - (NSArray *)parseAvailableRewardsFromHeaders:(NSDictionary *)headers {
return availableRewards;
}

- (MOPUBDisplayAgentType)clickthroughExperimentVariantFromHeaders:(NSDictionary *)headers forKey:(NSString *)key
{
NSString *variantString = [headers objectForKey:key];
NSInteger variant = 0;
if (variantString) {
int parsedInt = -1;
BOOL isNumber = [[NSScanner scannerWithString:variantString] scanInt:&parsedInt];
if (isNumber && parsedInt >= 0 && parsedInt <= kMaximumVariantForClickthroughExperiment) {
variant = parsedInt;
}
}

return variant;
}

@end
Loading

0 comments on commit 89e48aa

Please sign in to comment.