private void OnImportPackageCompleted(Network network) { var parentDirectory = network.Name.Equals("APPLOVIN_NETWORK") ? AppLovinIntegrationManager.PluginParentDirectory : AppLovinIntegrationManager.MediationSpecificPluginParentDirectory; AppLovinIntegrationManager.UpdateCurrentVersions(network, parentDirectory); UpdateShouldShowGoogleWarningIfNeeded(); }
/// <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." }, iconStyle); } else if ((network.Name.Equals("ADMOB_NETWORK") || network.Name.Equals("GOOGLE_AD_MANAGER_NETWORK")) && shouldShowGoogleWarning) { GUILayout.Label(new GUIContent { image = warningIcon, tooltip = "You may see unexpected errors if you use different versions of the AdMob and Google Ad Manager adapter SDKs." }, iconStyle); } 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" }, iconStyle)) { EditorUtility.DisplayProgressBar("Integration Manager", "Deleting " + network.Name + "...", 0.5f); var pluginRoot = AppLovinIntegrationManager.MediationSpecificPluginParentDirectory; foreach (var pluginFilePath in network.PluginFilePaths) { FileUtil.DeleteFileOrDirectory(Path.Combine(pluginRoot, pluginFilePath)); } AppLovinIntegrationManager.UpdateCurrentVersions(network, pluginRoot); // 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")) { string requiredVersion; string warningMessage; if (isPluginMoved) { requiredVersion = "android_19.6.0.1_ios_7.69.0.0"; warningMessage = "Looks like the MAX plugin has been moved to a different directory. This requires Google adapter version newer than " + requiredVersion + " for auto-export of AdMob App ID to work correctly."; } else { requiredVersion = "android_19.2.0.0_ios_7.61.0.0"; warningMessage = "The current version of AppLovin MAX plugin requires Google adapter version newer than " + requiredVersion + " to enable auto-export of AdMob App ID."; } GUILayout.Space(2); if (MaxSdkUtils.CompareUnityMediationVersions(network.CurrentVersions.Unity, requiredVersion) == 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(warningMessage, MessageType.Warning); } } GUILayout.EndHorizontal(); } } }