-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
[APDM-374] Release Appodeal Unity Plugin v3.3.1
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
using System.IO; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
using UnityEditor; | ||
using AppodealStack.UnityEditor.InternalResources; | ||
using AppodealStack.UnityEditor.Utils; | ||
|
||
// ReSharper Disable CheckNamespace | ||
// ReSharper Disable once CheckNamespace | ||
namespace AppodealStack.UnityEditor.AssetExtractors | ||
{ | ||
internal class ApdAssetPostprocessor : AssetPostprocessor | ||
{ | ||
#if UNITY_2021_3_OR_NEWER | ||
[SuppressMessage("ReSharper", "UnusedMember.Local")] | ||
[SuppressMessage("ReSharper", "UnusedParameter.Local")] | ||
[SuppressMessage("ReSharper", "Unity.IncorrectMethodSignature")] | ||
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths, bool didDomainReload) | ||
{ | ||
#else | ||
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) | ||
{ | ||
const string prefsPath = "Assets/Appodeal/Editor/InternalResources/PluginPreferences.asset"; | ||
if (File.Exists(prefsPath) && AssetDatabase.LoadAssetAtPath<PluginPreferences>(prefsPath) == null) return; | ||
#if APPODEAL_DEV | ||
return; | ||
#endif | ||
if (deletedAssets.Any(asset => asset.Contains(AppodealEditorConstants.PackageDir))) return; | ||
|
||
if (AndroidLibraryInstaller.InstallAndroidLibrary() | AppodealAdaptersInstaller.InstallAdapters()) | ||
{ | ||
AssetDatabase.Refresh(); | ||
} | ||
|
||
AssetDatabase.SaveAssetIfDirty(PluginPreferences.Instance); | ||
|
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,37 @@ | ||
using System.IO; | ||
using System.Linq; | ||
using System; | ||
using System.IO; | ||
using UnityEditor; | ||
using UnityEngine; | ||
using AppodealStack.UnityEditor.Utils; | ||
using AppodealStack.UnityEditor.InternalResources; | ||
|
||
// ReSharper Disable CheckNamespace | ||
// ReSharper Disable once CheckNamespace | ||
namespace AppodealStack.UnityEditor.AssetExtractors | ||
{ | ||
internal static class AppodealAdaptersInstaller | ||
{ | ||
public static bool InstallAdapters() | ||
{ | ||
return !PluginPreferences.Instance.AreAdaptersImported && CopyAdaptersFromPackage(); | ||
} | ||
if (File.Exists(AppodealEditorConstants.DependenciesFilePath)) return false; | ||
|
||
private static bool CopyAdaptersFromPackage() | ||
{ | ||
var depsDir = new DirectoryInfo($"{AppodealEditorConstants.PackagePath}/{AppodealEditorConstants.DependenciesPath}"); | ||
if (!depsDir.Exists) | ||
try | ||
{ | ||
Debug.LogError($"[Appodeal] Directory not found: '{depsDir}'. Please, contact support@apppodeal.com about this issue."); | ||
return false; | ||
} | ||
var depsFileInfo = new FileInfo(AppodealEditorConstants.BundledDependenciesFilePath); | ||
if (!depsFileInfo.Exists) | ||
{ | ||
Debug.LogError($"[Appodeal] File was not found: '{depsFileInfo.FullName}'. Please, contact support@apppodeal.com about this issue."); | ||
return false; | ||
} | ||
|
||
Directory.CreateDirectory(AppodealEditorConstants.DependenciesDir); | ||
FileUtil.ReplaceFile(depsFileInfo.FullName, AppodealEditorConstants.DependenciesFilePath); | ||
|
||
var deps = depsDir.GetFiles("*Dependencies.txt", SearchOption.AllDirectories); | ||
if (deps.Length < 1) | ||
return true; | ||
} | ||
catch (Exception e) | ||
{ | ||
Debug.LogError($"[Appodeal] No Adapters were found on path '{depsDir}'. Please, contact support@apppodeal.com about this issue."); | ||
Debug.LogException(e); | ||
return false; | ||
} | ||
|
||
string outputDir = $"{AppodealEditorConstants.PluginPath}/{AppodealEditorConstants.DependenciesPath}"; | ||
|
||
FileUtil.DeleteFileOrDirectory(outputDir); | ||
Directory.CreateDirectory(outputDir); | ||
|
||
deps.ToList().ForEach(dep => FileUtil.ReplaceFile(dep.FullName, $"{outputDir}/{dep.Name.Replace(".txt", ".xml")}")); | ||
|
||
PluginPreferences.Instance.AreAdaptersImported = true; | ||
PluginPreferences.SaveAsync(); | ||
|
||
return true; | ||
} | ||
} | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.