diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..97226c0 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,20 @@ +# Changelog +All notable changes to this project will be documented in this file using the standards as defined at [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0). + +### Version 5.0.0 *(2024-08-08)* + +First version of the Chartboost Mediation Unity SDK - Google Bidding Adapter. + +#Added +- Support for the following `Google Bidding` dependencies. Notice adapter dependencies are optimistic and any patches and hot-fixes will be automatically picked up.: + * Android: `com.chartboost:chartboost-mediation-adapter-google-bidding:5.23.2.+` + * iOS: `ChartboostMediationAdapterGoogleBidding ~> 5.11.5.0` + +- `GoogleBiddingAdapter.cs` with Configuration Properties for `Google Bidding`. +- The following properties have been added in `GoogleBiddingAdapter.cs` + * `string AdapterUnityVersion` + * `string AdapterNativeVersion` + * `string PartnerSDKVersion` + * `string PartnerIdentifier` + * `string PartnerDisplayName` + * `IReadOnlyCollection TestDeviceIds` \ No newline at end of file diff --git a/CHANGELOG.md.meta b/CHANGELOG.md.meta new file mode 100644 index 0000000..401b6eb --- /dev/null +++ b/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 842b7acc6f85942f1b5fc05d7f3c423e +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Chartboost.CSharp.Mediation.Unity.Adapter.GoogleBidding.nuspec b/Chartboost.CSharp.Mediation.Unity.Adapter.GoogleBidding.nuspec new file mode 100644 index 0000000..f086f0d --- /dev/null +++ b/Chartboost.CSharp.Mediation.Unity.Adapter.GoogleBidding.nuspec @@ -0,0 +1,24 @@ + + + + Chartboost.CSharp.Mediation.Unity.Adapter.GoogleBidding + 5.0.0 + Chartboost Mediation Adapter - Google Bidding + The Chartboost Mediation Unity SDK Adapter for Google Bidding. + Chartboost + Chartboost + LICENSE.md + README.md + https://www.chartboost.com/products/mediation/ + Copyright 2024 + Chartboost, Ads, Mediation, Unity, Adapter, Google Bidding, cs + + + + + + + + + + diff --git a/Chartboost.CSharp.Mediation.Unity.Adapter.GoogleBidding.nuspec.meta b/Chartboost.CSharp.Mediation.Unity.Adapter.GoogleBidding.nuspec.meta new file mode 100644 index 0000000..322ce89 --- /dev/null +++ b/Chartboost.CSharp.Mediation.Unity.Adapter.GoogleBidding.nuspec.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bfab9e785d1474a4abd984651d557f95 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor.meta b/Editor.meta new file mode 100644 index 0000000..373686c --- /dev/null +++ b/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 41e87f8b814c64f3c836871abb0f36ca +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/GoogleBiddingAdapterDependencies.xml b/Editor/GoogleBiddingAdapterDependencies.xml new file mode 100644 index 0000000..b22c825 --- /dev/null +++ b/Editor/GoogleBiddingAdapterDependencies.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/Editor/GoogleBiddingAdapterDependencies.xml.meta b/Editor/GoogleBiddingAdapterDependencies.xml.meta new file mode 100644 index 0000000..6bc5893 --- /dev/null +++ b/Editor/GoogleBiddingAdapterDependencies.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 06a3bbbe4c8f54163bacc53e7e4e2b2e +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..926856a --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,9 @@ +MIT License + +Copyright 2024 Chartboost Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/LICENSE.md.meta b/LICENSE.md.meta new file mode 100644 index 0000000..c6400eb --- /dev/null +++ b/LICENSE.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b01695eee43e74a2f9368438b5ac5920 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/README.md b/README.md index cb4afb3..15cd665 100644 --- a/README.md +++ b/README.md @@ -1 +1,92 @@ -# chartboost-mediation-unity-adapter-google-bidding \ No newline at end of file +# Chartboost Mediation Unity SDK - Google Bidding Adapter + +Provides a list of externally configurable properties pertaining to the partner SDK that can be retrieved and set by publishers. + +Dependencies for the adapter are now embedded in the package, and can be found at `com.chartboost.mediation.unity.adapter.google-bidding/Editor/GoogleBiddingAdapterDependencies.xml`. + +# Installation + +## Using the public [npm registry](https://www.npmjs.com/search?q=com.chartboost.mediation.unity.adapter.google-bidding) + +In order to add the Chartboost Mediation Unity SDK - Google Bidding Adapter to your project using the npm package, add the following to your Unity Project's ***manifest.json*** file. The scoped registry section is required in order to fetch packages from the NpmJS registry. + +```json +"dependencies": { + "com.chartboost.mediation.unity.adapter.google-bidding": "5.0.0", + ... +}, +"scopedRegistries": [ +{ + "name": "NpmJS", + "url": "https://registry.npmjs.org", + "scopes": [ + "com.chartboost" + ] +} +] +``` +## Using the public [NuGet package](https://www.nuget.org/packages/Chartboost.CSharp.Mediation.Unity.Adapter.GoogleBidding) + +To add the Chartboost Mediation Unity SDK - Google Bidding Adapter to your project using the NuGet package, you will first need to add the [NugetForUnity](https://github.com/GlitchEnzo/NuGetForUnity) package into your Unity Project. + +This can be done by adding the following to your Unity Project's ***manifest.json*** + +```json + "dependencies": { + "com.github-glitchenzo.nugetforunity": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity", + ... + }, +``` + +Once NugetForUnity is installed, search for `Chartboost.CSharp.Mediation.Unity.Adapter.GoogleBidding` in the search bar of Nuget Explorer window(Nuget -> Manage Nuget Packages). +You should be able to see the `Chartboost.CSharp.Mediation.Unity.Adapter.GoogleBidding` package. Choose the appropriate version and install. + +# Chartboost - Google Utilities for AndroidManifest.xml & Info.plist +In order for the Google User Messaging Platform to initialize the `application ID` must be added to the `AndroidManifest.xml` & `Info.plist`. Chartboost provides this functionality through its dependency package for Google adapters. + +Simply click on the Editor menu: `Chartboost/Google/Configure` and set your `application ID` as needed. This configuration is shared for all Google packages possibly integrated, e.g: Google User Messaging Platform, AdMob, Google Bidding, etc. + +# Usage + +The following code block exemplifies usage of the `GoogleBiddingAdapter.cs` configuration class. + +## IPartnerAdapterConfiguration Properties + +```csharp + +// AdapterUnityVersion - The partner adapter Unity version, e.g: 5.0.0 +Debug.Log($"Adapter Unity Version: {GoogleBiddingAdapter.AdapterUnityVersion}"); + +// AdapterNativeVersion - The partner adapter version, e.g: 5.22.3.0.0 +Debug.Log($"Adapter Native Version: {GoogleBiddingAdapter.AdapterNativeVersion}"); + +// PartnerSDKVersion - The partner SDK version, e.g: 22.3.0 +Debug.Log($"Partner SDK Version: {GoogleBiddingAdapter.PartnerSDKVersion}"); + +// PartnerIdentifier - The partner ID for internal uses, e.g: google_googlebidding +Debug.Log($"Partner Identifier: {GoogleBiddingAdapter.PartnerIdentifier}"); + +// PartnerDisplayName - The partner name for external uses, e.g: Google Bidding +Debug.Log($"Partner Display Name: {GoogleBiddingAdapter.PartnerDisplayName}"); +``` + +## Test Device Ids + +Test device Ids can be set and fetch using `GoogleBiddingAdapter.TestDeviceIds`. + +```csharp + +// Example test device ids +var testDeviceIds = new List +{ + "33BE2250B43518CCDA7DE426D04EE231", + "33BE2250B43518CCDA7DE426D04EE232", + "33BE2250B43518CCDA7DE426D04EE233" +}; + +// Setting test device ids +GoogleBiddingAdapter.TestDeviceIds = testDeviceIds; + +// Clearing test device ids +GoogleBiddingAdapter.TestDeviceIds = null; +``` \ No newline at end of file diff --git a/README.md.meta b/README.md.meta new file mode 100644 index 0000000..ec6d0ce --- /dev/null +++ b/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9137eb4ed93af4703be091e782bd6e5e +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime.meta b/Runtime.meta new file mode 100644 index 0000000..2582604 --- /dev/null +++ b/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 614736dfe41a44bb2b4dab73c8d9c759 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Android.meta b/Runtime/Android.meta new file mode 100644 index 0000000..434fcd8 --- /dev/null +++ b/Runtime/Android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a4ea7ece3c72c4506aa985f45a890364 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Android/AssemblyInfo.cs b/Runtime/Android/AssemblyInfo.cs new file mode 100644 index 0000000..5324eb2 --- /dev/null +++ b/Runtime/Android/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using UnityEngine.Scripting; + +[assembly: AlwaysLinkAssembly] diff --git a/Runtime/Android/AssemblyInfo.cs.meta b/Runtime/Android/AssemblyInfo.cs.meta new file mode 100644 index 0000000..27b224f --- /dev/null +++ b/Runtime/Android/AssemblyInfo.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 87867e3f7259a41359a2b3c05155ce34 +timeCreated: 1684175795 \ No newline at end of file diff --git a/Runtime/Android/Chartboost.Mediation.GoogleBidding.Android.asmdef b/Runtime/Android/Chartboost.Mediation.GoogleBidding.Android.asmdef new file mode 100644 index 0000000..bebf1ac --- /dev/null +++ b/Runtime/Android/Chartboost.Mediation.GoogleBidding.Android.asmdef @@ -0,0 +1,26 @@ +{ + "name": "Chartboost.Mediation.GoogleBidding.Android", + "rootNamespace": "Chartboost.Mediation.GoogleBidding.Android", + "references": [ + "Chartboost.Threading", + "Chartboost.Logging", + "Chartboost.Mediation.GoogleBidding", + "Chartboost.Mediation", + "Chartboost.Mediation.Android", + "Chartboost.Utilities.Android" + ], + "includePlatforms": [ + "Android", + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [ + "" + ], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} diff --git a/Runtime/Android/Chartboost.Mediation.GoogleBidding.Android.asmdef.meta b/Runtime/Android/Chartboost.Mediation.GoogleBidding.Android.asmdef.meta new file mode 100644 index 0000000..a962008 --- /dev/null +++ b/Runtime/Android/Chartboost.Mediation.GoogleBidding.Android.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 32d819a3a234e4909828e86f2e933da7 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Android/GoogleBiddingAdapter.cs b/Runtime/Android/GoogleBiddingAdapter.cs new file mode 100644 index 0000000..343e338 --- /dev/null +++ b/Runtime/Android/GoogleBiddingAdapter.cs @@ -0,0 +1,76 @@ +using System.Collections.Generic; +using Chartboost.Constants; +using Chartboost.Mediation.GoogleBidding.Common; +using UnityEngine; + +namespace Chartboost.Mediation.GoogleBidding.Android +{ + internal sealed class GoogleBiddingAdapter : IGoogleBiddingAdapter + { + private const string GoogleBiddingAdapterConfiguration = "com.chartboost.mediation.googlebiddingadapter.GoogleBiddingAdapterConfiguration"; + + [RuntimeInitializeOnLoadMethod] + private static void RegisterInstance() + { + if (Application.isEditor) + return; + GoogleBidding.GoogleBiddingAdapter.Instance = new GoogleBiddingAdapter(); + } + + /// + public string AdapterNativeVersion + { + get + { + using var adapterConfiguration = new AndroidJavaObject(GoogleBiddingAdapterConfiguration); + return adapterConfiguration.Call(SharedAndroidConstants.FunctionGetAdapterVersion); + } + } + + /// + public string PartnerSDKVersion + { + get + { + using var adapterConfiguration = new AndroidJavaObject(GoogleBiddingAdapterConfiguration); + return adapterConfiguration.Call(SharedAndroidConstants.FunctionGetPartnerSdkVersion); + } + } + + /// + public string PartnerIdentifier + { + get + { + using var adapterConfiguration = new AndroidJavaObject(GoogleBiddingAdapterConfiguration); + return adapterConfiguration.Call(SharedAndroidConstants.FunctionGetPartnerId); + } + } + + /// + public string PartnerDisplayName + { + get + { + using var adapterConfiguration = new AndroidJavaObject(GoogleBiddingAdapterConfiguration); + return adapterConfiguration.Call(SharedAndroidConstants.FunctionGetPartnerDisplayName); + } + } + + /// + public IReadOnlyCollection TestDeviceIds { + get + { + using var adapterConfiguration = new AndroidJavaObject(GoogleBiddingAdapterConfiguration); + using var nativeTestDeviceIds = adapterConfiguration.Call(SharedAndroidConstants.FunctionGetTestDeviceIds); + return nativeTestDeviceIds.NativeListToList(); + } + set + { + using var adapterConfiguration = new AndroidJavaObject(GoogleBiddingAdapterConfiguration); + using var nativeList = value.EnumerableToNativeList(); + adapterConfiguration.Call(SharedAndroidConstants.FunctionSetTestDeviceIds, nativeList); + } + } + } +} diff --git a/Runtime/Android/GoogleBiddingAdapter.cs.meta b/Runtime/Android/GoogleBiddingAdapter.cs.meta new file mode 100644 index 0000000..781d7c0 --- /dev/null +++ b/Runtime/Android/GoogleBiddingAdapter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 015d82fddd5c8481a9ebfd98b3b2b26e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/GoogleBidding.meta b/Runtime/GoogleBidding.meta new file mode 100644 index 0000000..90b4d3d --- /dev/null +++ b/Runtime/GoogleBidding.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7e7267081230e4697834b3baa1d1c432 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/GoogleBidding/AssemblyInfo.cs b/Runtime/GoogleBidding/AssemblyInfo.cs new file mode 100644 index 0000000..9155d6c --- /dev/null +++ b/Runtime/GoogleBidding/AssemblyInfo.cs @@ -0,0 +1,16 @@ +using System.Runtime.CompilerServices; +using Chartboost.Mediation.GoogleBidding; +using UnityEngine.Scripting; + +[assembly: AlwaysLinkAssembly] +[assembly: InternalsVisibleTo(AssemblyInfo.GoogleBiddingAssemblyInfoAndroid)] +[assembly: InternalsVisibleTo(AssemblyInfo.GoogleBiddingAssemblyInfoIOS)] + +namespace Chartboost.Mediation.GoogleBidding +{ + internal class AssemblyInfo + { + public const string GoogleBiddingAssemblyInfoAndroid = "Chartboost.Mediation.GoogleBidding.Android"; + public const string GoogleBiddingAssemblyInfoIOS = "Chartboost.Mediation.GoogleBidding.IOS"; + } +} diff --git a/Runtime/GoogleBidding/AssemblyInfo.cs.meta b/Runtime/GoogleBidding/AssemblyInfo.cs.meta new file mode 100644 index 0000000..f96586c --- /dev/null +++ b/Runtime/GoogleBidding/AssemblyInfo.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c8632ec956c974ba1bb94eb6ab8f0355 +timeCreated: 1684175795 \ No newline at end of file diff --git a/Runtime/GoogleBidding/Chartboost.Mediation.GoogleBidding.asmdef b/Runtime/GoogleBidding/Chartboost.Mediation.GoogleBidding.asmdef new file mode 100644 index 0000000..d76ce12 --- /dev/null +++ b/Runtime/GoogleBidding/Chartboost.Mediation.GoogleBidding.asmdef @@ -0,0 +1,21 @@ +{ + "name": "Chartboost.Mediation.GoogleBidding", + "rootNamespace": "Chartboost.Mediation.GoogleBidding", + "references": [ + "Chartboost.Threading", + "Chartboost.Logging", + "Chartboost.Utilities", + "Chartboost.Mediation" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [ + "" + ], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Runtime/GoogleBidding/Chartboost.Mediation.GoogleBidding.asmdef.meta b/Runtime/GoogleBidding/Chartboost.Mediation.GoogleBidding.asmdef.meta new file mode 100644 index 0000000..3591594 --- /dev/null +++ b/Runtime/GoogleBidding/Chartboost.Mediation.GoogleBidding.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ac9e9a9b7bd924d5e9ed9ab4280e4200 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/GoogleBidding/Common.meta b/Runtime/GoogleBidding/Common.meta new file mode 100644 index 0000000..7deae55 --- /dev/null +++ b/Runtime/GoogleBidding/Common.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a5d85fe3d74414807998f2da57f6cb7c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/GoogleBidding/Common/IGoogleBiddingAdapter.cs b/Runtime/GoogleBidding/Common/IGoogleBiddingAdapter.cs new file mode 100644 index 0000000..812b4b4 --- /dev/null +++ b/Runtime/GoogleBidding/Common/IGoogleBiddingAdapter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using Chartboost.Mediation.Adapters; + +namespace Chartboost.Mediation.GoogleBidding.Common +{ + /// + /// The Chartboost Mediation GoogleBidding adapter. + /// + internal interface IGoogleBiddingAdapter : IPartnerAdapterConfiguration + { + /// + /// List containing device IDs to be set for enabling GoogleBidding test ads. + /// It can be populated at any time and will take effect for the next ad request. + /// Remember to empty this list or stop setting it before releasing your app. + /// + IReadOnlyCollection TestDeviceIds { get; set; } + } +} diff --git a/Runtime/GoogleBidding/Common/IGoogleBiddingAdapter.cs.meta b/Runtime/GoogleBidding/Common/IGoogleBiddingAdapter.cs.meta new file mode 100644 index 0000000..58ce560 --- /dev/null +++ b/Runtime/GoogleBidding/Common/IGoogleBiddingAdapter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 39e798cfda8784793ab99ac3dfd123f7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/GoogleBidding/Default.meta b/Runtime/GoogleBidding/Default.meta new file mode 100644 index 0000000..71adafc --- /dev/null +++ b/Runtime/GoogleBidding/Default.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1e24b9f1df7714549a259cec89817a9f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/GoogleBidding/Default/GoogleBiddingDefault.cs b/Runtime/GoogleBidding/Default/GoogleBiddingDefault.cs new file mode 100644 index 0000000..b080cc9 --- /dev/null +++ b/Runtime/GoogleBidding/Default/GoogleBiddingDefault.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Chartboost.Mediation.GoogleBidding.Common; + +namespace Chartboost.Mediation.GoogleBidding.Default +{ + internal class GoogleBiddingDefault : IGoogleBiddingAdapter + { + /// + public string AdapterNativeVersion => GoogleBiddingAdapter.AdapterUnityVersion; + + /// + public string PartnerSDKVersion => GoogleBiddingAdapter.AdapterUnityVersion; + + /// + public string PartnerIdentifier => "google_googlebidding"; + + /// + public string PartnerDisplayName => "Google Bidding"; + + /// + public IReadOnlyCollection TestDeviceIds { + get => _testDeviceIds; + set + { + if (value == null || value.Count == 0) + _testDeviceIds = Array.Empty(); + else + _testDeviceIds = value; + } + } + + private IReadOnlyCollection _testDeviceIds = Array.Empty(); + } +} diff --git a/Runtime/GoogleBidding/Default/GoogleBiddingDefault.cs.meta b/Runtime/GoogleBidding/Default/GoogleBiddingDefault.cs.meta new file mode 100644 index 0000000..589753b --- /dev/null +++ b/Runtime/GoogleBidding/Default/GoogleBiddingDefault.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 52989e78606d94cb38298eccf12fa911 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/GoogleBidding/GoogleBiddingAdapter.cs b/Runtime/GoogleBidding/GoogleBiddingAdapter.cs new file mode 100644 index 0000000..ca57a71 --- /dev/null +++ b/Runtime/GoogleBidding/GoogleBiddingAdapter.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using Chartboost.Mediation.Adapters; +using Chartboost.Mediation.GoogleBidding.Common; +using Chartboost.Mediation.GoogleBidding.Default; + +namespace Chartboost.Mediation.GoogleBidding +{ + /// + public static class GoogleBiddingAdapter + { + internal static IGoogleBiddingAdapter Instance = new GoogleBiddingDefault(); + + /// + /// The partner adapter Unity version. + /// + public const string AdapterUnityVersion = "5.0.0"; + + /// + public static string AdapterNativeVersion => Instance.AdapterNativeVersion; + + /// + public static string PartnerSDKVersion => Instance.PartnerSDKVersion; + + /// + public static string PartnerIdentifier => Instance.PartnerIdentifier; + + /// + public static string PartnerDisplayName => Instance.PartnerDisplayName; + + /// + public static IReadOnlyCollection TestDeviceIds + { + get => Instance.TestDeviceIds; + set => Instance.TestDeviceIds = value; + } + } +} diff --git a/Runtime/GoogleBidding/GoogleBiddingAdapter.cs.meta b/Runtime/GoogleBidding/GoogleBiddingAdapter.cs.meta new file mode 100644 index 0000000..2903c39 --- /dev/null +++ b/Runtime/GoogleBidding/GoogleBiddingAdapter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4f08530679ff345e187b17cb2793f312 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/iOS.meta b/Runtime/iOS.meta new file mode 100644 index 0000000..1e12840 --- /dev/null +++ b/Runtime/iOS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dab8fc9e9b56046f7aac7f148d4353fd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/iOS/AssemblyInfo.cs b/Runtime/iOS/AssemblyInfo.cs new file mode 100644 index 0000000..5324eb2 --- /dev/null +++ b/Runtime/iOS/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using UnityEngine.Scripting; + +[assembly: AlwaysLinkAssembly] diff --git a/Runtime/iOS/AssemblyInfo.cs.meta b/Runtime/iOS/AssemblyInfo.cs.meta new file mode 100644 index 0000000..571b316 --- /dev/null +++ b/Runtime/iOS/AssemblyInfo.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8ff12ff50dcb64f009de01aff45657b2 +timeCreated: 1684175795 \ No newline at end of file diff --git a/Runtime/iOS/Chartboost.Mediation.GoogleBidding.IOS.asmdef b/Runtime/iOS/Chartboost.Mediation.GoogleBidding.IOS.asmdef new file mode 100644 index 0000000..19e89cf --- /dev/null +++ b/Runtime/iOS/Chartboost.Mediation.GoogleBidding.IOS.asmdef @@ -0,0 +1,25 @@ +{ + "name": "Chartboost.Mediation.GoogleBidding.IOS", + "rootNamespace": "Chartboost.Mediation.GoogleBidding.IOS", + "references": [ + "Chartboost.Threading", + "Chartboost.Logging", + "Chartboost.Mediation.GoogleBidding", + "Chartboost.Mediation", + "Chartboost.Utilities.IOS" + ], + "includePlatforms": [ + "Editor", + "iOS" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [ + "" + ], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} diff --git a/Runtime/iOS/Chartboost.Mediation.GoogleBidding.IOS.asmdef.meta b/Runtime/iOS/Chartboost.Mediation.GoogleBidding.IOS.asmdef.meta new file mode 100644 index 0000000..fa224bc --- /dev/null +++ b/Runtime/iOS/Chartboost.Mediation.GoogleBidding.IOS.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 619d6f240650c4cdcb1926a5aec52b9f +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/iOS/GoogleBiddingAdapter.cs b/Runtime/iOS/GoogleBiddingAdapter.cs new file mode 100644 index 0000000..fbda2e3 --- /dev/null +++ b/Runtime/iOS/GoogleBiddingAdapter.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using Chartboost.Constants; +using Chartboost.Mediation.GoogleBidding.Common; +using Chartboost.Mediation.Utilities; +using UnityEngine; + +namespace Chartboost.Mediation.GoogleBidding.IOS +{ + internal sealed class GoogleBiddingAdapter : IGoogleBiddingAdapter + { + [RuntimeInitializeOnLoadMethod] + private static void RegisterInstance() + { + if (Application.isEditor) + return; + GoogleBidding.GoogleBiddingAdapter.Instance = new GoogleBiddingAdapter(); + } + + /// + public string AdapterNativeVersion => _CBMGoogleBiddingAdapterAdapterVersion(); + + /// + public string PartnerSDKVersion => _CBMGoogleBiddingAdapterPartnerSDKVersion(); + + /// + public string PartnerIdentifier => _CBMGoogleBiddingAdapterPartnerId(); + + /// + public string PartnerDisplayName => _CBMGoogleBiddingAdapterPartnerDisplayName(); + + /// + public IReadOnlyCollection TestDeviceIds + { + get + { + var testDeviceIds = _CBMGoogleBiddingAdapterGetTestDeviceIds(); + return string.IsNullOrEmpty(testDeviceIds) ? Array.Empty() : testDeviceIds.ToList(); + } + set + { + if (value == null || value.Count == 0) + { + _CBMGoogleBiddingAdapterSetTestDeviceIds(Array.Empty(), 0); + return; + } + + _CBMGoogleBiddingAdapterSetTestDeviceIds(value.ToArray(), value.Count); + } + } + + [DllImport(SharedIOSConstants.DLLImport)] private static extern string _CBMGoogleBiddingAdapterAdapterVersion(); + [DllImport(SharedIOSConstants.DLLImport)] private static extern string _CBMGoogleBiddingAdapterPartnerSDKVersion(); + [DllImport(SharedIOSConstants.DLLImport)] private static extern string _CBMGoogleBiddingAdapterPartnerId(); + [DllImport(SharedIOSConstants.DLLImport)] private static extern string _CBMGoogleBiddingAdapterPartnerDisplayName(); + [DllImport(SharedIOSConstants.DLLImport)] private static extern string _CBMGoogleBiddingAdapterGetTestDeviceIds(); + [DllImport(SharedIOSConstants.DLLImport)] private static extern void _CBMGoogleBiddingAdapterSetTestDeviceIds(string[] testDeviceIds, int testDeviceIdsSize); + } +} diff --git a/Runtime/iOS/GoogleBiddingAdapter.cs.meta b/Runtime/iOS/GoogleBiddingAdapter.cs.meta new file mode 100644 index 0000000..533496f --- /dev/null +++ b/Runtime/iOS/GoogleBiddingAdapter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 58b170df4a00c4665ab95ea0e68056d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/iOS/Plugins.meta b/Runtime/iOS/Plugins.meta new file mode 100644 index 0000000..391789f --- /dev/null +++ b/Runtime/iOS/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b954de13c20c8443db510f10401df2d9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/iOS/Plugins/iOS.meta b/Runtime/iOS/Plugins/iOS.meta new file mode 100644 index 0000000..431d69c --- /dev/null +++ b/Runtime/iOS/Plugins/iOS.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f4c6099b5a809476897ef447ba557f93 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/iOS/Plugins/iOS/CBMGoogleBiddingUnityBridge.mm b/Runtime/iOS/Plugins/iOS/CBMGoogleBiddingUnityBridge.mm new file mode 100644 index 0000000..3f3eca3 --- /dev/null +++ b/Runtime/iOS/Plugins/iOS/CBMGoogleBiddingUnityBridge.mm @@ -0,0 +1,33 @@ +#import "CBMDelegates.h" +#import "ChartboostUnityUtilities.h" +#import + +extern "C" { + + const char * _CBMGoogleBiddingAdapterAdapterVersion(){ + return toCStringOrNull([GoogleBiddingAdapterConfiguration adapterVersion]); + } + + const char * _CBMGoogleBiddingAdapterPartnerSDKVersion(){ + return toCStringOrNull([GoogleBiddingAdapterConfiguration partnerSDKVersion]); + } + + const char * _CBMGoogleBiddingAdapterPartnerId(){ + return toCStringOrNull([GoogleBiddingAdapterConfiguration partnerID]); + } + + const char * _CBMGoogleBiddingAdapterPartnerDisplayName(){ + return toCStringOrNull([GoogleBiddingAdapterConfiguration partnerDisplayName]); + } + + const char * _CBMGoogleBiddingAdapterGetTestDeviceIds(){ + return toJSON([GoogleBiddingAdapterConfiguration testDeviceIdentifiers]); + } + + void _CBMGoogleBiddingAdapterSetTestDeviceIds(const char** testDeviceIds, int testDeviceIdsSize){ + if (testDeviceIdsSize > 0) + [GoogleBiddingAdapterConfiguration setTestDeviceIdentifiers:toNSMutableArray(testDeviceIds, testDeviceIdsSize)]; + else + [GoogleBiddingAdapterConfiguration setTestDeviceIdentifiers:nil]; + } +} diff --git a/Runtime/iOS/Plugins/iOS/CBMGoogleBiddingUnityBridge.mm.meta b/Runtime/iOS/Plugins/iOS/CBMGoogleBiddingUnityBridge.mm.meta new file mode 100644 index 0000000..ffcb6fb --- /dev/null +++ b/Runtime/iOS/Plugins/iOS/CBMGoogleBiddingUnityBridge.mm.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: 6970bc19b67da4819af5e961540c4d41 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + iPhone: iOS + second: + enabled: 1 + settings: {} + - first: + tvOS: tvOS + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests.meta b/Tests.meta new file mode 100644 index 0000000..5820e31 --- /dev/null +++ b/Tests.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: df606ab47965142ef804a5e98b990fb7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Editor.meta b/Tests/Editor.meta new file mode 100644 index 0000000..6870f54 --- /dev/null +++ b/Tests/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 685e23f725e9c4979a1f31be29b7bcef +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Editor/Chartboost.Mediation.GoogleBidding.Tests.Editor.asmdef b/Tests/Editor/Chartboost.Mediation.GoogleBidding.Tests.Editor.asmdef new file mode 100644 index 0000000..e9551b3 --- /dev/null +++ b/Tests/Editor/Chartboost.Mediation.GoogleBidding.Tests.Editor.asmdef @@ -0,0 +1,26 @@ +{ + "name": "Chartboost.Mediation.GoogleBidding.Tests.Editor", + "rootNamespace": "Chartboost.Tests.Editor", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner", + "Chartboost.Utilities.Editor", + "Chartboost.Logging", + "Chartboost.Mediation.GoogleBidding" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} diff --git a/Tests/Editor/Chartboost.Mediation.GoogleBidding.Tests.Editor.asmdef.meta b/Tests/Editor/Chartboost.Mediation.GoogleBidding.Tests.Editor.asmdef.meta new file mode 100644 index 0000000..5a959de --- /dev/null +++ b/Tests/Editor/Chartboost.Mediation.GoogleBidding.Tests.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: aea536ef908bf4b94ad2167531e83871 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Editor/VersionValidator.cs b/Tests/Editor/VersionValidator.cs new file mode 100644 index 0000000..9cd058b --- /dev/null +++ b/Tests/Editor/VersionValidator.cs @@ -0,0 +1,21 @@ +using Chartboost.Editor; +using Chartboost.Logging; +using Chartboost.Mediation.GoogleBidding; +using NUnit.Framework; + +namespace Chartboost.Tests.Editor +{ + internal class VersionValidator + { + private const string UnityPackageManagerPackageName = "com.chartboost.mediation.unity.adapter.google-bidding"; + private const string NuGetPackageName = "Chartboost.CSharp.Mediation.Unity.Adapter.GoogleBidding"; + + [SetUp] + public void SetUp() + => LogController.LoggingLevel = LogLevel.Debug; + + [Test] + public void ValidateVersion() + => VersionCheck.ValidateVersions(UnityPackageManagerPackageName, NuGetPackageName, GoogleBiddingAdapter.AdapterUnityVersion); + } +} diff --git a/Tests/Editor/VersionValidator.cs.meta b/Tests/Editor/VersionValidator.cs.meta new file mode 100644 index 0000000..3d5db85 --- /dev/null +++ b/Tests/Editor/VersionValidator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fb117dd47d90747beb4c52ca30ad4866 +timeCreated: 1710897732 \ No newline at end of file diff --git a/Tests/Runtime.meta b/Tests/Runtime.meta new file mode 100644 index 0000000..76f07df --- /dev/null +++ b/Tests/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 995a3bd168f794650b6102034b80507a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime/Chartboost.Mediation.GoogleBidding.Tests.Runtime.asmdef b/Tests/Runtime/Chartboost.Mediation.GoogleBidding.Tests.Runtime.asmdef new file mode 100644 index 0000000..e8a2fe5 --- /dev/null +++ b/Tests/Runtime/Chartboost.Mediation.GoogleBidding.Tests.Runtime.asmdef @@ -0,0 +1,29 @@ +{ + "name": "Chartboost.Mediation.GoogleBidding.Tests.Runtime", + "rootNamespace": "Chartboost.Tests", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner", + "Chartboost.Utilities", + "Chartboost.Mediation.GoogleBidding", + "Chartboost.Logging", + "Chartboost.Utilities.Tests.Runtime" + ], + "includePlatforms": [ + "Android", + "Editor", + "iOS" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Tests/Runtime/Chartboost.Mediation.GoogleBidding.Tests.Runtime.asmdef.meta b/Tests/Runtime/Chartboost.Mediation.GoogleBidding.Tests.Runtime.asmdef.meta new file mode 100644 index 0000000..b6b25ab --- /dev/null +++ b/Tests/Runtime/Chartboost.Mediation.GoogleBidding.Tests.Runtime.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 786f4770c6b64491b9809e22a7c45db7 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tests/Runtime/GoogleBiddingAdapterTests.cs b/Tests/Runtime/GoogleBiddingAdapterTests.cs new file mode 100644 index 0000000..030306d --- /dev/null +++ b/Tests/Runtime/GoogleBiddingAdapterTests.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using Chartboost.Logging; +using Chartboost.Mediation.GoogleBidding; +using Chartboost.Tests.Runtime; +using NUnit.Framework; + +namespace Chartboost.Tests +{ + internal class GoogleBiddingAdapterTests + { + [SetUp] + public void SetUp() + => LogController.LoggingLevel = LogLevel.Debug; + + [Test] + public void AdapterNativeVersion() + => TestUtilities.TestStringGetter(() => GoogleBiddingAdapter.AdapterNativeVersion); + + [Test] + public void PartnerSDKVersion() + => TestUtilities.TestStringGetter(() => GoogleBiddingAdapter.PartnerSDKVersion); + + [Test] + public void PartnerIdentifier() + => TestUtilities.TestStringGetter(() => GoogleBiddingAdapter.PartnerIdentifier); + + [Test] + public void PartnerDisplayName() + => TestUtilities.TestStringGetter(() => GoogleBiddingAdapter.PartnerDisplayName); + + [Test] + public void TestDeviceIds() + { + Assert.AreEqual(Array.Empty(), GoogleBiddingAdapter.TestDeviceIds); + + var testDeviceIds = new List + { + "33BE2250B43518CCDA7DE426D04EE231", + "33BE2250B43518CCDA7DE426D04EE232", + "33BE2250B43518CCDA7DE426D04EE233" + }; + + GoogleBiddingAdapter.TestDeviceIds = testDeviceIds; + Assert.AreEqual(testDeviceIds ,GoogleBiddingAdapter.TestDeviceIds); + LogController.Log($"Test Device Ids: {Json.JsonTools.SerializeObject(GoogleBiddingAdapter.TestDeviceIds)}", LogLevel.Debug); + GoogleBiddingAdapter.TestDeviceIds = null; + Assert.AreEqual(Array.Empty(), GoogleBiddingAdapter.TestDeviceIds); + } + } +} diff --git a/Tests/Runtime/GoogleBiddingAdapterTests.cs.meta b/Tests/Runtime/GoogleBiddingAdapterTests.cs.meta new file mode 100644 index 0000000..951b2f3 --- /dev/null +++ b/Tests/Runtime/GoogleBiddingAdapterTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0daf7d1f11f8b4e0383e16ec14940f63 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/package.json b/package.json new file mode 100644 index 0000000..d6be720 --- /dev/null +++ b/package.json @@ -0,0 +1,32 @@ +{ + "name": "com.chartboost.mediation.unity.adapter.google-bidding", + "version": "5.0.0", + "displayName": "Chartboost Mediation Adapter - Google Bidding", + "description": "The Chartboost Mediation Unity SDK Adapter for Google Bidding.", + "unity": "2022.3", + "documentationUrl": "https://docs.chartboost.com/en/mediation/integrate/unity/get-started/", + "changelogUrl": "https://docs.chartboost.com/en/mediation/integrate/unity/changelog/", + "licensesUrl": "https://docs.chartboost.com/en/legal/", + "dependencies": { + "com.chartboost.mediation" : "5.0.0", + "com.chartboost.unity.threading": "1.0.1", + "com.chartboost.unity.utilities": "1.0.1", + "com.chartboost.unity.logging": "1.0.0", + "com.chartboost.unity.utilities.google" : "1.0.0" + }, + "keywords": ["Chartboost", "Mediation", "Adapter", "Unity", "Google Bidding"], + "author": { + "name": "Chartboost", + "email": "sales@chartboost.com", + "url": "https://www.chartboost.com/products/mediation/" + }, + "repository": { + "type": "git", + "url": "https://github.com/ChartBoost/chartboost-mediation-unity-adapter-google-bidding.git" + }, + "bugs": { + "url": "https://github.com/ChartBoost/chartboost-mediation-unity-adapter-google-bidding/issues", + "email": "helium-service@chartboost.com" + }, + "hideInEditor": false +} \ No newline at end of file diff --git a/package.json.meta b/package.json.meta new file mode 100644 index 0000000..a917bfa --- /dev/null +++ b/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1486c6d001fc14832b33429e73c3238c +PackageManifestImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: