diff --git a/com.chartboost.mediation.demo/Assets/Demo/Editor/DisableBitcode.cs b/com.chartboost.mediation.demo/Assets/Demo/Editor/DisableBitcode.cs index cf18cee7..3c61c68c 100644 --- a/com.chartboost.mediation.demo/Assets/Demo/Editor/DisableBitcode.cs +++ b/com.chartboost.mediation.demo/Assets/Demo/Editor/DisableBitcode.cs @@ -1,3 +1,4 @@ +#if UNITY_IOS using UnityEditor; using UnityEditor.Build; using UnityEditor.Build.Reporting; @@ -36,3 +37,4 @@ public void OnPostprocessBuild(BuildReport report) } } } +#endif \ No newline at end of file diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AdColonyDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AdColonyDependencies.xml index 6a233ed9..41738092 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AdColonyDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AdColonyDependencies.xml @@ -4,9 +4,8 @@ - + - diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AdMobDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AdMobDependencies.xml index db5107e8..05057646 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AdMobDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AdMobDependencies.xml @@ -4,9 +4,8 @@ - + - diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AmazonPublisherServicesDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AmazonPublisherServicesDependencies.xml index 068d0628..af0ea0ea 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AmazonPublisherServicesDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AmazonPublisherServicesDependencies.xml @@ -4,9 +4,8 @@ - + - diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AppLovinDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AppLovinDependencies.xml index 7d51279a..5b1c52cd 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AppLovinDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/AppLovinDependencies.xml @@ -4,9 +4,8 @@ - + - diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/ChartboostDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/ChartboostDependencies.xml index 9585aab4..c8054bcd 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/ChartboostDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/ChartboostDependencies.xml @@ -4,9 +4,8 @@ - + - diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/DigitalTurbineExchangeDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/DigitalTurbineExchangeDependencies.xml index 19811d22..a2538b19 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/DigitalTurbineExchangeDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/DigitalTurbineExchangeDependencies.xml @@ -4,9 +4,8 @@ - + - diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/GoogleBiddingDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/GoogleBiddingDependencies.xml index 379016a2..3ac106df 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/GoogleBiddingDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/GoogleBiddingDependencies.xml @@ -4,9 +4,8 @@ - + - diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/HyprMXDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/HyprMXDependencies.xml new file mode 100644 index 00000000..56061051 --- /dev/null +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/HyprMXDependencies.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/HyprMXDependencies.xml.meta b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/HyprMXDependencies.xml.meta new file mode 100644 index 00000000..8a7a87c0 --- /dev/null +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/HyprMXDependencies.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d41be5493e1664542bbc29f5fa090171 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/InMobiDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/InMobiDependencies.xml index 404fdb02..91e5845f 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/InMobiDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/InMobiDependencies.xml @@ -2,17 +2,16 @@ - + - - - + + - + diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/IronSourceDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/IronSourceDependencies.xml index 7e98835e..36275915 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/IronSourceDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/IronSourceDependencies.xml @@ -2,21 +2,20 @@ - + - + - + https://android-sdk.is.com/ - - + - + diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/MetaAudienceNetworkDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/MetaAudienceNetworkDependencies.xml index 52ec9847..f0e963a3 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/MetaAudienceNetworkDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/MetaAudienceNetworkDependencies.xml @@ -4,9 +4,8 @@ - + - diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/MintegralDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/MintegralDependencies.xml index f3f9a5bd..e5d07376 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/MintegralDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/MintegralDependencies.xml @@ -4,14 +4,7 @@ - - - - - - https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea - - + @@ -23,7 +16,11 @@ - + + + + https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea + diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/PangleDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/PangleDependencies.xml index 323426dd..b5570ec0 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/PangleDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/PangleDependencies.xml @@ -4,14 +4,13 @@ - + - + https://artifact.bytedance.com/repository/pangle - diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/TapjoyDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/TapjoyDependencies.xml index b678319f..e8cf7e1e 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/TapjoyDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/TapjoyDependencies.xml @@ -4,14 +4,13 @@ - + - + https://sdk.tapjoy.com/ - diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/UnityAdsDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/UnityAdsDependencies.xml index add8e0e1..2f32d42f 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/UnityAdsDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/UnityAdsDependencies.xml @@ -4,9 +4,8 @@ - + - diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/VungleDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/VungleDependencies.xml index f73097f0..9611d6bb 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/VungleDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/VungleDependencies.xml @@ -4,9 +4,8 @@ - + - diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/YahooDependencies.xml b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/YahooDependencies.xml index 0352b58e..262f5c4e 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/YahooDependencies.xml +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/Adapters/YahooDependencies.xml @@ -4,14 +4,13 @@ - + - + https://artifactory.yahooinc.com/artifactory/maven/ - diff --git a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/selections.json b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/selections.json index 67ca41dc..42f0250c 100644 --- a/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/selections.json +++ b/com.chartboost.mediation.demo/Assets/com.chartboost.mediation/Editor/selections.json @@ -38,13 +38,13 @@ }, { "id": "inmobi", - "android": "10.1.3", + "android": "10.5.4", "ios": "10.5.0" }, { "id": "ironsource", "android": "7.3.0.0", - "ios": "7.2.7.0" + "ios": "7.3.0.0" }, { "id": "meta", @@ -80,6 +80,11 @@ "id": "yahoo", "android": "1.4.0", "ios": "1.4.0" + }, + { + "id": "hyprmx", + "android": "6.0.3", + "ios": "6.0.0" } ] } \ No newline at end of file diff --git a/com.chartboost.mediation/Editor/Adapters/AdapterDataSource.cs b/com.chartboost.mediation/Editor/Adapters/AdapterDataSource.cs index 1ec9085d..b397574e 100644 --- a/com.chartboost.mediation/Editor/Adapters/AdapterDataSource.cs +++ b/com.chartboost.mediation/Editor/Adapters/AdapterDataSource.cs @@ -35,8 +35,7 @@ static AdapterDataSource() /// /// Endpoint where Adapter Data is stored. /// - private const string Endpoint = "https://chartboost.s3.amazonaws.com/chartboost-mediation/mediation-integration/partners.json"; - + private const string Endpoint = "https://chartboost.s3.amazonaws.com/chartboost-mediation/mediation-integration/v2/partners.json"; private static readonly bool InitialCache; @@ -75,7 +74,6 @@ private static Task FetchCacheAndLoad() if (newVersion <= oldVersion) return Task.FromResult(cacheAdapterConfig); - Constants.PathToAdaptersCachedJson.FileCreate(newAdapters); return Task.FromResult(newAdapterConfig); } diff --git a/com.chartboost.mediation/Editor/Adapters/AdaptersWindow.cs b/com.chartboost.mediation/Editor/Adapters/AdaptersWindow.cs index 9c6e2458..0b839d38 100644 --- a/com.chartboost.mediation/Editor/Adapters/AdaptersWindow.cs +++ b/com.chartboost.mediation/Editor/Adapters/AdaptersWindow.cs @@ -101,8 +101,8 @@ private static void CheckMediationVersion(VisualElement root) var version = new Version(MediationSelection); var packageVersion = new Version(ChartboostMediationPackage.version); - - if (version != packageVersion) + + if (version.Minor != packageVersion.Minor) { _warningButton.tooltip = $"Your selected dependencies for Chartboost Mediation {version} do not match your current package version {packageVersion}. Press to fix."; root.Add(_warningButton); diff --git a/com.chartboost.mediation/Editor/Adapters/AdaptersWindowSerialization.cs b/com.chartboost.mediation/Editor/Adapters/AdaptersWindowSerialization.cs index 462646d3..c95fcee4 100644 --- a/com.chartboost.mediation/Editor/Adapters/AdaptersWindowSerialization.cs +++ b/com.chartboost.mediation/Editor/Adapters/AdaptersWindowSerialization.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text.RegularExpressions; using Newtonsoft.Json; using UnityEditor; using UnityEngine; @@ -25,6 +26,13 @@ public static void LoadSelections() var jsonContents = Constants.PathToSelectionsFile.ReadAllText(); var selections = JsonConvert.DeserializeObject(jsonContents); + if (selections == null) + { + MediationSelection = ChartboostMediationPackage.version; + UpdateSavedVersions(); + return; + } + MediationSelection = selections.mediationVersion; if (selections.adapterSelections != null) @@ -81,14 +89,12 @@ private static void GenerateDependenciesFromSelections() } const string androidAdapterInTemplate = "%ANDROID_ADAPTER%"; - const string iosAdapterInTemplate = "%IOS_ADAPTER%"; - const string androidSDKInTemplate = "%ANDROID_SDK%"; const string androidRepositoriesInTemplate = "%REPOSITORIES%"; - const string androidDependenciesInTemplate = "%DEPENDENCIES%"; - const string iosSDKInTemplate = "%IOS_SDK%"; + const string androidDependenciesInTemplate = "%ANDROID_DEPENDENCIES%"; + + const string iosAdapterInTemplate = "%IOS_ADAPTER%"; const string iosAdapterVersionInTemplate = "%IOS_CBMA_VERSION%"; - const string iosSDKVersionInTemplate = "%IOS_SDK_VERSION%"; - const string iosAllTargetsInTemplate = "%ALL_TARGETS%"; + const string iosDependenciesInTemplate = "%IOS_DEPENDENCIES%"; foreach (var adapter in adapters) { @@ -106,7 +112,7 @@ private static void GenerateDependenciesFromSelections() if (!Constants.PathToSelectionsFile.FileExist() && !Constants.PathToMainDependency.FileExist()) Constants.PathToEditorInGeneratedFiles.DeleteDirectoryWithMeta(); } - + foreach (var selection in UserSelectedVersions) { var template = new List(defaultTemplateContents); @@ -115,44 +121,52 @@ private static void GenerateDependenciesFromSelections() var pathToAdapter = Path.Combine(Constants.PathToAdaptersDirectory, $"{adapter.name.RemoveWhitespace()}Dependencies.xml"); var androidAdapterIndexInTemplate = template.FindIndex(x => x.Contains(androidAdapterInTemplate)); - var androidSDKIndexInTemplate = template.FindIndex(x => x.Contains(androidSDKInTemplate)); - - var androidSelected = selection.Value.android != Constants.Unselected; + var extraDependenciesStartPoint = template.FindIndex(x => x.Contains(androidDependenciesInTemplate)); + var androidSDKVersion = selection.Value.android; + var androidSelected = androidSDKVersion != Constants.Unselected; // Android SDK Adapter Version if (androidSelected) { - string sdkVersion; - var adapterVersion = sdkVersion = selection.Value.android; - var sdk = adapter.android.sdk; - // handling IronSource SDK versioning quirk - if (adapterId.Equals(Constants.IronSource) && sdkVersion[sdkVersion.Length - 1] == '0') - sdkVersion = sdkVersion.Remove(sdkVersion.Length - 2, 2); + if (adapterId.Equals(Constants.IronSource) && androidSDKVersion[androidSDKVersion.Length - 1] == '0') + androidSDKVersion = androidSDKVersion.Remove(androidSDKVersion.Length - 2, 2); - var androidDependency = $"{adapter.android.adapter}:4.{adapterVersion}+@aar"; - var androidSDKDependency = $"{sdk}:{sdkVersion}"; + // Set Adapter versioning + template[androidAdapterIndexInTemplate] = $" "; - template[androidAdapterIndexInTemplate] = template[androidAdapterIndexInTemplate].Replace(androidAdapterInTemplate, androidDependency); - - if (!string.IsNullOrEmpty(sdk)) - template[androidSDKIndexInTemplate] = template[androidSDKIndexInTemplate].Replace(androidSDKInTemplate, androidSDKDependency); - else - template[androidSDKIndexInTemplate] = $" "; + // Set all remaining dependencies + var versionSet = GetAdapterVersionSet(androidSDKVersion, adapter.android.versions); + if (versionSet.dependencies != null && versionSet.dependencies.Count > 0) + { + var dependenciesToAdd = new List(); + + foreach (var dependency in versionSet.dependencies) + { + var hasVersionNumber = Constants.NeedsVersionNumber.IsMatch(dependency); + + var toInsert = dependency; + if (!hasVersionNumber) + toInsert = $"{dependency}:{androidSDKVersion}"; + dependenciesToAdd.Add($" "); + } + + // Android Extra Dependencies + template.RemoveAt(extraDependenciesStartPoint); + template.InsertRange(extraDependenciesStartPoint, dependenciesToAdd); + } } else { var message = $" "; template[androidAdapterIndexInTemplate] = message; - template[androidSDKIndexInTemplate] = message; + template[extraDependenciesStartPoint] = message; } - + // Android Extra Repos var androidRepos = adapter.android.repositories; - var extraDependencies = adapter.android.dependencies; - var repositoriesIndexStartPoint = template.FindIndex(x => x.Contains(androidRepositoriesInTemplate)); - + if (androidSelected && androidRepos != null && androidRepos.Length > 0) { var repos = new List(); @@ -160,48 +174,31 @@ private static void GenerateDependenciesFromSelections() repos.Add(" "); repos.AddRange(androidRepos.Select(repo => $" {repo}")); repos.Add(" "); - if (extraDependencies != null && extraDependencies.Length > 0) - repos.Add(""); template.InsertRange(repositoriesIndexStartPoint, repos); - repositoriesIndexStartPoint += repos.Count; + repositoriesIndexStartPoint += repos.Count + 1; } if (repositoriesIndexStartPoint >= 0) - template.RemoveRange(repositoriesIndexStartPoint, 2); - - // Android Extra Dependencies - var extraDependenciesStartPoint = template.FindIndex(x => x.Contains(androidDependenciesInTemplate)); - - if (androidSelected && extraDependencies != null && extraDependencies.Length > 0) - { - var extra = new List(); - foreach (var dependency in extraDependencies) - { - // handling Mintegral quirk - var formatted = adapterId.Equals(Constants.Mintegral) ? $"{dependency}:{selection.Value.android}" : dependency; - extra.Add($" "); - } - template.InsertRange(extraDependenciesStartPoint, extra); - extraDependenciesStartPoint += extra.Count; - } + template.RemoveRange(repositoriesIndexStartPoint - 1, 2); - if (extraDependenciesStartPoint >= 0) - template.RemoveAt(extraDependenciesStartPoint); - var iosAdapterIndexInTemplate = template.FindIndex(x => x.Contains(iosAdapterInTemplate)); - var iosSDKIndexInTemplate = template.FindIndex(x => x.Contains(iosSDKInTemplate)); - - var iosSelection = selection.Value.ios; - if (iosSelection != Constants.Unselected) + var iosSDKIndexInTemplate = template.FindIndex(x => x.Contains(iosDependenciesInTemplate)); + + var iosSDKVersion = selection.Value.ios; + if (iosSDKVersion != Constants.Unselected) { - var iosDependency = $"4.{iosSelection}"; - template[iosAdapterIndexInTemplate] = template[iosAdapterIndexInTemplate].Replace(iosAdapterInTemplate, adapter.ios.adapter).Replace(iosAdapterVersionInTemplate, iosDependency); + var versionSet = GetAdapterVersionSet(iosSDKVersion, adapter.ios.versions); + template[iosAdapterIndexInTemplate] = $" 4.{iosSDKVersion}\"/>"; - // Handling InMobi quirk - if (adapterId != Constants.InMobi) - template[iosSDKIndexInTemplate] = template[iosSDKIndexInTemplate].Replace(iosSDKInTemplate, adapter.ios.sdk).Replace(iosSDKVersionInTemplate, iosSelection).Replace(iosAllTargetsInTemplate, adapter.ios.allTargets.ToString().ToLower()); - else - template[iosSDKIndexInTemplate] = $" "; + if (versionSet.dependencies != null && versionSet.dependencies.Count > 0) + { + var dependenciesToAdd = new List(); + foreach (var dependency in versionSet.dependencies) + dependenciesToAdd.Add($" {iosSDKVersion}\" addToAllTargets=\"{versionSet.allTargets.ToString().ToLower()}\"/>"); + + template.RemoveAt(iosSDKIndexInTemplate); + template.InsertRange(iosSDKIndexInTemplate, dependenciesToAdd); + } } else { @@ -209,7 +206,7 @@ private static void GenerateDependenciesFromSelections() template[iosAdapterIndexInTemplate] = message; template[iosSDKIndexInTemplate] = message; } - + Constants.PathToPackageGeneratedFiles.DirectoryCreate(); Constants.PathToEditorInGeneratedFiles.DirectoryCreate(); Constants.PathToAdaptersDirectory.DirectoryCreate(); @@ -217,6 +214,18 @@ private static void GenerateDependenciesFromSelections() } AssetDatabase.Refresh(); + + AdapterVersion GetAdapterVersionSet(string sdkVersion, AdapterVersion[] allVersions) + { + var versionSet = new AdapterVersion(); + foreach (var version in allVersions) + { + versionSet = version; + if (versionSet.versions.Find(x => x.Contains(sdkVersion)) != null) + return versionSet; + } + return versionSet; + } } private static void GenerateChartboostMediationDependency() diff --git a/com.chartboost.mediation/Editor/Adapters/Constants.cs b/com.chartboost.mediation/Editor/Adapters/Constants.cs index 58d86c90..180b3eb5 100644 --- a/com.chartboost.mediation/Editor/Adapters/Constants.cs +++ b/com.chartboost.mediation/Editor/Adapters/Constants.cs @@ -1,4 +1,5 @@ using System.IO; +using System.Text.RegularExpressions; using UnityEngine; namespace Chartboost.Editor.Adapters @@ -21,12 +22,15 @@ public class Constants public static readonly string PathToLibrary = Path.Combine(Directory.GetCurrentDirectory(), "Library"); public static readonly string PathToLibraryCacheDirectory = Path.Combine(PathToLibrary, "com.chartboost.mediation"); - public static readonly string PathToAdaptersCachedJson = Path.Combine(PathToLibraryCacheDirectory, "partners.json"); + public static readonly string PathToAdaptersCachedJson = Path.Combine(PathToLibraryCacheDirectory, "partnersv2.json"); // Networks with special handling due to different versioning, dependencies, or multiple sdks public const string InMobi = "inmobi"; public const string IronSource = "ironsource"; public const string Mintegral = "mintegral"; + + const string VersionNumberIsPresent = @"(?<=:)(?\d+)\.(?\d+)(\.(?\d+))?(-(?\w+(\.\w+)*))?(?=[^.\d]|$)"; + public static readonly Regex NeedsVersionNumber = new Regex(VersionNumberIsPresent); public const string StyleSheet = "Packages/com.chartboost.mediation/Editor/Adapters/Visuals/AdaptersWindow.uss"; public const string LogoPNG = "Packages/com.chartboost.mediation/Editor/Adapters/Visuals/Logo.png"; diff --git a/com.chartboost.mediation/Editor/Adapters/Serialization/AdapterData.cs b/com.chartboost.mediation/Editor/Adapters/Serialization/AdapterData.cs index 59719f78..c71c10eb 100644 --- a/com.chartboost.mediation/Editor/Adapters/Serialization/AdapterData.cs +++ b/com.chartboost.mediation/Editor/Adapters/Serialization/AdapterData.cs @@ -10,6 +10,11 @@ namespace Chartboost.Editor.Adapters.Serialization [Serializable] public struct AdapterData { + /// + /// Timestamp of last cron job + /// + public string? lastChecked; + /// /// Timestamp of last update /// diff --git a/com.chartboost.mediation/Editor/Adapters/Serialization/AdapterVersion.cs b/com.chartboost.mediation/Editor/Adapters/Serialization/AdapterVersion.cs new file mode 100644 index 00000000..64e64807 --- /dev/null +++ b/com.chartboost.mediation/Editor/Adapters/Serialization/AdapterVersion.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace Chartboost.Editor.Adapters.Serialization +{ + #nullable enable + /// + /// Represents all versions compatible with an specific adapter dependency set. This is relevant to those adapters that have changed their SDK dependencies naming conventions and versions. + /// + [Serializable] + public struct AdapterVersion + { + /// + /// Additional dependencies for the certified Ad Adapter + /// + public List? dependencies; + + /// + /// All certified versions of the Ad Adapter + /// + public List? versions; + + /// + /// Indicates if Native SDK dependency should be added to all targets, this is defined on a case by case basis. + /// + public bool? allTargets; + } + #nullable disable +} \ No newline at end of file diff --git a/com.chartboost.mediation/Editor/Adapters/Serialization/AdapterVersion.cs.meta b/com.chartboost.mediation/Editor/Adapters/Serialization/AdapterVersion.cs.meta new file mode 100644 index 00000000..b7c0e780 --- /dev/null +++ b/com.chartboost.mediation/Editor/Adapters/Serialization/AdapterVersion.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0b1171d7aa58463397029fd85b236ffe +timeCreated: 1683655589 \ No newline at end of file diff --git a/com.chartboost.mediation/Editor/Adapters/Serialization/NativeAdapter.cs b/com.chartboost.mediation/Editor/Adapters/Serialization/NativeAdapter.cs index b4b25731..a8c10980 100644 --- a/com.chartboost.mediation/Editor/Adapters/Serialization/NativeAdapter.cs +++ b/com.chartboost.mediation/Editor/Adapters/Serialization/NativeAdapter.cs @@ -14,30 +14,15 @@ public struct NativeAdapter /// public string adapter; - /// - /// SDK dependency name of the Native Ad Adapter. - /// - public string sdk; - - /// - /// Additional dependencies for the certified Ad Adapter - /// - public string[]? dependencies; - /// /// Additional repositories to fetch dependencies. Some providers have their own repos, they can be found here. /// public string[]? repositories; - + /// /// All certified versions of the Ad Adapter /// - public string[] versions; - - /// - /// Indicates if Native SDK dependency should be added to all targets, this is defined on a case by case basis. - /// - public bool? allTargets; + public AdapterVersion[]? versions; } #nullable disable } diff --git a/com.chartboost.mediation/Editor/Adapters/Serialization/PartnerVersions.cs b/com.chartboost.mediation/Editor/Adapters/Serialization/PartnerVersions.cs index 71290d77..e2ef4a1c 100644 --- a/com.chartboost.mediation/Editor/Adapters/Serialization/PartnerVersions.cs +++ b/com.chartboost.mediation/Editor/Adapters/Serialization/PartnerVersions.cs @@ -22,21 +22,24 @@ public class PartnerVersions /// /// Partner Adapter Android versions. /// Partner Adapter IOS versions. - public PartnerVersions(IEnumerable androidAdapters, IEnumerable iosAdapters) + public PartnerVersions(AdapterVersion[] androidAdapters, AdapterVersion[] iosAdapters) { android = GetSupportedVersions(androidAdapters); ios = GetSupportedVersions(iosAdapters); } - private static string[] GetSupportedVersions(IEnumerable adapters) + private static string[] GetSupportedVersions(AdapterVersion[] adapters) { var temp = new List { Constants.Unselected }; - foreach (var platformVersion in adapters) + foreach (var adapterVersion in adapters) { - var partnerVersion = GetPartnerSDKVersion(platformVersion); - if (!temp.Contains(partnerVersion)) - temp.Add(partnerVersion); + foreach (var version in adapterVersion.versions) + { + var partnerVersion = GetPartnerSDKVersion(version); + if (!temp.Contains(partnerVersion)) + temp.Add(partnerVersion); + } } return temp.ToArray(); diff --git a/com.chartboost.mediation/Editor/Adapters/Templates/TemplateAdapter.xml b/com.chartboost.mediation/Editor/Adapters/Templates/TemplateAdapter.xml index 2ad030ae..1f0756f4 100644 --- a/com.chartboost.mediation/Editor/Adapters/Templates/TemplateAdapter.xml +++ b/com.chartboost.mediation/Editor/Adapters/Templates/TemplateAdapter.xml @@ -2,20 +2,18 @@ - + %ANDROID_ADAPTER% - - - - %REPOSITORIES% + + %ANDROID_DEPENDENCIES% - %DEPENDENCIES% + %REPOSITORIES% - + %IOS_ADAPTER% - + %IOS_DEPENDENCIES%