com.amanotes.gdk 0.2.71 → 0.2.73-1

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 (65) hide show
  1. package/CHANGELOG.md +108 -88
  2. package/Editor/AmaGDKEditor.cs +133 -135
  3. package/Editor/EmbedRemoteConfigAssetInspector.cs +1 -1
  4. package/Editor/Extra/GDKAutoUpdateAdapter.cs +24 -24
  5. package/Editor/Extra/GDKCIBuildCommand.cs +2 -16
  6. package/Extra/AmaGDKInstaller.unitypackage +0 -0
  7. package/Extra/CheckDiskSpace.unitypackage +0 -0
  8. package/Extra/Consent.unitypackage +0 -0
  9. package/Extra/ForceUpdate.unitypackage +0 -0
  10. package/Extra/LegacyGDKUpdateHelper.unitypackage +0 -0
  11. package/Extra/PostProcessor.unitypackage +0 -0
  12. package/Packages/AmaGDKConfig.unitypackage +0 -0
  13. package/Packages/AmaGDKExample.unitypackage +0 -0
  14. package/Packages/AmaGDKTest.unitypackage +0 -0
  15. package/Packages/AppsFlyerAdapter.AdRevenue.unitypackage +0 -0
  16. package/Packages/AppsFlyerAdapter.AdRevenue.unitypackage.meta +7 -0
  17. package/Packages/AppsFlyerAdapter.PurchaseConnector.unitypackage +0 -0
  18. package/Packages/AppsFlyerAdapter.unitypackage +0 -0
  19. package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
  20. package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
  21. package/Packages/IronSourceAdapter.unitypackage +0 -0
  22. package/Packages/MaxAdNetworkAdapter.unitypackage +0 -0
  23. package/Packages/RevenueCatAdapter.unitypackage +0 -0
  24. package/Packages/SqliteAnalyticsAdapter.unitypackage +0 -0
  25. package/Runtime/Ad/AdExtension.cs +2 -1
  26. package/Runtime/Ad/AdLogic.cs +10 -5
  27. package/Runtime/Ad/AmaGDK.Ads.cs +2 -2
  28. package/Runtime/AmaGDK.Adapters.cs +7 -4
  29. package/Runtime/AmaGDK.Analytics.cs +67 -48
  30. package/Runtime/AmaGDK.Config.cs +1 -7
  31. package/Runtime/AmaGDK.Consent.cs +9 -8
  32. package/Runtime/AmaGDK.Context.cs +1 -1
  33. package/Runtime/AmaGDK.Device.cs +3 -2
  34. package/Runtime/AmaGDK.IAP.cs +1 -1
  35. package/Runtime/AmaGDK.RemoteConfig.cs +2 -2
  36. package/Runtime/AmaGDK.Singleton.cs +1 -1
  37. package/Runtime/AmaGDK.UserProfile.cs +12 -11
  38. package/Runtime/AmaGDK.asmdef +1 -1
  39. package/Runtime/AmaGDK.cs +25 -15
  40. package/Runtime/AnalyticQualityAsset.cs +5 -6
  41. package/Runtime/AudioToolkit/AmaGDK.Audio.cs +3 -2
  42. package/Runtime/AudioToolkit/Plugins/AudioDeviceDetector.cs +2 -2
  43. package/Runtime/Core/GDKDebug.cs +97 -0
  44. package/Runtime/Core/GDKDebug.cs.meta +3 -0
  45. package/Runtime/Core/GDKPool.cs +56 -337
  46. package/Runtime/Core/GDKRoutine.cs +3 -1
  47. package/Runtime/Core/GDKSemVer.cs +1 -1
  48. package/Runtime/Core/GDKString.cs +197 -0
  49. package/Runtime/Core/GDKString.cs.meta +3 -0
  50. package/Runtime/EmbedRemoteConfigAsset.cs +2 -1
  51. package/Runtime/Fps/AmaFPS.Utils.cs +5 -1
  52. package/Runtime/Fps/AmaFPS.cs +1 -1
  53. package/Runtime/Fps/AmaFPSVisualizer.cs +7 -2
  54. package/Runtime/Fps/FrameRecorder.cs +1 -1
  55. package/Runtime/GDKAudio/GDKAudio.cs +16 -13
  56. package/Runtime/Internal/AmaGDK.Internal.cs +24 -34
  57. package/Runtime/Internal/AmaGDK.Utils.cs +4 -4
  58. package/Runtime/Internal/AmaGDK.WebUtils.cs +1 -1
  59. package/Runtime/Internal/GDKGeoLocationcs.cs +2 -1
  60. package/Runtime/Internal/GDKServerTime.cs +2 -1
  61. package/Runtime/Klavar/Attributes/TimeDiffLastFireAttribute.cs +2 -1
  62. package/Runtime/Klavar/KlavarContainer.cs +4 -4
  63. package/Runtime/UserProfile/Plugins/Android/AdvertisingIdFetcher.cs +1 -1
  64. package/Runtime/Utils/GDKUtils.cs +1 -1
  65. package/package.json +1 -1
@@ -6,7 +6,7 @@ using Amanotes.Core.Internal;
6
6
  using UnityEngine;
7
7
  using UnityEngine.Profiling;
8
8
  using static Amanotes.Core.AmaGDK.Analytics;
9
- using static Amanotes.Core.Internal.Logging;
9
+ using static Amanotes.Core.GDKDebug;
10
10
 
11
11
  namespace Amanotes.Core
12
12
  {
@@ -25,9 +25,9 @@ namespace Amanotes.Core
25
25
  get => Config.analytics.showAnalyticsLog;
26
26
  }
27
27
 
28
- public interface IEventParamsBuilder { }
28
+ public interface IEventParamsBuilder { }
29
29
 
30
- public class EventParams : IEventParamsBuilder, GDKPool.IPoolItem
30
+ public class EventParams : IEventParamsBuilder, IPoolItem
31
31
  {
32
32
  public string eventName { get; private set; }
33
33
  public readonly Dictionary<string, object> parameters = new Dictionary<string, object>();
@@ -56,7 +56,6 @@ namespace Amanotes.Core
56
56
 
57
57
  internal EventParams SetEventName(string eventName)
58
58
  {
59
- // Debug.Log($"SetEventName --> {this} : {GetHashCode()}");
60
59
  this.eventName = eventName;
61
60
  return this;
62
61
  }
@@ -74,8 +73,6 @@ namespace Amanotes.Core
74
73
 
75
74
  GDKPool.ReturnAndNullize(ref ignoreAdapterIds);
76
75
  GDKPool.ReturnAndNullize(ref allowAdapterIds);
77
-
78
- //Debug.Log($"Reset --> {this} : {GetHashCode()}");
79
76
  _detail = null;
80
77
  }
81
78
 
@@ -313,6 +310,7 @@ namespace Amanotes.Core
313
310
  internal static readonly List<AnalyticsAdapter> listAdapters = new List<AnalyticsAdapter>();
314
311
  internal static readonly AnalyticsData localData = new AnalyticsData().LoadJsonFromFile().BuildCache();
315
312
  internal static SessionStat sessionStat;
313
+ internal static readonly GDKPool.Pool<EventParams> epPool = new GDKPool.Pool<EventParams>(1);
316
314
 
317
315
  internal static readonly Dictionary<string, string> reservedPrefixes = new Dictionary<string, string>()
318
316
  {
@@ -377,7 +375,7 @@ namespace Amanotes.Core
377
375
  internal static EventParams PrepareEvent(string eventName)
378
376
  {
379
377
  PrepareEventCheck(eventName);
380
- var result = GDKPool.Take<EventParams>().SetEventName(eventName);
378
+ var result = epPool.Get().SetEventName(eventName);
381
379
  PostPrepareEventProcess(result);
382
380
  return result;
383
381
  }
@@ -386,7 +384,7 @@ namespace Amanotes.Core
386
384
  {
387
385
  if (parameters == null) return PrepareEvent(eventName);
388
386
  PrepareEventCheck(eventName);
389
- var result = GDKPool.Take<EventParams>().SetEventName(eventName);
387
+ var result = epPool.Get().SetEventName(eventName);
390
388
  result.AddParam(parameters);
391
389
  PostPrepareEventProcess(result);
392
390
  return result;
@@ -396,7 +394,7 @@ namespace Amanotes.Core
396
394
  {
397
395
  if (parameters == null) return PrepareEvent(eventName);
398
396
  PrepareEventCheck(eventName);
399
- var result = GDKPool.Take<EventParams>().SetEventName(eventName);
397
+ var result = epPool.Get().SetEventName(eventName);
400
398
  for (var i = 0; i < parameters.Length; i++)
401
399
  {
402
400
  result.AddParam(parameters[i].Item1, parameters[i].Item2);
@@ -417,11 +415,11 @@ namespace Amanotes.Core
417
415
  {
418
416
  if (eventData.isLoggedImmediately) continue;
419
417
  if (Config.analytics.immediatelyLoggedEvents.Contains(eventData.eventName)){
420
- Utils.ThrowExceptionIfEditor($"This event '{eventData.eventName}' must be sent immediately by AmaGDK.Analytics.LogEvent(eventName).LogImmediately()");
418
+ GDKUtils.ThrowExceptionIfEditor($"This event '{eventData.eventName}' must be sent immediately by AmaGDK.Analytics.LogEvent(eventName).LogImmediately()");
421
419
  }
422
420
 
423
421
  LogEventActually(eventData);
424
- GDKPool.Return(eventData);
422
+ epPool.Return(eventData);
425
423
  }
426
424
 
427
425
  localData.SaveIfDirty();
@@ -445,7 +443,7 @@ namespace Amanotes.Core
445
443
 
446
444
  if (config.showAnalyticsLog)
447
445
  {
448
- Debug.Log($"AmaGDK [Analytics] Event <{eventNameToSend}> (in session: {countInSession}, total: {totalCount})\n{JsonUtils.DictionaryToJson(eventParams.parameters, true)}");
446
+ ForceLog($"[Analytics] Event <{eventNameToSend}> (in session: {countInSession}, total: {totalCount})\n{JsonUtils.DictionaryToJson(eventParams.parameters, true)}");
449
447
  }
450
448
 
451
449
  config.quality.CheckEventQuality(eventParams.eventName, eventParams.parameters);
@@ -476,7 +474,7 @@ namespace Amanotes.Core
476
474
  internal static void LogEventImmediately(EventParams eventParams)
477
475
  {
478
476
  LogEventActually(eventParams);
479
- GDKPool.Return(eventParams);
477
+ epPool.Return(eventParams);
480
478
  sessionStat?.Save();
481
479
  localData.SaveIfDirty();
482
480
  }
@@ -495,7 +493,7 @@ namespace Amanotes.Core
495
493
  int.TryParse(eventData.parameters[ACCUMULATED_COUNT].ToString(), out int oriAccCount);
496
494
  if (oriAccCount != countByGDK)
497
495
  {
498
- LogWarning($"[Analytics] event <{eventData.eventName}> has difference in accumulated count. Original count: {oriAccCount}. AmaGDK count: {countByGDK}");
496
+ // Log($"[Analytics] event <{eventData.eventName}>, game count: {oriAccCount}, AmaGDK count: {countByGDK}");
499
497
  if (Config.analytics.migrateAccumulatedCount && !eventData.withinSession)
500
498
  {
501
499
  Log($"[Analytics] Update event count of event <{eventData.eventName}> from {countByGDK} to {oriAccCount}");
@@ -519,7 +517,7 @@ namespace Amanotes.Core
519
517
  {
520
518
  Profiler.BeginSample("AmaGDK.Analytics.NormalizeEventName()");
521
519
  {
522
- var warningLog = GDKPool.TakeStringBuilder(8192);
520
+ var warningLog = GDKPool.GetStringBuilder(8);
523
521
  NormalizeKeyString(ref eventName, warningLog, dryRun);
524
522
  if (reservedEvents.Contains(eventName))
525
523
  {
@@ -541,9 +539,9 @@ namespace Amanotes.Core
541
539
 
542
540
  Profiler.BeginSample("AmaGDK.Analytics.NormalizeKeyString()");
543
541
  {
544
- bool willLog = Config.common.logLevel != LogLevel.None;
545
- var tempLog = willLog ? GDKPool.TakeStringBuilder() : null;
546
- var tempKey = GDKPool.TakeStringBuilder();
542
+ var willLog = Config.common.logLevel != LogLevel.None;
543
+ var tempLog = willLog ? GDKPool.GetStringBuilder() : null;
544
+ var tempKey = GDKPool.GetStringBuilder();
547
545
 
548
546
  var hasChanged = false;
549
547
  var trimKey = key.Trim();
@@ -917,6 +915,27 @@ namespace Amanotes.Core
917
915
 
918
916
  public static class EventParamsExtension
919
917
  {
918
+ internal static string AppendEventErrorDetail(this string message, string eventName, string eventParamName, string eventParamValue)
919
+ {
920
+ return $"{message}\n{GetEventErrorDetail(eventName, eventParamName, eventParamValue)}";
921
+ }
922
+
923
+ internal static string GetEventErrorDetail(string eventName, string eventParamName, string eventParamValue)
924
+ {
925
+ string key = eventParamName == null
926
+ ? "null" : string.IsNullOrWhiteSpace(eventParamName)
927
+ ? "\"\""
928
+ : eventParamName;
929
+
930
+ string value = eventParamValue == null
931
+ ? "null" : string.IsNullOrWhiteSpace(eventParamValue)
932
+ ? "\"\""
933
+ : eventParamValue;
934
+
935
+ return $"Event <{eventName}> {{ {key} : {value}, ... }}\n";
936
+ }
937
+
938
+
920
939
  public static void LogImmediately(this IEventParamsBuilder ap)
921
940
  {
922
941
  if (ap == null) return;
@@ -929,7 +948,7 @@ namespace Amanotes.Core
929
948
  public static IEventParamsBuilder AttachParam_TimeDiffLastFire(this IEventParamsBuilder ap)
930
949
  {
931
950
  var data = ap as EventParams;
932
- return data?.AddParam("time_diff_last_fire", Utils.GetTimeDiffLastFire(data.eventName));
951
+ return data?.AddParam("time_diff_last_fire", GDKUtils.GetTimeDiffLastFire(data.eventName));
933
952
  }
934
953
 
935
954
  public static IEventParamsBuilder AttachParam_InternetConnectionStatus(this IEventParamsBuilder ap)
@@ -983,7 +1002,7 @@ namespace Amanotes.Core
983
1002
  }
984
1003
 
985
1004
  eventData.overrideConfig = true;
986
- eventData.ignoreAdapterIds ??= GDKPool.TakeHashSet();
1005
+ eventData.ignoreAdapterIds ??= GDKPool.GetHashSet();
987
1006
 
988
1007
  foreach (string mId in analyticIds)
989
1008
  {
@@ -1009,18 +1028,7 @@ namespace Amanotes.Core
1009
1028
  }
1010
1029
 
1011
1030
  eventData.overrideConfig = true;
1012
- if (eventData.allowAdapterIds != null)
1013
- {
1014
- LogWarning($"OnlyTo() why should allowAdapterIds != null? ({eventData.allowAdapterIds.Count})");
1015
- return ap;
1016
- }
1017
-
1018
- eventData.allowAdapterIds = GDKPool.TakeHashSet();
1019
- if (eventData.allowAdapterIds.Count != 0)
1020
- {
1021
- Debug.Break();
1022
- throw new Exception($"GDKPool.TakeHashSet() should return empty HashSet! ({eventData.GetHashCode()})");
1023
- }
1031
+ eventData.allowAdapterIds ??= GDKPool.GetHashSet();
1024
1032
 
1025
1033
  foreach (string mId in analyticIds)
1026
1034
  {
@@ -1102,35 +1110,46 @@ namespace Amanotes.Core
1102
1110
  {
1103
1111
  string eventName = (ap as EventParams)?.eventName;
1104
1112
 
1105
- var sb = GDKPool.TakeStringBuilder();
1106
- sb.Clear();
1107
- NormalizeKeyString(ref key, sb, AmaGDK.Config.analytics.normalizeEventName);
1108
-
1109
- if (sb.Length > 0) LogWarningOnce($"Warning for event <{eventName}>, param <{key}>:\n{sb}", $"NormalizeParamKey <{eventName}>");
1110
- GDKPool.Return(sb);
1111
-
1112
- if (string.IsNullOrWhiteSpace(key))
1113
- {
1114
- LogWarning($"Param key is empty. Event name: {eventName}!");
1115
- return false;
1116
- }
1117
-
1118
1113
  if (value == null)
1119
1114
  {
1120
- LogWarning($"Param value is null. Event name: {eventName}, key: {key}!");
1115
+ LogWarning($"[Analytics] parameter value should not be null!"
1116
+ .AppendEventErrorDetail(eventName, key, null)
1117
+ );
1121
1118
  return false;
1122
1119
  }
1123
-
1120
+
1124
1121
  if (value is string stringValue)
1125
1122
  {
1126
1123
  var strLimit = 100;
1127
1124
  if (stringValue.Length > strLimit)
1128
1125
  {
1129
1126
  value = stringValue.Substring(0, strLimit);
1130
- LogWarning($"Param value exceeds the length limit ({strLimit}). Event name: {eventName}, key: {key}!");
1127
+ LogWarning($"[Analytics] parameter value length = {stringValue.Length} > {strLimit} chars!"
1128
+ .AppendEventErrorDetail(eventName, key, stringValue));
1131
1129
  }
1132
1130
  }
1133
1131
 
1132
+ string valueString;
1133
+ if (string.IsNullOrWhiteSpace(key))
1134
+ {
1135
+ valueString = (string)Convert.ChangeType(value, typeof(string));
1136
+ LogWarning($"[Analytics] parameter name should not be null or empty!"
1137
+ .AppendEventErrorDetail(eventName, key, valueString));
1138
+ return false;
1139
+ }
1140
+
1141
+ StringBuilder sb = GDKPool.GetStringBuilder();
1142
+ sb.Clear();
1143
+ NormalizeKeyString(ref key, sb, AmaGDK.Config.analytics.normalizeEventName);
1144
+ if (sb.Length > 0)
1145
+ {
1146
+ valueString = (string)Convert.ChangeType(value, typeof(string));
1147
+ var onceKey = $"NormalizeParamKey <{eventName}>";
1148
+ var onceMessage = $"[Analytics] normalized KeyValue applied for {GetEventErrorDetail(eventName, key, valueString)}\n{sb}";
1149
+ LogWarningOnce(onceMessage, onceKey);
1150
+ }
1151
+
1152
+ GDKPool.Return(sb);
1134
1153
  return true;
1135
1154
  }
1136
1155
  }
@@ -84,13 +84,7 @@ namespace Amanotes.Core.Internal
84
84
  #endif
85
85
  }
86
86
 
87
- public enum LogLevel
88
- {
89
- None,
90
- Error,
91
- Warning,
92
- Verbose
93
- }
87
+
94
88
 
95
89
  [Serializable]
96
90
  public partial class SDKConfig
@@ -1,6 +1,7 @@
1
1
  using System;
2
2
  using Amanotes.Core.Internal;
3
3
  using UnityEngine;
4
+ using static Amanotes.Core.GDKDebug;
4
5
 
5
6
  namespace Amanotes.Core
6
7
  {
@@ -15,7 +16,7 @@ namespace Amanotes.Core
15
16
 
16
17
  if (_onGoingRequestAllConsents)
17
18
  {
18
- Logging.LogWarning($"[Consent] RequestAllConsents is called multiple times.");
19
+ LogWarning($"[Consent] RequestAllConsents is called multiple times.");
19
20
  return;
20
21
  }
21
22
 
@@ -49,7 +50,7 @@ namespace Amanotes.Core
49
50
  get
50
51
  {
51
52
  if (checkedATT) return allowedATT;
52
- Logging.LogWarning("[Consent] ATT has not completed yet");
53
+ LogWarning("[Consent] ATT has not completed yet");
53
54
  return false;
54
55
  }
55
56
  }
@@ -85,7 +86,7 @@ namespace Amanotes.Core
85
86
 
86
87
  if (!ConsentHook.IsRequiredCMP.HasValue)
87
88
  {
88
- Logging.LogWarningOnce("[Consent] CMP is not available or not ready");
89
+ LogWarningOnce("[Consent] CMP is not available or not ready");
89
90
  return false;
90
91
  }
91
92
 
@@ -169,7 +170,7 @@ namespace Amanotes.Core
169
170
  var tmpAction = _onConsentComplete;
170
171
  _onConsentComplete = null;
171
172
  tmpAction?.Invoke();
172
- Logging.Log("[Consent] End consent checking");
173
+ Log("[Consent] End consent checking");
173
174
  }
174
175
  }
175
176
  }
@@ -192,7 +193,7 @@ namespace Amanotes.Core
192
193
  {
193
194
  if (_tryToShowCMP != null) return _tryToShowCMP;
194
195
 
195
- Logging.LogWarning("[Consent] ConsentHook.TryToShowCMP is null");
196
+ LogWarning("[Consent] ConsentHook.TryToShowCMP is null");
196
197
  _tryToShowCMP = callback => callback(false);
197
198
  return _tryToShowCMP;
198
199
  }
@@ -206,7 +207,7 @@ namespace Amanotes.Core
206
207
  {
207
208
  if (_forceShowCMP != null) return _forceShowCMP;
208
209
 
209
- Logging.LogWarning("[Consent] ConsentHook.ForceShowCMP is null");
210
+ LogWarning("[Consent] ConsentHook.ForceShowCMP is null");
210
211
  _forceShowCMP = callback => callback(false);
211
212
  return _forceShowCMP;
212
213
  }
@@ -220,7 +221,7 @@ namespace Amanotes.Core
220
221
  {
221
222
  if (_setNotRequiredCMP != null) return _setNotRequiredCMP;
222
223
 
223
- Logging.LogWarning("[Consent] ConsentHook.SetNotRequiredCMP is null");
224
+ LogWarning("[Consent] ConsentHook.SetNotRequiredCMP is null");
224
225
  _setNotRequiredCMP = callback => callback(false);
225
226
  return _setNotRequiredCMP;
226
227
  }
@@ -234,7 +235,7 @@ namespace Amanotes.Core
234
235
  {
235
236
  if (_attRequest != null) return _attRequest;
236
237
 
237
- Logging.LogWarning("[Consent] ConsentHook.ATTRequest is null");
238
+ LogWarning("[Consent] ConsentHook.ATTRequest is null");
238
239
  _attRequest = callback => callback(false);
239
240
  return _attRequest;
240
241
  }
@@ -1,4 +1,4 @@
1
- using static Amanotes.Core.Internal.Logging;
1
+ using static Amanotes.Core.GDKDebug;
2
2
 
3
3
  namespace Amanotes.Core
4
4
  {
@@ -2,6 +2,7 @@ using System;
2
2
  using System.Text;
3
3
  using Amanotes.Core.Internal;
4
4
  using UnityEngine;
5
+ using static Amanotes.Core.GDKDebug;
5
6
 
6
7
  namespace Amanotes.Core
7
8
  {
@@ -67,14 +68,14 @@ namespace Amanotes.Core.Internal
67
68
 
68
69
  if (AmaGDK.Config.common.logLevel == LogLevel.Verbose)
69
70
  {
70
- var stringBuilder = GDKPool.TakeStringBuilder();
71
+ var stringBuilder = GDKPool.GetStringBuilder();
71
72
  stringBuilder.Append("Device info:");
72
73
  stringBuilder.AppendLine("DeviceSpec: " + result);
73
74
  stringBuilder.AppendLine("systemMemorySize: " + SystemInfo.systemMemorySize);
74
75
  stringBuilder.AppendLine("processorCount: " + SystemInfo.processorCount);
75
76
  stringBuilder.AppendLine("processorFrequency: " + SystemInfo.processorFrequency);
76
77
  stringBuilder.AppendLine("graphicsMemorySize: " + SystemInfo.graphicsMemorySize);
77
- Logging.Log(GDKPool.ReturnAndStringify(stringBuilder));
78
+ Log(GDKPool.ReturnString(stringBuilder));
78
79
  }
79
80
 
80
81
  return result;
@@ -6,7 +6,7 @@ using UnityEngine;
6
6
  using Amanotes.Core.Internal;
7
7
 
8
8
  using static Amanotes.Core.AmaGDK.IAP;
9
- using static Amanotes.Core.Internal.Logging;
9
+ using static Amanotes.Core.GDKDebug;
10
10
 
11
11
  namespace Amanotes.Core
12
12
  {
@@ -6,7 +6,7 @@ using UnityEngine;
6
6
  using Amanotes.Core.Internal;
7
7
  using UnityEngine.Profiling;
8
8
  using UnityEngine.Serialization;
9
- using static Amanotes.Core.Internal.Logging;
9
+ using static Amanotes.Core.GDKDebug;
10
10
 
11
11
  #if UNITY_EDITOR
12
12
  using UnityEditor;
@@ -214,7 +214,7 @@ namespace Amanotes.Core
214
214
  Profiler.BeginSample("AmaGDK.RemoteConfig.SaveCache()");
215
215
 
216
216
  _fetchState = FetchState.SaveCache;
217
- StringBuilder sb = GDKPool.TakeStringBuilder(8192);
217
+ StringBuilder sb = GDKPool.GetStringBuilder(8);
218
218
 
219
219
  //Add embedded remote config version to force load from embedded config after app update
220
220
  sb.AppendLine($"{VERSION_PREFIX}{EmbedVersion}");
@@ -1,6 +1,6 @@
1
1
 
2
2
  using System.Threading;
3
- using static Amanotes.Core.Internal.Logging;
3
+ using static Amanotes.Core.GDKDebug;
4
4
  using static Amanotes.Core.Internal.Messsage;
5
5
 
6
6
  namespace Amanotes.Core
@@ -3,6 +3,7 @@ using System.Text.RegularExpressions;
3
3
  using Amanotes.Core.Internal;
4
4
  using System.Collections.Generic;
5
5
  using UnityEngine;
6
+ using static Amanotes.Core.GDKDebug;
6
7
 
7
8
  namespace Amanotes.Core
8
9
  {
@@ -70,7 +71,7 @@ namespace Amanotes.Core
70
71
  {
71
72
  if (_userId == value) return;
72
73
  _userId = value;
73
- Logging.Log($"GDK UserID Updated: {_userId}");
74
+ Log($"GDK UserID Updated: {_userId}");
74
75
  dispatcher.Dispatch(Event.GDK_USER_ID_UPDATED, _userId);
75
76
  _dirty = true;
76
77
  if (isReady) SendMapUserId();
@@ -84,7 +85,7 @@ namespace Amanotes.Core
84
85
  {
85
86
  if (!ValidateId(value, ALPHANUMERIC_HYPHEN_PATTERN))
86
87
  {
87
- Logging.LogError($"[UserProfile] Wrong format for GAId. Value: {value}");
88
+ LogError($"[UserProfile] Wrong format for GAId. Value: {value}");
88
89
  return;
89
90
  }
90
91
  _gaid = value;
@@ -99,7 +100,7 @@ namespace Amanotes.Core
99
100
  {
100
101
  if (!ValidateId(value, ALPHANUMERIC_HYPHEN_PATTERN))
101
102
  {
102
- Logging.LogError($"[UserProfile] Wrong format for IDFA. Value: {value}");
103
+ LogError($"[UserProfile] Wrong format for IDFA. Value: {value}");
103
104
  return;
104
105
  }
105
106
  _idfa = value;
@@ -114,7 +115,7 @@ namespace Amanotes.Core
114
115
  {
115
116
  if (!ValidateId(value, ALPHANUMERIC_HYPHEN_PATTERN))
116
117
  {
117
- Logging.LogError($"[UserProfile] Wrong format for IDFV. Value: {value}");
118
+ LogError($"[UserProfile] Wrong format for IDFV. Value: {value}");
118
119
  return;
119
120
  }
120
121
  _idfv = value;
@@ -129,7 +130,7 @@ namespace Amanotes.Core
129
130
  {
130
131
  if (!ValidateId(value, ALPHANUMERIC_PATTERN))
131
132
  {
132
- Logging.LogError($"[UserProfile] Wrong format for AndroidId. Value: {value}");
133
+ LogError($"[UserProfile] Wrong format for AndroidId. Value: {value}");
133
134
  return;
134
135
  }
135
136
  _androidId = value;
@@ -144,7 +145,7 @@ namespace Amanotes.Core
144
145
  {
145
146
  if (!ValidateId(value, ALPHANUMERIC_PATTERN))
146
147
  {
147
- Logging.LogError($"[UserProfile] Wrong format for PseudoId. Value: {value}");
148
+ LogError($"[UserProfile] Wrong format for PseudoId. Value: {value}");
148
149
  return;
149
150
  }
150
151
  _pseudoId = value;
@@ -163,7 +164,7 @@ namespace Amanotes.Core
163
164
  #endif
164
165
  if (!ValidateId(value, pattern))
165
166
  {
166
- Logging.LogError($"[UserProfile] Wrong format for AmaDeviceId. Value: {value}");
167
+ LogError($"[UserProfile] Wrong format for AmaDeviceId. Value: {value}");
167
168
  return;
168
169
  }
169
170
  _amaDeviceId = value;
@@ -179,7 +180,7 @@ namespace Amanotes.Core
179
180
  {
180
181
  if (!Application.isEditor && !ValidateId(value, NUMERIC_HYPHEN_PATTERN))
181
182
  {
182
- Logging.LogError($"[UserProfile] Wrong format for AppsFlyerId. Value: {value}");
183
+ LogError($"[UserProfile] Wrong format for AppsFlyerId. Value: {value}");
183
184
  return;
184
185
  }
185
186
  _appsFlyerId = value;
@@ -194,7 +195,7 @@ namespace Amanotes.Core
194
195
  {
195
196
  if (!ValidateId(value, ALPHANUMERIC_PATTERN))
196
197
  {
197
- Logging.LogError($"[UserProfile] Wrong format for InstallationId. Value: {value}");
198
+ LogError($"[UserProfile] Wrong format for InstallationId. Value: {value}");
198
199
  return;
199
200
  }
200
201
  _installationId = value;
@@ -325,7 +326,7 @@ namespace Amanotes.Core
325
326
  {
326
327
  // Always get the latest advertising id
327
328
  GetAdvertisingId();
328
- Logging.Log($"[UserProfile] user_id: {_userId}");
329
+ Log($"[UserProfile] user_id: {_userId}");
329
330
  GDKUtils.OnFrameUpdate(SaveIfDirty);
330
331
 
331
332
  var adsId = Application.platform == RuntimePlatform.Android ? GAId : IDFA;
@@ -394,7 +395,7 @@ namespace Amanotes.Core
394
395
  AmaDeviceId = SystemInfo.deviceUniqueIdentifier;
395
396
  break;
396
397
  }
397
- Logging.Log($"[UserProfile] Generate ama_device_id: {_amaDeviceId}");
398
+ Log($"[UserProfile] Generate ama_device_id: {_amaDeviceId}");
398
399
  Save();
399
400
  }
400
401
 
@@ -4,7 +4,7 @@
4
4
  "references": [],
5
5
  "includePlatforms": [],
6
6
  "excludePlatforms": [],
7
- "allowUnsafeCode": false,
7
+ "allowUnsafeCode": true,
8
8
  "overrideReferences": false,
9
9
  "precompiledReferences": [],
10
10
  "autoReferenced": true,
package/Runtime/AmaGDK.cs CHANGED
@@ -1,23 +1,30 @@
1
1
  using System;
2
- using System.Collections;
3
- using System.Collections.Generic;
4
- using System.Diagnostics;
5
2
  using System.IO;
6
3
  using System.Text;
7
- using System.Text.RegularExpressions;
8
- using Amanotes.Core.Internal;
9
4
  using System.Linq;
5
+ using System.Diagnostics;
6
+ using System.Collections;
7
+ using System.Collections.Generic;
8
+ using System.Text.RegularExpressions;
9
+
10
10
  using UnityEngine;
11
11
  using UnityEngine.Profiling;
12
- using static Amanotes.Core.Internal.Logging;
13
- using static Amanotes.Core.Internal.Messsage;
14
12
  using Debug = UnityEngine.Debug;
15
13
 
14
+ using Amanotes.Core.Internal;
15
+ using static Amanotes.Core.GDKDebug;
16
+ using static Amanotes.Core.Internal.Messsage;
17
+
18
+ #if UNITY_EDITOR
19
+ using UnityEditor;
20
+ using UnityEditor.PackageManager;
21
+ #endif
22
+
16
23
  namespace Amanotes.Core
17
24
  {
18
25
  public partial class AmaGDK : MonoBehaviour
19
26
  {
20
- public const string VERSION = "0.2.71";
27
+ public const string VERSION = "0.2.73-1";
21
28
 
22
29
  internal static Status _status = Status.None;
23
30
  private static ConfigAsset _config = null;
@@ -47,7 +54,7 @@ namespace Amanotes.Core
47
54
  {
48
55
  if (_config != null) return _config;
49
56
  _config = Resources.Load<ConfigAsset>("AmaGDKConfig");
50
- // if (_config == null) LogWarningOnce(CONFIG_NOT_FOUND);
57
+ GDKDebug.logLevel = _config.common.logLevel;
51
58
  return _config;
52
59
  }
53
60
  }
@@ -176,7 +183,7 @@ namespace Amanotes.Core
176
183
  }
177
184
 
178
185
  var startTime = Time.realtimeSinceStartup;
179
- var sb = GDKPool.TakeStringBuilder(1024);
186
+ var sb = GDKPool.GetStringBuilder();
180
187
 
181
188
  InitModules();
182
189
 
@@ -210,7 +217,7 @@ namespace Amanotes.Core
210
217
  LogEvent_GDKInit(Mathf.RoundToInt(initDuration));
211
218
 
212
219
  sb.Append($"\nMapping UserId: {User.UserId}\n");
213
- Debug.Log($"AmaGDK v{VERSION} | {READY} in {initDuration:#0.00}s\n\n{sb}");
220
+ ForceLog($"v{VERSION} | {READY} in {initDuration:#0.00}s\n\n{sb}");
214
221
  GDKPool.Return(sb);
215
222
  }
216
223
 
@@ -265,8 +272,8 @@ namespace Amanotes.Core
265
272
 
266
273
  public static LogLevel logLevel
267
274
  {
268
- get => Config.common.logLevel;
269
- set => Config.common.logLevel = value;
275
+ get => _config == null ? Config.common.logLevel : GDKDebug.logLevel;
276
+ set => GDKDebug.logLevel = value;
270
277
  }
271
278
 
272
279
  public static void Init(Action onReady = null)
@@ -437,8 +444,8 @@ namespace Amanotes.Core
437
444
  const string manifestPath = "Packages/manifest.json";
438
445
  string manifestJson = File.ReadAllText(manifestPath);
439
446
 
440
- string pattern = "\"com\\.amanotes\\.gdk\": \"(.*)\"";
441
- string devModeEntry = $"\"com.amanotes.gdk\": \"{strDesired}\"";
447
+ var pattern = "\"com\\.amanotes\\.gdk\": \"(.*)\"";
448
+ var devModeEntry = $"\"com.amanotes.gdk\": \"{strDesired}\"";
442
449
 
443
450
  manifestJson = Regex.Replace(manifestJson, pattern, devModeEntry);
444
451
  File.WriteAllText(manifestPath, manifestJson);
@@ -448,6 +455,9 @@ namespace Amanotes.Core
448
455
  Debug.LogWarning($"AmaGDK changes to dev mode failed. The expected value is: {devModeEntry}");
449
456
  return;
450
457
  }
458
+
459
+ AssetDatabase.Refresh();
460
+ Client.Resolve();
451
461
  Debug.Log("AmaGDK changes to dev mode successfully");
452
462
  }
453
463
  catch (Exception e)