Skip to content

Commit

Permalink
Syncing changes from private repository
Browse files Browse the repository at this point in the history
  • Loading branch information
helium-service committed Aug 8, 2024
1 parent 4e0bf92 commit 22101c2
Show file tree
Hide file tree
Showing 56 changed files with 1,035 additions and 1 deletion.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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 - Verve Adapter.

#Added
- Support for the following `Verve` dependencies. Notice adapter dependencies are optimistic and any patches and hot-fixes will be automatically picked up.:
* Android: `com.chartboost:chartboost-mediation-adapter-verve:5.3.0.+`
* iOS: `ChartboostMediationAdapterVerve ~> 5.3.0.0`

- `VerveAdapter.cs` with Configuration Properties for `Verve`.
- The following properties have been added in `VerveAdapter.cs`
* `string AdapterUnityVersion`
* `string AdapterNativeVersion`
* `string PartnerSDKVersion`
* `string PartnerIdentifier`
* `string PartnerDisplayName`
* `bool TestMode`
* `bool VerboseLogging`
7 changes: 7 additions & 0 deletions CHANGELOG.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions Chartboost.CSharp.Mediation.Unity.Adapter.Verve.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>Chartboost.CSharp.Mediation.Unity.Adapter.Verve</id>
<version>5.0.0</version>
<title>Chartboost Mediation Adapter - Verve</title>
<description>The Chartboost Mediation Unity SDK Adapter for Verve.</description>
<authors>Chartboost</authors>
<owners>Chartboost</owners>
<license type="file">LICENSE.md</license>
<readme>README.md</readme>
<projectUrl>https://www.chartboost.com/products/mediation/</projectUrl>
<copyright>Copyright 2024</copyright>
<tags>Chartboost, Ads, Mediation, Unity, Adapter, Verve, cs</tags>
<repository type="git" url="https://github.com/ChartBoost/chartboost-mediation-unity-adapter-verve.git"/>
<dependencies>
<dependency id="Chartboost.CSharp.Mediation.Unity" version="5.0.0" />
<dependency id="Chartboost.CSharp.Threading.Unity" version="1.0.1" />
<dependency id="Chartboost.CSharp.Utilities.Unity" version="1.0.1" />
<dependency id="Chartboost.CSharp.Logging.Unity" version="1.0.0" />
</dependencies>
</metadata>
</package>
7 changes: 7 additions & 0 deletions Chartboost.CSharp.Mediation.Unity.Adapter.Verve.nuspec.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions Editor/VerveAdapterDependencies.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<dependencies>
<androidPackages>
<!-- Android Adapter -->
<androidPackage spec="com.chartboost:chartboost-mediation-adapter-verve:5.3.0.+"/>

<!-- Verve Android Repositories -->
<repositories>
<repository>https://verve.jfrog.io/artifactory/verve-gradle-release</repository>
</repositories>
</androidPackages>
<iosPods>
<!-- iOS Adapter -->
<iosPod name="ChartboostMediationAdapterVerve" version="~> 5.3.0.0"/>

<!-- Partner iOS SDK-->
<iosPod name="HyBid" version="~> 3.0.0" addToAllTargets="true"/>
</iosPods>
</dependencies>
7 changes: 7 additions & 0 deletions Editor/VerveAdapterDependencies.xml.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 7 additions & 0 deletions LICENSE.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 99 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,99 @@
# chartboost-mediation-unity-adapter-verve
# Chartboost Mediation Unity SDK - Verve 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.verve/Editor/VerveAdapterDependencies.xml`.

# Installation

## Using the public [npm registry](https://www.npmjs.com/search?q=com.chartboost.mediation.unity.adapter.verve)

In order to add the Chartboost Mediation Unity SDK - Verve 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.verve": "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.Verve)

To add the Chartboost Mediation Unity SDK - Verve 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 <code>NugetForUnity</code> is installed, search for `Chartboost.CSharp.Mediation.Unity.Adapter.Verve` in the search bar of Nuget Explorer window(Nuget -> Manage Nuget Packages).
You should be able to see the `Chartboost.CSharp.Mediation.Unity.Adapter.Verve` package. Choose the appropriate version and install.

# AndroidManifest.xml Permissions

The following permissions must be added in the `AndroidManifest.xml` file:

```xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
```

For improved targeting and therefore higher eCPMs you can add this other permissions but keep in mind that the user needs to approve them explicitly on Android versions 6 or higher.

```xml
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<!-- For location use one of the following permissions -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- or -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
```

# Usage
The following code block exemplifies usage of the `VerveAdapter.cs` configuration class.

## IPartnerAdapterConfiguration Properties

```csharp

// AdapterUnityVersion - The partner adapter Unity version, e.g: 5.0.0
Debug.Log($"Adapter Unity Version: {VerveAdapter.AdapterUnityVersion}");

// AdapterNativeVersion - The partner adapter version, e.g: 5.3.0.2.0
Debug.Log($"Adapter Native Version: {VerveAdapter.AdapterNativeVersion}");

// PartnerSDKVersion - The partner SDK version, e.g: 3.0.2
Debug.Log($"Partner SDK Version: {VerveAdapter.PartnerSDKVersion}");

// PartnerIdentifier - The partner ID for internal uses, e.g: verve
Debug.Log($"Partner Identifier: {VerveAdapter.PartnerIdentifier}");

// PartnerDisplayName - The partner name for external uses, e.g: Verve
Debug.Log($"Partner Display Name: {VerveAdapter.PartnerDisplayName}");
```

## Test Mode
To enable test mode for the Verve adapter, the following property has been made available:

```csharp
VerveAdapter.TestMode = true;
```

## Verbose Logging
To enable verbose logging for the Verve adapter, the following property has been made available:

```csharp
VerveAdapter.VerboseLogging = true;
```
7 changes: 7 additions & 0 deletions README.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Runtime.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Runtime/Android.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Runtime/Android/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using UnityEngine.Scripting;

[assembly: AlwaysLinkAssembly]
3 changes: 3 additions & 0 deletions Runtime/Android/AssemblyInfo.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions Runtime/Android/Chartboost.Mediation.Verve.Android.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "Chartboost.Mediation.Verve.Android",
"rootNamespace": "Chartboost.Mediation.Verve.Android",
"references": [
"Chartboost.Threading",
"Chartboost.Logging",
"Chartboost.Mediation.Verve",
"Chartboost.Mediation",
"Chartboost.Mediation.Android",
"Chartboost.Utilities.Android"
],
"includePlatforms": [
"Android",
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [
""
],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 104 additions & 0 deletions Runtime/Android/VerveAdapter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
using Chartboost.Constants;
using Chartboost.Mediation.Verve.Common;
using UnityEngine;

namespace Chartboost.Mediation.Verve.Android
{
internal sealed class VerveAdapter : IVerveAdapter
{
private const string VerveAdapterConfiguration = "com.chartboost.mediation.verveadapter.VerveAdapterConfiguration";
private const string FunctionGetTestModeEnabled = "getTestModeEnabled";
private const string FunctionSetTestModeEnabled = "setTestModeEnabled";

private const string VerveLoggerLevel = "net.pubnative.lite.sdk.utils.Logger$Level";
private const string EnumVerveLogLevelVerbose = "verbose";
private const string EnumVerveLogLevelNone = "none";

[RuntimeInitializeOnLoadMethod]
private static void RegisterInstance()
{
if (Application.isEditor)
return;
Verve.VerveAdapter.Instance = new VerveAdapter();
}

/// <inheritdoc/>
public string AdapterNativeVersion
{
get
{
using var adapterConfiguration = new AndroidJavaObject(VerveAdapterConfiguration);
return adapterConfiguration.Call<string>(SharedAndroidConstants.FunctionGetAdapterVersion);
}
}

/// <inheritdoc/>
public string PartnerSDKVersion
{
get
{
using var adapterConfiguration = new AndroidJavaObject(VerveAdapterConfiguration);
return adapterConfiguration.Call<string>(SharedAndroidConstants.FunctionGetPartnerSdkVersion);
}
}

/// <inheritdoc/>
public string PartnerIdentifier
{
get
{
using var adapterConfiguration = new AndroidJavaObject(VerveAdapterConfiguration);
return adapterConfiguration.Call<string>(SharedAndroidConstants.FunctionGetPartnerId);
}
}

/// <inheritdoc/>
public string PartnerDisplayName
{
get
{
using var adapterConfiguration = new AndroidJavaObject(VerveAdapterConfiguration);
return adapterConfiguration.Call<string>(SharedAndroidConstants.FunctionGetPartnerDisplayName);
}
}

/// <inheritdoc/>
public bool TestMode
{
get
{
using var adapterConfiguration = new AndroidJavaObject(VerveAdapterConfiguration);
return adapterConfiguration.Call<bool>(FunctionGetTestModeEnabled);
}
set
{
using var adapterConfiguration = new AndroidJavaObject(VerveAdapterConfiguration);
adapterConfiguration.Call(FunctionSetTestModeEnabled, value);
}
}

/// <inheritdoc/>
public bool VerboseLogging
{
get
{
using var adapterConfiguration = new AndroidJavaObject(VerveAdapterConfiguration);
using var nativeLogLevel = adapterConfiguration.Call<AndroidJavaObject>(SharedAndroidConstants.FunctionGetLogLevel);

var logLevelAsString = nativeLogLevel.Call<string>(SharedAndroidConstants.FunctionToString);
return logLevelAsString switch
{
EnumVerveLogLevelVerbose => true,
_ => false
};
}
set
{
using var adapterConfiguration = new AndroidJavaObject(VerveAdapterConfiguration);
using var loggerLevelClass = new AndroidJavaClass(VerveLoggerLevel);
using var enumValue = loggerLevelClass.GetStatic<AndroidJavaObject>(value ? EnumVerveLogLevelVerbose : EnumVerveLogLevelNone);
adapterConfiguration.Call(SharedAndroidConstants.FunctionSetLogLevel, enumValue);
}
}
}
}
Loading

0 comments on commit 22101c2

Please sign in to comment.