private static void AddSnapAppStoreAppIdIfNeeded(PlistDocument plist) { var snapDependencyPath = Path.Combine(PluginMediationDirectory, "Snap/Editor/Dependencies.xml"); if (!File.Exists(snapDependencyPath)) { return; } // App Store App ID is only needed for iOS versions 2.0.0.0 or newer. var currentVersion = AppLovinIntegrationManager.GetCurrentVersions(snapDependencyPath); var iosVersionComparison = MaxSdkUtils.CompareVersions(currentVersion.Ios, AppLovinSettings.SnapAppStoreAppIdMinVersion); if (iosVersionComparison == MaxSdkUtils.VersionComparisonResult.Lesser) { return; } if (AppLovinSettings.Instance.SnapAppStoreAppId <= 0) { MaxSdkLogger.UserError("Snap App Store App ID is not set. Please enter a valid App ID within the AppLovin Integration Manager window."); return; } plist.root.SetInteger("SCAppStoreAppID", AppLovinSettings.Instance.SnapAppStoreAppId); }
private static bool ShouldEmbedSnapSdk() { var snapDependencyPath = Path.Combine(PluginMediationDirectory, "Snap/Editor/Dependencies.xml"); if (!File.Exists(snapDependencyPath)) { return(false); } // Return true for UNITY_2019_3_OR_NEWER because app will crash on launch unless embedded. #if UNITY_2019_3_OR_NEWER return(true); #else var currentVersion = AppLovinIntegrationManager.GetCurrentVersions(snapDependencyPath); var iosVersionComparison = MaxSdkUtils.CompareVersions(currentVersion.Ios, "1.0.7.2"); return(iosVersionComparison != MaxSdkUtils.VersionComparisonResult.Lesser); #endif }
private static void EnableConsentFlowIfNeeded(PlistDocument plist, string buildPath) { // Check if consent flow is enabled. No need to update info.plist if consent flow is disabled. var consentFlowEnabled = AppLovinSettings.Instance.ConsentFlowEnabled; if (!consentFlowEnabled) { return; } var userTrackingUsageDescription = AppLovinSettings.Instance.UserTrackingUsageDescriptionEn; var privacyPolicyUrl = AppLovinSettings.Instance.ConsentFlowPrivacyPolicyUrl; if (string.IsNullOrEmpty(userTrackingUsageDescription) || string.IsNullOrEmpty(privacyPolicyUrl)) { AppLovinIntegrationManager.ShowBuildFailureDialog("You cannot use the AppLovin SDK's consent flow without defining a Privacy Policy URL and the `User Tracking Usage Description` in the AppLovin Integration Manager. \n\n" + "Both values must be included to enable the SDK's consent flow."); // No need to update the info.plist here. Default consent flow state will be determined on the SDK side. return; } var consentFlowInfoRoot = plist.root.CreateDict("AppLovinConsentFlowInfo"); consentFlowInfoRoot.SetBoolean("AppLovinConsentFlowEnabled", consentFlowEnabled); consentFlowInfoRoot.SetString("AppLovinConsentFlowPrivacyPolicy", privacyPolicyUrl); var termsOfServiceUrl = AppLovinSettings.Instance.ConsentFlowTermsOfServiceUrl; if (!string.IsNullOrEmpty(termsOfServiceUrl)) { consentFlowInfoRoot.SetString("AppLovinConsentFlowTermsOfService", termsOfServiceUrl); } plist.root.SetString("NSUserTrackingUsageDescription", userTrackingUsageDescription); }
private static void ShowNetworkAdaptersUpdateDialogIfNeeded(PluginData data) { var networks = data.MediatedNetworks; var networksToUpdate = networks.Where(network => network.RequiresUpdate).ToList(); // If all networks are above the required version, do nothing. if (networksToUpdate.Count <= 0) { return; } // We found a few adapters that are not compatible with the current SDK, show alert. var message = "The following network adapters are not compatible with the current version of AppLovin MAX Plugin:\n"; foreach (var networkName in networksToUpdate) { message += "\n- "; message += networkName.DisplayName; } message += "\n\nPlease update them to the latest versions to avoid any issues."; AppLovinIntegrationManager.ShowBuildFailureDialog(message); }
/// <summary> /// Draws the network specific details for a given network. /// </summary> private void DrawNetworkDetailRow(Network network) { string action; var currentVersion = network.CurrentVersions.Unity; var latestVersion = network.LatestVersions.Unity; bool isActionEnabled; bool isInstalled; if (string.IsNullOrEmpty(currentVersion)) { action = "Install"; currentVersion = "Not Installed"; isActionEnabled = true; isInstalled = false; } else { isInstalled = true; var comparison = network.CurrentToLatestVersionComparisonResult; // A newer version is available if (comparison == VersionComparisonResult.Lesser) { action = "Upgrade"; isActionEnabled = true; } // Current installed version is newer than latest version from DB (beta version) else if (comparison == VersionComparisonResult.Greater) { action = "Installed"; isActionEnabled = false; } // Already on the latest version else { action = "Installed"; isActionEnabled = false; } } GUILayout.Space(4); using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandHeight(false))) { GUILayout.Space(5); EditorGUILayout.LabelField(new GUIContent(network.DisplayName), networkWidthOption); EditorGUILayout.LabelField(new GUIContent(currentVersion), versionWidthOption); GUILayout.Space(3); EditorGUILayout.LabelField(new GUIContent(latestVersion), versionWidthOption); GUILayout.Space(3); GUILayout.FlexibleSpace(); if (network.RequiresUpdate) { GUILayout.Label(new GUIContent { image = alertIcon, tooltip = "Adapter not compatible, please update to the latest version." }, uninstallButtonStyle); } GUI.enabled = isActionEnabled; if (GUILayout.Button(new GUIContent(action), fieldWidth)) { // Download the plugin. AppLovinEditorCoroutine.StartCoroutine(AppLovinIntegrationManager.Instance.DownloadPlugin(network)); } GUI.enabled = true; GUILayout.Space(2); GUI.enabled = isInstalled; if (GUILayout.Button(new GUIContent { image = uninstallIcon, tooltip = "Uninstall" }, uninstallButtonStyle)) { EditorUtility.DisplayProgressBar("Integration Manager", "Deleting " + network.Name + "...", 0.5f); foreach (var pluginFilePath in network.PluginFilePaths) { FileUtil.DeleteFileOrDirectory(Path.Combine("Assets", pluginFilePath)); } AppLovinIntegrationManager.UpdateCurrentVersions(network); // Refresh UI AssetDatabase.Refresh(); EditorUtility.ClearProgressBar(); } GUI.enabled = true; GUILayout.Space(5); } // Custom integration for AdMob where the user can enter the Android and iOS App IDs. if (network.Name.Equals("ADMOB_NETWORK") && isInstalled) { // Custom integration requires Google AdMob adapter version newer than android_19.0.1.0_ios_7.57.0.0. if (MaxSdkUtils.CompareUnityMediationVersions(network.CurrentVersions.Unity, "android_19.0.1.0_ios_7.57.0.0") == VersionComparisonResult.Greater) { GUILayout.BeginHorizontal(); GUILayout.Space(20); using (new EditorGUILayout.VerticalScope("box")) { GUILayout.Space(2); if (MaxSdkUtils.CompareUnityMediationVersions(network.CurrentVersions.Unity, "android_19.2.0.0_ios_7.61.0.0") == VersionComparisonResult.Greater) { AppLovinSettings.Instance.AdMobAndroidAppId = DrawTextField("App ID (Android)", AppLovinSettings.Instance.AdMobAndroidAppId, networkWidthOption); AppLovinSettings.Instance.AdMobIosAppId = DrawTextField("App ID (iOS)", AppLovinSettings.Instance.AdMobIosAppId, networkWidthOption); } else { EditorGUILayout.HelpBox("The current version of AppLovin MAX plugin requires Google adapter version newer than android_19.2.0.0_ios_7.61.0.0 to enable auto-export of AdMob App ID.", MessageType.Warning); } } GUILayout.EndHorizontal(); } } }
static MaxInitialize() { #if UNITY_IOS // Check that the publisher is targeting iOS 9.0+ if (!PlayerSettings.iOS.targetOSVersionString.StartsWith("9.") && !PlayerSettings.iOS.targetOSVersionString.StartsWith("1")) { MaxSdkLogger.UserError("Detected iOS project version less than iOS 9 - The AppLovin MAX SDK WILL NOT WORK ON < iOS9!!!"); } #endif var pluginParentDir = AppLovinIntegrationManager.PluginParentDirectory; var isPluginOutsideAssetsDir = AppLovinIntegrationManager.IsPluginOutsideAssetsDirectory; var changesMade = AppLovinIntegrationManager.MovePluginFilesIfNeeded(pluginParentDir, isPluginOutsideAssetsDir); if (isPluginOutsideAssetsDir) { // If the plugin is not under the assets folder, delete the MaxSdk/Mediation folder in the plugin, so that the adapters are not imported at that location and imported to the default location. var mediationDir = Path.Combine(pluginParentDir, "MaxSdk/Mediation"); if (Directory.Exists(mediationDir)) { FileUtil.DeleteFileOrDirectory(mediationDir); FileUtil.DeleteFileOrDirectory(mediationDir + ".meta"); changesMade = true; } } AppLovinIntegrationManager.AddLabelsToAssetsIfNeeded(pluginParentDir, isPluginOutsideAssetsDir); // Check if we have legacy adapter CHANGELOGs. foreach (var network in Networks) { var mediationAdapterDir = Path.Combine(pluginParentDir, "MaxSdk/Mediation/" + network); // If new directory exists if (CheckExistence(mediationAdapterDir)) { var androidChangelogFile = Path.Combine(mediationAdapterDir, AndroidChangelog); if (CheckExistence(androidChangelogFile)) { FileUtil.DeleteFileOrDirectory(androidChangelogFile); changesMade = true; } var iosChangelogFile = Path.Combine(mediationAdapterDir, IosChangelog); if (CheckExistence(iosChangelogFile)) { FileUtil.DeleteFileOrDirectory(iosChangelogFile); changesMade = true; } } } // Check if any obsolete networks are installed foreach (var obsoleteNetwork in ObsoleteNetworks) { var networkDir = Path.Combine(pluginParentDir, "MaxSdk/Mediation/" + obsoleteNetwork); if (CheckExistence(networkDir)) { MaxSdkLogger.UserDebug("Deleting obsolete network " + obsoleteNetwork + " from path " + networkDir + "..."); FileUtil.DeleteFileOrDirectory(networkDir); changesMade = true; } } // Refresh UI if (changesMade) { AssetDatabase.Refresh(); MaxSdkLogger.UserDebug("AppLovin MAX Migration completed"); } AppLovinAutoUpdater.Update(); }