Skip to content

Commit

Permalink
Merge pull request #126 from ChartBoost/HB-5821-mediation-unity-impro…
Browse files Browse the repository at this point in the history
…ve-fetching-of-package-information-for-projects-with-large-amounts-of-packages

[HB-5821] Fixing AdaptersWindow issues with UPM
  • Loading branch information
SCastanedaMunoz authored May 5, 2023
2 parents 2924b43 + ef6be36 commit c829977
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 47 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# 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 4.2.0 *(2023-05-04)*
## Version 4.2.1 *(2023-05-05)*
Bug Fixes:
- Fixed an issue where package information failed to load if projects had a large amount of packages.
- Fixed an issue where main SDK dependency could not be generated through UPM implementation.

## Version 4.2.0 *(2023-05-04)*
Added:
- Editor Window, `AdaptersWindow.cs`, for Chartboost Mediation adapters handling. For capabilities, see below:
* Ad Adapters are now decoupled from the Chartboost Mediation UPM package.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<dependencies>
<androidPackages>
<!-- Android Adapter -->
<androidPackage spec="com.chartboost:chartboost-mediation-adapter-amazon-publisher-services:4.9.7.0+@aar"/>
<androidPackage spec="com.chartboost:chartboost-mediation-adapter-amazon-publisher-services:4.9.7.1+@aar"/>

<!-- Partner Android SDK-->
<androidPackage spec="com.amazon.android:aps-sdk:9.7.0"/>
<androidPackage spec="com.amazon.android:aps-sdk:9.7.1"/>

</androidPackages>
<iosPods>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<dependencies>
<androidPackages>
<!-- Android Adapter -->
<androidPackage spec="com.chartboost:chartboost-mediation-adapter-applovin:4.11.8.1+@aar"/>
<androidPackage spec="com.chartboost:chartboost-mediation-adapter-applovin:4.11.8.2+@aar"/>

<!-- Partner Android SDK-->
<androidPackage spec="com.applovin:applovin-sdk:11.8.1"/>
<androidPackage spec="com.applovin:applovin-sdk:11.8.2"/>

</androidPackages>
<iosPods>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</androidPackages>
<iosPods>
<!-- iOS Adapter -->
<iosPod name="ChartboostMediationAdapterDigitalTurbineExchange" version="~> 4.8.1.9"/>
<iosPod name="ChartboostMediationAdapterDigitalTurbineExchange" version="~> 4.8.2.1"/>

<!-- Partner iOS SDK-->
<iosPod name="Fyber_Marketplace_SDK" version="~> 8.1.9" addToAllTargets="true"/>
<iosPod name="Fyber_Marketplace_SDK" version="~> 8.2.1" addToAllTargets="true"/>
</iosPods>
</dependencies>
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<dependencies>
<androidPackages>
<!-- Android Adapter -->
<androidPackage spec="com.chartboost:chartboost-mediation-adapter-ironsource:4.7.2.7.0+@aar"/>
<androidPackage spec="com.chartboost:chartboost-mediation-adapter-ironsource:4.7.3.0.0+@aar"/>

<!-- Partner Android SDK-->
<androidPackage spec="com.ironsource.sdk:mediationsdk:7.2.7"/>
<androidPackage spec="com.ironsource.sdk:mediationsdk:7.3.0"/>

<!-- IronSource Android Repositories -->
<repositories>
Expand All @@ -14,9 +14,9 @@
</androidPackages>
<iosPods>
<!-- iOS Adapter -->
<iosPod name="ChartboostMediationAdapterIronSource" version="~> 4.7.2.6.0"/>
<iosPod name="ChartboostMediationAdapterIronSource" version="~> 4.7.2.7.0"/>

<!-- Partner iOS SDK-->
<iosPod name="IronSourceSDK" version="~> 7.2.6.0" addToAllTargets="false"/>
<iosPod name="IronSourceSDK" version="~> 7.2.7.0" addToAllTargets="false"/>
</iosPods>
</dependencies>
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<dependencies>
<androidPackages>
<!-- Android Adapter -->
<androidPackage spec="com.chartboost:chartboost-mediation-adapter-meta-audience-network:4.6.12.0+@aar"/>
<androidPackage spec="com.chartboost:chartboost-mediation-adapter-meta-audience-network:4.6.13.7+@aar"/>

<!-- Partner Android SDK-->
<androidPackage spec="com.facebook.android:audience-network-sdk:6.12.0"/>
<androidPackage spec="com.facebook.android:audience-network-sdk:6.13.7"/>

</androidPackages>
<iosPods>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<dependencies>
<androidPackages>
<!-- Android Adapter -->
<androidPackage spec="com.chartboost:chartboost-mediation-adapter-unity-ads:4.4.6.0+@aar"/>
<androidPackage spec="com.chartboost:chartboost-mediation-adapter-unity-ads:4.4.6.1+@aar"/>

<!-- Partner Android SDK-->
<androidPackage spec="com.unity3d.ads:unity-ads:4.6.0"/>
<androidPackage spec="com.unity3d.ads:unity-ads:4.6.1"/>

<androidPackage spec="androidx.core:core:1.2.0"/>
</androidPackages>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
</androidPackages>
<iosPods>
<!-- iOS Adapter -->
<iosPod name="ChartboostMediationAdapterVungle" version="~> 4.6.12.2"/>
<iosPod name="ChartboostMediationAdapterVungle" version="~> 4.6.12.3"/>

<!-- Partner iOS SDK-->
<iosPod name="VungleSDK-iOS" version="~> 6.12.2" addToAllTargets="false"/>
<iosPod name="VungleSDK-iOS" version="~> 6.12.3" addToAllTargets="false"/>
</iosPods>
</dependencies>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"mediationVersion": "4.2.0",
"mediationVersion": "4.2.1",
"adapterSelections": [
{
"id": "adcolony",
Expand All @@ -13,12 +13,12 @@
},
{
"id": "aps",
"android": "9.7.0",
"android": "9.7.1",
"ios": "4.6.0"
},
{
"id": "applovin",
"android": "11.8.1",
"android": "11.8.2",
"ios": "11.8.0"
},
{
Expand All @@ -29,7 +29,7 @@
{
"id": "digitalturbine",
"android": "8.2.2",
"ios": "8.1.9"
"ios": "8.2.1"
},
{
"id": "googlebidding",
Expand All @@ -43,12 +43,12 @@
},
{
"id": "ironsource",
"android": "7.2.7.0",
"ios": "7.2.6.0"
"android": "7.3.0.0",
"ios": "7.2.7.0"
},
{
"id": "meta",
"android": "6.12.0",
"android": "6.13.7",
"ios": "6.12.0"
},
{
Expand All @@ -68,13 +68,13 @@
},
{
"id": "unityads",
"android": "4.6.0",
"android": "4.6.1",
"ios": "4.6.0"
},
{
"id": "vungle",
"android": "6.12.1",
"ios": "6.12.2"
"ios": "6.12.3"
},
{
"id": "yahoo",
Expand Down
2 changes: 1 addition & 1 deletion com.chartboost.mediation.demo/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"com.unity.ide.rider": "3.0.16",
"com.unity.ide.visualstudio": "2.0.16",
"com.unity.ide.vscode": "1.2.5",
"com.unity.test-framework": "1.1.31",
"com.unity.test-framework": "1.1.33",
"com.unity.textmeshpro": "3.0.6",
"com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion com.chartboost.mediation.demo/Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"url": "https://packages.unity.com"
},
"com.unity.test-framework": {
"version": "1.1.31",
"version": "1.1.33",
"depth": 0,
"source": "registry",
"dependencies": {
Expand Down
6 changes: 5 additions & 1 deletion com.chartboost.mediation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# 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 4.2.0 *(2023-05-04)*
## Version 4.2.1 *(2023-05-05)*
Bug Fixes:
- Fixed an issue where package information failed to load if projects had a large amount of packages.
- Fixed an issue where main SDK dependency could not be generated through UPM implementation.

## Version 4.2.0 *(2023-05-04)*
Added:
- Editor Window, `AdaptersWindow.cs`, for Chartboost Mediation adapters handling. For capabilities, see below:
* Ad Adapters are now decoupled from the Chartboost Mediation UPM package.
Expand Down
10 changes: 6 additions & 4 deletions com.chartboost.mediation/Editor/Adapters/AdaptersWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using UnityEditor.UIElements;
using UnityEngine;
using UnityEngine.UIElements;
using PackageInfo = UnityEditor.PackageManager.PackageInfo;

namespace Chartboost.Editor.Adapters
{
Expand Down Expand Up @@ -36,6 +37,9 @@ public partial class AdaptersWindow : EditorWindow
private static Button _saveButton;
private static Button _warningButton;

private static PackageInfo ChartboostMediationPackage => _mediationPackage ??= Utilities.FindPackage(Constants.ChartboostMediationPackageName);
private static PackageInfo _mediationPackage;

private static AdaptersWindow Instance {
get
{
Expand Down Expand Up @@ -84,21 +88,19 @@ private static void CheckMediationVersion(VisualElement root)
scaleMode = ScaleMode.ScaleToFit
};

var package = Utilities.FindPackage(Constants.ChartboostMediationPackageName);

_warningButton = new Button(() => CheckChartboostMediationVersion());
_warningButton.name = "warning-button";
_warningButton.Add(logo);

if (string.IsNullOrEmpty(MediationSelection) || !Constants.PathToMainDependency.FileExist())
{
_warningButton.tooltip = $"Dependencies for Chartboost Mediation {package.version} have not been found. Press to add.";
_warningButton.tooltip = $"Dependencies for Chartboost Mediation {ChartboostMediationPackage.version} have not been found. Press to add.";
root.Add(_warningButton);
return;
}

var version = new Version(MediationSelection);
var packageVersion = new Version(package.version);
var packageVersion = new Version(ChartboostMediationPackage.version);

if (version != packageVersion)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,18 @@ public static bool CheckChartboostMediationVersion()
{
if (!Application.isBatchMode && _warningButton != null)
_warningButton.RemoveFromHierarchy();
var package = Utilities.FindPackage(Constants.ChartboostMediationPackageName);

var version = new Version(MediationSelection);
var packageVersion = new Version(package.version);
if (!string.IsNullOrEmpty(MediationSelection) && ChartboostMediationPackage != null)
{
var version = new Version(MediationSelection);
var packageVersion = new Version(ChartboostMediationPackage.version);

if (Constants.PathToMainDependency.FileExist() && version == packageVersion)
return false;
}

if (!string.IsNullOrEmpty(MediationSelection) && Constants.PathToMainDependency.FileExist() &&
version == packageVersion) return false;

MediationSelection = package.version;
if (ChartboostMediationPackage != null)
MediationSelection = ChartboostMediationPackage.version;
GenerateChartboostMediationDependency();
return true;
}
Expand Down Expand Up @@ -172,6 +175,7 @@ private static void Refresh(bool ignore = true)
{
if (!Application.isBatchMode)
Instance.rootVisualElement.Clear();
_mediationPackage = Utilities.FindPackage(Constants.ChartboostMediationPackageName);
AdapterDataSource.Update();
Initialize();
if (!Application.isBatchMode|| !ignore)
Expand Down
12 changes: 6 additions & 6 deletions com.chartboost.mediation/Editor/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Linq;
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEngine;
using UnityEditor.PackageManager;
using Object = UnityEngine.Object;
using PackageInfo = UnityEditor.PackageManager.PackageInfo;

Expand All @@ -14,11 +14,11 @@ public static class Utilities
{
public static PackageInfo FindPackage(string packageName)
{
var packageJsons = AssetDatabase.FindAssets("package")
.Select(AssetDatabase.GUIDToAssetPath).Where(x => AssetDatabase.LoadAssetAtPath<TextAsset>(x) != null)
.Select(PackageInfo.FindForAssetPath).ToList();

return packageJsons.Find(x => x.name == packageName);
var packages = Client.List(false, false);
while (!packages.IsCompleted) { }
var packageInfos = packages.Result.ToList();
var desiredPackage = packageInfos.Find(x => x.name == packageName);
return desiredPackage;
}

private static readonly Regex SWhitespace = new Regex(@"\s+");
Expand Down
2 changes: 1 addition & 1 deletion com.chartboost.mediation/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.chartboost.mediation",
"version": "4.2.0",
"version": "4.2.1",
"displayName": "Chartboost Mediation",
"description": "The Chartboost Mediation Unity SDK. Better monetization powered by bidding",
"unity": "2020.3",
Expand Down

0 comments on commit c829977

Please sign in to comment.