-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mopub] [ios] Added Mopub framework.
- Loading branch information
1 parent
d5ea81c
commit 5733437
Showing
405 changed files
with
37,363 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
3 changes: 0 additions & 3 deletions
3
iphone/Maps/3party/FBAudienceNetwork.framework/FBAudienceNetwork
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
iphone/Maps/3party/FBAudienceNetwork.framework/FBAudienceNetwork-DynamicFramework.xcconfig
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
iphone/Maps/3party/FBAudienceNetwork.framework/Headers/FBInstreamAdView.h
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
20 changes: 20 additions & 0 deletions
20
iphone/Maps/3party/MoPubSDK/AdNetworkSupport/Facebook/FacebookBannerCustomEvent.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// FacebookBannerCustomEvent.h | ||
// MoPub | ||
// | ||
// Copyright (c) 2014 MoPub. All rights reserved. | ||
// | ||
|
||
#if __has_include(<MoPub/MoPub.h>) | ||
#import <MoPub/MoPub.h> | ||
#else | ||
#import "MPBannerCustomEvent.h" | ||
#endif | ||
|
||
/* | ||
* Please reference the Supported Mediation Partner page at http://bit.ly/2mqsuFH for the | ||
* latest version and ad format certifications. | ||
*/ | ||
@interface FacebookBannerCustomEvent : MPBannerCustomEvent | ||
|
||
@end |
141 changes: 141 additions & 0 deletions
141
iphone/Maps/3party/MoPubSDK/AdNetworkSupport/Facebook/FacebookBannerCustomEvent.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
// | ||
// FacebookBannerCustomEvent.m | ||
// MoPub | ||
// | ||
// Copyright (c) 2014 MoPub. All rights reserved. | ||
// | ||
|
||
#import <FBAudienceNetwork/FBAudienceNetwork.h> | ||
#import "FacebookBannerCustomEvent.h" | ||
|
||
#import "MPInstanceProvider.h" | ||
#import "MPLogging.h" | ||
|
||
@interface MPInstanceProvider (FacebookBanners) | ||
|
||
- (FBAdView *)buildFBAdViewWithPlacementID:(NSString *)placementID | ||
size:(FBAdSize)size | ||
rootViewController:(UIViewController *)controller | ||
delegate:(id<FBAdViewDelegate>)delegate; | ||
@end | ||
|
||
@implementation MPInstanceProvider (FacebookBanners) | ||
|
||
- (FBAdView *)buildFBAdViewWithPlacementID:(NSString *)placementID | ||
size:(FBAdSize)size | ||
rootViewController:(UIViewController *)controller | ||
delegate:(id<FBAdViewDelegate>)delegate | ||
{ | ||
FBAdView *adView = [[FBAdView alloc] initWithPlacementID:placementID | ||
adSize:size | ||
rootViewController:controller]; | ||
adView.delegate = delegate; | ||
[adView disableAutoRefresh]; | ||
return adView; | ||
} | ||
|
||
@end | ||
|
||
@interface FacebookBannerCustomEvent () <FBAdViewDelegate> | ||
|
||
@property (nonatomic, strong) FBAdView *fbAdView; | ||
|
||
@end | ||
|
||
@implementation FacebookBannerCustomEvent | ||
|
||
- (BOOL)enableAutomaticImpressionAndClickTracking | ||
{ | ||
return NO; | ||
} | ||
|
||
- (void)requestAdWithSize:(CGSize)size customEventInfo:(NSDictionary *)info | ||
{ | ||
/** | ||
* Facebook Banner ads can accept arbitrary widths for given heights of 50 and 90. We convert these sizes | ||
* to Facebook's constants and set the fbAdView's size to the intended size ("size" passed to this method). | ||
*/ | ||
FBAdSize fbAdSize; | ||
if (CGSizeEqualToSize(size, kFBAdSize320x50.size)) { | ||
fbAdSize = kFBAdSize320x50; | ||
} else if (size.height == kFBAdSizeHeight250Rectangle.size.height) { | ||
fbAdSize = kFBAdSizeHeight250Rectangle; | ||
} else if (size.height == kFBAdSizeHeight90Banner.size.height) { | ||
fbAdSize = kFBAdSizeHeight90Banner; | ||
} else if (size.height == kFBAdSizeHeight50Banner.size.height) { | ||
fbAdSize = kFBAdSizeHeight50Banner; | ||
} else { | ||
MPLogError(@"Invalid size for Facebook banner ad"); | ||
[self.delegate bannerCustomEvent:self didFailToLoadAdWithError:nil]; | ||
return; | ||
} | ||
|
||
if (![info objectForKey:@"placement_id"]) { | ||
MPLogError(@"Placement ID is required for Facebook banner ad"); | ||
[self.delegate bannerCustomEvent:self didFailToLoadAdWithError:nil]; | ||
return; | ||
} | ||
|
||
MPLogInfo(@"Requesting Facebook banner ad"); | ||
self.fbAdView = | ||
[[MPInstanceProvider sharedProvider] buildFBAdViewWithPlacementID:[info objectForKey:@"placement_id"] | ||
size:fbAdSize | ||
rootViewController:[self.delegate viewControllerForPresentingModalView] | ||
delegate:self]; | ||
|
||
if (!self.fbAdView) { | ||
[self.delegate bannerCustomEvent:self didFailToLoadAdWithError:nil]; | ||
return; | ||
} | ||
|
||
/* | ||
* Manually resize the frame of the FBAdView due to a bug in the Facebook SDK that sets the ad's width | ||
* to the width of the device instead of the width of the container it's placed in. | ||
* (Confirmed in email with a FB Solutions Engineer) | ||
*/ | ||
CGRect fbAdFrame = self.fbAdView.frame; | ||
fbAdFrame.size = size; | ||
self.fbAdView.frame = fbAdFrame; | ||
|
||
[self.fbAdView loadAd]; | ||
} | ||
|
||
- (void)dealloc | ||
{ | ||
_fbAdView.delegate = nil; | ||
} | ||
|
||
#pragma mark FBAdViewDelegate methods | ||
|
||
- (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; | ||
{ | ||
MPLogInfo(@"Facebook banner ad did load"); | ||
[self.delegate trackImpression]; | ||
[self.delegate bannerCustomEvent:self didLoadAd:adView]; | ||
} | ||
|
||
- (void)adViewDidClick:(FBAdView *)adView | ||
{ | ||
MPLogInfo(@"Facebook banner ad was clicked"); | ||
[self.delegate trackClick]; | ||
[self.delegate bannerCustomEventWillBeginAction:self]; | ||
} | ||
|
||
- (void)adViewDidFinishHandlingClick:(FBAdView *)adView | ||
{ | ||
MPLogInfo(@"Facebook banner ad did finish handling click"); | ||
[self.delegate bannerCustomEventDidFinishAction:self]; | ||
} | ||
|
||
- (UIViewController *)viewControllerForPresentingModalView | ||
{ | ||
return [self.delegate viewControllerForPresentingModalView]; | ||
} | ||
|
||
@end |
20 changes: 20 additions & 0 deletions
20
iphone/Maps/3party/MoPubSDK/AdNetworkSupport/Facebook/FacebookInterstitialCustomEvent.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// FacebookInterstitialCustomEvent.h | ||
// MoPub | ||
// | ||
// Copyright (c) 2014 MoPub. All rights reserved. | ||
// | ||
|
||
#if __has_include(<MoPub/MoPub.h>) | ||
#import <MoPub/MoPub.h> | ||
#else | ||
#import "MPInterstitialCustomEvent.h" | ||
#endif | ||
|
||
/* | ||
* Please reference the Supported Mediation Partner page at http://bit.ly/2mqsuFH for the | ||
* latest version and ad format certifications. | ||
*/ | ||
@interface FacebookInterstitialCustomEvent : MPInterstitialCustomEvent | ||
|
||
@end |
108 changes: 108 additions & 0 deletions
108
iphone/Maps/3party/MoPubSDK/AdNetworkSupport/Facebook/FacebookInterstitialCustomEvent.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
// | ||
// FacebookInterstitialCustomEvent.m | ||
// MoPub | ||
// | ||
// Copyright (c) 2014 MoPub. All rights reserved. | ||
// | ||
|
||
#import <FBAudienceNetwork/FBAudienceNetwork.h> | ||
#import "FacebookInterstitialCustomEvent.h" | ||
|
||
#import "MPInstanceProvider.h" | ||
#import "MPLogging.h" | ||
|
||
@interface MPInstanceProvider (FacebookInterstitials) | ||
|
||
- (FBInterstitialAd *)buildFBInterstitialAdWithPlacementID:(NSString *)placementID | ||
delegate:(id<FBInterstitialAdDelegate>)delegate; | ||
|
||
@end | ||
|
||
@implementation MPInstanceProvider (FacebookInterstitials) | ||
|
||
- (FBInterstitialAd *)buildFBInterstitialAdWithPlacementID:(NSString *)placementID | ||
delegate:(id<FBInterstitialAdDelegate>)delegate | ||
{ | ||
FBInterstitialAd *interstitialAd = [[FBInterstitialAd alloc] initWithPlacementID:placementID]; | ||
interstitialAd.delegate = delegate; | ||
return interstitialAd; | ||
} | ||
|
||
@end | ||
|
||
@interface FacebookInterstitialCustomEvent () <FBInterstitialAdDelegate> | ||
|
||
@property (nonatomic, strong) FBInterstitialAd *fbInterstitialAd; | ||
|
||
@end | ||
|
||
@implementation FacebookInterstitialCustomEvent | ||
|
||
- (void)requestInterstitialWithCustomEventInfo:(NSDictionary *)info | ||
{ | ||
if (![info objectForKey:@"placement_id"]) { | ||
MPLogError(@"Placement ID is required for Facebook interstitial ad"); | ||
[self.delegate interstitialCustomEvent:self didFailToLoadAdWithError:nil]; | ||
return; | ||
} | ||
|
||
MPLogInfo(@"Requesting Facebook interstitial ad"); | ||
|
||
self.fbInterstitialAd = | ||
[[MPInstanceProvider sharedProvider] buildFBInterstitialAdWithPlacementID:[info objectForKey:@"placement_id"] | ||
delegate:self]; | ||
|
||
[self.fbInterstitialAd loadAd]; | ||
} | ||
|
||
- (void)showInterstitialFromRootViewController:(UIViewController *)controller { | ||
if (!self.fbInterstitialAd || !self.fbInterstitialAd.isAdValid) { | ||
MPLogError(@"Facebook interstitial ad was not loaded"); | ||
[self.delegate interstitialCustomEventDidExpire:self]; | ||
} else { | ||
MPLogInfo(@"Facebook interstitial ad will be presented"); | ||
[self.delegate interstitialCustomEventWillAppear:self]; | ||
[self.fbInterstitialAd showAdFromRootViewController:controller]; | ||
MPLogInfo(@"Facebook interstitial ad was presented"); | ||
[self.delegate interstitialCustomEventDidAppear:self]; | ||
} | ||
} | ||
|
||
- (void)dealloc | ||
{ | ||
_fbInterstitialAd.delegate = nil; | ||
} | ||
|
||
#pragma mark FBInterstitialAdDelegate methods | ||
|
||
- (void)interstitialAdDidLoad:(FBInterstitialAd *)interstitialAd | ||
{ | ||
MPLogInfo(@"Facebook intersitital ad was loaded. Can present now"); | ||
[self.delegate interstitialCustomEvent:self didLoadAd:interstitialAd]; | ||
} | ||
|
||
- (void)interstitialAd:(FBInterstitialAd *)interstitialAd didFailWithError:(NSError *)error | ||
{ | ||
MPLogInfo(@"Facebook intersitital ad failed to load with error: %@", error.description); | ||
[self.delegate interstitialCustomEvent:self didFailToLoadAdWithError:nil]; | ||
} | ||
|
||
- (void)interstitialAdDidClick:(FBInterstitialAd *)interstitialAd | ||
{ | ||
MPLogInfo(@"Facebook interstitial ad was clicked"); | ||
[self.delegate interstitialCustomEventDidReceiveTapEvent:self]; | ||
} | ||
|
||
- (void)interstitialAdDidClose:(FBInterstitialAd *)interstitialAd | ||
{ | ||
MPLogInfo(@"Facebook interstitial ad was closed"); | ||
[self.delegate interstitialCustomEventDidDisappear:self]; | ||
} | ||
|
||
- (void)interstitialAdWillClose:(FBInterstitialAd *)interstitialAd | ||
{ | ||
MPLogInfo(@"Facebook interstitial ad will close"); | ||
[self.delegate interstitialCustomEventWillDisappear:self]; | ||
} | ||
|
||
@end |
Oops, something went wrong.