Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions source/plugin/Assets/GoogleMobileAds/Api/Core/AdChoicesPlacement.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// <copyright file="AdChoicesPlacement.cs" company="Google LLC">
// Copyright (C) 2023 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -11,6 +12,7 @@
// 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.
// </copyright>

namespace GoogleMobileAds.Api
{
Expand All @@ -19,21 +21,24 @@ namespace GoogleMobileAds.Api
/// </summary>
public enum AdChoicesPlacement
{
/// <summary>
/// Ad Choices icon in top right corner
/// </summary>
TopRightCorner = 0,
/// <summary>
/// Ad Choices icon in top left corner
/// </summary>
TopLeftCorner = 1,
/// <summary>
/// Ad Choices icon in bottom right corner
/// </summary>
BottomRightCorner = 2,
/// <summary>
/// Ad Choices icon in bottom left corner
/// </summary>
BottomLeftCorner = 3,
/// <summary>
/// Ad Choices icon in top right corner.
/// </summary>
TopRightCorner = 0,

/// <summary>
/// Ad Choices icon in top left corner.
/// </summary>
TopLeftCorner = 1,

/// <summary>
/// Ad Choices icon in bottom right corner.
/// </summary>
BottomRightCorner = 2,

/// <summary>
/// Ad Choices icon in bottom left corner.
/// </summary>
BottomLeftCorner = 3,
}
}
19 changes: 19 additions & 0 deletions source/plugin/Assets/GoogleMobileAds/Api/Core/AdFormat.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// <copyright file="AdFormat.cs" company="Google LLC">
// Copyright (C) 2024 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -11,6 +12,7 @@
// 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.
// </copyright>

namespace GoogleMobileAds.Api
{
Expand All @@ -19,17 +21,34 @@ namespace GoogleMobileAds.Api
/// </summary>
public enum AdFormat
{
/// <summary>
/// Banner ad format.
/// </summary>
BANNER = 0,

/// <summary>
/// Interstitial ad format.
/// </summary>
INTERSTITIAL = 1,

/// <summary>
/// Rewarded ad format.
/// </summary>
REWARDED = 2,

/// <summary>
/// Rewarded interstitial ad format.
/// </summary>
REWARDED_INTERSTITIAL = 3,

/// <summary>
/// Native ad format.
/// </summary>
NATIVE = 4,

/// <summary>
/// App open ad format.
/// </summary>
APP_OPEN_AD = 5
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// <copyright file="AdManagerAdRequest.cs" company="Google LLC">
// Copyright (C) 2023 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,12 +12,13 @@
// 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.

using System;
using System.Collections.Generic;
// </copyright>

namespace GoogleMobileAds.Api.AdManager
{
using System;
using System.Collections.Generic;

/// <summary>
/// An <see cref="AdManagerAdRequest"/> contains targeting information used to fetch an ad from
/// Google Ad Manager.
Expand All @@ -40,11 +41,14 @@ public class AdManagerAdRequest : AdRequest
/// <summary>
/// Create a new AdManagerAdRequest object.
/// </summary>
public AdManagerAdRequest() : base() {}
public AdManagerAdRequest() : base()
{
}

/// <summary>
/// Create a copy of AdManagerAdRequest object.
/// </summary>
/// <param name="request">The AdManagerAdRequest to copy.</param>
public AdManagerAdRequest(AdManagerAdRequest request) : base(request)
{
PublisherProvidedId = request.PublisherProvidedId;
Expand Down
37 changes: 30 additions & 7 deletions source/plugin/Assets/GoogleMobileAds/Api/Core/AdPosition.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// <copyright file="AdPosition.cs" company="Google LLC">
// Copyright (C) 2015 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -11,6 +12,7 @@
// 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.
// </copyright>

namespace GoogleMobileAds.Api
{
Expand All @@ -19,19 +21,40 @@ namespace GoogleMobileAds.Api
/// </summary>
public enum AdPosition
{
/// Top

/// <summary>
/// Top of the screen, center aligned.
/// </summary>
Top = 0,
/// Bottom

/// <summary>
/// Bottom of the screen, center aligned.
/// </summary>
Bottom = 1,
/// Top left

/// <summary>
/// Top left corner of the screen.
/// </summary>
TopLeft = 2,
/// Top right

/// <summary>
/// Top right corner of the screen.
/// </summary>
TopRight = 3,
/// Bottom left

/// <summary>
/// Bottom left corner of the screen.
/// </summary>
BottomLeft = 4,
/// Bottom right

/// <summary>
/// Bottom right corner of the screen.
/// </summary>
BottomRight = 5,
/// Center

/// <summary>
/// Centered on the screen both horizontally and vertically.
/// </summary>
Center = 6
}
}
64 changes: 38 additions & 26 deletions source/plugin/Assets/GoogleMobileAds/Api/Core/AdRequest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// <copyright file="AdRequest.cs" company="Google LLC">
// Copyright (C) 2015 Google, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -11,28 +12,23 @@
// 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.

using System;
using System.Text;
using System.Collections.Generic;
using UnityEngine;

using GoogleMobileAds.Api.Mediation;
// </copyright>

namespace GoogleMobileAds.Api
{
using System;
using System.Collections.Generic;
using System.Text;
using GoogleMobileAds.Api.Mediation;
using UnityEngine;

/// <summary>
/// An <see cref="AdRequest"/> contains targeting information used to fetch an ad.
/// Ad requests are created using <see cref="AdRequest.Builder"/>.
/// </summary>
[Serializable]
public class AdRequest
{
/// <summary>
/// Request version string.
/// </summary>
public static string Version { get; private set; }

/// <summary>
/// Test device ID used to load test ads.
/// <seealso href="https://developers.google.com/admob/unity/test-ads"/>.
Expand All @@ -44,14 +40,38 @@ public class AdRequest
/// </summary>
public Dictionary<string, string> CustomTargeting = new Dictionary<string, string>();

/// <summary>
/// Targeting information keywords set. Empty if no keywords were added.
/// </summary>
public HashSet<string> Keywords = new HashSet<string>();

/// <summary>
/// Dictionary of extra parameters to be sent in the ad request.
/// </summary>
public Dictionary<string, string> Extras = new Dictionary<string, string>();

/// <summary>
/// Extra parameters to be sent to a specific ad partner in the ad request.
/// </summary>
public List<MediationExtras> MediationExtras = new List<MediationExtras>();

static AdRequest()
{
Version version = typeof(AdRequest).Assembly.GetName().Version;
Version = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);
}

public AdRequest() {}
/// <summary>
/// Initializes a new instance of the <see cref="AdRequest"/> class.
/// </summary>
public AdRequest()
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AdRequest"/> class.
/// </summary>
/// <param name="request">The <see cref="AdRequest"/> to copy.</param>
public AdRequest(AdRequest request)
{
Keywords = request.Keywords;
Expand All @@ -61,28 +81,20 @@ public AdRequest(AdRequest request)
}

/// <summary>
/// Returns targeting information keywords. Returns an empty set if no keywords were added.
/// </summary>
public HashSet<string> Keywords = new HashSet<string>();

/// <summary>
/// Returns extra parameters to be sent in the ad request.
/// Gets the request version string.
/// </summary>
public Dictionary<string, string> Extras = new Dictionary<string, string>();

/// <summary>
/// Returns extra parameters to be sent to a specific ad partner in the ad request.
/// </summary>
public List<MediationExtras> MediationExtras = new List<MediationExtras>();
public static string Version { get; private set; }

internal static string BuildVersionString(string nativePluginVersion = null)
{
var versionBuilder = new StringBuilder("unity-");
versionBuilder.Append(AdRequest.Version);
if (!string.IsNullOrEmpty(nativePluginVersion)) {
if (!string.IsNullOrEmpty(nativePluginVersion))
{
versionBuilder.Append("-native-");
versionBuilder.Append(nativePluginVersion);
}

return versionBuilder.ToString();
}
}
Expand Down
Loading