com.amanotes.gdk 0.2.51 → 0.2.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,16 +1,22 @@
1
1
  # Changelog
2
2
 
3
- ## [0.2.51 - 2024-02-23]
4
- - New feature: GDKCIBuildCommand
5
- - [Dev] Change Google Mobile Ads SDK version for iOS, 10.9 -> 10.5.0
6
- - [Analytics] Add LogEventImmediately()
7
- - [Analytics] Move AddParam() to internal use
8
- - [Analytics] Replace event Queue by ConcurrentQueue
9
- - [Ads] Check null Ads._adapter
10
- - [Ads] Autostart AdEventTracking
11
- - [Analytics] Update AppsFlyer adapter version
12
- - [UserProfile] Change logic of getting ama_device_id
13
- - [Core] Init modules before Hooks
3
+ ## [0.2.53 - 2024-03-14]
4
+ - Add FirebaseCrashlyticsHook
5
+ - Fix Change to dev mode
6
+ - Public analytics config
7
+ - Update SDK version tracking
8
+ - Update GDKLocalBuild
9
+
10
+ ## [0.2.52 - 2024-02-27]
11
+ - Change post processing order
12
+ - Remove GDKInstaller after installed
13
+ - Enable pipeline execution for branches with active merge requests
14
+ - [Fix] Non-fatal exceptions relate to Analytics and Ads
15
+ - Update Google Sheet Id default
16
+ - Optimize GC for Analytics
17
+
18
+ ## [0.2.51 - 2024-02-20]
19
+ - Change Google Mobile Ads SDK version , iosPod 10.5.0
14
20
 
15
21
  ## [0.2.50 - 2024-02-20]
16
22
  - New feature: Modify Android post processor
@@ -180,7 +180,7 @@ namespace Amanotes.Editor
180
180
  {
181
181
  if (GUILayout.Button(ObjectNames.NicifyVariableName(extra)))
182
182
  {
183
- var package = $"{Res.PACKAGE_PATH}{extra}";
183
+ var package = $"{Res.EXTRA_PATH}{extra}";
184
184
  AssetDatabase.ImportPackage(package, false);
185
185
  }
186
186
  }
@@ -393,10 +393,14 @@ namespace Amanotes.Editor
393
393
  {
394
394
  string adapterName = FindBestAdapterFor(adapterId);
395
395
  var package = $"{Res.PACKAGE_PATH}{adapterName}";
396
- if (GUILayout.Button(GetGUIContent($"Import {adapterId} Adapter"), GUILayout.Height(24f)))
396
+ EditorGUI.BeginDisabledGroup(!status.sdkInstalled);
397
397
  {
398
- AssetDatabase.ImportPackage(package, false);
398
+ if (GUILayout.Button(GetGUIContent($"Import {adapterId} Adapter"), GUILayout.Height(24f)))
399
+ {
400
+ AssetDatabase.ImportPackage(package, false);
401
+ }
399
402
  }
403
+ EditorGUI.EndDisabledGroup();
400
404
  }
401
405
 
402
406
  }, () =>
@@ -412,7 +416,7 @@ namespace Amanotes.Editor
412
416
  Color c = GUI.color;
413
417
  GUI.color = Color.yellow;
414
418
 
415
- float w = EditorStyles.label.CalcSize(label).x;
419
+ float w = EditorStyles.label.CalcSize(label).x+5f;
416
420
  GUILayout.Label(label, GUILayout.Width(w));
417
421
  GUI.color = c;
418
422
  }
@@ -0,0 +1,354 @@
1
+ using UnityEditor;
2
+ using System.Linq;
3
+ using System;
4
+ using System.IO;
5
+ using UnityEditor.Build;
6
+ using UnityEditor.Build.Reporting;
7
+ using UnityEngine;
8
+
9
+ namespace Amanotes.Core
10
+ {
11
+ public static class GDKCIBuildCommand
12
+ {
13
+ private const string KEYSTORE_PASS = "KEYSTORE_PASS";
14
+ private const string KEY_ALIAS_PASS = "KEY_ALIAS_PASS";
15
+ private const string KEY_ALIAS_NAME = "KEY_ALIAS_NAME";
16
+ private const string KEYSTORE = "keystore.keystore";
17
+ private const string BUILD_OPTIONS_ENV_VAR = "BuildOptions";
18
+ private const string ANDROID_BUNDLE_VERSION_CODE = "VERSION_BUILD_VAR";
19
+ private const string ANDROID_APP_BUNDLE = "BUILD_APP_BUNDLE";
20
+ private const string SCRIPTING_BACKEND_ENV_VAR = "SCRIPTING_BACKEND";
21
+ private const string VERSION_NUMBER_VAR = "VERSION_NUMBER_VAR";
22
+ private const string VERSION_iOS = "VERSION_BUILD_VAR";
23
+
24
+ static string GetArgument(string name)
25
+ {
26
+ string[] args = Environment.GetCommandLineArgs();
27
+ for (int i = 0; i < args.Length; i++)
28
+ {
29
+ if (args[i].Contains(name))
30
+ {
31
+ return args[i + 1];
32
+ }
33
+ }
34
+ return null;
35
+ }
36
+
37
+ static string[] GetEnabledScenes()
38
+ {
39
+ return (
40
+ from scene in EditorBuildSettings.scenes
41
+ where scene.enabled
42
+ where !string.IsNullOrEmpty(scene.path)
43
+ select scene.path
44
+ ).ToArray();
45
+ }
46
+
47
+ static BuildTarget GetBuildTarget()
48
+ {
49
+ string buildTargetName = GetArgument("customBuildTarget");
50
+ Console.WriteLine(":: Received customBuildTarget " + buildTargetName);
51
+
52
+ if (buildTargetName.ToLower() == "android")
53
+ {
54
+ #if !UNITY_5_6_OR_NEWER
55
+ // https://issuetracker.unity3d.com/issues/buildoptions-dot-acceptexternalmodificationstoplayer-causes-unityexception-unknown-project-type-0
56
+ // Fixed in Unity 5.6.0
57
+ // side effect to fix android build system:
58
+ EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Internal;
59
+ #endif
60
+ }
61
+
62
+ if (buildTargetName.TryConvertToEnum(out BuildTarget target))
63
+ return target;
64
+
65
+ Console.WriteLine($":: {nameof(buildTargetName)} \"{buildTargetName}\" not defined on enum {nameof(BuildTarget)}, using {nameof(BuildTarget.NoTarget)} enum to build");
66
+
67
+ return BuildTarget.NoTarget;
68
+ }
69
+
70
+ static string GetBuildPath()
71
+ {
72
+ string buildPath = GetArgument("customBuildPath");
73
+ Console.WriteLine(":: Received customBuildPath " + buildPath);
74
+ if (buildPath == "")
75
+ {
76
+ throw new Exception("customBuildPath argument is missing");
77
+ }
78
+ return buildPath;
79
+ }
80
+
81
+ static string GetBuildName()
82
+ {
83
+ string buildName = GetArgument("customBuildName");
84
+ Console.WriteLine(":: Received customBuildName " + buildName);
85
+ if (buildName == "")
86
+ {
87
+ throw new Exception("customBuildName argument is missing");
88
+ }
89
+ return buildName;
90
+ }
91
+
92
+ static string GetFixedBuildPath(BuildTarget buildTarget, string buildPath, string buildName)
93
+ {
94
+ if (buildTarget.ToString().ToLower().Contains("windows"))
95
+ {
96
+ buildName += ".exe";
97
+ }
98
+ else if (buildTarget == BuildTarget.Android)
99
+ {
100
+ #if UNITY_2018_3_OR_NEWER
101
+ buildName += EditorUserBuildSettings.buildAppBundle ? ".aab" : ".apk";
102
+ #else
103
+ buildName += ".apk";
104
+ #endif
105
+ }
106
+ return buildPath + buildName;
107
+ }
108
+
109
+ static BuildOptions GetBuildOptions()
110
+ {
111
+ if (TryGetEnv(BUILD_OPTIONS_ENV_VAR, out string envVar))
112
+ {
113
+ string[] allOptionVars = envVar.Split(',');
114
+ BuildOptions allOptions = BuildOptions.None;
115
+ BuildOptions option;
116
+ string optionVar;
117
+ int length = allOptionVars.Length;
118
+
119
+ Console.WriteLine($":: Detecting {BUILD_OPTIONS_ENV_VAR} env var with {length} elements ({envVar})");
120
+
121
+ for (int i = 0; i < length; i++)
122
+ {
123
+ optionVar = allOptionVars[i];
124
+
125
+ if (optionVar.TryConvertToEnum(out option))
126
+ {
127
+ allOptions |= option;
128
+ }
129
+ else
130
+ {
131
+ Console.WriteLine($":: Cannot convert {optionVar} to {nameof(BuildOptions)} enum, skipping it.");
132
+ }
133
+ }
134
+
135
+ return allOptions;
136
+ }
137
+
138
+ return BuildOptions.None;
139
+ }
140
+
141
+ // https://stackoverflow.com/questions/1082532/how-to-tryparse-for-enum-value
142
+ static bool TryConvertToEnum<TEnum>(this string strEnumValue, out TEnum value)
143
+ {
144
+ if (!Enum.IsDefined(typeof(TEnum), strEnumValue))
145
+ {
146
+ value = default;
147
+ return false;
148
+ }
149
+
150
+ value = (TEnum)Enum.Parse(typeof(TEnum), strEnumValue);
151
+ return true;
152
+ }
153
+
154
+ internal static bool TryGetEnv(string key, out string value)
155
+ {
156
+ value = Environment.GetEnvironmentVariable(key);
157
+ return !string.IsNullOrEmpty(value);
158
+ }
159
+
160
+ static void SetScriptingBackendFromEnv(BuildTarget platform)
161
+ {
162
+ var targetGroup = BuildPipeline.GetBuildTargetGroup(platform);
163
+ if (TryGetEnv(SCRIPTING_BACKEND_ENV_VAR, out string scriptingBackend))
164
+ {
165
+ if (scriptingBackend.TryConvertToEnum(out ScriptingImplementation backend))
166
+ {
167
+ Console.WriteLine($":: Setting ScriptingBackend to {backend}");
168
+ PlayerSettings.SetScriptingBackend(targetGroup, backend);
169
+ }
170
+ else
171
+ {
172
+ string possibleValues = string.Join(", ", Enum.GetValues(typeof(ScriptingImplementation)).Cast<ScriptingImplementation>());
173
+ throw new Exception($"Could not find '{scriptingBackend}' in ScriptingImplementation enum. Possible values are: {possibleValues}");
174
+ }
175
+ }
176
+ else
177
+ {
178
+ var defaultBackend = PlayerSettings.GetDefaultScriptingBackend(targetGroup);
179
+ Console.WriteLine($":: Using project's configured ScriptingBackend (should be {defaultBackend} for targetGroup {targetGroup}");
180
+ }
181
+ }
182
+
183
+ public static void PerformBuild()
184
+ {
185
+ var buildTarget = GetBuildTarget();
186
+
187
+ Console.WriteLine(":: Performing build");
188
+ if (TryGetEnv(VERSION_NUMBER_VAR, out var bundleVersionNumber))
189
+ {
190
+ if (buildTarget == BuildTarget.iOS)
191
+ {
192
+ bundleVersionNumber = GetIosVersion();
193
+ }
194
+ Console.WriteLine($":: Setting bundleVersionNumber to '{bundleVersionNumber}' (Length: {bundleVersionNumber.Length})");
195
+ PlayerSettings.bundleVersion = bundleVersionNumber;
196
+ }
197
+
198
+ if (buildTarget == BuildTarget.Android)
199
+ {
200
+ HandleAndroidAppBundle();
201
+ HandleAndroidBundleVersionCode();
202
+ HandleAndroidKeystore();
203
+ }
204
+
205
+ var buildPath = GetBuildPath();
206
+ var buildName = GetBuildName();
207
+ var buildOptions = GetBuildOptions();
208
+ var fixedBuildPath = GetFixedBuildPath(buildTarget, buildPath, buildName);
209
+
210
+ SetScriptingBackendFromEnv(buildTarget);
211
+
212
+ var buildReport = BuildPipeline.BuildPlayer(GetEnabledScenes(), fixedBuildPath, buildTarget, buildOptions);
213
+
214
+ if (buildReport.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
215
+ throw new Exception($"Build ended with {buildReport.summary.result} status");
216
+
217
+ Console.WriteLine(":: Done with build");
218
+ }
219
+
220
+ private static void HandleAndroidAppBundle()
221
+ {
222
+ if (TryGetEnv(ANDROID_APP_BUNDLE, out string value))
223
+ {
224
+ #if UNITY_2018_3_OR_NEWER
225
+ if (bool.TryParse(value, out bool buildAppBundle))
226
+ {
227
+ EditorUserBuildSettings.buildAppBundle = buildAppBundle;
228
+ Console.WriteLine($":: {ANDROID_APP_BUNDLE} env var detected, set buildAppBundle to {value}.");
229
+ }
230
+ else
231
+ {
232
+ Console.WriteLine($":: {ANDROID_APP_BUNDLE} env var detected but the value \"{value}\" is not a boolean.");
233
+ }
234
+ #else
235
+ Console.WriteLine($":: {ANDROID_APP_BUNDLE} env var detected but does not work with lower Unity version than 2018.3");
236
+ #endif
237
+ }
238
+ }
239
+
240
+ private static void HandleAndroidBundleVersionCode()
241
+ {
242
+ if (TryGetEnv(ANDROID_BUNDLE_VERSION_CODE, out string value))
243
+ {
244
+ if (int.TryParse(value, out int version))
245
+ {
246
+ PlayerSettings.Android.bundleVersionCode = version;
247
+ Console.WriteLine($":: {ANDROID_BUNDLE_VERSION_CODE} env var detected, set the bundle version code to {value}.");
248
+ }
249
+ else
250
+ Console.WriteLine($":: {ANDROID_BUNDLE_VERSION_CODE} env var detected but the version value \"{value}\" is not an integer.");
251
+ }
252
+ }
253
+
254
+ private static string GetIosVersion()
255
+ {
256
+ if (TryGetEnv(VERSION_iOS, out string value))
257
+ {
258
+ if (int.TryParse(value, out int version))
259
+ {
260
+ Console.WriteLine($":: {VERSION_iOS} env var detected, set the version to {value}.");
261
+ return version.ToString();
262
+ }
263
+ else
264
+ Console.WriteLine($":: {VERSION_iOS} env var detected but the version value \"{value}\" is not an integer.");
265
+ }
266
+
267
+ throw new ArgumentNullException(nameof(value), $":: Error finding {VERSION_iOS} env var");
268
+ }
269
+
270
+ private static void HandleAndroidKeystore()
271
+ {
272
+ #if UNITY_2019_1_OR_NEWER
273
+ PlayerSettings.Android.useCustomKeystore = false;
274
+ #endif
275
+
276
+ if (!File.Exists(KEYSTORE))
277
+ {
278
+ Console.WriteLine($":: {KEYSTORE} not found, skipping setup, using Unity's default keystore");
279
+ return;
280
+ }
281
+
282
+ PlayerSettings.Android.keystoreName = KEYSTORE;
283
+
284
+ string keystorePass;
285
+ string keystoreAliasPass;
286
+
287
+ if (TryGetEnv(KEY_ALIAS_NAME, out string keyaliasName))
288
+ {
289
+ PlayerSettings.Android.keyaliasName = keyaliasName;
290
+ Console.WriteLine($":: using ${KEY_ALIAS_NAME} env var on PlayerSettings");
291
+ }
292
+ else
293
+ {
294
+ Console.WriteLine($":: ${KEY_ALIAS_NAME} env var not set, using Project's PlayerSettings");
295
+ }
296
+
297
+ if (!TryGetEnv(KEYSTORE_PASS, out keystorePass))
298
+ {
299
+ Console.WriteLine($":: ${KEYSTORE_PASS} env var not set, skipping setup, using Unity's default keystore");
300
+ return;
301
+ }
302
+
303
+ if (!TryGetEnv(KEY_ALIAS_PASS, out keystoreAliasPass))
304
+ {
305
+ Console.WriteLine($":: ${KEY_ALIAS_PASS} env var not set, skipping setup, using Unity's default keystore");
306
+ return;
307
+ }
308
+ #if UNITY_2019_1_OR_NEWER
309
+ PlayerSettings.Android.useCustomKeystore = true;
310
+ #endif
311
+ PlayerSettings.Android.keystorePass = keystorePass;
312
+ PlayerSettings.Android.keyaliasPass = keystoreAliasPass;
313
+ }
314
+ }
315
+
316
+ public class GDKPreProcessBuild: IPreprocessBuildWithReport
317
+ {
318
+ #if UNITY_2022_1_OR_NEWER
319
+ private static readonly string GRADLE_VERSION = "7.6.1";
320
+ #else
321
+ private static readonly string GRADLE_VERSION = "6.7.1";
322
+ #endif
323
+ private static readonly string GRADLE_ROOT = "/usr/local/gradle";
324
+
325
+ public int callbackOrder
326
+ {
327
+ get { return 0; }
328
+ }
329
+ public void OnPreprocessBuild(BuildReport report)
330
+ {
331
+ if (report.summary.platform == BuildTarget.Android)
332
+ {
333
+ // Change Gradle path when running in headless mode (CI Machine)
334
+ if (Application.isBatchMode)
335
+ {
336
+ EditorPrefs.SetBool("GradleUseEmbedded", false);
337
+
338
+ if (GDKCIBuildCommand.TryGetEnv("GRADLE_PATH", out string envGradlePath))
339
+ {
340
+ EditorPrefs.SetString("GradlePath", envGradlePath);
341
+ Debug.Log("Update gradle path to: " + envGradlePath);
342
+ }
343
+ else
344
+ {
345
+ string gradlePath = GRADLE_ROOT + "/gradle-" + GRADLE_VERSION;
346
+ EditorPrefs.SetString("GradlePath", gradlePath);
347
+ Debug.Log("Update gradle path to: " + gradlePath);
348
+ }
349
+ }
350
+ }
351
+
352
+ }
353
+ }
354
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: bfe10a860d56457f86c6bb3931b972a5
3
+ timeCreated: 1706775850
@@ -350,8 +350,8 @@ namespace Amanotes.Editor
350
350
  {
351
351
  PlayerSettings.Android.bundleVersionCode = buildNumber;
352
352
  PlayerSettings.Android.buildApkPerCpuArchitecture = splitAPK;
353
- PlayerSettings.Android.targetArchitectures = AndroidArchitecture.All;
354
-
353
+ PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64 | AndroidArchitecture.ARMv7;
354
+
355
355
  EditorUserBuildSettings.buildAppBundle = isAAB;
356
356
  EditorUserBuildSettings.exportAsGoogleAndroidProject = false;
357
357
 
@@ -817,6 +817,7 @@ namespace Amanotes.Editor
817
817
  {
818
818
  ab.buildRQ = GDKLocalBuild.BuildRequestTS.Generate(); //ab.runGitPostBuild
819
819
  ab.ProcessBuild();
820
+ GUIUtility.ExitGUI();
820
821
  }
821
822
 
822
823
  if (GUILayout.Button("Stop")) ab.StopBuild();
@@ -1,3 +1,4 @@
1
+ using Amanotes.Core.Internal;
1
2
  using System.Collections.Generic;
2
3
  using UnityEditor;
3
4
  using UnityEngine;
@@ -149,10 +150,67 @@ namespace Amanotes
149
150
  if (productNameStyle == null) Init();
150
151
 
151
152
  DrawProjectInfo();
153
+
154
+ if (EditorApplication.isPlayingOrWillChangePlaymode)
155
+ {
156
+ // EditorGUILayout.HelpBox("Application is Playing!", MessageType.Info);
157
+ DrawRuntimeGUI();
158
+ return;
159
+ }
160
+
152
161
  EditorGUILayout.Space();
153
162
  DrawBigPlayButton();
154
163
  EditorGUILayout.Space();
155
164
  DrawListScenes();
156
165
  }
166
+
167
+
168
+ private readonly List<float> FPS = new List<float>()
169
+ {
170
+ 0, 1, 5, 10, 15, 20, 30, 45, 50, 60, 75, 90, 120, 240, 360, 480, 720, 960, 1000, 1200
171
+ };
172
+
173
+ private readonly List<float> TIMESCALES = new List<float>()
174
+ {
175
+ 0f, 0.1f, 0.2f, 0.5f, 1f, 2f, 5f, 10f
176
+ };
177
+
178
+ void DrawRuntimeGUI()
179
+ {
180
+ float fps = Application.targetFrameRate;
181
+ if (DrawSlider2("Target FPS", ref fps, FPS))
182
+ {
183
+ Application.targetFrameRate = (int)fps;
184
+ }
185
+
186
+ float ts = Time.timeScale;
187
+ if (DrawSlider2("Time Scale", ref ts, TIMESCALES))
188
+ {
189
+ Time.timeScale = ts;
190
+ }
191
+ }
192
+
193
+ bool DrawSlider2(string label, ref float v, List<float> values)
194
+ {
195
+ int idx1 = values.IndexOf(v);
196
+ if (idx1 == -1)
197
+ {
198
+ values.Add(v);
199
+ values.Sort();
200
+ idx1 = values.IndexOf(v);
201
+ }
202
+
203
+ int idx2;
204
+ GUILayout.BeginHorizontal();
205
+ {
206
+ GUILayout.Label(label, GUILayout.Width(100f));
207
+ idx2 = Mathf.RoundToInt(GUILayout.HorizontalSlider(idx1, 0, values.Count - 1));
208
+ GUILayout.Label($"{v}", GUILayout.Width(50f));
209
+ }
210
+ GUILayout.EndHorizontal();
211
+ if (idx2 == idx1) return false;
212
+ v = values[idx2];
213
+ return true;
214
+ }
157
215
  }
158
216
  }
@@ -5,6 +5,11 @@ using System.Linq;
5
5
  using System.Reflection;
6
6
  using System.Xml;
7
7
  using Amanotes.Core.Internal;
8
+ #if !UNITY_2021_1_OR_NEWER
9
+ using UnityEditor;
10
+ using UnityEditor.PackageManager;
11
+ using UnityEditor.PackageManager.Requests;
12
+ #endif
8
13
  using UnityEngine;
9
14
  using static Amanotes.Core.AmaGDK.AdapterID;
10
15
 
@@ -66,9 +71,38 @@ namespace Amanotes.Editor
66
71
  return result;
67
72
  }
68
73
  }
69
-
74
+
70
75
  internal static class ExtractVersion
71
76
  {
77
+ #if !UNITY_2021_1_OR_NEWER
78
+ static ListRequest listRequest;
79
+ const string LIST_REQUEST_KEY = "ListRequestData";
80
+
81
+ [InitializeOnLoadMethod]
82
+ static void Initialize()
83
+ {
84
+ Events.registeredPackages += RegisteredPackages;
85
+ GetRequestList();
86
+ }
87
+
88
+ private static void RegisteredPackages(PackageRegistrationEventArgs obj)
89
+ {
90
+ PlayerPrefs.DeleteKey(LIST_REQUEST_KEY);
91
+ GetRequestList();
92
+ }
93
+
94
+ static void GetRequestList()
95
+ {
96
+ if (PlayerPrefs.HasKey(LIST_REQUEST_KEY))
97
+ {
98
+ listRequest = JsonUtility.FromJson<ListRequest>(PlayerPrefs.GetString(LIST_REQUEST_KEY));
99
+ return;
100
+ }
101
+
102
+ listRequest = Client.List();
103
+ }
104
+ #endif
105
+
72
106
  public static string GDKAdapter(string sdkId)
73
107
  {
74
108
  var version = "";
@@ -94,20 +128,54 @@ namespace Amanotes.Editor
94
128
  }
95
129
  return version.Trim();
96
130
  }
131
+
132
+ static string GetPackageVersion(string packageName)
133
+ {
134
+ #if UNITY_2021_1_OR_NEWER
135
+ foreach (var package in UnityEditor.PackageManager.PackageInfo.GetAllRegisteredPackages())
136
+ {
137
+ if(package.name != packageName) continue;
138
+ return package.version;
139
+ }
140
+
141
+ #else
142
+ if (listRequest == null || !listRequest.IsCompleted) return "";
143
+
144
+ if (listRequest.Status != StatusCode.Success)
145
+ {
146
+ Debug.LogWarning($"Failed to list packages: {listRequest.Error.message}");
147
+ return "";
148
+ }
149
+
150
+ if (!PlayerPrefs.HasKey(LIST_REQUEST_KEY))
151
+ {
152
+ PlayerPrefs.SetString(LIST_REQUEST_KEY, JsonUtility.ToJson(listRequest));
153
+ PlayerPrefs.Save();
154
+ }
155
+
156
+ foreach (var package in listRequest.Result)
157
+ {
158
+ if(package.name != packageName) continue;
159
+
160
+ return package.version;
161
+ }
162
+ #endif
163
+ return "";
164
+ }
97
165
 
98
166
  public static string ThirdParty(string sdkId)
99
167
  {
100
168
  var version = "";
101
169
  switch (sdkId)
102
170
  {
103
- case FIREBASE_ANALYTICS: return FirebaseAnalytics();
104
- case FIREBASE_REMOTE_CONFIG: return FirebaseRemoteConfig();
105
- case APPSFLYER: return AppsFlyer();
106
- case IRONSOURCE: return Ironsource();
107
- case REVENUECAT: return RevenueCat();
108
- default:
109
- Debug.LogWarning($"Unsupported sdkID <{sdkId}>");
110
- break;
171
+ case FIREBASE_ANALYTICS: return FirebaseAnalytics();
172
+ case FIREBASE_REMOTE_CONFIG: return FirebaseRemoteConfig();
173
+ case APPSFLYER: return AppsFlyer();
174
+ case IRONSOURCE: return Ironsource();
175
+ case REVENUECAT: return RevenueCat();
176
+ default:
177
+ Debug.LogWarning($"Unsupported sdkID <{sdkId}>");
178
+ break;
111
179
  }
112
180
  return version;
113
181
  }
@@ -116,7 +184,7 @@ namespace Amanotes.Editor
116
184
  {
117
185
  var version = "";
118
186
  string[] filesFirebase = Directory.GetFiles("Assets", "maven-metadata.xml", SearchOption.AllDirectories);
119
- if (filesFirebase.Length <= 0) return version.Trim();
187
+ if (filesFirebase.Length <= 0) return GetPackageVersion("com.google.firebase.analytics").Trim();
120
188
 
121
189
  for (var i = 0; i < filesFirebase.Length; i++)
122
190
  {
@@ -140,7 +208,7 @@ namespace Amanotes.Editor
140
208
  {
141
209
  var version = "";
142
210
  string[] filesFirebase = Directory.GetFiles("Assets", "maven-metadata.xml", SearchOption.AllDirectories);
143
- if (filesFirebase.Length <= 0) return version.Trim();
211
+ if (filesFirebase.Length <= 0) return GetPackageVersion("com.google.firebase.remote-config").Trim();
144
212
 
145
213
  for (var i = 0; i < filesFirebase.Length; i++)
146
214
  {
@@ -190,7 +258,6 @@ namespace Amanotes.Editor
190
258
  }
191
259
  }
192
260
  }
193
-
194
261
  return version.Trim();
195
262
  }
196
263
 
@@ -213,10 +280,7 @@ namespace Amanotes.Editor
213
280
  string[] files = Directory.GetFiles("Assets", "PurchasesWrapper.java", SearchOption.AllDirectories);
214
281
  var searchString = "PLUGIN_VERSION";
215
282
  var version = "";
216
- if (files.Length < 1)
217
- {
218
- return version;
219
- }
283
+ if (files.Length < 1) return GetPackageVersion("com.revenuecat.purchases-unity").Trim();
220
284
 
221
285
  foreach (string file in files)
222
286
  {
@@ -236,9 +300,16 @@ namespace Amanotes.Editor
236
300
 
237
301
  internal static List<IronSourceSDKAdapter> IronSourceAdapter()
238
302
  {
239
- string[] filesIRadapter = Directory.GetFiles("Assets/IronSource", "IS*AdapterDependencies.xml", SearchOption.AllDirectories);
240
- List<IronSourceSDKAdapter> listAdapter = new List<IronSourceSDKAdapter>();
241
-
303
+ var listAdapter = new List<IronSourceSDKAdapter>();
304
+ const string IRONSOURCE_PATH = "Assets/IronSource";
305
+
306
+ if (!Directory.Exists(IRONSOURCE_PATH))
307
+ {
308
+ return listAdapter;
309
+ }
310
+
311
+ string[] filesIRadapter = Directory.GetFiles(IRONSOURCE_PATH, "IS*AdapterDependencies.xml", SearchOption.AllDirectories);
312
+
242
313
  if (filesIRadapter.Length <= 0) return listAdapter;
243
314
  for (var i = 0; i < filesIRadapter.Length; i++)
244
315
  {
Binary file