Skip to content

Commit

Permalink
Update for version 3.18.0 release.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 254288644
  • Loading branch information
Samuel Stow authored and maddevrelgithubbot committed Jun 20, 2019
1 parent 3dbf548 commit 0e87ab0
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 208 deletions.
15 changes: 15 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
Google Mobile Ads Unity Plugin Change Log

**************
Version 3.18.0
**************

Plugin:
- Added GoogleMobileAdsSettings editor UI for making Plist / manifest changes.
- Fix OnRewardedAdFailedToShow callbacks.
- Migrated android support library to androidx (JetPack) with Google Mobile Ads
SDK version 18.0.0.

Built and tested with:
- Google Play services 18.0.0
- Google Mobile Ads iOS SDK 7.45.0
- Unity Jar Resolver 1.2.119

**************
Version 3.17.0
**************
Expand Down
4 changes: 2 additions & 2 deletions source/android-library/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services-ads:17.2.1'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.android.gms:play-services-ads:18.0.0'
}

task clearJar(type: Delete) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.google.unity.ads;

import android.app.Activity;
import android.support.annotation.NonNull;
import android.util.Log;
import androidx.annotation.NonNull;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.rewarded.RewardItem;
import com.google.android.gms.ads.rewarded.RewardedAd;
Expand Down
2 changes: 1 addition & 1 deletion source/plugin/Assets/GoogleMobileAds/Api/AdRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace GoogleMobileAds.Api
{
public class AdRequest
{
public const string Version = "3.17.0";
public const string Version = "3.18.0";
public const string TestDeviceSimulator = "SIMULATOR";

private AdRequest(Builder builder)
Expand Down
62 changes: 0 additions & 62 deletions source/plugin/Assets/GoogleMobileAds/Api/AdSize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,8 @@
namespace GoogleMobileAds.Api
{

// copybara_strip_begin
internal enum Orientation {
Current = 0,
Landscape = 1,
Portrait = 2
}
// copybara_strip_end

public class AdSize
{
// copybara_strip_begin
private bool isAdaptiveBanner;
private Orientation orientation;
// copybara_strip_end
private bool isSmartBanner;
private int width;
private int height;
Expand All @@ -45,38 +33,12 @@ public AdSize(int width, int height)
isSmartBanner = false;
this.width = width;
this.height = height;
// copybara_strip_begin
isAdaptiveBanner = false;
this.orientation = Orientation.Current;
// copybara_strip_end
}

private AdSize(bool isSmartBanner) : this(0, 0)
{
this.isSmartBanner = isSmartBanner;
}
// copybara_strip_begin
private static AdSize CreateAdaptiveAdSize(int width, Orientation orientation)
{
AdSize adSize = new AdSize(width, 0);
adSize.isAdaptiveBanner = true;
adSize.orientation = orientation;
return adSize;
}


public static AdSize GetLandscapeBannerAdSizeWithWidth(int width) {
return CreateAdaptiveAdSize(width, Orientation.Landscape);
}

public static AdSize GetPortraitBannerAdSizeWithWidth(int width) {
return CreateAdaptiveAdSize(width, Orientation.Portrait);
}

public static AdSize GetCurrentOrientationBannerAdSizeWithWidth(int width) {
return CreateAdaptiveAdSize(width, Orientation.Current);
}
// copybara_strip_end
public int Width
{
get
Expand All @@ -100,23 +62,6 @@ public bool IsSmartBanner
return isSmartBanner;
}
}
// copybara_strip_begin
public bool IsAdaptiveBanner
{
get
{
return isAdaptiveBanner;
}
}

internal Orientation Orientation
{
get
{
return orientation;
}
}
// copybara_strip_end

public override bool Equals(object obj)
{
Expand All @@ -125,9 +70,6 @@ public override bool Equals(object obj)

AdSize other = (AdSize)obj;
return (width == other.width) && (height == other.height)
// copybara_strip_begin
&& (isAdaptiveBanner == other.isAdaptiveBanner) && (orientation == other.orientation)
// copybara_strip_end
&& (isSmartBanner == other.isSmartBanner);
}

Expand All @@ -150,10 +92,6 @@ public override int GetHashCode()
hash = (hash * hashMultiplier) ^ width.GetHashCode();
hash = (hash * hashMultiplier) ^ height.GetHashCode();
hash = (hash * hashMultiplier) ^ isSmartBanner.GetHashCode();
// copybara_strip_begin
hash = (hash * hashMultiplier) ^ isAdaptiveBanner.GetHashCode();
hash = (hash * hashMultiplier) ^ orientation.GetHashCode();
// copybara_strip_end
return hash;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dependencies>
<androidPackages>
<androidPackage spec="com.google.android.gms:play-services-ads:17.2.0">
<androidPackage spec="com.google.android.gms:play-services-ads:18.0.0">
<repositories>
<repository>https://maven.google.com/</repository>
</repositories>
Expand Down
23 changes: 0 additions & 23 deletions source/plugin/Assets/GoogleMobileAds/Platforms/iOS/BannerClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,6 @@ public void CreateBannerView(string adUnitId, AdSize adSize, AdPosition position
this.BannerViewPtr = Externs.GADUCreateSmartBannerView(
this.bannerClientPtr, adUnitId, (int)position);
}
// copybara_strip_begin
else if (adSize.IsAdaptiveBanner)
{
this.BannerViewPtr = Externs.GADUCreateAdaptiveBannerView(
this.bannerClientPtr,
adUnitId,
adSize.Width,
(int)adSize.Orientation,
(int)position);
}
// copybara_strip_end
else
{
this.BannerViewPtr = Externs.GADUCreateBannerView(
Expand Down Expand Up @@ -120,18 +109,6 @@ public void CreateBannerView(string adUnitId, AdSize adSize, int x, int y)
x,
y);
}
// copybara_strip_begin
else if (adSize.IsAdaptiveBanner)
{
this.BannerViewPtr = Externs.GADUCreateAdaptiveBannerViewWithCustomPosition(
this.bannerClientPtr,
adUnitId,
adSize.Width,
(int)adSize.Orientation,
x,
y);
}
// copybara_strip_end
else
{
this.BannerViewPtr = Externs.GADUCreateBannerViewWithCustomPosition(
Expand Down
18 changes: 0 additions & 18 deletions source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,6 @@ internal static extern IntPtr GADUCreateSmartBannerView(
[DllImport("__Internal")]
internal static extern IntPtr GADUCreateSmartBannerViewWithCustomPosition(
IntPtr bannerClient, string adUnitId, int x, int y);
// copybara_strip_begin
[DllImport("__Internal")]
internal static extern IntPtr GADUCreateAdaptiveBannerView(
IntPtr bannerClient,
string adUnitId,
int width,
int orientation,
int positionAtTop);

[DllImport("__Internal")]
internal static extern IntPtr GADUCreateAdaptiveBannerViewWithCustomPosition(
IntPtr bannerClient,
string adUnitId,
int width,
int orientation,
int x,
int y);
// copybara_strip_end
[DllImport("__Internal")]
internal static extern void GADUSetBannerCallbacks(
IntPtr bannerView,
Expand Down
15 changes: 0 additions & 15 deletions source/plugin/Assets/Plugins/iOS/GADUBanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,6 @@
adUnitID:(NSString *)adUnitID
customAdPosition:(CGPoint)customAdPosition;

// copybara_strip_begin
/// Initializes an adaptive GADUBanner, positioned at either the top or bottom of the screen.
- (id)initWithAdaptiveBannerSizeAndBannerClientReference:(GADUTypeBannerClientRef *)bannerClient
adUnitID:(NSString *)adUnitID
width:(NSInteger)width
orientation:(GADUBannerOrientation)orientation
adPosition:(GADAdPosition)adPosition;

/// Initializes an adaptive GADUBanner with a custom position at given point from top left.
- (id)initWithAdaptiveBannerSizeAndBannerClientReference:(GADUTypeBannerClientRef *)bannerClient
adUnitID:(NSString *)adUnitID
width:(NSInteger)width
orientation:(GADUBannerOrientation)orientation
customAdPosition:(CGPoint)customAdPosition;
// copybara_strip_end
/// A reference to the Unity banner client.
@property(nonatomic, assign) GADUTypeBannerClientRef *bannerClient;

Expand Down
26 changes: 0 additions & 26 deletions source/plugin/Assets/Plugins/iOS/GADUBanner.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,32 +76,6 @@ - (id)initWithSmartBannerSizeAndBannerClientReference:(GADUTypeBannerClientRef *
customAdPosition:customAdPosition];
}

// copybara_strip_begin
- (id)initWithAdaptiveBannerSizeAndBannerClientReference:(GADUTypeBannerClientRef *)bannerClient
adUnitID:(NSString *)adUnitID
width:(NSInteger)width
orientation:(GADUBannerOrientation)orientation
adPosition:(GADAdPosition)adPosition {
return [self initWithBannerClientReference:bannerClient
adUnitID:adUnitID
adSize:[GADUPluginUtil adaptiveAdSizeForWidth:(CGFloat)width
orientation:orientation]
adPosition:adPosition];
}

- (id)initWithAdaptiveBannerSizeAndBannerClientReference:(GADUTypeBannerClientRef *)bannerClient
adUnitID:(NSString *)adUnitID
width:(NSInteger)width
orientation:(GADUBannerOrientation)orientation
customAdPosition:(CGPoint)customAdPosition {
return [self initWithBannerClientReference:bannerClient
adUnitID:adUnitID
adSize:[GADUPluginUtil adaptiveAdSizeForWidth:(CGFloat)width
orientation:orientation]
customAdPosition:customAdPosition];
}
// copybara_strip_end

- (id)initWithBannerClientReference:(GADUTypeBannerClientRef *)bannerClient
adUnitID:(NSString *)adUnitID
adSize:(GADAdSize)size
Expand Down
35 changes: 0 additions & 35 deletions source/plugin/Assets/Plugins/iOS/GADUInterface.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,41 +133,6 @@ GADUTypeBannerRef GADUCreateSmartBannerViewWithCustomPosition(GADUTypeBannerClie
[cache.references setObject:banner forKey:[banner gadu_referenceKey]];
return (__bridge GADUTypeBannerRef)banner;
}
// copybara_strip_begin
/// Creates a an adaptive sized GADBannerView with the specified width, orientation, and position.
/// Returns a reference to the GADUBannerView.
GADUTypeBannerRef GADUCreateAdaptiveBannerView(GADUTypeBannerClientRef *bannerClient,
const char *adUnitID, NSInteger width,
GADUBannerOrientation orientation,
GADAdPosition adPosition) {
GADUBanner *banner = [[GADUBanner alloc]
initWithAdaptiveBannerSizeAndBannerClientReference:bannerClient
adUnitID:GADUStringFromUTF8String(adUnitID)
width:(int)width
orientation:orientation
adPosition:adPosition];
GADUObjectCache *cache = [GADUObjectCache sharedInstance];
[cache.references setObject:banner forKey:[banner gadu_referenceKey]];
return (__bridge GADUTypeBannerRef)banner;
}

/// Creates a an adaptive sized GADBannerView with the specified width, orientation, and position.
/// Returns a reference to the GADUBannerView.
GADUTypeBannerRef GADUCreateAdaptiveBannerViewWithCustomPosition(
GADUTypeBannerClientRef *bannerClient, const char *adUnitID, NSInteger width,
GADUBannerOrientation orientation, NSInteger x, NSInteger y) {
CGPoint adPosition = CGPointMake(x, y);
GADUBanner *banner = [[GADUBanner alloc]
initWithAdaptiveBannerSizeAndBannerClientReference:bannerClient
adUnitID:GADUStringFromUTF8String(adUnitID)
width:(int)width
orientation:orientation
customAdPosition:adPosition];
GADUObjectCache *cache = [GADUObjectCache sharedInstance];
[cache.references setObject:banner forKey:[banner gadu_referenceKey]];
return (__bridge GADUTypeBannerRef)banner;
}
// copybara_strip_end

/// Creates a GADUInterstitial and returns its reference.
GADUTypeInterstitialRef GADUCreateInterstitial(GADUTypeInterstitialClientRef *interstitialClient,
Expand Down
4 changes: 0 additions & 4 deletions source/plugin/Assets/Plugins/iOS/GADUPluginUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@

/// Returns a GADAdSize for a specified width and height.
+ (GADAdSize)adSizeForWidth:(CGFloat)width height:(CGFloat)height;
// copybara_strip_begin
/// Returns the anchored adaptive banner ad size for the given width and orientation.
+ (GADAdSize)adaptiveAdSizeForWidth:(CGFloat)width orientation:(GADUBannerOrientation)orientation;
// copybara_strip_end
/// If requesting smart banner landscape, returns the custom size for landscape smart banners which
/// is full width of the safe area and auto height. Assumes that the application window is visible.
/// If requesting any other ad size, returns the un-modified ad size.
Expand Down
12 changes: 0 additions & 12 deletions source/plugin/Assets/Plugins/iOS/GADUPluginUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,5 @@ + (GADAdSize)adSizeForWidth:(CGFloat)width height:(CGFloat)height {
}
return GADAdSizeFromCGSize(CGSizeMake(width, height));
}
// copybara_strip_begin
+ (GADAdSize)adaptiveAdSizeForWidth:(CGFloat)width orientation:(GADUBannerOrientation)orientation {
switch (orientation) {
case kGADUBannerOrientationCurrent:
return GADCurrentOrientationBannerAdSizeWithWidth(width);
case kGADUBannerOrientationLandscape:
return GADLandscapeBannerAdSizeWithWidth(width);
case kGADUBannerOrientationPortrait:
return GADPortraitBannerAdSizeWithWidth(width);
}
}
// copybara_strip_end

@end
8 changes: 0 additions & 8 deletions source/plugin/Assets/Plugins/iOS/GADUTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ typedef NS_ENUM(NSUInteger, GADAdPosition) {
kGADAdPositionBottomRightOfScreen = 5, ///< Bottom right of screen.
kGADAdPositionCenterOfScreen = 6 ///< Bottom right of screen.
};
// copybara_strip_begin
/// Orientation for an adaptive banner.
typedef NS_ENUM(NSUInteger, GADUBannerOrientation) {
kGADUBannerOrientationCurrent = 0, ///< Current Orientation.
kGADUBannerOrientationLandscape = 1, ///< Landscape.
kGADUBannerOrientationPortrait = 2, ///< Portrait.
};
// copybara_strip_end

typedef NS_ENUM(NSInteger, GADUAdSize) { kGADUAdSizeUseFullWidth = -1 };

Expand Down

0 comments on commit 0e87ab0

Please sign in to comment.