Skip to content

Commit

Permalink
Version 3.0.2 of the Google Mobile Ads Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Ram Parameswaran committed Mar 3, 2016
1 parent 723fdd3 commit 4faac16
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 64 deletions.
19 changes: 19 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
Google Mobile Ads Unity Plugin Change Log

*************
Version 3.0.2
*************
- Fix compatibility issues with Google Mobile Ads iOS SDK 7.7.0

Built and tested with:
- Google Play Services 8.4.0
- Google Mobile Ads iOS SDK 7.7.0

*************
Version 3.0.1
*************
- Update preprocessor directives for iOS post build setup
- Add request agent to all ad requests from plugin

Built and tested with:
- Google Play Services 8.4.0
- Google Mobile Ads iOS SDK 7.6.0

*************
Version 3.0.0
*************
Expand Down
Binary file modified GoogleMobileAds.unitypackage
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,6 @@ public void onRewardedVideoAdLeftApplication() {
});
}

/**
* Sets user id for reward based video ad.
*
* @param userId The userId to be used for reward based video ad requests.
*/
public void setUserId(final String userId) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
rewardBasedVideo.setUserId(userId);
}
});
}

/**
* Loads a reward based video ad.
*
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 @@ -20,7 +20,7 @@ namespace GoogleMobileAds.Api
{
public class AdRequest
{
public const string Version = "3.0.0";
public const string Version = "3.0.2";
public const string TestDeviceSimulator = "SIMULATOR";

public class Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ internal interface IRewardBasedVideoAdClient
// Ad event fired when the reward based video ad is leaving the application.
event EventHandler<EventArgs> OnAdLeavingApplication;

// UserId for reward based video ad requests.
String UserId
{
get;
set;
}

// Creates a reward based video ad and adds it to the view hierarchy.
void CreateRewardBasedVideoAd();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ namespace GoogleMobileAds.Android
internal class RewardBasedVideoAdClient : AndroidJavaProxy, IRewardBasedVideoAdClient
{
private AndroidJavaObject androidRewardBasedVideo;
private String userId;

public event EventHandler<EventArgs> OnAdLoaded = delegate {};
public event EventHandler<AdFailedToLoadEventArgs> OnAdFailedToLoad = delegate {};
Expand All @@ -36,16 +35,6 @@ internal class RewardBasedVideoAdClient : AndroidJavaProxy, IRewardBasedVideoAdC
public event EventHandler<Reward> OnAdRewarded = delegate {};
public event EventHandler<EventArgs> OnAdLeavingApplication = delegate {};

public String UserId
{
get { return userId; }
set
{
userId = value;
SetUserId(value);
}
}

public RewardBasedVideoAdClient()
: base(Utils.UnityRewardBasedVideoAdListenerClassName)
{
Expand All @@ -62,10 +51,6 @@ public void CreateRewardBasedVideoAd() {
androidRewardBasedVideo.Call("create");
}

public void SetUserId(string userId) {
androidRewardBasedVideo.Call("setUserId", userId);
}

public void LoadAd(AdRequest request, string adUnitId) {
androidRewardBasedVideo.Call("loadAd", Utils.GetAdRequestJavaObject(request), adUnitId);
}
Expand Down Expand Up @@ -132,4 +117,5 @@ void onAdLeftApplication()
}
}

#endif
#endif

Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ internal static extern void GADUSetInterstitialCallbacks(

[DllImport("__Internal")]
internal static extern void GADURequestRewardBasedVideoAd(
IntPtr bannerView, IntPtr request, string adUnitId, string userId);
IntPtr bannerView, IntPtr request, string adUnitId);

[DllImport("__Internal")]
internal static extern void GADUSetRewardBasedVideoAdCallbacks(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ internal delegate void GADURewardBasedVideoAdWillLeaveApplicationCallback(
public event EventHandler<EventArgs> OnAdLeavingApplication = delegate {};

private IntPtr rewardBasedVideoAdPtr;
private string userId;

// This property should be used when setting the rewardBasedVideoPtr.
private IntPtr RewardBasedVideoAdPtr {
Expand All @@ -64,12 +63,6 @@ private IntPtr RewardBasedVideoAdPtr {
}
}

public String UserId
{
get { return userId; }
set { userId = value; }
}

#region IGoogleMobileAdsRewardBasedVideoClient implementation

// Creates a reward based video.
Expand All @@ -94,7 +87,7 @@ public void LoadAd(AdRequest request, string adUnitId)
{
IntPtr requestPtr = Utils.BuildAdRequest(request);
Externs.GADURequestRewardBasedVideoAd(
RewardBasedVideoAdPtr, requestPtr, adUnitId, userId);
RewardBasedVideoAdPtr, requestPtr, adUnitId);
Externs.GADURelease(requestPtr);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ internal virtual string ProcessAar(string dir, string aarFile)

System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.Arguments = "xvf " + Path.GetFullPath(aarFile);
p.StartInfo.Arguments = "xvf " +
"\"" + Path.GetFullPath(aarFile) + "\"";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = false;
p.StartInfo.RedirectStandardError = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ static IResolver Resolver
if (_resolver == null)
{
// create the latest resolver known.
Type type = Type.GetType(CurrentResolverName, true);

_resolver = Activator.CreateInstance(type) as IResolver;
_resolver = Activator.CreateInstance("GooglePlayServices", CurrentResolverName) as IResolver;
}
return _resolver;
}
Expand Down
9 changes: 3 additions & 6 deletions source/plugin/Assets/Plugins/iOS/GADUInterface.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ GADUTypeBannerRef GADUCreateInterstitial(GADUTypeInterstitialClientRef *intersti

/// Creates a GADURewardBasedVideo and returns its reference.
GADUTypeRewardBasedVideoAdRef GADUCreateRewardBasedVideoAd(
GADUTypeRewardBasedVideoAdClientRef *rewardBasedVideoAdClient, const char *adUnitID,
const char *userID) {
GADUTypeRewardBasedVideoAdClientRef *rewardBasedVideoAdClient) {
GADURewardBasedVideoAd *rewardBasedVideoAd = [[GADURewardBasedVideoAd alloc]
initWithRewardBasedVideoClientReference:rewardBasedVideoAdClient];
GADUObjectCache *cache = [GADUObjectCache sharedInstance];
Expand Down Expand Up @@ -232,14 +231,12 @@ void GADURequestInterstitial(GADUTypeInterstitialRef interstitial, GADUTypeReque

/// Makes a rewarded video ad request.
void GADURequestRewardBasedVideoAd(GADUTypeRewardBasedVideoAdRef rewardBasedVideoAd,
GADUTypeRequestRef request, const char *adUnitID,
const char *userID) {
GADUTypeRequestRef request, const char *adUnitID) {
GADURewardBasedVideoAd *internalRewardBasedVideoAd =
(__bridge GADURewardBasedVideoAd *)rewardBasedVideoAd;
GADURequest *internalRequest = (__bridge GADURequest *)request;
[internalRewardBasedVideoAd loadRequest:[internalRequest request]
withAdUnitID:GADUStringFromUTF8String(adUnitID)
userID:GADUStringFromUTF8String(userID)];
withAdUnitID:GADUStringFromUTF8String(adUnitID)];
}

/// Removes an object from the cache.
Expand Down
4 changes: 1 addition & 3 deletions source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@
@property(nonatomic, assign) GADURewardBasedVideoAdWillLeaveApplicationCallback willLeaveCallback;

/// Makes an ad request. Additional targeting options can be supplied with a request object.
- (void)loadRequest:(GADRequest *)request
withAdUnitID:(NSString *)adUnitID
userID:(NSString *)userID;
- (void)loadRequest:(GADRequest *)request withAdUnitID:(NSString *)adUnitID;

/// Returns YES if the reward based video is ready to be displayed.
- (BOOL)isReady;
Expand Down
6 changes: 2 additions & 4 deletions source/plugin/Assets/Plugins/iOS/GADURewardBasedVideoAd.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ - (void)dealloc {
_rewardBasedVideo.delegate = nil;
}

- (void)loadRequest:(GADRequest *)request
withAdUnitID:(NSString *)adUnitID
userID:(NSString *)userID {
[self.rewardBasedVideo loadRequest:request withAdUnitID:adUnitID userID:userID];
- (void)loadRequest:(GADRequest *)request withAdUnitID:(NSString *)adUnitID {
[self.rewardBasedVideo loadRequest:request withAdUnitID:adUnitID];
}

- (BOOL)isReady {
Expand Down

0 comments on commit 4faac16

Please sign in to comment.