feat(integration): 添加 AppLovin SDK 集成管理功能
- 实现 AppLovinIntegrationManagerUtils 版本比较工具类 - 添加 AppLovinPackageManager 处理 UPM 和 Assets 包管理 - 实现 AppLovinPluginMigrationHelper 插件迁移辅助功能 - 添加 AppLovinUpmManifest 管理 UPM 清单文件操作 - 支持 mediation adapter 的版本检测和安装管理 - 实现重复适配器检测和删除功能
This commit is contained in:
@@ -12,17 +12,6 @@ using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
|
||||
namespace AppLovinMax.Scripts.IntegrationManager.Editor
|
||||
{
|
||||
public enum Platform
|
||||
{
|
||||
All,
|
||||
Android,
|
||||
iOS
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="ScriptableObject"/> representing the AppLovin Settings that can be set in the Integration Manager Window.
|
||||
///
|
||||
@@ -32,56 +21,19 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
|
||||
/// </summary>
|
||||
public class AppLovinSettings : ScriptableObject
|
||||
{
|
||||
public const string SettingsExportPath = "MaxSdk/Resources/AppLovinSettings.asset";
|
||||
|
||||
public const string DefaultUserTrackingDescriptionEnV0 = "Pressing \\\"Allow\\\" uses device info for more relevant ad content";
|
||||
public const string DefaultUserTrackingDescriptionEnV1 = "This only uses device info for less annoying, more relevant ads";
|
||||
public const string DefaultUserTrackingDescriptionEnV2 = "This only uses device info for more interesting and relevant ads";
|
||||
public const string DefaultUserTrackingDescriptionEnV3 = "This uses device info for more personalized ads and content";
|
||||
|
||||
public const string DefaultUserTrackingDescriptionDe = "\\\"Erlauben\\\" drücken benutzt Gerätinformationen für relevantere Werbeinhalte";
|
||||
public const string DefaultUserTrackingDescriptionEs = "Presionando \\\"Permitir\\\", se usa la información del dispositivo para obtener contenido publicitario más relevante";
|
||||
public const string DefaultUserTrackingDescriptionFr = "\\\"Autoriser\\\" permet d'utiliser les infos du téléphone pour afficher des contenus publicitaires plus pertinents";
|
||||
public const string DefaultUserTrackingDescriptionJa = "\\\"許可\\\"をクリックすることで、デバイス情報を元により最適な広告を表示することができます";
|
||||
public const string DefaultUserTrackingDescriptionKo = "\\\"허용\\\"을 누르면 더 관련성 높은 광고 콘텐츠를 제공하기 위해 기기 정보가 사용됩니다";
|
||||
public const string DefaultUserTrackingDescriptionZhHans = "点击\\\"允许\\\"以使用设备信息获得更加相关的广告内容";
|
||||
public const string DefaultUserTrackingDescriptionZhHant = "點擊\\\"允許\\\"以使用設備信息獲得更加相關的廣告內容";
|
||||
|
||||
/// <summary>
|
||||
/// A placeholder constant to be replaced with the actual default localization or an empty string based on whether or not localization is enabled when when the getter is called.
|
||||
/// </summary>
|
||||
protected const string DefaultLocalization = "default_localization";
|
||||
private const string SettingsExportPath = "MaxSdk/Resources/AppLovinSettings.asset";
|
||||
|
||||
private static AppLovinSettings instance;
|
||||
|
||||
[SerializeField] private bool qualityServiceEnabled = true;
|
||||
[SerializeField] private string sdkKey;
|
||||
|
||||
[SerializeField] private bool setAttributionReportEndpoint;
|
||||
[SerializeField] private bool addApsSkAdNetworkIds;
|
||||
|
||||
[SerializeField] private string customGradleVersionUrl;
|
||||
[SerializeField] private string customGradleToolsVersion;
|
||||
|
||||
[SerializeField] private bool consentFlowEnabled;
|
||||
[SerializeField] private Platform consentFlowPlatform;
|
||||
[SerializeField] private string consentFlowPrivacyPolicyUrl = string.Empty;
|
||||
[SerializeField] private string consentFlowTermsOfServiceUrl = string.Empty;
|
||||
[FormerlySerializedAs("userTrackingUsageDescription")] [SerializeField] private string userTrackingUsageDescriptionEn = string.Empty;
|
||||
[SerializeField] private bool userTrackingUsageLocalizationEnabled;
|
||||
[SerializeField] private string userTrackingUsageDescriptionDe = string.Empty;
|
||||
[SerializeField] private string userTrackingUsageDescriptionEs = string.Empty;
|
||||
[SerializeField] private string userTrackingUsageDescriptionFr = string.Empty;
|
||||
[SerializeField] private string userTrackingUsageDescriptionJa = string.Empty;
|
||||
[SerializeField] private string userTrackingUsageDescriptionKo = string.Empty;
|
||||
[SerializeField] private string userTrackingUsageDescriptionZhHans = string.Empty;
|
||||
[SerializeField] private string userTrackingUsageDescriptionZhHant = DefaultLocalization;
|
||||
|
||||
[SerializeField] private string adMobAndroidAppId = string.Empty;
|
||||
[SerializeField] private string adMobIosAppId = string.Empty;
|
||||
|
||||
[SerializeField] private bool showInternalSettingsInIntegrationManager;
|
||||
|
||||
/// <summary>
|
||||
/// An instance of AppLovin Setting.
|
||||
/// </summary>
|
||||
@@ -105,16 +57,15 @@ public class AppLovinSettings : ScriptableObject
|
||||
return instance;
|
||||
}
|
||||
|
||||
// If there is no existing AppLovinSettings asset, create one in the default location
|
||||
string settingsFilePath;
|
||||
// The settings file should be under the Assets/ folder so that it can be version controlled and cannot be overriden when updating.
|
||||
// If the plugin is outside the Assets folder, create the settings asset at the default location.
|
||||
if (AppLovinIntegrationManager.IsPluginOutsideAssetsDirectory)
|
||||
// If the plugin is outside the Assets folder or if there is no existing AppLovinSettings asset, create the settings asset at the default location.
|
||||
if (AppLovinIntegrationManager.IsPluginInPackageManager)
|
||||
{
|
||||
// Note: Can't use absolute path when calling `CreateAsset`. Should use relative path to Assets/ directory.
|
||||
settingsFilePath = Path.Combine("Assets", SettingsExportPath);
|
||||
// Note: Can't use absolute path when calling `CreateAsset`. Should use path relative to Assets/ directory.
|
||||
settingsFilePath = MaxSdkUtils.NormalizeToUnityPath(Path.Combine("Assets", SettingsExportPath));
|
||||
|
||||
var maxSdkDir = Path.Combine(Application.dataPath, "MaxSdk");
|
||||
var maxSdkDir = MaxSdkUtils.NormalizeToUnityPath(Path.Combine(Application.dataPath, "MaxSdk"));
|
||||
if (!Directory.Exists(maxSdkDir))
|
||||
{
|
||||
Directory.CreateDirectory(maxSdkDir);
|
||||
@@ -122,7 +73,7 @@ public class AppLovinSettings : ScriptableObject
|
||||
}
|
||||
else
|
||||
{
|
||||
settingsFilePath = Path.Combine(AppLovinIntegrationManager.PluginParentDirectory, SettingsExportPath);
|
||||
settingsFilePath = MaxSdkUtils.NormalizeToUnityPath(Path.Combine(AppLovinIntegrationManager.PluginParentDirectory, SettingsExportPath));
|
||||
}
|
||||
|
||||
var settingsDir = Path.GetDirectoryName(settingsFilePath);
|
||||
@@ -162,24 +113,6 @@ public class AppLovinSettings : ScriptableObject
|
||||
set { Instance.sdkKey = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not to set `NSAdvertisingAttributionReportEndpoint` in Info.plist.
|
||||
/// </summary>
|
||||
public bool SetAttributionReportEndpoint
|
||||
{
|
||||
get { return Instance.setAttributionReportEndpoint; }
|
||||
set { Instance.setAttributionReportEndpoint = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not to add Amazon Publisher Services SKAdNetworkID's.
|
||||
/// </summary>
|
||||
public bool AddApsSkAdNetworkIds
|
||||
{
|
||||
get { return Instance.addApsSkAdNetworkIds; }
|
||||
set { Instance.addApsSkAdNetworkIds = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A URL to set the distributionUrl in the gradle-wrapper.properties file (ex: https\://services.gradle.org/distributions/gradle-6.9.3-bin.zip)
|
||||
/// </summary>
|
||||
@@ -198,199 +131,6 @@ public class AppLovinSettings : ScriptableObject
|
||||
set { Instance.customGradleToolsVersion = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not AppLovin Consent Flow is enabled.
|
||||
/// </summary>
|
||||
public bool ConsentFlowEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
// Update the default EN description if an old version of the description is still being used.
|
||||
if (DefaultUserTrackingDescriptionEnV0.Equals(Instance.UserTrackingUsageDescriptionEn)
|
||||
|| DefaultUserTrackingDescriptionEnV1.Equals(Instance.UserTrackingUsageDescriptionEn)
|
||||
|| DefaultUserTrackingDescriptionEnV2.Equals(Instance.UserTrackingUsageDescriptionEn))
|
||||
{
|
||||
Instance.UserTrackingUsageDescriptionEn = DefaultUserTrackingDescriptionEnV3;
|
||||
}
|
||||
|
||||
return Instance.consentFlowEnabled;
|
||||
}
|
||||
set
|
||||
{
|
||||
var previousValue = Instance.consentFlowEnabled;
|
||||
Instance.consentFlowEnabled = value;
|
||||
|
||||
if (value)
|
||||
{
|
||||
// If the value didn't change, we don't need to update anything.
|
||||
if (previousValue) return;
|
||||
|
||||
Instance.UserTrackingUsageDescriptionEn = DefaultUserTrackingDescriptionEnV3;
|
||||
Instance.UserTrackingUsageLocalizationEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Instance.ConsentFlowPlatform = Platform.All;
|
||||
Instance.ConsentFlowPrivacyPolicyUrl = string.Empty;
|
||||
Instance.ConsentFlowTermsOfServiceUrl = string.Empty;
|
||||
Instance.UserTrackingUsageDescriptionEn = string.Empty;
|
||||
Instance.UserTrackingUsageLocalizationEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Platform ConsentFlowPlatform
|
||||
{
|
||||
get { return Instance.consentFlowEnabled ? Instance.consentFlowPlatform : Platform.All; }
|
||||
set { Instance.consentFlowPlatform = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A URL pointing to the Privacy Policy for the app to be shown when prompting the user for consent.
|
||||
/// </summary>
|
||||
public string ConsentFlowPrivacyPolicyUrl
|
||||
{
|
||||
get { return Instance.consentFlowPrivacyPolicyUrl; }
|
||||
set { Instance.consentFlowPrivacyPolicyUrl = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An optional URL pointing to the Terms of Service for the app to be shown when prompting the user for consent.
|
||||
/// </summary>
|
||||
public string ConsentFlowTermsOfServiceUrl
|
||||
{
|
||||
get { return Instance.consentFlowTermsOfServiceUrl; }
|
||||
set { Instance.consentFlowTermsOfServiceUrl = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A User Tracking Usage Description in English to be shown to users when requesting permission to use data for tracking.
|
||||
/// For more information see <see cref="https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription">Apple's documentation</see>.
|
||||
/// </summary>
|
||||
public string UserTrackingUsageDescriptionEn
|
||||
{
|
||||
get { return Instance.userTrackingUsageDescriptionEn; }
|
||||
set { Instance.userTrackingUsageDescriptionEn = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not to localize User Tracking Usage Description.
|
||||
/// For more information see <see cref="https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription">Apple's documentation</see>.
|
||||
/// </summary>
|
||||
public bool UserTrackingUsageLocalizationEnabled
|
||||
{
|
||||
get { return Instance.userTrackingUsageLocalizationEnabled; }
|
||||
set
|
||||
{
|
||||
var previousValue = Instance.userTrackingUsageLocalizationEnabled;
|
||||
Instance.userTrackingUsageLocalizationEnabled = value;
|
||||
|
||||
if (value)
|
||||
{
|
||||
// If the value didn't change or the english localization text is not the default one, we don't need to update anything.
|
||||
if (previousValue || !DefaultUserTrackingDescriptionEnV3.Equals(Instance.UserTrackingUsageDescriptionEn)) return;
|
||||
|
||||
Instance.UserTrackingUsageDescriptionDe = DefaultUserTrackingDescriptionDe;
|
||||
Instance.UserTrackingUsageDescriptionEs = DefaultUserTrackingDescriptionEs;
|
||||
Instance.UserTrackingUsageDescriptionFr = DefaultUserTrackingDescriptionFr;
|
||||
Instance.UserTrackingUsageDescriptionJa = DefaultUserTrackingDescriptionJa;
|
||||
Instance.UserTrackingUsageDescriptionKo = DefaultUserTrackingDescriptionKo;
|
||||
Instance.UserTrackingUsageDescriptionZhHans = DefaultUserTrackingDescriptionZhHans;
|
||||
Instance.UserTrackingUsageDescriptionZhHant = DefaultUserTrackingDescriptionZhHant;
|
||||
}
|
||||
else
|
||||
{
|
||||
Instance.UserTrackingUsageDescriptionDe = string.Empty;
|
||||
Instance.UserTrackingUsageDescriptionEs = string.Empty;
|
||||
Instance.UserTrackingUsageDescriptionFr = string.Empty;
|
||||
Instance.UserTrackingUsageDescriptionJa = string.Empty;
|
||||
Instance.UserTrackingUsageDescriptionKo = string.Empty;
|
||||
Instance.UserTrackingUsageDescriptionZhHans = string.Empty;
|
||||
Instance.UserTrackingUsageDescriptionZhHant = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A User Tracking Usage Description in German to be shown to users when requesting permission to use data for tracking.
|
||||
/// For more information see <see cref="https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription">Apple's documentation</see>.
|
||||
/// </summary>
|
||||
public string UserTrackingUsageDescriptionDe
|
||||
{
|
||||
get { return Instance.userTrackingUsageDescriptionDe; }
|
||||
set { Instance.userTrackingUsageDescriptionDe = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A User Tracking Usage Description in Spanish to be shown to users when requesting permission to use data for tracking.
|
||||
/// For more information see <see cref="https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription">Apple's documentation</see>.
|
||||
/// </summary>
|
||||
public string UserTrackingUsageDescriptionEs
|
||||
{
|
||||
get { return Instance.userTrackingUsageDescriptionEs; }
|
||||
set { Instance.userTrackingUsageDescriptionEs = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A User Tracking Usage Description in French to be shown to users when requesting permission to use data for tracking.
|
||||
/// For more information see <see cref="https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription">Apple's documentation</see>.
|
||||
/// </summary>
|
||||
public string UserTrackingUsageDescriptionFr
|
||||
{
|
||||
get { return Instance.userTrackingUsageDescriptionFr; }
|
||||
set { Instance.userTrackingUsageDescriptionFr = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A User Tracking Usage Description in Japanese to be shown to users when requesting permission to use data for tracking.
|
||||
/// For more information see <see cref="https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription">Apple's documentation</see>.
|
||||
/// </summary>
|
||||
public string UserTrackingUsageDescriptionJa
|
||||
{
|
||||
get { return Instance.userTrackingUsageDescriptionJa; }
|
||||
set { Instance.userTrackingUsageDescriptionJa = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A User Tracking Usage Description in Korean to be shown to users when requesting permission to use data for tracking.
|
||||
/// For more information see <see cref="https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription">Apple's documentation</see>.
|
||||
/// </summary>
|
||||
public string UserTrackingUsageDescriptionKo
|
||||
{
|
||||
get { return Instance.userTrackingUsageDescriptionKo; }
|
||||
set { Instance.userTrackingUsageDescriptionKo = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A User Tracking Usage Description in Chinese (Simplified) to be shown to users when requesting permission to use data for tracking.
|
||||
/// For more information see <see cref="https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription">Apple's documentation</see>.
|
||||
/// </summary>
|
||||
public string UserTrackingUsageDescriptionZhHans
|
||||
{
|
||||
get { return Instance.userTrackingUsageDescriptionZhHans; }
|
||||
set { Instance.userTrackingUsageDescriptionZhHans = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A User Tracking Usage Description in Chinese (Traditional) to be shown to users when requesting permission to use data for tracking.
|
||||
/// For more information see <see cref="https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription">Apple's documentation</see>.
|
||||
/// </summary>
|
||||
public string UserTrackingUsageDescriptionZhHant
|
||||
{
|
||||
get
|
||||
{
|
||||
// Since this localization has been added separate from the other localizations,
|
||||
// we use a placeholder constant to be replaced with the actual value or an empty string based on whether or not the localization was enabled by the publisher.
|
||||
if (DefaultLocalization.Equals(Instance.userTrackingUsageDescriptionZhHant))
|
||||
{
|
||||
Instance.userTrackingUsageDescriptionZhHant = Instance.UserTrackingUsageLocalizationEnabled ? DefaultUserTrackingDescriptionZhHant : string.Empty;
|
||||
}
|
||||
|
||||
return Instance.userTrackingUsageDescriptionZhHant;
|
||||
}
|
||||
set { Instance.userTrackingUsageDescriptionZhHant = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// AdMob Android App ID.
|
||||
/// </summary>
|
||||
@@ -409,12 +149,6 @@ public class AppLovinSettings : ScriptableObject
|
||||
set { Instance.adMobIosAppId = value; }
|
||||
}
|
||||
|
||||
public bool ShowInternalSettingsInIntegrationManager
|
||||
{
|
||||
get { return Instance.showInternalSettingsInIntegrationManager; }
|
||||
set { Instance.showInternalSettingsInIntegrationManager = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the instance of the settings.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user