com.amanotes.gdk 0.2.70 → 0.2.72

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +113 -87
  2. package/Editor/AmaGDKEditor.cs +1 -1
  3. package/Editor/EmbedRemoteConfigAssetInspector.cs +1 -1
  4. package/Editor/Extra/GDKCIBuildCommand.cs +57 -16
  5. package/Extra/AmaGDKInstaller.unitypackage +0 -0
  6. package/Extra/CheckDiskSpace.unitypackage +0 -0
  7. package/Extra/Consent.unitypackage +0 -0
  8. package/Extra/ForceUpdate.unitypackage +0 -0
  9. package/Extra/LegacyGDKUpdateHelper.unitypackage +0 -0
  10. package/Extra/PostProcessor.unitypackage +0 -0
  11. package/Packages/AmaGDKConfig.unitypackage +0 -0
  12. package/Packages/AmaGDKExample.unitypackage +0 -0
  13. package/Packages/AmaGDKTest.unitypackage +0 -0
  14. package/Packages/AppsFlyerAdapter.PurchaseConnector.unitypackage +0 -0
  15. package/Packages/AppsFlyerAdapter.unitypackage +0 -0
  16. package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
  17. package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
  18. package/Packages/IronSourceAdapter.unitypackage +0 -0
  19. package/Packages/MaxAdNetworkAdapter.unitypackage +0 -0
  20. package/Packages/RevenueCatAdapter.unitypackage +0 -0
  21. package/Packages/SqliteAnalyticsAdapter.unitypackage +0 -0
  22. package/Runtime/Ad/AdExtension.cs +2 -1
  23. package/Runtime/Ad/AdLogic.cs +1 -1
  24. package/Runtime/Ad/AdModuleConfig.cs +19 -4
  25. package/Runtime/Ad/AmaGDK.Ads.cs +20 -8
  26. package/Runtime/AmaGDK.Adapters.cs +1 -1
  27. package/Runtime/AmaGDK.Analytics.cs +37 -35
  28. package/Runtime/AmaGDK.Config.cs +1 -7
  29. package/Runtime/AmaGDK.Consent.cs +9 -8
  30. package/Runtime/AmaGDK.Context.cs +1 -1
  31. package/Runtime/AmaGDK.Device.cs +2 -1
  32. package/Runtime/AmaGDK.IAP.cs +1 -1
  33. package/Runtime/AmaGDK.RemoteConfig.cs +1 -1
  34. package/Runtime/AmaGDK.Singleton.cs +1 -1
  35. package/Runtime/AmaGDK.UserProfile.cs +12 -11
  36. package/Runtime/AmaGDK.asmdef +1 -1
  37. package/Runtime/AmaGDK.cs +6 -6
  38. package/Runtime/AnalyticQualityAsset.cs +1 -1
  39. package/Runtime/AudioToolkit/AmaGDK.Audio.cs +3 -2
  40. package/Runtime/Core/GDKDebug.cs +97 -0
  41. package/Runtime/Core/GDKDebug.cs.meta +3 -0
  42. package/Runtime/Core/GDKPool.cs +1 -0
  43. package/Runtime/Core/GDKRoutine.cs +3 -1
  44. package/Runtime/Core/GDKSemVer.cs +1 -1
  45. package/Runtime/Core/GDKString.cs +197 -0
  46. package/Runtime/Core/GDKString.cs.meta +3 -0
  47. package/Runtime/EmbedRemoteConfigAsset.cs +2 -1
  48. package/Runtime/Fps/AmaFPS.Utils.cs +2 -2
  49. package/Runtime/Fps/AmaFPS.cs +1 -1
  50. package/Runtime/Fps/AmaFPSVisualizer.cs +1 -1
  51. package/Runtime/Fps/FrameRecorder.cs +1 -1
  52. package/Runtime/GDKAudio/GDKAudio.cs +308 -0
  53. package/Runtime/GDKAudio/GDKAudio.cs.meta +3 -0
  54. package/Runtime/GDKAudio/Plugins/Android/atensor-release.aar +0 -0
  55. package/Runtime/GDKAudio/Plugins/Android/atensor-release.aar.meta +32 -0
  56. package/Runtime/GDKAudio/Plugins/Android.meta +3 -0
  57. package/Runtime/GDKAudio/Plugins/iOS/libatensor.a +0 -0
  58. package/Runtime/GDKAudio/Plugins/iOS/libatensor.a.meta +68 -0
  59. package/Runtime/GDKAudio/Plugins/iOS/libcrypto.a +0 -0
  60. package/Runtime/GDKAudio/Plugins/iOS/libcrypto.a.meta +68 -0
  61. package/Runtime/GDKAudio/Plugins/iOS/libssl.a +0 -0
  62. package/Runtime/GDKAudio/Plugins/iOS/libssl.a.meta +68 -0
  63. package/Runtime/GDKAudio/Plugins/iOS.meta +8 -0
  64. package/Runtime/GDKAudio/Plugins/macOS/libatensor.dylib +0 -0
  65. package/Runtime/GDKAudio/Plugins/macOS/libatensor.dylib.meta +81 -0
  66. package/Runtime/GDKAudio/Plugins/macOS.meta +8 -0
  67. package/Runtime/GDKAudio/Plugins.meta +8 -0
  68. package/Runtime/GDKAudio.meta +3 -0
  69. package/Runtime/Internal/AmaGDK.Internal.cs +22 -33
  70. package/Runtime/Internal/AmaGDK.Utils.cs +1 -1
  71. package/Runtime/Internal/AmaGDK.WebUtils.cs +1 -1
  72. package/Runtime/Internal/ForceQuitMonitor.cs +7 -2
  73. package/Runtime/Internal/GDKGeoLocationcs.cs +2 -1
  74. package/Runtime/Internal/GDKServerTime.cs +2 -1
  75. package/Runtime/Klavar/KlavarContainer.cs +4 -4
  76. package/Runtime/UserProfile/Plugins/Android/AdvertisingIdFetcher.cs +1 -1
  77. package/Runtime/Utils/GDKUtils.cs +35 -4
  78. package/package.json +1 -1
@@ -0,0 +1,97 @@
1
+ using Amanotes.Core.Internal;
2
+ using System;
3
+ using System.Collections.Generic;
4
+ using UnityEngine;
5
+ namespace Amanotes.Core
6
+ {
7
+ public enum LogLevel
8
+ {
9
+ None,
10
+ Error,
11
+ Warning,
12
+ Verbose
13
+ }
14
+
15
+ internal struct NoStackTrace : IDisposable
16
+ {
17
+ internal LogType logType;
18
+ internal StackTraceLogType stackTraceType;
19
+
20
+ internal NoStackTrace(LogType logType)
21
+ {
22
+ this.logType = logType;
23
+ stackTraceType = Application.GetStackTraceLogType(logType);
24
+ Application.SetStackTraceLogType(logType, StackTraceLogType.None);
25
+ }
26
+
27
+ public void Dispose()
28
+ {
29
+ Application.SetStackTraceLogType(logType, stackTraceType);
30
+ }
31
+
32
+ public static NoStackTrace Error => new NoStackTrace(LogType.Error);
33
+ public static NoStackTrace Warning => new NoStackTrace(LogType.Warning);
34
+ public static NoStackTrace Log => new NoStackTrace(LogType.Log);
35
+ }
36
+
37
+ public class GDKDebug
38
+ {
39
+ public static LogLevel logLevel;
40
+ public static Action<string> logNonfatalErrorHook = null;
41
+ private static readonly HashSet<string> nonFatalDict = new HashSet<string>();
42
+ public static readonly HashSet<string> logWarningDict = new HashSet<string>();
43
+
44
+ public static void LogWarningOnce(string message, string key = null)
45
+ {
46
+ if (logLevel < LogLevel.Warning) return;
47
+ if (string.IsNullOrEmpty(key)) key = message;
48
+ if (!logWarningDict.Add(key)) return;
49
+
50
+ using (NoStackTrace.Warning)
51
+ {
52
+ Debug.LogWarning($"AmaGDK {message}");
53
+ }
54
+ }
55
+ public static void LogWarning(string message)
56
+ {
57
+ if (logLevel < LogLevel.Warning) return;
58
+ using (NoStackTrace.Warning)
59
+ {
60
+ Debug.LogWarning($"AmaGDK {message}");
61
+ }
62
+ }
63
+ public static void LogError(string message)
64
+ {
65
+ if (logLevel < LogLevel.Error) return;
66
+ using (NoStackTrace.Error)
67
+ {
68
+ Debug.LogError($"AmaGDK {message}");
69
+ }
70
+
71
+ if (logNonfatalErrorHook == null) return;
72
+ GDKUtils.DoOnMainThread(() =>
73
+ {
74
+ if (!nonFatalDict.Add(message)) return; // LogOnce
75
+ logNonfatalErrorHook(message);
76
+ });
77
+ }
78
+
79
+ public static void Log(string message)
80
+ {
81
+ if (logLevel < LogLevel.Verbose) return;
82
+ using (NoStackTrace.Log)
83
+ {
84
+ Debug.Log($"AmaGDK {message}");
85
+ }
86
+ }
87
+
88
+ public static void ForceLog(string message)
89
+ {
90
+ using (NoStackTrace.Log)
91
+ {
92
+ Debug.Log($"AmaGDK {message}");
93
+ }
94
+ }
95
+ }
96
+ }
97
+
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 952f1023aed84e35b18d0be8ae20dda9
3
+ timeCreated: 1724669802
@@ -3,6 +3,7 @@ using System.Collections.Concurrent;
3
3
  using System.Collections.Generic;
4
4
  using System.Text;
5
5
 
6
+ using static Amanotes.Core.GDKDebug;
6
7
  namespace Amanotes.Core.Internal
7
8
  {
8
9
  public interface IPoolItem
@@ -1,6 +1,8 @@
1
1
  using System;
2
2
  using System.Collections;
3
3
  using UnityEngine;
4
+ using static Amanotes.Core.GDKDebug;
5
+
4
6
  namespace Amanotes.Core.Internal
5
7
  {
6
8
  public class GDKRoutine
@@ -59,7 +61,7 @@ namespace Amanotes.Core.Internal
59
61
  } catch (Exception ex)
60
62
  {
61
63
  status |= RoutineStatus.Stopped;
62
- if (exceptionHandler == null) Logging.LogError($"Exception caught in coroutine: {ex}");
64
+ if (exceptionHandler == null) LogError($"Exception caught in coroutine: {ex}");
63
65
  exceptionHandler?.Invoke(ex);
64
66
  yield break; // Stop executing the coroutine
65
67
  }
@@ -2,7 +2,7 @@
2
2
  using System.Collections.Generic;
3
3
  using System.Text.RegularExpressions;
4
4
  using UnityEngine.Profiling;
5
- using static Amanotes.Core.Internal.Logging;
5
+ using static Amanotes.Core.GDKDebug;
6
6
 
7
7
  namespace Amanotes.Core.Internal
8
8
  {
@@ -0,0 +1,197 @@
1
+ using System;
2
+ using UnityEngine;
3
+
4
+ namespace Amanotes.Core
5
+ {
6
+ public static class GDKStringExtension
7
+ {
8
+ internal static void Log(GDKString gdkStr, LogType logType, UnityEngine.Object context, Action<string, UnityEngine.Object> logFunc)
9
+ {
10
+ StackTraceLogType type = Application.GetStackTraceLogType(logType);
11
+ Application.SetStackTraceLogType(logType, StackTraceLogType.None);
12
+ {
13
+ logFunc(gdkStr.ToString(), context);
14
+ }
15
+ Application.SetStackTraceLogType(logType, type);
16
+ gdkStr.Clear();
17
+ }
18
+
19
+ public static void Log(this GDKString gdkStr, UnityEngine.Object context = null)
20
+ {
21
+ Log(gdkStr, LogType.Log, context, Debug.Log);
22
+ }
23
+
24
+ public static void LogWarning(this GDKString gdkStr, UnityEngine.Object context = null)
25
+ {
26
+ Log(gdkStr, LogType.Warning, context, Debug.LogWarning);
27
+ }
28
+
29
+ public static void LogError(this GDKString gdkStr, UnityEngine.Object context = null)
30
+ {
31
+ Log(gdkStr, LogType.Error, context, Debug.LogError);
32
+ }
33
+
34
+ private static readonly char[] DigitChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
35
+ internal static unsafe int Write(string s, int stIndex, ulong value, bool writePrefix = false, char prefix = '-')
36
+ {
37
+ fixed (char* ptr = s)
38
+ {
39
+ var idx = 0;
40
+ if (writePrefix)
41
+ {
42
+ ptr[stIndex] = prefix;
43
+ idx++;
44
+ }
45
+
46
+ if (value <= 9)
47
+ {
48
+ ptr[stIndex + idx] = DigitChars[value];
49
+ idx++;
50
+ return idx;
51
+ }
52
+
53
+ var len = (int)Math.Ceiling(Math.Log10(value));
54
+ int endIdx = stIndex + len - 1 + idx;
55
+ do
56
+ {
57
+ ptr[endIdx] = (char)('0' + value % 10);
58
+ endIdx--;
59
+ value /= 10;
60
+ } while (value > 0);
61
+
62
+ idx += len;
63
+ return idx;
64
+ }
65
+ }
66
+
67
+ internal static int WriteULong(this string s, int stIndex, ulong value)
68
+ {
69
+ return Write(s, stIndex, value);
70
+ }
71
+
72
+ internal static int WriteLong(this string s, int stIndex, long value)
73
+ {
74
+ return Write(s, stIndex, (ulong)(value < 0 ? -value : value), value < 0, '-');
75
+ }
76
+
77
+ internal static int WriteDouble(this string s, int stIndex, double value, int decimalPlaces = 4)
78
+ {
79
+ var integerPart = (ulong)value;
80
+ int counter = Write(s, stIndex, integerPart, value < 0);
81
+ if (decimalPlaces <= 0) return counter;
82
+
83
+ double fractionalPart = value - integerPart;
84
+ for (var i = 0; i < decimalPlaces; i++)
85
+ {
86
+ fractionalPart *= 10;
87
+ }
88
+
89
+ var fractionalInt = (ulong)(fractionalPart + 0.5);
90
+ counter += Write(s, stIndex + counter, fractionalInt, true, '.');
91
+ return counter;
92
+ }
93
+ }
94
+
95
+ public unsafe class GDKString
96
+ {
97
+ private readonly int _capacity;
98
+ private readonly string _str;
99
+ private int _length;
100
+
101
+ public GDKString(int capacity)
102
+ {
103
+ _capacity = capacity;
104
+ _str = new string('\0', capacity);
105
+ _length = 0;
106
+ }
107
+
108
+ public int Length => _length;
109
+
110
+ private GDKString SetLength(int value)
111
+ {
112
+ if (value < 0 || value > _capacity)
113
+ {
114
+ throw new ArgumentOutOfRangeException(nameof(value));
115
+ }
116
+
117
+ _length = value;
118
+ fixed (char* ptr = _str)
119
+ {
120
+ ptr[value] = '\0';
121
+ *(int*)((IntPtr)ptr - sizeof(int)) = _length;
122
+ }
123
+
124
+ return this;
125
+ }
126
+
127
+ public GDKString Append(string value)
128
+ {
129
+ return string.IsNullOrEmpty(value) ? this : WriteAt(_length, value);
130
+ }
131
+
132
+ public GDKString WriteAt(int stIdx, string value)
133
+ {
134
+ if (string.IsNullOrEmpty(value)) return this;
135
+
136
+ int vLength = value.Length;
137
+ if (stIdx + vLength >= _capacity)
138
+ {
139
+ throw new InvalidOperationException("Buffer overflow.");
140
+ }
141
+
142
+ // Calculate the number of bytes to copy (2 bytes per char)
143
+ fixed (char* srcPtr = value)
144
+ fixed (char* destPtr = _str)
145
+ {
146
+ // Use memcpy equivalent with pointers
147
+ char* destPos = destPtr + _length;
148
+ for (var i = 0; i < vLength; i++)
149
+ {
150
+ *(destPos + i) = *(srcPtr + i);
151
+ }
152
+ }
153
+
154
+ if (stIdx + vLength > _length) SetLength(_length + vLength);
155
+ return this;
156
+ }
157
+
158
+ public GDKString Append(int value)
159
+ {
160
+ int vLength = _str.WriteLong(Length, value);
161
+ return SetLength(_length + vLength);
162
+ }
163
+
164
+ public GDKString Append(uint value)
165
+ {
166
+ int vLength = _str.WriteULong(Length, value);
167
+ return SetLength(_length + vLength);
168
+ }
169
+
170
+ private const string TRUE = "True";
171
+ private const string FALSE = "False";
172
+ public GDKString Append(bool value)
173
+ {
174
+ Append(value ? TRUE : FALSE);
175
+ return this;
176
+ }
177
+
178
+ public GDKString Append(float value)
179
+ {
180
+ int vLength = _str.WriteDouble(Length, value);
181
+ return SetLength(_length + vLength);
182
+ }
183
+
184
+ public GDKString Append(double value)
185
+ {
186
+ int vLength = _str.WriteDouble(Length, value);
187
+ return SetLength(_length + vLength);
188
+ }
189
+
190
+ public GDKString Clear()
191
+ {
192
+ return SetLength(0);
193
+ }
194
+
195
+ public override string ToString() => _str;
196
+ }
197
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 1b832c4b2bab4b7d8f05c2d315eb6f85
3
+ timeCreated: 1724065190
@@ -1,6 +1,7 @@
1
1
  using System;
2
2
  using System.Linq;
3
3
  using UnityEngine;
4
+ using static Amanotes.Core.GDKDebug;
4
5
 
5
6
  namespace Amanotes.Core.Internal
6
7
  {
@@ -30,7 +31,7 @@ namespace Amanotes.Core.Internal
30
31
  {
31
32
  var config = configs?.FirstOrDefault(a => a.id == id);
32
33
  if (config == null)
33
- Logging.LogWarningOnce($"Not found embedded config <{id}>");
34
+ LogWarningOnce($"Not found embedded config <{id}>");
34
35
  return config;
35
36
  }
36
37
 
@@ -1,5 +1,5 @@
1
1
  using System.Collections.Generic;
2
- using static Amanotes.Core.Internal.Logging;
2
+ using static Amanotes.Core.GDKDebug;
3
3
  using UnityEngine;
4
4
  namespace Amanotes.Core
5
5
  {
@@ -27,7 +27,7 @@ namespace Amanotes.Core
27
27
  var resolution = Screen.currentResolution;
28
28
  dictionary.Add("system_memory_size", SystemInfo.systemMemorySize);
29
29
  dictionary.Add("graphics_memory_size", SystemInfo.graphicsMemorySize);
30
- dictionary.Add("graphics_device_type", SystemInfo.graphicsDeviceType);
30
+ dictionary.Add("graphics_device_type", SystemInfo.graphicsDeviceType.ToString());
31
31
  dictionary.Add("graphics_shader_level", SystemInfo.graphicsShaderLevel);
32
32
  dictionary.Add("processor_count", SystemInfo.processorCount);
33
33
  dictionary.Add("processor_frequency", SystemInfo.processorFrequency);
@@ -1,7 +1,7 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
3
  using Amanotes.Core.Internal;
4
- using static Amanotes.Core.Internal.Logging;
4
+ using static Amanotes.Core.GDKDebug;
5
5
  using UnityEngine;
6
6
  using UnityEngine.Events;
7
7
 
@@ -3,7 +3,7 @@ using System.Collections.Generic;
3
3
  using UnityEngine;
4
4
  using UnityEngine.Profiling;
5
5
  using UnityEngine.UI;
6
- using static Amanotes.Core.Internal.Logging;
6
+ using static Amanotes.Core.GDKDebug;
7
7
 
8
8
  namespace Amanotes.Core
9
9
  {
@@ -2,7 +2,7 @@
2
2
  using System;
3
3
  using System.Collections.Generic;
4
4
  using UnityEngine;
5
- using static Amanotes.Core.Internal.Logging;
5
+ using static Amanotes.Core.GDKDebug;
6
6
 
7
7
  namespace Amanotes.Core
8
8
  {