Skip to content

Commit

Permalink
Merge pull request #67 from hansemannn/UPDATE-SDK
Browse files Browse the repository at this point in the history
Update AdMob SDK to 7.18.0
  • Loading branch information
hansemannn authored Mar 25, 2017
2 parents a350f16 + 5851108 commit cddc92e
Show file tree
Hide file tree
Showing 83 changed files with 1,875 additions and 324 deletions.
3 changes: 2 additions & 1 deletion ios/Classes/TiAdmobModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ -(void)startup
// you *must* call the superclass
[super startup];

NSLog(@"[INFO] AdMob module loaded",self);
NSLog(@"[DEBUG] Ti.AdMob loaded",self);
}

-(void)shutdown:(id)sender
Expand Down Expand Up @@ -69,6 +69,7 @@ -(void)didReceiveMemoryWarning:(NSNotification*)notification
MAKE_SYSTEM_STR(SIMULATOR_ID, kGADSimulatorID);
MAKE_SYSTEM_PROP(GENDER_MALE, kGADGenderMale);
MAKE_SYSTEM_PROP(GENDER_FEMALE, kGADGenderFemale);
MAKE_SYSTEM_PROP(GENDER_UNKNOWN, kGADGenderUnknown);
MAKE_SYSTEM_PROP(AD_TYPE_BANNER, TiAdmobAdTypeBanner);
MAKE_SYSTEM_PROP(AD_TYPE_INTERSTITIAL, TiAdmobAdTypeInterstitial)

Expand Down
24 changes: 24 additions & 0 deletions ios/Classes/TiAdmobModuleAssets.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* This is a generated file. Do not edit or your changes will be lost
*/
#import "TiAdmobModuleAssets.h"

extern NSData* filterDataInRange(NSData* thedata, NSRange range);

@implementation TiAdmobModuleAssets

- (NSData*) moduleAsset
{


return nil;
}

- (NSData*) resolveModuleAsset:(NSString*)path
{


return nil;
}

@end
63 changes: 41 additions & 22 deletions ios/Classes/TiAdmobView.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ @implementation TiAdmobView

#pragma mark - Ad Lifecycle

- (GADRequest*)request
- (GADRequest *)request
{
if (request == nil) {
request = [[GADRequest request] retain];
Expand All @@ -23,26 +23,25 @@ - (GADRequest*)request
return request;
}

- (GADInterstitial*)interstitial
- (GADInterstitial *)interstitial
{
if (interstitial == nil) {
id debugEnabled = [[self proxy] valueForKey:@"debugEnabled"];
id adUnitId = [[self proxy] valueForKey:@"adUnitId"];

if (debugEnabled != nil && [TiUtils boolValue:debugEnabled def:NO] == YES) {
if (debugEnabled != nil && [TiUtils boolValue:debugEnabled def:NO]) {
adUnitId = [self exampleAdId];
}

[self setBackgroundColor:[UIColor redColor]];

interstitial = [[GADInterstitial alloc] initWithAdUnitID:[TiUtils stringValue:adUnitId]];
[interstitial setDelegate:self];
[interstitial setInAppPurchaseDelegate:self];
}

return interstitial;
}

- (GADBannerView*)bannerView
- (GADBannerView *)bannerView
{
if (bannerView == nil) {
// Create the view with dynamic width and height specification.
Expand Down Expand Up @@ -185,18 +184,20 @@ - (void)setExtras_:(id)args
GADExtras *extras = [[GADExtras alloc] init];
[extras setAdditionalParameters:args];
[[self request] registerAdNetworkExtras:extras];

RELEASE_TO_NIL(extras);
}

- (void)setGender_:(id)value
{
if ([value isKindOfClass:[NSString class]]) {
NSLog(@"[WARN] Ti.Admob: String values for `gender` are deprecated in 2.0.0, use the `GENDER_MALE` or `GENDER_FEMALE` constant instead.");
NSLog(@"[WARN] Ti.Admob: String values for `gender` are deprecated in 2.0.0, use the `GENDER_MALE`, `GENDER_FEMALE` or `GENDER_UNKNOWN` constant instead.");

if ([value isEqualToString:@"male"]) {
[[self request] setGender:kGADGenderMale];
} else if ([value isEqualToString:@"female"]) {
[[self request] setGender:kGADGenderFemale];
} else {
} else if ([value isEqualToString:@"unknown"]) {
[[self request] setGender:kGADGenderUnknown];
}

Expand Down Expand Up @@ -260,42 +261,57 @@ - (NSString*)exampleAdId
return @"ca-app-pub-0123456789012345/0123456789";
}

+ (NSDictionary *)dictionaryFromBannerView:(GADBannerView *)bannerView
{
return @{
@"adUnitId": bannerView.adUnitID
};
}

+ (NSDictionary *)dictionaryFromInterstitial:(GADInterstitial *)interstitial
{
return @{
@"adUnitId": interstitial.adUnitID,
@"isReady": NUMBOOL(interstitial.isReady)
};
}

#pragma mark - Ad Delegate

- (void)adViewDidReceiveAd:(GADBannerView *)view
{
[self.proxy fireEvent:@"didReceiveAd"];
[self.proxy fireEvent:@"didReceiveAd" withObject:[TiAdmobView dictionaryFromBannerView:view]];
}

- (void)adView:(GADBannerView *)view didFailToReceiveAdWithError:(GADRequestError *)error
{
[self.proxy fireEvent:@"didFailToReceiveAd" withObject:@{@"error":error.localizedDescription}];
[self.proxy fireEvent:@"didFailToReceiveAd" withObject:@{@"adUnitId": view.adUnitID, @"error":error.localizedDescription}];
}

- (void)adViewWillPresentScreen:(GADBannerView *)adView
{
[self.proxy fireEvent:@"willPresentScreen"];
[self.proxy fireEvent:@"willPresentScreen" withObject:[TiAdmobView dictionaryFromBannerView:adView]];
}

- (void)adViewWillDismissScreen:(GADBannerView *)adView
{
[self.proxy fireEvent:@"willDismissScreen"];
[self.proxy fireEvent:@"willDismissScreen" withObject:[TiAdmobView dictionaryFromBannerView:adView]];
}

- (void)adViewDidDismissScreen:(GADBannerView *)adView
{
[self.proxy fireEvent:@"didDismissScreen"];
[self.proxy fireEvent:@"didDismissScreen" withObject:[TiAdmobView dictionaryFromBannerView:adView]];
}

- (void)adViewWillLeaveApplication:(GADBannerView *)adView
{
[self.proxy fireEvent:@"willLeaveApplication"];
[self.proxy fireEvent:@"willLeaveApplication" withObject:[TiAdmobView dictionaryFromBannerView:adView]];
}

- (void)didReceiveInAppPurchase:(GADInAppPurchase *)purchase
{
[self.proxy fireEvent:@"didReceiveInAppPurchase" withObject:@{
@"productID": purchase.productID,
@"productId": purchase.productID,
@"quantity": [NSNumber numberWithInteger:purchase.quantity]
}];
}
Expand All @@ -304,34 +320,37 @@ - (void)didReceiveInAppPurchase:(GADInAppPurchase *)purchase

- (void)interstitialDidReceiveAd:(GADInterstitial *)ad
{
[self.proxy fireEvent:@"didReceiveAd" withObject:@{@"isReady": NUMBOOL([[self interstitial] isReady])}];
[self.proxy fireEvent:@"didReceiveAd" withObject:[TiAdmobView dictionaryFromInterstitial:ad]];
[self showInterstitial];
}

- (void)interstitial:(GADInterstitial *)ad didFailToReceiveAdWithError:(GADRequestError *)error
{
[self.proxy fireEvent:@"didFailToReceiveAd" withObject:@{@"error":error.localizedDescription}];
[self.proxy fireEvent:@"didFailToReceiveAd" withObject:@{@"adUnitId": ad.adUnitID, @"error":error.localizedDescription}];
}

- (void)interstitialWillPresentScreen:(GADInterstitial *)ad
{
[self.proxy fireEvent:@"willPresentScreen"];
[self.proxy fireEvent:@"willPresentScreen" withObject:[TiAdmobView dictionaryFromInterstitial:ad]];
}

- (void)interstitialWillDismissScreen:(GADInterstitial *)ad
{
[self.proxy fireEvent:@"willDismissScreen"];
[self.proxy fireEvent:@"willDismissScreen" withObject:[TiAdmobView dictionaryFromInterstitial:ad]];
}

- (void)interstitialDidDismissScreen:(GADInterstitial *)ad
{
[self performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:NO];
[self.proxy fireEvent:@"didDismissScreen"];
TiThreadPerformOnMainThread(^{
[self removeFromSuperview];
}, NO);

[self.proxy fireEvent:@"didDismissScreen" withObject:[TiAdmobView dictionaryFromInterstitial:ad]];
}

- (void)interstitialWillLeaveApplication:(GADInterstitial *)ad
{
[self.proxy fireEvent:@"willLeaveApplication"];
[self.proxy fireEvent:@"willLeaveApplication" withObject:[TiAdmobView dictionaryFromInterstitial:ad]];
}

@end
38 changes: 36 additions & 2 deletions ios/admob.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
CE6C17AA1982D1870017C788 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE6C17A91982D1870017C788 /* SystemConfiguration.framework */; };
DAD5D7CF12527E11009CF986 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAD5D7CE12527E11009CF986 /* AudioToolbox.framework */; };
DAD5D7D512527E2F009CF986 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAD5D7D412527E2F009CF986 /* MessageUI.framework */; };
DB07E8B81E8010000008C1E1 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB07E8B61E8010000008C1E1 /* CoreMedia.framework */; };
DB07E8B91E8010000008C1E1 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB07E8B71E8010000008C1E1 /* CoreMotion.framework */; };
DB07E8BB1E80100D0008C1E1 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB07E8BA1E80100D0008C1E1 /* CoreVideo.framework */; };
DB07E8BD1E80101A0008C1E1 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB07E8BC1E80101A0008C1E1 /* GLKit.framework */; };
DB07E8BF1E80101F0008C1E1 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB07E8BE1E80101F0008C1E1 /* JavaScriptCore.framework */; };
DB07E8C01E80103C0008C1E1 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAD5D7D112527E1A009CF986 /* MediaPlayer.framework */; };
DB07E8C21E80104D0008C1E1 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB07E8C11E80104D0008C1E1 /* MobileCoreServices.framework */; };
DB07E8C41E8010560008C1E1 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB07E8C31E8010560008C1E1 /* OpenGLES.framework */; };
DB07E8C61E8010680008C1E1 /* SafariServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB07E8C51E8010680008C1E1 /* SafariServices.framework */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -53,6 +62,14 @@
DAD5D7CE12527E11009CF986 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
DAD5D7D112527E1A009CF986 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
DAD5D7D412527E2F009CF986 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; };
DB07E8B61E8010000008C1E1 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
DB07E8B71E8010000008C1E1 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
DB07E8BA1E80100D0008C1E1 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
DB07E8BC1E80101A0008C1E1 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; };
DB07E8BE1E80101F0008C1E1 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
DB07E8C11E80104D0008C1E1 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
DB07E8C31E8010560008C1E1 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
DB07E8C51E8010680008C1E1 /* SafariServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SafariServices.framework; path = System/Library/Frameworks/SafariServices.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -62,16 +79,25 @@
files = (
3A4F268F1C68DDF7003E06CF /* iAd.framework in Frameworks */,
3AC840121C60A7F3002A52E3 /* libAdapterIAd.a in Frameworks */,
3AEA89BF1C5F727300FBA64B /* GoogleMobileAds.framework in Frameworks */,
CE6C17A01982D1170017C788 /* AdSupport.framework in Frameworks */,
DAD5D7CF12527E11009CF986 /* AudioToolbox.framework in Frameworks */,
CE6C17A21982D12D0017C788 /* AVFoundation.framework in Frameworks */,
CE6C17A41982D13A0017C788 /* CoreGraphics.framework in Frameworks */,
DB07E8B81E8010000008C1E1 /* CoreMedia.framework in Frameworks */,
DB07E8B91E8010000008C1E1 /* CoreMotion.framework in Frameworks */,
CE6C17A61982D1660017C788 /* CoreTelephony.framework in Frameworks */,
DB07E8BB1E80100D0008C1E1 /* CoreVideo.framework in Frameworks */,
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */,
DB07E8BD1E80101A0008C1E1 /* GLKit.framework in Frameworks */,
DB07E8BF1E80101F0008C1E1 /* JavaScriptCore.framework in Frameworks */,
DB07E8C01E80103C0008C1E1 /* MediaPlayer.framework in Frameworks */,
DAD5D7D512527E2F009CF986 /* MessageUI.framework in Frameworks */,
DB07E8C21E80104D0008C1E1 /* MobileCoreServices.framework in Frameworks */,
DB07E8C41E8010560008C1E1 /* OpenGLES.framework in Frameworks */,
DB07E8C61E8010680008C1E1 /* SafariServices.framework in Frameworks */,
CE6C17A81982D1780017C788 /* StoreKit.framework in Frameworks */,
CE6C17AA1982D1870017C788 /* SystemConfiguration.framework in Frameworks */,
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */,
3AEA89BF1C5F727300FBA64B /* GoogleMobileAds.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -100,6 +126,14 @@
0867D69AFE84028FC02AAC07 /* Frameworks */ = {
isa = PBXGroup;
children = (
DB07E8C51E8010680008C1E1 /* SafariServices.framework */,
DB07E8C31E8010560008C1E1 /* OpenGLES.framework */,
DB07E8C11E80104D0008C1E1 /* MobileCoreServices.framework */,
DB07E8BE1E80101F0008C1E1 /* JavaScriptCore.framework */,
DB07E8BC1E80101A0008C1E1 /* GLKit.framework */,
DB07E8BA1E80100D0008C1E1 /* CoreVideo.framework */,
DB07E8B61E8010000008C1E1 /* CoreMedia.framework */,
DB07E8B71E8010000008C1E1 /* CoreMotion.framework */,
3A4F268E1C68DDF7003E06CF /* iAd.framework */,
3AC8400F1C60A67D002A52E3 /* iAd Adapter */,
CE6C17AB1982D1C90017C788 /* AdMob iOS SDK */,
Expand Down
10 changes: 7 additions & 3 deletions ios/documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ A constant to be passed to the `gender` property to specify a gender if used.

A constant to be passed to the `gender` property to specify a gender if used.

### Number GENDER_UNKNOWN

A constant to be passed to the `gender` property to specify a gender if used.

## Functions

### Ti.Admob.createView({...})
Expand All @@ -64,7 +68,7 @@ parameters[object]: a dictionary object of properties defined in [Ti.Admob.View]
#### Example:

var ad = Admob.createView({
top: 0,
bottom: 0,
width: 320, // Will calculate the width internally to fit its container if not specified
height: 50,
debugEnabled: true, // If enabled, a dummy value for `adUnitId` will be used to test
Expand Down Expand Up @@ -109,6 +113,6 @@ Please direct all questions, feedback, and concerns to [info@appcelerator.com](m

## License

Copyright(c) 2010-2015 by Appcelerator, Inc. All Rights Reserved. Please see the LICENSE file included in the distribution for further details.
Copyright(c) 2010-Present by Appcelerator, Inc. All Rights Reserved. Please see the LICENSE file included in the distribution for further details.

[Ti.Admob.View]: view.html
[Ti.Admob.View]: view.html
7 changes: 4 additions & 3 deletions ios/documentation/view.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ See the example.js for more infos.

### string adUnitId

The ad Unit ID for admob.
The ad Unit ID for Admob.

### string adBackgroundColor

Expand All @@ -45,7 +45,7 @@ for determining ad delivery.

### string gender

The user's gender for the purpose of determining ad delivery. This should be one of the constants `GENDER_MALE` or `GENDER_FEMALE`.
The user's gender for the purpose of determining ad delivery. This should be one of the constants `GENDER_MALE`, `GENDER_FEMALE` or `GENDER_UNKNOWN`.

### Array[String] keywords

Expand Down Expand Up @@ -103,7 +103,8 @@ Sets a testing value for `adUnitId` to test ads without an admob account.
Sent when an ad request loaded an ad. This is a good opportunity to add this
view to the hierarchy if it has not yet been added. If the ad was received
as a part of the server-side auto refreshing, you can examine the
hasAutoRefreshed property of the view.
hasAutoRefreshed property of the view. Use the `adUnitId` property of the callback
to identify the ad that was loaded.

### didFailToReceiveAd

Expand Down
Loading

0 comments on commit cddc92e

Please sign in to comment.