Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

first import

  • Loading branch information...
commit bc1fa7dbd9697090c3bbc66cf8f9b240b2ab799e 0 parents
@marcosiino marcosiino authored
Showing with 15,735 additions and 0 deletions.
  1. +34 −0 AdMAL/Ad Mediation Abstraction Layer/AdCustomNetworkFactory.h
  2. +79 −0 AdMAL/Ad Mediation Abstraction Layer/AdCustomNetworkFactory.m
  3. +31 −0 AdMAL/Ad Mediation Abstraction Layer/AdGlobals.h
  4. +85 −0 AdMAL/Ad Mediation Abstraction Layer/AdMediationAL.h
  5. +414 −0 AdMAL/Ad Mediation Abstraction Layer/AdMediationAL.m
  6. +43 −0 AdMAL/Ad Mediation Abstraction Layer/AdMediationALManager.h
  7. +146 −0 AdMAL/Ad Mediation Abstraction Layer/AdMediationALManager.m
  8. +37 −0 AdMAL/Ad Mediation Abstraction Layer/AdViewController.h
  9. +59 −0 AdMAL/Ad Mediation Abstraction Layer/AdViewController.m
  10. +28 −0 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdAppCircleNetwork.h
  11. +152 −0 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdAppCircleNetwork.m
  12. +40 −0 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdBMobileNetwork.h
  13. +162 −0 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdBMobileNetwork.m
  14. +52 −0 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdCustomNetwork.h
  15. +57 −0 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdCustomNetwork.m
  16. +28 −0 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdMoPubNetwork.h
  17. +138 −0 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdMoPubNetwork.m
  18. +32 −0 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdMobClixNetwork.h
  19. +115 −0 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdMobClixNetwork.m
  20. +31 −0 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdMobFoxNetwork.h
  21. +116 −0 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdMobFoxNetwork.m
  22. +344 −0 AdMAL/Ad SDKs/AdWhirl/AdWhirlDelegateProtocol.h
  23. +231 −0 AdMAL/Ad SDKs/AdWhirl/AdWhirlView.h
  24. +128 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdNetworkAdapter.h
  25. +36 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterBrightRoll.h
  26. +137 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterBrightRoll.m
  27. +32 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterGoogleAdMobAds.h
  28. +199 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterGoogleAdMobAds.m
  29. +42 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterGoogleAdSense.h
  30. +189 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterGoogleAdSense.m
  31. +49 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterGreystripe.h
  32. +191 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterGreystripe.m
  33. +31 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterIAd.h
  34. +135 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterIAd.m
  35. +37 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterInMobi.h
  36. +173 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterInMobi.m
  37. +30 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterJumpTap.h
  38. +238 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterJumpTap.m
  39. +38 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterMdotM.h
  40. +423 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterMdotM.m
  41. +30 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterMillennial.h
  42. +227 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterMillennial.m
  43. +45 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterNexage.h
  44. +219 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterNexage.m
  45. +30 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterOneRiot.h
  46. +75 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterOneRiot.m
  47. +30 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterQuattro.h
  48. +222 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterQuattro.m
  49. +29 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterVideoEgg.h
  50. +117 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterVideoEgg.m
  51. +32 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterZestADZ.h
  52. +101 −0 AdMAL/Ad SDKs/AdWhirl/adapters/AdWhirlAdapterZestADZ.m
  53. +46 −0 AdMAL/Ad SDKs/AdWhirl/internal/ARRollerView.m
  54. +29 −0 AdMAL/Ad SDKs/AdWhirl/internal/AWNetworkReachabilityDelegate.h
  55. +53 −0 AdMAL/Ad SDKs/AdWhirl/internal/AWNetworkReachabilityWrapper.h
  56. +172 −0 AdMAL/Ad SDKs/AdWhirl/internal/AWNetworkReachabilityWrapper.m
  57. +46 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlAdNetworkAdapter+Helpers.h
  58. +93 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlAdNetworkAdapter+Helpers.m
  59. +84 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlAdNetworkAdapter.m
  60. +57 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlAdNetworkConfig.h
  61. +169 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlAdNetworkConfig.m
  62. +34 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlAdNetworkRegistry.h
  63. +64 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlAdNetworkRegistry.m
  64. +40 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlAdapterCustom.h
  65. +423 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlAdapterCustom.m
  66. +29 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlAdapterEvent.h
  67. +69 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlAdapterEvent.m
  68. +29 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlAdapterGeneric.h
  69. +56 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlAdapterGeneric.m
  70. +31 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlClassWrapper.h
  71. +35 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlClassWrapper.m
  72. +103 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlConfig.h
  73. +562 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlConfig.m
  74. +67 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlConfigStore.h
  75. +291 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlConfigStore.m
  76. +101 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlCustomAdView.h
  77. +168 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlCustomAdView.m
  78. +55 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlError.h
  79. +56 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlError.m
  80. +61 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlLog.h
  81. +67 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlLog.m
  82. +60 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlView+.h
  83. +1,015 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlView.m
  84. +764 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlWebBrowser.xib
  85. +75 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlWebBrowserController.h
  86. +266 −0 AdMAL/Ad SDKs/AdWhirl/internal/AdWhirlWebBrowserController.m
  87. +31 −0 AdMAL/Ad SDKs/AdWhirl/internal/UIColor+AdWhirlConfig.h
  88. +73 −0 AdMAL/Ad SDKs/AdWhirl/internal/UIColor+AdWhirlConfig.m
  89. +31 −0 AdMAL/Ad SDKs/AdWhirl/legacy/ARRollerProtocol.h
  90. +30 −0 AdMAL/Ad SDKs/AdWhirl/legacy/ARRollerView.h
  91. +68 −0 AdMAL/TouchJSON/CDataScanner.h
  92. +270 −0 AdMAL/TouchJSON/CDataScanner.m
  93. +37 −0 AdMAL/TouchJSON/Extensions/CDataScanner_Extensions.h
  94. +80 −0 AdMAL/TouchJSON/Extensions/CDataScanner_Extensions.m
  95. +36 −0 AdMAL/TouchJSON/Extensions/NSCharacterSet_Extensions.h
  96. +48 −0 AdMAL/TouchJSON/Extensions/NSCharacterSet_Extensions.m
  97. +36 −0 AdMAL/TouchJSON/Extensions/NSDictionary_JSONExtensions.h
  98. +41 −0 AdMAL/TouchJSON/Extensions/NSDictionary_JSONExtensions.m
  99. +44 −0 AdMAL/TouchJSON/Extensions/NSScanner_Extensions.h
  100. +118 −0 AdMAL/TouchJSON/Extensions/NSScanner_Extensions.m
  101. +46 −0 AdMAL/TouchJSON/JSON/CJSONDataSerializer.h
  102. +225 −0 AdMAL/TouchJSON/JSON/CJSONDataSerializer.m
  103. +45 −0 AdMAL/TouchJSON/JSON/CJSONDeserializer.h
  104. +95 −0 AdMAL/TouchJSON/JSON/CJSONDeserializer.m
  105. +44 −0 AdMAL/TouchJSON/JSON/CJSONScanner.h
  106. +539 −0 AdMAL/TouchJSON/JSON/CJSONScanner.m
  107. +47 −0 AdMAL/TouchJSON/JSON/CJSONSerializer.h
  108. +75 −0 AdMAL/TouchJSON/JSON/CJSONSerializer.m
  109. +40 −0 AdMAL/TouchJSON/JSON/CSerializedJSONData.h
  110. +54 −0 AdMAL/TouchJSON/JSON/CSerializedJSONData.m
  111. +4 −0 CHANGELOG
  112. +13 −0 LICENSE-AdMAL
  113. +12 −0 LICENSE-AdWhirl
  114. +11 −0 LICENSE-TouchJSON
  115. +171 −0 README
  116. +761 −0 sample/AdMALSample.xcodeproj/project.pbxproj
  117. +7 −0 sample/AdMALSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  118. BIN  sample/AdMALSample.xcodeproj/project.xcworkspace/xcuserdata/ops8086.xcuserdatad/UserInterfaceState.xcuserstate
  119. +21 −0 sample/AdMALSample.xcodeproj/xcuserdata/ops8086.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
  120. +84 −0 sample/AdMALSample.xcodeproj/xcuserdata/ops8086.xcuserdatad/xcschemes/AdMALSample.xcscheme
  121. +22 −0 sample/AdMALSample.xcodeproj/xcuserdata/ops8086.xcuserdatad/xcschemes/xcschememanagement.plist
  122. +47 −0 sample/AdMALSample/AdMALSample-Info.plist
  123. +14 −0 sample/AdMALSample/AdMALSample-Prefix.pch
  124. +40 −0 sample/AdMALSample/AppDelegate.h
  125. +139 −0 sample/AdMALSample/AppDelegate.m
  126. +28 −0 sample/AdMALSample/FirstViewController.h
  127. +88 −0 sample/AdMALSample/FirstViewController.m
  128. +28 −0 sample/AdMALSample/SecondViewController.h
  129. +93 −0 sample/AdMALSample/SecondViewController.m
  130. +219 −0 sample/AdMALSample/en.lproj/FirstViewController_iPad.xib
  131. +210 −0 sample/AdMALSample/en.lproj/FirstViewController_iPhone.xib
  132. +2 −0  sample/AdMALSample/en.lproj/InfoPlist.strings
  133. +277 −0 sample/AdMALSample/en.lproj/SecondViewController_iPad.xib
  134. +272 −0 sample/AdMALSample/en.lproj/SecondViewController_iPhone.xib
  135. BIN  sample/AdMALSample/first.png
  136. BIN  sample/AdMALSample/first@2x.png
  137. +30 −0 sample/AdMALSample/main.m
  138. BIN  sample/AdMALSample/second.png
  139. BIN  sample/AdMALSample/second@2x.png
34 AdMAL/Ad Mediation Abstraction Layer/AdCustomNetworkFactory.h
@@ -0,0 +1,34 @@
+//
+// AdCustomNetworkFactory.h
+// Ad Mediation Abstraction Layer
+//
+
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 <Foundation/Foundation.h>
+#import "AdGlobals.h"
+
+@interface AdCustomNetworkFactory : NSObject {
+
+}
+
+//create an instance of an AdCustomNetwork subclass. Specify the network name in the name parameter using the NETWORK_* defines. The returned instance has a retain count of 1 so it must be released
+
++(id)createCustomNetwork:(NSString*)name;
+
+//get the Class of the specified custom network. Useful to call the class methods of a certain network class. Use the NETWORK_* defines to pass the network name.
++(Class)getCustomNetworkClass:(NSString*)name;
+@end
79 AdMAL/Ad Mediation Abstraction Layer/AdCustomNetworkFactory.m
@@ -0,0 +1,79 @@
+//
+// AdCustomNetworkFactory.m
+// Ad Mediation Abstraction Layer
+//
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdCustomNetworkFactory.h"
+
+@implementation AdCustomNetworkFactory
+
++(id)createCustomNetwork:(NSString *)name {
+ if([name isEqualToString:NETWORK_MOBCLIX]) {
+ Class networkClass = NSClassFromString(@"AdMobClixNetwork");
+ if(networkClass)
+ return [[[networkClass alloc] init] autorelease];
+ }
+ else if([name isEqualToString:NETWORK_BMOBILE]) {
+ Class networkClass = NSClassFromString(@"AdBMobileNetwork");
+ if(networkClass)
+ return [[[networkClass alloc] init] autorelease];
+ }
+ else if([name isEqualToString:NETWORK_MOPUB]) {
+ Class networkClass = NSClassFromString(@"AdMoPubNetwork");
+ if(networkClass)
+ return [[[networkClass alloc] init] autorelease];
+ }
+ else if([name isEqualToString:NETWORK_MOBFOX]) {
+ Class networkClass = NSClassFromString(@"AdMobFoxNetwork");
+ if(networkClass)
+ return [[[networkClass alloc] init] autorelease];
+ }
+ else if([name isEqualToString:NETWORK_APPCIRCLE]) {
+ Class networkClass = NSClassFromString(@"AdAppCircleNetwork");
+ if(networkClass)
+ return [[[networkClass alloc] init] autorelease];
+ }
+
+ return nil;
+}
+
++(Class)getCustomNetworkClass:(NSString*)name {
+ if([name isEqualToString:NETWORK_MOBCLIX]) {
+ Class networkClass = NSClassFromString(@"AdMobClixNetwork");
+ return networkClass;
+ }
+ else if([name isEqualToString:NETWORK_BMOBILE]) {
+ Class networkClass = NSClassFromString(@"AdBMobileNetwork");
+ return networkClass;
+ }
+ else if([name isEqualToString:NETWORK_MOPUB]) {
+ Class networkClass = NSClassFromString(@"AdMoPubNetwork");
+ return networkClass;
+ }
+ else if([name isEqualToString:NETWORK_MOBFOX]) {
+ Class networkClass = NSClassFromString(@"AdMobFoxNetwork");
+ return networkClass;
+ }
+ else if([name isEqualToString:NETWORK_APPCIRCLE]) {
+ Class networkClass = NSClassFromString(@"AdAppCircleNetwork");
+ return networkClass;
+ }
+
+ return nil;
+}
+
+@end
31 AdMAL/Ad Mediation Abstraction Layer/AdGlobals.h
@@ -0,0 +1,31 @@
+//
+// AdGlobals.h
+// Ad Mediation Abstraction Layer
+//
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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.
+ */
+
+//SETTINGS KEY
+#define S_APPKEY @"appKey"
+#define S_GLOBALKEY @"globalKey"
+#define S_TESTING @"testing"
+
+//NETWORKS
+#define NETWORK_MOBCLIX @"mobclix"
+#define NETWORK_BMOBILE @"bmobile"
+#define NETWORK_MOPUB @"mopub"
+#define NETWORK_MOBFOX @"mobfox"
+#define NETWORK_APPCIRCLE @"appcircle"
+#define NETWORK_SMAATO @"smaato"
85 AdMAL/Ad Mediation Abstraction Layer/AdMediationAL.h
@@ -0,0 +1,85 @@
+//
+// AdMediationAL.h
+// Ad Mediation Abstraction Layer
+//
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 <Foundation/Foundation.h>
+#import "AdWhirlView.h"
+#import "AdCustomNetwork.h"
+
+//x alignment
+#define ALIGN_LEFT -10000
+#define ALIGN_CENTER -15000
+#define ALIGN_RIGHT -20000
+
+//y alignment
+#define ALIGN_TOP -10000
+#define ALIGN_BOTTOM -20000
+#define ALIGN_RANDOM -30000
+
+//ad standard positions
+#define POSITION_TOP CGPointMake(ALIGN_CENTER, ALIGN_TOP)
+#define POSITION_BOTTOM CGPointMake(ALIGN_CENTER, ALIGN_BOTTOM)
+#define POSITION_RANDOM CGPointMake(ALIGN_CENTER, ALIGN_RANDOM)
+
+@protocol AdMediationALDelegate
+
+-(void)adMediationALDidReceiveAdWithRect:(CGRect)adRect;
+-(void)adMediationALDidFailToReceiveAd;
+
+@end
+
+@interface AdMediationAL : NSObject<AdWhirlDelegate, AdCustomNetworkDelegate> {
+ id delegate;
+ AdWhirlView *adView;
+ UIViewController *parentViewController;
+ UIView *parentView;
+ CGPoint adPosition;
+ UIView *uiMainContainerView; //the view that contains the current view UI. If set is resized when the ad is shown and resized back when the ad is hide (works only with POSITION_TOP and POSITION_BOTTOM ad positions
+
+ NSMutableDictionary *customAdViews; //a dictionary that contains the custom networks adviews. key = name of the network (i.e. "mobclix". Use the #defines that starts with NETWORK_ in AdMediationLayerALManager.h). Each time a new custom event trigger the AdMediationAL tries to load the related network adview and add it to the dictionary (if it is already added it uses this adview instead of allocating a new one).
+
+ NSString *lastCustomNetwork;
+
+ bool yRandomPositioning; //if true assign a random Y position between TOP and BOTTOM to the ad banner y (this is internally set to true when the POSITION_RANDOM is passed to initAdWithDelegate:andParentViewController:andParentView:andPosition:...
+}
+
+@property (nonatomic, assign) UIView *uiMainContainerView;
+
+-(id)initAdWithDelegate:(id<AdMediationALDelegate>)delegate andParentViewController:(UIViewController*)viewController andParentView:(UIView*)view andPosition:(CGPoint)pos;
+
+//Use this to also specify a containerView to be resized when an ad is received or when ad disappear (failed to receive)
+-(id)initAdWithDelegate:(id<AdMediationALDelegate>)delegate andParentViewController:(UIViewController*)viewController andParentView:(UIView*)view andPosition:(CGPoint)pos andAutoresizeContainerView:(UIView*)mainContainerView;
+
+-(id)delegate;
+-(void)setDelegate:(id<AdMediationALDelegate>)del;
+-(void)didRotateInterfaceOrientation;
+
+//call this method inside adMediationALDidReceiveAdWithRect to autoresize a UIView* viewContainer (a view that contains all the current interface controls) based on the current ad banner. This works only if you passed POSITION_TOP or POSITION_BOTTOM in the andPosition: paramers of the init method. If you used POSITION_TOP the viewContainer y position will be offset by the height of the current ad banner and the height of the viewContainer will be resized to fill the remaining space of the parentView. If you used POSITION_BOTTOM the viewContainer y position will be set to 0 and it's height will be set to the height of parentView bounds minus the height of the current ad banner.
+-(void)autoResizeViewContainer:(UIView*)viewContainer;
+
+//Adjust the display of the ad (call this on viewDidAppear)
+-(void)resetDisplay;
+
+-(void)pauseAdRefresh;
+
+-(void)resumeAdRefresh;
+
+-(CGSize)getAdSize;
+-(CGPoint)getAdPosition;
+
+@end
414 AdMAL/Ad Mediation Abstraction Layer/AdMediationAL.m
@@ -0,0 +1,414 @@
+//
+// AdMediationAL.m
+// Ad Mediation Abstraction Layer
+//
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdMediationAL.h"
+#import "AdMediationALManager.h"
+
+@implementation AdMediationAL
+@synthesize uiMainContainerView;
+
+#pragma mark instance methods
+
+-(id)init {
+ NSAssert(false, @"use initAdWithKey: instead of init");
+
+ return nil;
+}
+
+-(id)initAdWithDelegate:(id)del andParentViewController:(UIViewController*)viewController andParentView:(UIView*)view andPosition:(CGPoint)pos andAutoresizeContainerView:(UIView *)mainContainerView {
+
+ self = [super init];
+
+ if(self) {
+ NSAssert(viewController != nil, @"parent view controller must not be nil");
+
+ delegate = del;
+ parentViewController = viewController;
+ if(parentView)
+ parentView = view;
+ else
+ parentView = parentViewController.view;
+
+ //[parentView retain];
+ //[parentViewController retain];
+
+ NSAssert(parentView != nil, @"parentView cannot be nil");
+
+ adView = [AdWhirlView requestAdWhirlViewWithDelegate:self];
+ [adView retain];
+
+ adView.hidden = YES;
+ [parentView addSubview:adView];
+
+ adPosition = pos;
+ if(adPosition.y == ALIGN_RANDOM) //random y pos (TOP / BOTTOM)?
+ //When yRandomPositioning is TRUE, the adPosition.y is set randomly to ALIGN_TOP or ALIGN_BOTTOM in the onReceiveAd method each time an ad is received.
+ yRandomPositioning = TRUE;
+ else
+ yRandomPositioning = FALSE;
+
+ self.uiMainContainerView = mainContainerView;
+
+ //Position the adView outside the view (on the upside if adPosition.y == ALIGN_TOP or on the bottomside if adPosition.y == ALIGN_BOTTOM) so that when a banner is received and repositionAd is called the view will animate in a way that it seems to popup from the up or bottom side of the view
+ /* if(adPosition.y == ALIGN_TOP)
+ adView.frame = CGRectMake(0, -100, parentView.bounds.size.width, 100);
+ else if(adPosition.y == ALIGN_BOTTOM)
+ adView.frame = CGRectMake(0, parentView.bounds.size.height, parentView.bounds.size.width, 100);
+
+ NSLog(@"init %f,%f - %f,%f", adView.frame.origin.x, adView.frame.origin.y, adView.frame.size.width, adView.frame.size.height);
+ */
+ customAdViews = [[NSMutableDictionary alloc] init];
+
+ }
+
+ return self;
+}
+
+-(id)initAdWithDelegate:(id)del andParentViewController:(UIViewController*)viewController andParentView:(UIView*)view andPosition:(CGPoint)pos {
+ return [self initAdWithDelegate:del andParentViewController:viewController andParentView:view andPosition:pos andAutoresizeContainerView:nil];
+}
+
+-(void)deallocateLastCustomNetwork {
+ if(lastCustomNetwork != nil) {
+ id customNetwork = [customAdViews objectForKey:lastCustomNetwork];
+ [customNetwork unloadAd];
+ [customAdViews removeObjectForKey:lastCustomNetwork];
+
+ NSLog(@"deallocated custom network: %@", lastCustomNetwork);
+
+ lastCustomNetwork = nil;
+ }
+}
+
+-(void)deallocateAllLoadedCustomNetworks {
+ for(NSString *key in [customAdViews allKeys]) {
+ id customNetwork = [customAdViews objectForKey:key];
+ [customNetwork unloadAd];
+
+ NSLog(@"deallocated custom network: %@", [customNetwork networkName]);
+ }
+
+ [customAdViews removeAllObjects];
+}
+
+-(void)dealloc {
+ //parentView = nil;
+ //parentViewController = nil;
+ //uiMainContainerView = nil;
+
+ adView.delegate = nil;
+ [adView release];
+ //adView = nil;
+
+ [self deallocateAllLoadedCustomNetworks];
+ [customAdViews release];
+
+ [super dealloc];
+}
+
+-(id)delegate {
+ return delegate;
+}
+
+-(void)setDelegate:(id)del {
+ delegate = del;
+}
+
+-(CGSize)getAdSize {
+ return adView.frame.size;
+}
+
+-(CGPoint)getAdPosition {
+ return adPosition;
+}
+
+-(void)repositionAd {
+ CGRect frame = adView.frame;
+
+ CGSize adSize;
+
+ if(lastCustomNetwork == nil) //is not using a custom network
+ adSize = adView.actualAdSize; //i use actualAdSize only if it's not currently showing a custom network banner, because in this case actualAdSize will not reflect the custom network banner size
+ else
+ adSize = adView.frame.size;
+
+ //X position
+ if(adPosition.x == ALIGN_CENTER)
+ frame.origin.x = parentView.bounds.size.width / 2 - adSize.width / 2;
+ else if(adPosition.x == ALIGN_LEFT)
+ frame.origin.x = 0;
+ else if(adPosition.x == ALIGN_RIGHT)
+ frame.origin.x = parentView.bounds.size.width - adSize.width;
+ else
+ frame.origin.x = adPosition.x;
+
+ //Y position
+ if(adPosition.y == ALIGN_TOP) {
+ //Starting y (before animation):
+ CGRect startinPos = adView.frame;
+ startinPos.origin.y = -adSize.height;
+ adView.frame = startinPos;
+
+ //final y (after animation)
+ frame.origin.y = 0;
+ }
+ else if(adPosition.y == ALIGN_BOTTOM) {
+
+ //Starting y (before animation):
+ CGRect startinPos = adView.frame;
+ startinPos.origin.y = parentView.bounds.size.height;
+ adView.frame = startinPos;
+
+ //final y (after animation)
+ frame.origin.y = parentView.bounds.size.height - adSize.height;
+ }
+ else
+ frame.origin.y = adPosition.y;
+
+ frame.size.width = adSize.width;
+ frame.size.height = adSize.height;
+
+ [UIView beginAnimations:@"" context:nil];
+ adView.frame = frame;
+ [UIView commitAnimations];
+
+ //[adView setNeedsDisplay];
+ //[adView setNeedsLayout];
+
+}
+
+-(void)didRotateInterfaceOrientation {
+ [adView rotateToOrientation: [UIApplication sharedApplication].statusBarOrientation];
+ [self repositionAd];
+
+ if(uiMainContainerView)
+ [self autoResizeViewContainer:uiMainContainerView];
+}
+
+-(void)autoResizeViewContainer:(UIView *)viewContainer {
+
+ if(adView.hidden == NO) { //resize to fit space to the ad
+ if(adPosition.y == ALIGN_TOP) {
+ [UIView beginAnimations:@"" context:nil];
+ viewContainer.frame = CGRectMake(viewContainer.frame.origin.x, adView.frame.size.height, viewContainer.frame.size.width, parentView.bounds.size.height - adView.frame.size.height);
+ [UIView commitAnimations];
+ }
+ else if(adPosition.y == ALIGN_BOTTOM) {
+ [UIView beginAnimations:@"" context:nil];
+ viewContainer.frame = CGRectMake(viewContainer.frame.origin.x, 0, viewContainer.frame.size.width, parentView.bounds.size.height - adView.frame.size.height);
+ [UIView commitAnimations];
+ }
+ }
+ else { //resize back to because no ad is currently showed
+ if(adPosition.y == ALIGN_TOP) {
+ [UIView beginAnimations:@"" context:nil];
+ viewContainer.frame = CGRectMake(viewContainer.frame.origin.x, 0, viewContainer.frame.size.width, parentView.bounds.size.height);
+ [UIView commitAnimations];
+ }
+ else if(adPosition.y == ALIGN_BOTTOM) {
+ [UIView beginAnimations:@"" context:nil];
+ viewContainer.frame = CGRectMake(viewContainer.frame.origin.x, 0, viewContainer.frame.size.width, parentView.bounds.size.height);
+ [UIView commitAnimations];
+ }
+ }
+}
+
+-(void)resetDisplay {
+ [self didRotateInterfaceOrientation]; //simulate the rotation of the interface to reset the size of the ad in case the interface has been rotated when the viewcontroller was hidden.
+
+ if(uiMainContainerView)
+ [self autoResizeViewContainer:uiMainContainerView];
+}
+
+-(void)pauseAdRefresh {
+ [adView ignoreNewAdRequests];
+}
+
+-(void)resumeAdRefresh {
+ [adView doNotIgnoreNewAdRequests];
+}
+
+-(id)getNetworkAdView:(NSString*)networkName {
+ return [customAdViews objectForKey:networkName];
+}
+
+-(void)onReceivedAd {
+ adView.hidden = NO;
+
+ if(yRandomPositioning) { //if y position is set to be random inside the initAdWithDelegate
+
+ //Choose a random position between TOP and BOTTOM each time i receive an ad:
+ int rnd = arc4random()%2;
+ if(rnd == 0)
+ adPosition.y = ALIGN_TOP;
+ else if(rnd == 1)
+ adPosition.y = ALIGN_BOTTOM;
+ }
+
+ [self repositionAd];
+
+ if(uiMainContainerView)
+ [self autoResizeViewContainer:uiMainContainerView];
+
+ if([delegate respondsToSelector:@selector(adMediationALDidReceiveAdWithRect:)]) {
+ [delegate adMediationALDidReceiveAdWithRect:adView.frame];
+ }
+}
+
+-(void)onFailedReceivingAd {
+
+ if(uiMainContainerView)
+ [self autoResizeViewContainer:uiMainContainerView];
+
+ if([delegate respondsToSelector:@selector(adMediationALDidFailToReceiveAd)]) {
+ [delegate adMediationALDidFailToReceiveAd];
+ }
+
+}
+
+#pragma mark - AdWhirlView delegate
+
+-(NSString *)adWhirlApplicationKey {
+ return [[AdMediationALManager sharedManager] appKey];
+}
+
+-(UIViewController *)viewControllerForPresentingModalView {
+ return parentViewController;
+}
+
+-(void)adWhirlDidReceiveAd:(AdWhirlView *)adWhirlView {
+ [self deallocateLastCustomNetwork];
+ [self onReceivedAd];
+}
+
+-(void)adWhirlDidFailToReceiveAd:(AdWhirlView *)adWhirlView usingBackup:(BOOL)yesOrNo {
+
+ NSLog(@"Did fail to receive ad from AdWhirl supported network adapter: %@", [adWhirlView currAdapter]);
+
+ if(yesOrNo == NO) //no more ad to rollback
+ adView.hidden = YES; //hide the ad banner
+
+ [self onFailedReceivingAd];
+}
+
+-(UIDeviceOrientation)adWhirlCurrentOrientation {
+ if([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortraitUpsideDown)
+ return UIDeviceOrientationPortraitUpsideDown;
+ else if([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeLeft)
+ return UIDeviceOrientationLandscapeLeft;
+ else if([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeRight)
+ return UIDeviceOrientationLandscapeRight;
+ else
+ return UIDeviceOrientationPortrait;
+}
+
+#pragma mark Custom Networks (Custom Events Triggers called by AdWhirl)
+
+-(void)requestCustomNetworkAd:(NSString*)network {
+
+ //Test if the custom network sdk and custom adapter are available
+ if(![AdCustomNetworkFactory getCustomNetworkClass:network]) {
+ NSLog(@"Unable to request ad for '%@' custom network: class not found. Have you included the custom network sdk and adapter ?", network);
+
+ [adView performSelector:@selector(rollOver) withObject:nil afterDelay:0.1f]; //call rollOver after a while instead of now to avoid a problem that causes an exception (may be due the fact that if i call the rollOver now, and the next networks fail it call the rollOver again and again and this causes a stack of rollOver calls that causes some problems).
+ //[adView rollOver];
+ return;
+ }
+
+ //try to get the instance of the custom network from the loadedCustomNetworks dictionary, if it already exits (has been instanced before)
+ id customNetwork = [self getNetworkAdView:network];
+
+ NSDictionary *networkSettings = [[AdMediationALManager sharedManager] getSettingsForCustomNetwork:network];
+ if(!networkSettings) {
+ NSLog(@"AdWhirl requested an ad for '%@' custom network but this network is not enabled in the app. Skipping", network);
+ [adView performSelector:@selector(rollOver) withObject:nil afterDelay:0.1f]; //call rollOver after a while instead of now to avoid a problem that causes an exception (may be due the fact that if i call the rollOver now, and the next networks fail it call the rollOver again and again and this causes a stack of rollOver calls that causes some problems)
+ //[adView rollOver];
+ return;
+ }
+
+ if(![lastCustomNetwork isEqualToString:network]) //if the last custom network is not the same as this i deallocate it
+ [self deallocateLastCustomNetwork];
+
+ //if the loadedCustomNetworks don't have an instance for this custom network i create the instance and save it on the loadedCustomNetworks dictionary
+ if(!customNetwork) {
+ customNetwork = [AdCustomNetworkFactory createCustomNetwork:network];
+ if(customNetwork)
+ [customAdViews setObject:customNetwork forKey:network];
+ }
+
+ //if the customNetwork is valid (it is a subclass of AdCustomNetwork) i call the requestAdWithDelegate:andSettings: method to request an Ad
+ if(customNetwork && [customNetwork isKindOfClass:[AdCustomNetwork class]]) {
+
+ lastCustomNetwork = network;
+
+ [customNetwork requestAdWithDelegate:self andSettings:networkSettings];
+ }
+}
+
+-(void)mobclix {
+ [self requestCustomNetworkAd:NETWORK_MOBCLIX];
+}
+
+-(void)bmobile {
+ [self requestCustomNetworkAd:NETWORK_BMOBILE];
+}
+
+-(void)mopub {
+ [self requestCustomNetworkAd:NETWORK_MOPUB];
+}
+
+-(void)mobfox {
+ [self requestCustomNetworkAd:NETWORK_MOBFOX];
+}
+
+-(void)appcircle {
+ [self requestCustomNetworkAd:NETWORK_APPCIRCLE];
+}
+
+#pragma mark Custom Network Adapter delegate
+
+-(void)customNetworkDidReceiveAd:(UIView *)ad {
+ adView.frame = ad.frame;
+ [adView replaceBannerViewWith:ad];
+
+ [self onReceivedAd];
+}
+
+-(void)customNetworkDidFailReceiveAd {
+ [self onFailedReceivingAd];
+ [adView rollOver];
+}
+
+-(UIViewController *)customNetworkViewController {
+ return parentViewController;
+}
+
+-(void)customNetworkShouldCallNextAd {
+ [adView requestFreshAd];
+}
+
+-(void)customNetworkWillPresentModalViewForAd {
+ [self pauseAdRefresh];
+}
+
+-(void)customNetworkDidDismissModalViewForAd {
+ [self resumeAdRefresh];
+}
+
+@end
43 AdMAL/Ad Mediation Abstraction Layer/AdMediationALManager.h
@@ -0,0 +1,43 @@
+//
+// AdMediationALManager.h
+// Ad Mediation Abstraction Layer
+//
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 <Foundation/Foundation.h>
+#import "AdMediationAL.h"
+#import "AdCustomNetworkFactory.h"
+#import "AdGlobals.h"
+
+@interface AdMediationALManager : NSObject {
+ NSString *appKey; //app key for the main mediation layer used (actually AdWhirl app key)
+ NSMutableDictionary *enabledCustomNetworks;
+}
+
++(id)sharedManager;
+
+-(void)setAppKey:(NSString*)key;
+-(NSString*)appKey;
+
+//enable a custom network, pass the settings required (i.e. the network app key. See the S_* defines in AdGlobals. for the settings dictionary keys). Use the NETWORK_* defines declared in AdGlobals.h for the network parameter.
+-(void)enableCustomNetwork:(NSString*)network withSettings:(NSDictionary*)settings;
+
+//get the settings dictionary for the specified network. Use the NETWORK_* defines declared in AdGlobals.h for the network parameter.
+-(NSDictionary*)getSettingsForCustomNetwork:(NSString*)network;
+
+-(AdMediationAL*)requestAdWithDelegate:(id<AdMediationALDelegate>)delegate andParentViewController:(UIViewController*)viewController andParentView:(UIView*)view andPosition:(CGPoint)pos;
+
+@end
146 AdMAL/Ad Mediation Abstraction Layer/AdMediationALManager.m
@@ -0,0 +1,146 @@
+//
+// AdMediationALManager.m
+// Ad Mediation Abstraction Layer
+//
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdMediationALManager.h"
+#import "AdMediationAL.h"
+#import "AdCustomNetwork.h"
+
+@implementation AdMediationALManager
+
+#pragma mark Singleton Pattern methods
+
+//these Singleton methods are currently not thread-safe
+
+static id sharedInstance = nil;
+
++(id)sharedManager {
+
+ if(!sharedInstance)
+ sharedInstance = [[super allocWithZone:NULL] init];
+
+ return sharedInstance;
+}
+
++(id)allocWithZone:(NSZone *)zone {
+ @synchronized(self) {
+ if(!sharedInstance) {
+ sharedInstance = [[super allocWithZone:zone] init];
+ return sharedInstance;
+ }
+ }
+
+ NSAssert(false, @"Cannot manually allocate a Singleton. Use +sharedManager instead");
+ return nil;
+}
+
++(id)new {
+ return [self alloc];
+}
+
+-(id)copyWithZone:(NSZone *)zone {
+ NSLog(@"AdMediationALManager: attempt to -copy on a Singleton class may be a bug");
+
+ [self retain];
+ return self;
+}
+
+-(id)mutableCopyWithZone:(NSZone*)zone {
+
+ return [self copyWithZone:zone];
+}
+
+#pragma mark instance methods
+
+-(id)init {
+ self = [super init];
+ if(self) {
+ enabledCustomNetworks = [[NSMutableDictionary alloc] init];
+ }
+
+ return self;
+}
+
+-(void)setAppKey:(NSString*)key {
+ [appKey release];
+ appKey = [key copy];
+}
+
+-(NSString*)appKey {
+ return appKey;
+}
+
+//Check the settings dictionary for the specified custom network. This is a preliminary formal check
+-(BOOL)checkNetworkSettings:(NSDictionary*)settings forNetwork:(NSString*)network {
+
+ //Get the custom network class from the factory and if exists (is included in the project) i call the method startApplication of the custom network class:
+
+ Class networkClass = [AdCustomNetworkFactory getCustomNetworkClass:network];
+ if(networkClass && [networkClass isSubclassOfClass:[AdCustomNetwork class]])
+ return [networkClass checkNetworkSettings:settings];
+
+ return false;
+}
+
+//Call startApplication on the custom network, passing the settings.
+-(void)initializeCustomNetwork:(NSString*)network withSettings:(NSDictionary*)settings {
+
+ //Get the custom network class from the factory and if exists (is included in the project) i call the method startApplication of the custom network class:
+
+ Class networkClass = [AdCustomNetworkFactory getCustomNetworkClass:network];
+ if(networkClass && [networkClass isSubclassOfClass:[AdCustomNetwork class]])
+ [networkClass startApplication:settings];
+
+}
+
+-(void)enableCustomNetwork:(NSString *)network withSettings:(NSDictionary *)settings {
+
+ if(![AdCustomNetworkFactory getCustomNetworkClass:network]) {
+ NSLog(@"Can't enable '%@' custom network: class not found. Have you included the custom network SDK and custom adapter?", network );
+ }
+
+ if([self checkNetworkSettings:settings forNetwork:network]) {
+ [enabledCustomNetworks setObject:settings forKey:network];
+
+ [self initializeCustomNetwork:network withSettings:settings];
+ }
+}
+
+-(NSDictionary*)getSettingsForCustomNetwork:(NSString *)network {
+ return [enabledCustomNetworks objectForKey:network];
+}
+
+-(AdMediationAL*)requestAdWithDelegate:(id<AdMediationALDelegate>)delegate andParentViewController:(UIViewController*)viewController andParentView:(UIView*)view andPosition:(CGPoint)pos {
+
+ NSAssert(appKey != nil && ![appKey isEqualToString:@""], @"you must specify a valid App Key using setAppKey: before calling requestAdWithDelegate:");
+
+ AdMediationAL *ad = [[[AdMediationAL alloc] initAdWithDelegate:delegate andParentViewController:viewController andParentView:view andPosition:pos] autorelease];
+
+ return ad;
+
+}
+
+
+-(void)dealloc {
+ [appKey release];
+ [enabledCustomNetworks release];
+
+ [super dealloc];
+}
+
+@end
37 AdMAL/Ad Mediation Abstraction Layer/AdViewController.h
@@ -0,0 +1,37 @@
+//
+// AdViewController.h
+// Ad Mediation Abstraction Layer
+//
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 <UIKit/UIKit.h>
+#import "AdMediationAL.h"
+#import "AdMediationALManager.h"
+
+//This View Controller simplifies the usage of ad banners with AdMediationAL. Use this as base class for your view controllers.
+
+@interface AdViewController : UIViewController {
+ AdMediationAL *adMediation;
+}
+
+//Request an ad banner and automatically resizes the viewContainer (a container that contains all the main UI, for example the current tab UI) when a banner appear, and viceversa. The auto resize function only works if pos is POSITION_TOP or POSITION_BOTTOM.
+-(void)requestAdWithDelegate:(id<AdMediationALDelegate>)del andPosition:(CGPoint)pos andMainViewContainer:(UIView*)viewContainer;
+
+//Request an ad banner without automatically resizing the viewContainer (see above)
+-(void)requestAdWithDelegate:(id<AdMediationALDelegate>)del andPosition:(CGPoint)pos;
+
+
+@end
59 AdMAL/Ad Mediation Abstraction Layer/AdViewController.m
@@ -0,0 +1,59 @@
+//
+// AdViewController.m
+// Ad Mediation Abstraction Layer
+//
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdViewController.h"
+
+@implementation AdViewController
+
+-(void)viewDidAppear:(BOOL)animated {
+ [super viewDidAppear:animated];
+
+ [adMediation resetDisplay];
+ [adMediation resumeAdRefresh];
+}
+
+-(void)viewWillDisappear:(BOOL)animated {
+ [super viewWillDisappear:animated];
+
+ [adMediation pauseAdRefresh];
+}
+
+-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
+ [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
+
+ [adMediation didRotateInterfaceOrientation];
+}
+
+-(void)requestAdWithDelegate:(id<AdMediationALDelegate>)del andPosition:(CGPoint)pos andMainViewContainer:(UIView*)viewContainer {
+ adMediation = [[AdMediationALManager sharedManager] requestAdWithDelegate:del andParentViewController:self andParentView:self.view andPosition:pos];
+ [adMediation retain];
+ adMediation.uiMainContainerView = viewContainer;
+}
+
+-(void)requestAdWithDelegate:(id<AdMediationALDelegate>)del andPosition:(CGPoint)pos {
+ [self requestAdWithDelegate:del andPosition:pos andMainViewContainer:nil];
+}
+
+-(void)dealloc {
+ [adMediation release];
+
+ [super dealloc];
+}
+
+@end
28 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdAppCircleNetwork.h
@@ -0,0 +1,28 @@
+//
+// AdAppCircleNetwork.h
+// Ad Mediation Abstraction Layer
+//
+
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdCustomNetwork.h"
+#import "FlurryAdDelegate.h"
+
+@interface AdAppCircleNetwork : AdCustomNetwork<FlurryAdDelegate> {
+ UIView *adView;
+}
+
+@end
152 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdAppCircleNetwork.m
@@ -0,0 +1,152 @@
+//
+// AdAppCircleNetwork.m
+// Ad Mediation Abstraction Layer
+//
+
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdAppCircleNetwork.h"
+#import "AdGlobals.h"
+#import "FlurryAppCircle.h"
+#import "FlurryAnalytics.h"
+
+@implementation AdAppCircleNetwork
+
++(BOOL)checkNetworkSettings:(NSDictionary *)networkSettings {
+ if(!networkSettings) {
+ NSLog(@"Can't enable the AppCircle network because you've specified a nil settings dictionary");
+ return false;
+ }
+
+ //Verify the app key
+ NSString *appKey = [networkSettings objectForKey:S_APPKEY];
+
+ if(!appKey) { //appKey not specified in settings dictionary
+ NSLog(@"Can't enable the AppCircle network because you've not specified the app key using the S_APPKEY key in settings dictionary");
+ return false;
+ }
+
+ if([[appKey stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" "]] isEqualToString:@""]) { //appKey is empty
+ NSLog(@"Can't enable the AppCircle network because the siteId you've specified in the settings dictionary using the key S_APPKEY is empty");
+ return false;
+ }
+
+ return true;
+}
+
++(void)startApplication:(NSDictionary *)networkSettings {
+ [FlurryAppCircle setAppCircleEnabled:TRUE];
+ [FlurryAppCircle setAppCircleDelegate:self];
+ [FlurryAnalytics startSession:[networkSettings objectForKey:S_APPKEY]];
+
+ NSLog(@"AppCircle adapter: started Flurry Analytics with AppCircle");
+}
+
+-(NSString *)networkName {
+ return NETWORK_APPCIRCLE;
+}
+
+-(BOOL)requestAdWithDelegate:(id<AdCustomNetworkDelegate>)del andSettings:(NSDictionary *)networkSettings {
+
+ if(![super requestAdWithDelegate:del andSettings:networkSettings]) {
+ if([delegate respondsToSelector:@selector(customNetworkDidFailReceiveAd)])
+ [delegate customNetworkDidFailReceiveAd];
+
+ return FALSE;
+ }
+
+ if(!adView) {
+ UIViewController *viewController = nil;
+ UIView *view = nil;
+
+ //ask the viewController to the delegate
+ if([delegate respondsToSelector:@selector(customNetworkViewController)]) {
+ viewController = [delegate customNetworkViewController];
+
+ if(!viewController) {
+ NSLog(@"AppCircle Network Custom Adapter: Can't request an ad: You must return a valid View Controller using the delegate method customNetworkViewController.");
+ return FALSE;
+ }
+ }
+ else {
+ NSLog(@"AppCircle Network Custom Adapter: Can't request an ad: You must implement the method customNetworkViewController in the delegate and return a valid view controller.");
+ return FALSE;
+ }
+
+ if(viewController)
+ view = viewController.view;
+
+ if(!view) {
+ NSLog(@"AppCircle Network Custom Adapter: Can't request an ad. The view controller the delegate returned has not a valid view.");
+ return FALSE;
+ }
+
+ adView = [FlurryAppCircle getHook:@"DEFAULT_HOOK" xLoc:0 yLoc:0 view:view attachToView:NO orientation:@"portrait" canvasOrientation:@"portrait" autoRefresh:NO canvasAnimated:YES rewardMessage:nil userCookies:nil];
+ }
+ else
+ [FlurryAppCircle updateHook:adView];
+
+ [self dataAvailable];
+
+ return TRUE;
+}
+
+-(void)unloadAd {
+ [super unloadAd];
+}
+
+-(void)dealloc {
+ //The demo app didn't released adView, so i don't release it too even if it sounds strange.
+ [FlurryAppCircle setAppCircleDelegate:nil];
+ if(adView)
+ [FlurryAppCircle removeHook:adView];
+
+ [super dealloc];
+}
+
+#pragma mark - Flurry AppCircle delegate
+
+-(void)dataAvailable {
+ if(adView) {
+ NSLog(@"Flurry AppCircle Adapter: did receive ad");
+
+ if([delegate respondsToSelector:@selector(customNetworkDidReceiveAd:)]) {
+ [delegate customNetworkDidReceiveAd:adView];
+ }
+ }
+ else {
+ [self dataUnavailable];
+ }
+}
+
+-(void)dataUnavailable {
+ NSLog(@"Flurry AppCircle Adapter: did fail to receive ad");
+
+ if([delegate respondsToSelector:@selector(customNetworkDidFailReceiveAd)]) {
+ [delegate customNetworkDidFailReceiveAd];
+ }
+}
+
+-(void)takeoverWillDisplay:(NSString *)hook {
+
+}
+
+-(void)takeoverWillClose {
+
+}
+
+
+@end
40 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdBMobileNetwork.h
@@ -0,0 +1,40 @@
+//
+// AdBMobileNetwork.h
+// Ad Mediation Abstraction Layer
+//
+
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdCustomNetwork.h"
+#import "AdMarvelView.h"
+#import "AdMarvelDelegate.h"
+
+//Settings to pass to enableCustomNetwork:
+//S_GLOBALKEY => The B!Mobile partnerId
+//S_APPKEY => The B!Mobile siteId
+//S_TESTING => (optional) [NSNumber numberWithBool:TRUE] to enable testing bool or [NSNumber numberWithBool:FALSE] instead. Default: FALSE.
+
+@interface AdBMobileNetwork : AdCustomNetwork<AdMarvelDelegate> {
+ AdMarvelView *adView;
+ NSString *partnerId;
+ NSString *siteId;
+ BOOL testingMode;
+}
+
+@property(nonatomic, copy) NSString *partnerId;
+@property(nonatomic, copy) NSString *siteId;
+
+@end
162 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdBMobileNetwork.m
@@ -0,0 +1,162 @@
+//
+// AdBMobileNetwork.m
+// Ad Mediation Abstraction Layer
+//
+
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdBMobileNetwork.h"
+#import "AdGlobals.h"
+
+@implementation AdBMobileNetwork
+@synthesize partnerId, siteId;
+
++(BOOL)checkNetworkSettings:(NSDictionary *)networkSettings {
+ if(!networkSettings) {
+ NSLog(@"Can't enable the B!Mobile network because you've specified a nil settings dictionary");
+ return false;
+ }
+
+ //Verify the siteId
+ NSString *siteId = [networkSettings objectForKey:S_APPKEY];
+
+ if(!siteId) { //appKey not specified in settings dictionary
+ NSLog(@"Can't enable the B!Mobile network because you've not specified the siteId using the S_APPKEY key in settings dictionary");
+ return false;
+ }
+
+ if([[siteId stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" "]] isEqualToString:@""]) { //siteId is empty
+ NSLog(@"Can't enable the B!Mobile network because the siteId you've specified in the settings dictionary using the key S_APPKEY is empty");
+ return false;
+ }
+
+ //Verify the partnerId
+ NSString *partnerId = [networkSettings objectForKey:S_GLOBALKEY];
+
+ if(!partnerId) { //appKey not specified in settings dictionary
+ NSLog(@"Can't enable the B!Mobile network because you've not specified the partnerId using the S_GLOBALKEY key in settings dictionary");
+ return false;
+ }
+
+ if([[partnerId stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" "]] isEqualToString:@""]) { //partnerId is empty
+ NSLog(@"Can't enable the B!Mobile network because the partnerId you've specified in the settings dictionary using the key S_GLOBALKEY is empty");
+ return false;
+ }
+
+ return true;
+}
+
++(void)startApplication:(NSDictionary *)networkSettings {
+
+ NSLog(@"B!Mobile adapter: started.");
+}
+
+-(NSString *)networkName {
+ return NETWORK_BMOBILE;
+}
+
+-(BOOL)requestAdWithDelegate:(id<AdCustomNetworkDelegate>)del andSettings:(NSDictionary *)networkSettings {
+
+ if(![super requestAdWithDelegate:del andSettings:networkSettings]) {
+ if([delegate respondsToSelector:@selector(customNetworkDidFailReceiveAd)])
+ [delegate customNetworkDidFailReceiveAd];
+
+ return FALSE;
+ }
+
+ self.partnerId = [networkSettings objectForKey:S_GLOBALKEY];
+ self.siteId = [networkSettings objectForKey:S_APPKEY];
+
+ NSNumber *number = [networkSettings objectForKey:S_TESTING];
+ if(number && [number boolValue] == TRUE)
+ testingMode = TRUE;
+ else
+ testingMode = FALSE;
+
+ if(!adView) {
+ adView = [AdMarvelView createAdMarvelViewWithDelegate:self];
+ [adView retain];
+ }
+
+ [adView getAdWithNotification];
+
+ return TRUE;
+}
+
+-(void)unloadAd {
+ [super unloadAd];
+}
+
+-(void)dealloc {
+ [adView setDelegate:nil];
+ [adView release];
+
+ [super dealloc];
+}
+
+#pragma mark AdMarvelDelegate
+
+-(NSString *)partnerId {
+ return partnerId;
+}
+
+-(NSString *)siteId {
+ return siteId;
+}
+
+-(CGRect)adMarvelViewFrame {
+ if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
+ return CGRectMake(0, 0, 768, 60);
+ else
+ return CGRectMake(0, 0, 320, 50);
+}
+
+-(UIViewController *)applicationUIViewController {
+ if([delegate respondsToSelector:@selector(customNetworkViewController)])
+ return [delegate customNetworkViewController];
+ else return nil;
+}
+
+-(void)getAdSucceeded {
+ NSLog(@"B!Mobile adapter: received ad");
+
+ if([delegate respondsToSelector:@selector(customNetworkDidReceiveAd:)])
+ [delegate customNetworkDidReceiveAd:adView];
+}
+
+-(void)getAdFailed {
+ NSLog(@"B!Mobile adapter: failed to receive ad");
+
+ if([delegate respondsToSelector:@selector(customNetworkDidFailReceiveAd)])
+ [delegate customNetworkDidFailReceiveAd];
+}
+
+-(BOOL)testingEnabled {
+ return testingMode;
+}
+
+-(void)fullScreenWebViewActivated {
+ if([delegate respondsToSelector:@selector(customNetworkWillPresentModalViewForAd)])
+ [delegate customNetworkWillPresentModalViewForAd];
+}
+
+
+-(void)fullScreenWebViewClosed {
+ if([delegate respondsToSelector:@selector(customNetworkDidDismissModalViewForAd)])
+ [delegate customNetworkDidDismissModalViewForAd];
+}
+
+@end
52 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdCustomNetwork.h
@@ -0,0 +1,52 @@
+//
+// AdCustomNetwork.h
+// Ad Mediation Abstraction Layer
+//
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 <Foundation/Foundation.h>
+
+@protocol AdCustomNetworkDelegate
+-(void)customNetworkDidReceiveAd:(UIView*)ad;
+-(void)customNetworkDidFailReceiveAd;
+-(UIViewController*)customNetworkViewController;
+-(void)customNetworkShouldCallNextAd;
+-(void)customNetworkWillPresentModalViewForAd;
+-(void)customNetworkDidDismissModalViewForAd;
+@end
+
+@interface AdCustomNetwork : NSObject {
+ id delegate;
+}
+
+@property(nonatomic, assign) id delegate;
+
+//Verify if the network settings are correct
++(BOOL)checkNetworkSettings:(NSDictionary*)networkSettings;
+
+//Initialize the network and pass the parameters (appkeys, etc..)
++(void)startApplication:(NSDictionary*)networkSettings;
+
+//return the name of the network (uses the NETWORK_* defines declared in AdGlobals.h)
+-(NSString*)networkName;
+
+//Request an ad to the network.
+-(BOOL)requestAdWithDelegate:(id<AdCustomNetworkDelegate>)del andSettings:(NSDictionary*)networkSettings;
+
+-(void)unloadAd;
+
+
+@end
57 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdCustomNetwork.m
@@ -0,0 +1,57 @@
+//
+// AdCustomNetwork.m
+// Ad Mediation Abstraction Layer
+//
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdCustomNetwork.h"
+/*#import "Reachability.h"
+#import <SystemConfiguration/SystemConfiguration.h>*/
+
+@implementation AdCustomNetwork
+@synthesize delegate;
+
+/*
+- (BOOL)connected
+{
+ Reachability *reachability = [Reachability reachabilityForInternetConnection];
+ NetworkStatus networkStatus = [reachability currentReachabilityStatus];
+ return !(networkStatus == NotReachable);
+}*/
+
++(BOOL)checkNetworkSettings:(NSDictionary *)networkSettings {
+ return TRUE;
+}
+
++(void)startApplication:(NSDictionary *)networkSettings {
+
+}
+
+
+-(BOOL)requestAdWithDelegate:(id<AdCustomNetworkDelegate>)del andSettings:(NSDictionary *)networkSettings {
+ delegate = del;
+
+ /* if(![self connected])
+ return FALSE;*/
+
+ return TRUE;
+}
+
+-(void)unloadAd {
+ delegate = nil;
+}
+
+@end
28 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdMoPubNetwork.h
@@ -0,0 +1,28 @@
+//
+// AdMoPubNetwork.h
+// Ad Mediation Abstraction Layer
+//
+
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdCustomNetwork.h"
+#import "MPAdView.h"
+
+@interface AdMoPubNetwork : AdCustomNetwork<MPAdViewDelegate> {
+ MPAdView *adView;
+}
+
+@end
138 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdMoPubNetwork.m
@@ -0,0 +1,138 @@
+//
+// AdMoPubNetwork.m
+// Ad Mediation Abstraction Layer
+//
+
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdMoPubNetwork.h"
+#import "AdGlobals.h"
+#import "MPAdConversionTracker.h"
+
+@implementation AdMoPubNetwork
+
++(BOOL)checkNetworkSettings:(NSDictionary *)networkSettings {
+ if(!networkSettings) {
+ NSLog(@"Can't enable the MoPub network because you've specified a nil settings dictionary");
+ return false;
+ }
+
+ //Verify the app key
+ NSString *appKey = [networkSettings objectForKey:S_APPKEY];
+
+ if(!appKey) { //appKey not specified in settings dictionary
+ NSLog(@"Can't enable the MoPub network because you've not specified the app key using the S_APPKEY key in settings dictionary");
+ return false;
+ }
+
+ if([[appKey stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" "]] isEqualToString:@""]) { //siteId is empty
+ NSLog(@"Can't enable the MoPub network because the siteId you've specified in the settings dictionary using the key S_APPKEY is empty");
+ return false;
+ }
+
+ return true;
+}
+
++(void)startApplication:(NSDictionary *)networkSettings {
+
+ [[MPAdConversionTracker sharedConversionTracker] reportApplicationOpenForApplicationID:[networkSettings objectForKey:S_APPKEY]];
+
+ NSLog(@"MoPub adapter: started.");
+}
+
+-(NSString *)networkName {
+ return NETWORK_MOPUB;
+}
+
+-(BOOL)requestAdWithDelegate:(id<AdCustomNetworkDelegate>)del andSettings:(NSDictionary *)networkSettings {
+
+ if(![super requestAdWithDelegate:del andSettings:networkSettings]) {
+ if([delegate respondsToSelector:@selector(customNetworkDidFailReceiveAd)])
+ [delegate customNetworkDidFailReceiveAd];
+
+ return FALSE;
+ }
+
+ if(!adView) {
+
+ NSString *appKey = [networkSettings objectForKey:S_APPKEY];
+
+ if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
+ adView = [[MPAdView alloc] initWithAdUnitId:appKey size:MOPUB_LEADERBOARD_SIZE];
+ else
+ adView = [[MPAdView alloc] initWithAdUnitId:appKey size:MOPUB_BANNER_SIZE];
+ adView.delegate = self;
+ adView.ignoresAutorefresh = TRUE;
+ }
+
+ [adView loadAd];
+
+ return TRUE;
+}
+
+-(void)unloadAd {
+ [super unloadAd];
+}
+
+-(void)dealloc {
+ [adView setDelegate:nil];
+ [adView release];
+
+ [super dealloc];
+}
+
+#pragma MPAdViewDelegate
+
+-(UIViewController *)viewControllerForPresentingModalView {
+ if([delegate respondsToSelector:@selector(customNetworkViewController)])
+ return [delegate customNetworkViewController];
+ else
+ return nil;
+}
+
+-(void)adViewDidLoadAd:(MPAdView *)view {
+ NSLog(@"MoPub adapter: received ad");
+
+ view.frame = CGRectMake(0, 0, view.adContentViewSize.width, view.adContentViewSize.height);
+
+ if([delegate respondsToSelector:@selector(customNetworkDidReceiveAd:)])
+ [delegate customNetworkDidReceiveAd:view];
+}
+
+-(void)adViewDidFailToLoadAd:(MPAdView *)view {
+ NSLog(@"MoPub adapter: failed to receive ad");
+
+ if([delegate respondsToSelector:@selector(customNetworkDidFailReceiveAd)])
+ [delegate customNetworkDidFailReceiveAd];
+}
+
+-(void)willPresentModalViewForAd:(MPAdView *)view {
+ if([delegate respondsToSelector:@selector(customNetworkWillPresentModalViewForAd)])
+ [delegate customNetworkWillPresentModalViewForAd];
+}
+
+-(void)didDismissModalViewForAd:(MPAdView *)view {
+ if([delegate respondsToSelector:@selector(customNetworkDidDismissModalViewForAd)])
+ [delegate customNetworkDidDismissModalViewForAd];
+}
+
+-(void)adViewShouldClose:(MPAdView *)view {
+ if([delegate respondsToSelector:@selector(customNetworkShouldCallNextAd)])
+ [delegate customNetworkShouldCallNextAd];
+}
+
+
+@end
32 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdMobClixNetwork.h
@@ -0,0 +1,32 @@
+//
+// AdMobClixNetwork.h
+// Ad Mediation Abstraction Layer
+//
+
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 <Foundation/Foundation.h>
+#import "AdCustomNetwork.h"
+#import "MobclixAdView.h"
+
+//Settings to pass to enableCustomNetwork:
+//S_APPKEY => The MobClix AppKey
+
+@interface AdMobClixNetwork : AdCustomNetwork<MobclixAdViewDelegate> {
+ MobclixAdView *adView;
+}
+
+@end
115 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdMobClixNetwork.m
@@ -0,0 +1,115 @@
+//
+// AdMobClixNetwork.m
+// Ad Mediation Abstraction Layer
+//
+
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdMobClixNetwork.h"
+#import "Mobclix.h"
+#import "AdGlobals.h"
+
+@implementation AdMobClixNetwork
+
++(BOOL)checkNetworkSettings:(NSDictionary *)networkSettings {
+ if(!networkSettings) {
+ NSLog(@"Can't enable the MobClix network because you've specified a nil settings dictionary");
+ return false;
+ }
+
+ NSString *key = [networkSettings objectForKey:S_APPKEY];
+
+ if(!key) { //appKey not specified in settings dictionary
+ NSLog(@"Can't enable the MobClix network because you've not specified the app key using the S_APPKEY in settings dictionary");
+ return false;
+ }
+
+ if([[key stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" "]] isEqualToString:@""]) { //appKey is empty
+ NSLog(@"Can't enable the MobClix network because the settings dictionary key S_APPKEY you've specified is empty");
+ return false;
+ }
+
+ return true;
+}
+
++(void)startApplication:(NSDictionary *)networkSettings {
+ [Mobclix startWithApplicationId:[networkSettings objectForKey:S_APPKEY]];
+
+ NSLog(@"MobClix adapter: started.");
+}
+
+-(NSString *)networkName {
+ return NETWORK_MOBCLIX;
+}
+
+-(BOOL)requestAdWithDelegate:(id<AdCustomNetworkDelegate>)del andSettings:(NSDictionary *)networkSettings {
+
+ if(![super requestAdWithDelegate:del andSettings:networkSettings]) {
+ if([delegate respondsToSelector:@selector(customNetworkDidFailReceiveAd)])
+ [delegate customNetworkDidFailReceiveAd];
+
+ return FALSE;
+ }
+
+ if(!adView) {
+ if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
+ adView = [[MobclixAdViewiPhone_320x50 alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
+ else if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
+ adView = [[MobclixAdViewiPad_728x90 alloc] initWithFrame:CGRectMake(0, 0, 728, 90)];
+ }
+ }
+
+ [adView setDelegate:self];
+ [adView setRefreshTime:-1]; //disables the mobclix autorefresh timer
+
+ [adView getAd];
+
+ return TRUE;
+}
+
+-(void)unloadAd {
+ [super unloadAd];
+
+ [adView cancelAd];
+ [adView setDelegate: nil];
+ adView = nil;
+}
+
+-(void)dealloc {
+ [adView cancelAd];
+ [adView setDelegate:nil];
+ adView = nil;
+
+ [super dealloc];
+}
+
+#pragma mark MobClixAdViewDelegate
+
+- (void)adViewDidFinishLoad:(MobclixAdView*)ad {
+ NSLog(@"MobClix adapter: received ad");
+
+ if([delegate respondsToSelector:@selector(customNetworkDidReceiveAd:)])
+ [delegate customNetworkDidReceiveAd:ad];
+}
+
+- (void)adView:(MobclixAdView*)ad didFailLoadWithError:(NSError*)error {
+ NSLog(@"MobClix adapter: failed to receive ad");
+
+ if([delegate respondsToSelector:@selector(customNetworkDidFailReceiveAd)])
+ [delegate customNetworkDidFailReceiveAd];
+}
+
+@end
31 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdMobFoxNetwork.h
@@ -0,0 +1,31 @@
+//
+// AdMobFoxNetwork.h
+// Ad Mediation Abstraction Layer
+//
+
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdCustomNetwork.h"
+#import <MobFox/MobFox.h>
+
+@interface AdMobFoxNetwork : AdCustomNetwork<MobFoxBannerViewDelegate> {
+ MobFoxBannerView *adView;
+ NSString *appKey;
+}
+
+@property(nonatomic, copy) NSString *appKey;
+
+@end
116 AdMAL/Ad Mediation Abstraction Layer/custom network adapters/AdMobFoxNetwork.m
@@ -0,0 +1,116 @@
+//
+// AdMobFoxNetwork.m
+// Ad Mediation Abstraction Layer
+//
+
+/* Copyright 2012 Marco Siino, DooLabs (http://www.marcosiino.it - http://www.doolabs.com)
+
+ 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 "AdMobFoxNetwork.h"
+#import "AdGlobals.h"
+
+@implementation AdMobFoxNetwork
+@synthesize appKey;
+
++(BOOL)checkNetworkSettings:(NSDictionary *)networkSettings {
+ if(!networkSettings) {
+ NSLog(@"Can't enable the MobFox network because you've specified a nil settings dictionary");
+ return false;
+ }
+
+ //Verify the app key
+ NSString *appKey = [networkSettings objectForKey:S_APPKEY];
+
+ if(!appKey) { //appKey not specified in settings dictionary
+ NSLog(@"Can't enable the MobFox network because you've not specified the app key using the S_APPKEY key in settings dictionary");
+ return false;
+ }
+
+ if([[appKey stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" "]] isEqualToString:@""]) { //siteId is empty
+ NSLog(@"Can't enable the MobFox network because the siteId you've specified in the settings dictionary using the key S_APPKEY is empty");
+ return false;
+ }
+
+ return true;
+}
+
++(void)startApplication:(NSDictionary *)networkSettings {
+ NSLog(@"MobFox adapter: started.");
+}
+
+-(NSString *)networkName {
+ return NETWORK_MOBFOX;
+}
+
+-(BOOL)requestAdWithDelegate:(id<AdCustomNetworkDelegate>)del andSettings:(NSDictionary *)networkSettings {
+
+ if(![super requestAdWithDelegate:del andSettings:networkSettings]) {
+ if([delegate respondsToSelector:@selector(customNetworkDidFailReceiveAd)])
+ [delegate customNetworkDidFailReceiveAd];
+
+ return FALSE;
+ }
+
+ self.appKey = [networkSettings objectForKey:S_APPKEY];
+
+ if(!adView) {
+ adView = [[MobFoxBannerView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
+ }
+ else
+ [adView requestAd]; //calling a method of MobFox that is not exposed on the .h because there is no other method to refresh the ad manually
+
+ adView.delegate = self;
+
+ return TRUE;
+}
+
+-(void)unloadAd {
+ [super unloadAd];
+}
+
+-(void)dealloc {
+ //The demo app didn't released adView, so i don't release it too even if it sounds strange.
+ adView.delegate = nil;
+ adView = nil;
+
+ [appKey release];
+
+ [super dealloc];
+}
+
+#pragma mark - MobFoxDelegate
+
+-(NSString *)publisherIdForMobFoxBannerView:(MobFoxBannerView *)banner {
+ return appKey;
+}
+
+-(void)mobfoxBannerViewDidLoadMobFoxAd:(MobFoxBannerView *)banner {
+ NSLog(@"MobFox adapter: received ad");
+
+ if([delegate respondsToSelector:@selector(customNetworkDidReceiveAd:)])
+ [delegate customNetworkDidReceiveAd:adView];
+}
+
+-(void)mobfoxBannerView:(MobFoxBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
+
+ NSLog(@"MobFox adapter: failed to receive ad");
+
+ if([delegate respondsToSelector:@selector(customNetworkDidFailReceiveAd)])
+ [delegate customNetworkDidFailReceiveAd];
+
+}
+
+
+@end
344 AdMAL/Ad SDKs/AdWhirl/AdWhirlDelegateProtocol.h
@@ -0,0 +1,344 @@
+/*
+
+ AdWhirlDelegateProtocol.h
+
+ Copyright 2009 AdMob, 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 <CoreLocation/CoreLocation.h>
+#import <UIKit/UIKit.h>
+
+@class AdWhirlView;
+
+@protocol AdWhirlDelegate<NSObject>
+
+@required
+
+- (NSString *)adWhirlApplicationKey;
+
+/**
+ * The view controller with which the ad network will display a modal view
+ * (web view, canvas), such as when the user clicks on the ad. You must
+ * supply a view controller. You should return the root view controller
+ * of your application, such as the root UINavigationController, or
+ * any controllers that are pushed/added directly to the root view controller.
+ * For example, if your app delegate has a pointer to the root view controller:
+ *
+ * return [(MyAppDelegate *)[[UIApplication sharedApplication] delegate] rootViewController]
+ *
+ * will suffice.
+ */
+- (UIViewController *)viewControllerForPresentingModalView;
+
+@optional
+
+#pragma mark server endpoints
+/**
+ * If you are running your own AdWhirl server instance, make sure you
+ * implement the following to return the URL that points to the endpoints
+ * on your server.
+ */
+- (NSURL *)adWhirlConfigURL;
+- (NSURL *)adWhirlImpMetricURL;
+- (NSURL *)adWhirlClickMetricURL;
+- (NSURL *)adWhirlCustomAdURL;
+
+
+#pragma mark notifications
+/**
+ * You can listen to callbacks from AdWhirl via these methods. When AdWhirl is
+ * notified that an ad request is fulfilled, it will notify you immediately.
+ * Thus, when notified that an ad request succeeded, you can choose to add the
+ * AdWhirlView object as a subview to your view. This view contains the ad.
+ * When you are notified that an ad request failed, you are also informed if the
+ * AdWhirlView is fetching a backup ad. The backup fetching order is specified
+ * by you in adwhirl.com or your own server instance. When all backup sources
+ * are attempted and the last ad request still fails, the usingBackup parameter
+ * will be set to NO. You can use this notification to try again and perhaps
+ * request another AdWhirlView via [AdWhirlView requestAdWhirlViewWithDelegate:]
+ */
+- (void)adWhirlDidReceiveAd:(AdWhirlView *)adWhirlView;
+- (void)adWhirlDidFailToReceiveAd:(AdWhirlView *)adWhirlView usingBackup:(BOOL)yesOrNo;
+
+/**
+ * You can get notified when the transition animation to a new ad is completed
+ * so you can make necessary adjustments to the size of the adWhirlView and
+ * surrounding views after the animation.
+ */
+- (void)adWhirlDidAnimateToNewAdIn:(AdWhirlView *)adWhirlView;
+
+/**
+ * This function is your integration point for Generic Notifications. You can
+ * control when this notification occurs via the developers member section. You
+ * can allocate a percentage of your ad requests to initiate this callback. When
+ * you receive this notification, you can execute any code block that you own.
+ * For example, you can replace the ad in AdWhirlView after getting this callback
+ * by calling replaceBannerViewWith: . Note that the ad refresh cycle is still
+ * alive, so your view could be replaced by other ads when it's time for an
+ * ad refresh.
+ */
+- (void)adWhirlReceivedRequestForDeveloperToFufill:(AdWhirlView *)adWhirlView;
+
+/**
+ * In the event that ads are OFF, you can listen to this callback method to
+ * determine that ads have been turned off.
+ */
+- (void)adWhirlReceivedNotificationAdsAreOff:(AdWhirlView *)adWhirlView;
+
+/**
+ * These notifications will let you know when a user is being shown a full screen
+ * webview canvas with an ad because they tapped on an ad. You should listen to
+ * these notifications to determine when to pause/resume your game--if you're
+ * building a game app.
+ */
+- (void)adWhirlWillPresentFullScreenModal;
+- (void)adWhirlDidDismissFullScreenModal;
+
+/**
+ * An ad request is a two step process: first the SDK must go to the AdWhirl
+ * server to retrieve configuration information. Then, based on the configuration
+ * information, it chooses an ad network and fetch an ad. The following call
+ * is for users to get notified when the first step is complete. The
+ * adWhirlView passed could be null if you had called the AdWhirlView class
+ * method +startPreFetchingConfigurationDataWithDelegate .
+ */
+- (void)adWhirlDidReceiveConfig:(AdWhirlView *)adWhirlView;
+
+
+#pragma mark behavior configurations
+
+/**
+ * Request test ads for APIs that supports it. Make sure you turn it to OFF
+ * or remove the function before you submit your app to the app store.
+ */
+- (BOOL)adWhirlTestMode;
+
+/**
+ * Returns the device's current orientation for ad networks that relys on
+ * it. If you don't implement this function, [UIDevice currentDevice].orientation
+ * is used to get the current orientation.
+ */
+- (UIDeviceOrientation)adWhirlCurrentOrientation;
+
+#pragma mark appearance configurations
+- (UIColor *)adWhirlAdBackgroundColor;
+- (UIColor *)adWhirlTextColor;
+- (UIColor *)adWhirlSecondaryTextColor;
+- (UIColor *)backgroundColor DEPRECATED_ATTRIBUTE; // use the one with adWhirl prefix
+- (UIColor *)textColor DEPRECATED_ATTRIBUTE; // use the one with adWhirl prefix
+
+
+#pragma mark hard-coded application keys
+- (NSString *)admobPublisherID; // your Publisher ID from Admob.
+- (NSDictionary *)quattroWirelessDictionary; // key-value pairs for the keys "publisherID" and "siteID" provided by Quattro Wireless. Set NSString values for these two keys.
+- (NSString *)pinchApplicationKey; // your Application Code from Pinch Media.
+- (NSDictionary *)videoEggConfigDictionary; // key-value pairs for the keys "publisher" and "area" information from Video Egg. Set NSString values for these two keys.
+- (NSString *)millennialMediaApIDString; // your ApID string from Millennial Media.
+- (NSString *)MdotMApplicationKey; // your Application Code from MdotM
+- (NSString *)googleAdSenseClientID; // your publisher ID from Google AdSense
+- (NSString *)zestADZClientID; // your clientID from ZestADZ
+- (NSString *)brightRollAppId; // your BrightRoll App ID
+- (NSString *)inMobiAppID; // your inMobi app ID
+- (NSString *)oneRiotAppID;
+- (NSDictionary *) nexageDictionary; // your nexage dcn and position
+
+
+#pragma mark demographic information optional delegate methods
+- (CLLocation *)locationInfo; // user's current location
+- (NSString *)postalCode; // user's postal code, e.g. "94401"
+- (NSString *)areaCode; // user's area code, e.g. "415"
+- (NSDate *)dateOfBirth; // user's date of birth
+- (NSString *)gender; // user's gender (e.g. @"m" or @"f")
+- (NSString *)keywords; // keywords the user has provided or that are contextually relevant, e.g. @"twitter client iPhone"
+- (NSString *)searchString; // a search string the user has provided, e.g. @"Jasmine Tea House San Francisco"
+- (NSUInteger)incomeLevel; // return actual annual income
+
+
+#pragma mark QuattroWireless-specific optional delegate methods
+/**
+ * Return the ad type desired for Quattro
+ * QWAdTypeBanner = 0,
+ * QWAdTypeText=2,
+ */
+- (NSUInteger)quattroWirelessAdType;
+
+/**
+ * Return a value for the education level if you have access to this info. This
+ * information will be relayed to Quattro Wireless if provided.
+ * QWEducationNoCollege = 0
+ * QWEducationCollegeGraduate = 1
+ * QWEducationGraduateSchool = 2
+ * QWEducationUnknown = 3
+ */
+- (NSUInteger)quattroWirelessEducationLevel;
+
+/**
+ * Return a value for the ethnicity if you have access to this info. This
+ * information will be relayed to Quattro Wireless if provided.
+ * QWEthnicGroupAfrican_American = 0
+ * QWEthnicGroupAsian = 1
+ * QWEthnicGroupHispanic = 2
+ * QWEthnicGroupWhite = 3
+ * QWEthnicGroupOther = 4
+ */
+- (NSUInteger)quattroWirelessEthnicity;
+
+
+#pragma mark MillennialMedia-specific optional delegate methods
+/**
+ * Return the ad type desired for Millennial Media, depending on your ad position
+ * MMBannerAdTop = 1,
+ * MMBannerAdBottom = 2,
+ */
+- (NSUInteger)millennialMediaAdType;
+
+/**
+ * Return a value for the education level if you have access to this info. This
+ * information will be relayed to Millennial Media if provided
+ * MMEducationUnknown = 0,
+ * MMEducationHishSchool = 1,
+ * MMEducationSomeCollege = 2,
+ * MMEducationInCollege = 3,
+ * MMEducationBachelorsDegree = 4,
+ * MMEducationMastersDegree = 5,
+ * MMEducationPhD = 6
+ */
+- (NSUInteger)millennialMediaEducationLevel;
+
+/**
+ * Return a value for ethnicity if you have access to this info. This
+ * information will be relayed to Millennial Media if provided.
+ * MMEthnicityUnknown = 0,
+ * MMEthnicityAfricanAmerican = 1,
+ * MMEthnicityAsian = 2,
+ * MMEthnicityCaucasian = 3,
+ * MMEthnicityHispanic = 4,
+ * MMEthnicityNativeAmerican = 5,
+ * MMEthnicityMixed = 6
+ */
+- (NSUInteger)millennialMediaEthnicity;
+
+- (NSUInteger)millennialMediaAge DEPRECATED_ATTRIBUTE; // use dateOfBirth
+
+
+#pragma mark Jumptap-specific optional delegate methods
+/**
+ * optional site and spot id as provided by Jumptap.
+ */
+- (NSString *)jumptapSiteId;
+- (NSString *)jumptapSpotId;
+
+/**
+ * Find a list of valid categories at https://support.jumptap.com/index.php/Valid_Categories
+ */
+- (NSString *)jumptapCategory;
+
+/**
+ * Whether adult content is allowed.
+ * AdultContentAllowed = 0,
+ * AdultContentNotAllowed = 1,
+ * AdultContentOnly = 2
+ */
+- (NSUInteger)jumptapAdultContent;
+
+/**
+ * The transition to use when moving from, say, a banner to full-screen.
+ * TransitionHorizontalSlide = 0,
+ * TransitionVerticalSlide = 1,
+ * TransitionCurl = 2,
+ * TransitionFlip = 3
+ */
+- (NSUInteger)jumptapTransitionType;
+
+
+#pragma mark Google AdSense-specific delegate methods
+/**
+ These are *REQUIRED* for googleAdSense. If you don't implement these methods,
+ your app will crash as the AdSense adapter looks for these methods.
+ */
+- (NSString *)googleAdSenseCompanyName;
+- (NSString *)googleAdSenseAppName;
+- (NSString *)googleAdSenseApplicationAppleID;
+
+/**
+ The following are optional and correspond to the optional kGADAdSense* ad attributes.
+ For documentation, see GADAdSenseParameters.h .
+ */
+- (NSString *)googleAdSenseKeywords;
+- (NSURL *)googleAdSenseAppWebContentURL;
+- (NSArray *)googleAdSenseChannelIDs;
+- (NSString *)googleAdSenseAdType;
+- (NSString *)googleAdSenseHostID;
+//- (UIColor *)googleAdSenseAdBackgroundColor; // implement adWhirlAdBackgroundColor or set in server
+- (UIColor *)googleAdSenseAdTopBackgroundColor;
+- (UIColor *)googleAdSenseAdBorderColor;
+- (UIColor *)googleAdSenseAdLinkColor;
+//- (UIColor *)googleAdSenseAdTextColor; // implement adWhirlTextColor or set in server
+- (UIColor *)googleAdSenseAdURLColor;
+- (UIColor *)googleAdSenseAlternateAdColor;
+- (NSURL *)googleAdSenseAlternateAdURL;
+- (NSNumber *)googleAdSenseAllowAdsafeMedium;
+
+
+#pragma mark InMobi-specific optional delegate methods
+/**
+ * Education level for InMobi
+ * Edu_None = 0
+ * Edu_HighSchool = 1
+ * Edu_SomeCollege = 2
+ * Edu_InCollege = 3
+ * Edu_BachelorsDegree = 4
+ * Edu_MastersDegree = 5
+ * Edu_DoctoralDegree = 6
+ * Edu_Other = 7
+ */
+- (NSUInteger)inMobiEducation;
+
+/**
+ Eth_None = 0,
+ Eth_Mixed = 1,
+ Eth_Asian = 2,
+ Eth_Black = 3,
+ Eth_Hispanic = 4,
+ Eth_NativeAmerican = 5,