com.amanotes.gdk 0.2.71 → 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.
- package/CHANGELOG.md +96 -88
- package/Editor/AmaGDKEditor.cs +1 -1
- package/Editor/EmbedRemoteConfigAssetInspector.cs +1 -1
- package/Editor/Extra/GDKCIBuildCommand.cs +2 -16
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/CheckDiskSpace.unitypackage +0 -0
- package/Extra/Consent.unitypackage +0 -0
- package/Extra/ForceUpdate.unitypackage +0 -0
- package/Extra/LegacyGDKUpdateHelper.unitypackage +0 -0
- package/Extra/PostProcessor.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.PurchaseConnector.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.unitypackage +0 -0
- package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
- package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
- package/Packages/IronSourceAdapter.unitypackage +0 -0
- package/Packages/MaxAdNetworkAdapter.unitypackage +0 -0
- package/Packages/RevenueCatAdapter.unitypackage +0 -0
- package/Packages/SqliteAnalyticsAdapter.unitypackage +0 -0
- package/Runtime/Ad/AdExtension.cs +2 -1
- package/Runtime/Ad/AdLogic.cs +1 -1
- package/Runtime/Ad/AmaGDK.Ads.cs +1 -1
- package/Runtime/AmaGDK.Adapters.cs +1 -1
- package/Runtime/AmaGDK.Analytics.cs +17 -30
- package/Runtime/AmaGDK.Config.cs +1 -7
- package/Runtime/AmaGDK.Consent.cs +9 -8
- package/Runtime/AmaGDK.Context.cs +1 -1
- package/Runtime/AmaGDK.Device.cs +3 -2
- package/Runtime/AmaGDK.IAP.cs +1 -1
- package/Runtime/AmaGDK.RemoteConfig.cs +2 -2
- package/Runtime/AmaGDK.Singleton.cs +1 -1
- package/Runtime/AmaGDK.UserProfile.cs +12 -11
- package/Runtime/AmaGDK.asmdef +1 -1
- package/Runtime/AmaGDK.cs +7 -7
- package/Runtime/AnalyticQualityAsset.cs +5 -6
- package/Runtime/AudioToolkit/AmaGDK.Audio.cs +3 -2
- package/Runtime/AudioToolkit/Plugins/AudioDeviceDetector.cs +2 -2
- package/Runtime/Core/GDKDebug.cs +97 -0
- package/Runtime/Core/GDKDebug.cs.meta +3 -0
- package/Runtime/Core/GDKPool.cs +56 -337
- package/Runtime/Core/GDKRoutine.cs +3 -1
- package/Runtime/Core/GDKSemVer.cs +1 -1
- package/Runtime/Core/GDKString.cs +197 -0
- package/Runtime/Core/GDKString.cs.meta +3 -0
- package/Runtime/EmbedRemoteConfigAsset.cs +2 -1
- package/Runtime/Fps/AmaFPS.Utils.cs +1 -1
- package/Runtime/Fps/AmaFPS.cs +1 -1
- package/Runtime/Fps/AmaFPSVisualizer.cs +1 -1
- package/Runtime/Fps/FrameRecorder.cs +1 -1
- package/Runtime/GDKAudio/GDKAudio.cs +11 -8
- package/Runtime/Internal/AmaGDK.Internal.cs +22 -33
- package/Runtime/Internal/AmaGDK.Utils.cs +4 -4
- package/Runtime/Internal/AmaGDK.WebUtils.cs +1 -1
- package/Runtime/Internal/GDKGeoLocationcs.cs +2 -1
- package/Runtime/Internal/GDKServerTime.cs +2 -1
- package/Runtime/Klavar/KlavarContainer.cs +4 -4
- package/Runtime/UserProfile/Plugins/Android/AdvertisingIdFetcher.cs +1 -1
- package/Runtime/Utils/GDKUtils.cs +1 -1
- 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.
|
|
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,
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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);
|
|
@@ -421,7 +419,7 @@ namespace Amanotes.Core
|
|
|
421
419
|
}
|
|
422
420
|
|
|
423
421
|
LogEventActually(eventData);
|
|
424
|
-
|
|
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
|
-
|
|
446
|
+
ForceLog($"AmaGDK [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
|
-
|
|
477
|
+
epPool.Return(eventParams);
|
|
480
478
|
sessionStat?.Save();
|
|
481
479
|
localData.SaveIfDirty();
|
|
482
480
|
}
|
|
@@ -519,7 +517,7 @@ namespace Amanotes.Core
|
|
|
519
517
|
{
|
|
520
518
|
Profiler.BeginSample("AmaGDK.Analytics.NormalizeEventName()");
|
|
521
519
|
{
|
|
522
|
-
var warningLog = GDKPool.
|
|
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
|
-
|
|
545
|
-
var tempLog = willLog ? GDKPool.
|
|
546
|
-
var tempKey = GDKPool.
|
|
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();
|
|
@@ -983,7 +981,7 @@ namespace Amanotes.Core
|
|
|
983
981
|
}
|
|
984
982
|
|
|
985
983
|
eventData.overrideConfig = true;
|
|
986
|
-
eventData.ignoreAdapterIds ??= GDKPool.
|
|
984
|
+
eventData.ignoreAdapterIds ??= GDKPool.GetHashSet();
|
|
987
985
|
|
|
988
986
|
foreach (string mId in analyticIds)
|
|
989
987
|
{
|
|
@@ -1009,18 +1007,7 @@ namespace Amanotes.Core
|
|
|
1009
1007
|
}
|
|
1010
1008
|
|
|
1011
1009
|
eventData.overrideConfig = true;
|
|
1012
|
-
|
|
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
|
-
}
|
|
1010
|
+
eventData.allowAdapterIds ??= GDKPool.GetHashSet();
|
|
1024
1011
|
|
|
1025
1012
|
foreach (string mId in analyticIds)
|
|
1026
1013
|
{
|
|
@@ -1102,7 +1089,7 @@ namespace Amanotes.Core
|
|
|
1102
1089
|
{
|
|
1103
1090
|
string eventName = (ap as EventParams)?.eventName;
|
|
1104
1091
|
|
|
1105
|
-
var sb = GDKPool.
|
|
1092
|
+
var sb = GDKPool.GetStringBuilder();
|
|
1106
1093
|
sb.Clear();
|
|
1107
1094
|
NormalizeKeyString(ref key, sb, AmaGDK.Config.analytics.normalizeEventName);
|
|
1108
1095
|
|
package/Runtime/AmaGDK.Config.cs
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
238
|
+
LogWarning("[Consent] ConsentHook.ATTRequest is null");
|
|
238
239
|
_attRequest = callback => callback(false);
|
|
239
240
|
return _attRequest;
|
|
240
241
|
}
|
package/Runtime/AmaGDK.Device.cs
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
78
|
+
Log(GDKPool.ReturnString(stringBuilder));
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
return result;
|
package/Runtime/AmaGDK.IAP.cs
CHANGED
|
@@ -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.
|
|
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.
|
|
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}");
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
398
|
+
Log($"[UserProfile] Generate ama_device_id: {_amaDeviceId}");
|
|
398
399
|
Save();
|
|
399
400
|
}
|
|
400
401
|
|
package/Runtime/AmaGDK.asmdef
CHANGED
package/Runtime/AmaGDK.cs
CHANGED
|
@@ -9,7 +9,7 @@ using Amanotes.Core.Internal;
|
|
|
9
9
|
using System.Linq;
|
|
10
10
|
using UnityEngine;
|
|
11
11
|
using UnityEngine.Profiling;
|
|
12
|
-
using static Amanotes.Core.
|
|
12
|
+
using static Amanotes.Core.GDKDebug;
|
|
13
13
|
using static Amanotes.Core.Internal.Messsage;
|
|
14
14
|
using Debug = UnityEngine.Debug;
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ namespace Amanotes.Core
|
|
|
17
17
|
{
|
|
18
18
|
public partial class AmaGDK : MonoBehaviour
|
|
19
19
|
{
|
|
20
|
-
public const string VERSION = "0.2.
|
|
20
|
+
public const string VERSION = "0.2.72";
|
|
21
21
|
|
|
22
22
|
internal static Status _status = Status.None;
|
|
23
23
|
private static ConfigAsset _config = null;
|
|
@@ -47,7 +47,7 @@ namespace Amanotes.Core
|
|
|
47
47
|
{
|
|
48
48
|
if (_config != null) return _config;
|
|
49
49
|
_config = Resources.Load<ConfigAsset>("AmaGDKConfig");
|
|
50
|
-
|
|
50
|
+
GDKDebug.logLevel = _config.common.logLevel;
|
|
51
51
|
return _config;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -176,7 +176,7 @@ namespace Amanotes.Core
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
var startTime = Time.realtimeSinceStartup;
|
|
179
|
-
|
|
179
|
+
var sb = GDKPool.GetStringBuilder();
|
|
180
180
|
|
|
181
181
|
InitModules();
|
|
182
182
|
|
|
@@ -210,7 +210,7 @@ namespace Amanotes.Core
|
|
|
210
210
|
LogEvent_GDKInit(Mathf.RoundToInt(initDuration));
|
|
211
211
|
|
|
212
212
|
sb.Append($"\nMapping UserId: {User.UserId}\n");
|
|
213
|
-
|
|
213
|
+
ForceLog($"AmaGDK v{VERSION} | {READY} in {initDuration:#0.00}s\n\n{sb}");
|
|
214
214
|
GDKPool.Return(sb);
|
|
215
215
|
}
|
|
216
216
|
|
|
@@ -265,8 +265,8 @@ namespace Amanotes.Core
|
|
|
265
265
|
|
|
266
266
|
public static LogLevel logLevel
|
|
267
267
|
{
|
|
268
|
-
get => Config.common.logLevel;
|
|
269
|
-
set =>
|
|
268
|
+
get => _config == null ? Config.common.logLevel : GDKDebug.logLevel;
|
|
269
|
+
set => GDKDebug.logLevel = value;
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
public static void Init(Action onReady = null)
|
|
@@ -4,8 +4,7 @@ using System.Collections.Generic;
|
|
|
4
4
|
using System.Linq;
|
|
5
5
|
using System.Text;
|
|
6
6
|
using UnityEngine;
|
|
7
|
-
using
|
|
8
|
-
using static Amanotes.Core.Internal.Logging;
|
|
7
|
+
using static Amanotes.Core.GDKDebug;
|
|
9
8
|
#if UNITY_EDITOR
|
|
10
9
|
using UnityEditor;
|
|
11
10
|
#endif
|
|
@@ -84,11 +83,11 @@ namespace Amanotes.Core
|
|
|
84
83
|
|
|
85
84
|
internal void ValidateParams(string eventName, Dictionary<string, object> eventParams)
|
|
86
85
|
{
|
|
87
|
-
var logBuilder = GDKPool.
|
|
86
|
+
var logBuilder = GDKPool.GetStringBuilder();
|
|
88
87
|
|
|
89
88
|
logBuilder.AppendLine($"Analytics quality violation found for event <{eventName}>");
|
|
90
89
|
var isValid = true;
|
|
91
|
-
HashSet<string> checkedParameters = GDKPool.
|
|
90
|
+
HashSet<string> checkedParameters = GDKPool.GetHashSet();
|
|
92
91
|
|
|
93
92
|
foreach (var kvp in DicParam)
|
|
94
93
|
{
|
|
@@ -183,7 +182,7 @@ namespace Amanotes.Core
|
|
|
183
182
|
[ContextMenu("Validate Unique EventNames")]
|
|
184
183
|
private void ValidateUniqueEventNames()
|
|
185
184
|
{
|
|
186
|
-
HashSet<string> eventNames = GDKPool.
|
|
185
|
+
HashSet<string> eventNames = GDKPool.GetHashSet();
|
|
187
186
|
|
|
188
187
|
lstEvent = lstEvent.OrderBy(evt => evt.eventName).ToList();
|
|
189
188
|
|
|
@@ -193,7 +192,7 @@ namespace Amanotes.Core
|
|
|
193
192
|
|
|
194
193
|
if (!eventNames.Add(eventQuality.eventName)) Debug.LogWarning($"Duplicate event name found: {eventQuality.eventName}. Event names must be unique.");
|
|
195
194
|
|
|
196
|
-
HashSet<string> paramNames = GDKPool.
|
|
195
|
+
HashSet<string> paramNames = GDKPool.GetHashSet();
|
|
197
196
|
|
|
198
197
|
eventQuality.lstParam = eventQuality.lstParam.OrderBy(param => param.paramName).ToList();
|
|
199
198
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
using UnityEngine;
|
|
2
2
|
using System;
|
|
3
3
|
using Amanotes.Core.Internal;
|
|
4
|
+
using static Amanotes.Core.GDKDebug;
|
|
4
5
|
|
|
5
6
|
namespace Amanotes.Core.Internal
|
|
6
7
|
{
|
|
@@ -69,7 +70,7 @@ namespace Amanotes.Core
|
|
|
69
70
|
|
|
70
71
|
if (onAudioDeviceChange == null)
|
|
71
72
|
{
|
|
72
|
-
|
|
73
|
+
LogWarning("Cannot add a null callback!");
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
75
76
|
|
|
@@ -111,7 +112,7 @@ namespace Amanotes.Core
|
|
|
111
112
|
{
|
|
112
113
|
if (_audioDeviceDetector == null)
|
|
113
114
|
{
|
|
114
|
-
|
|
115
|
+
LogWarning("AmaGDK | [Audio] Module has not been initialized!");
|
|
115
116
|
return NO_DEVICE;
|
|
116
117
|
}
|
|
117
118
|
|
|
@@ -176,7 +176,7 @@ namespace Amanotes.Core
|
|
|
176
176
|
{
|
|
177
177
|
if (sb == null)
|
|
178
178
|
{
|
|
179
|
-
sb = GDKPool.
|
|
179
|
+
sb = GDKPool.GetStringBuilder();
|
|
180
180
|
sb.Append(str, 0, i);
|
|
181
181
|
}
|
|
182
182
|
|
|
@@ -194,7 +194,7 @@ namespace Amanotes.Core
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
return sb == null ? str : GDKPool.
|
|
197
|
+
return sb == null ? str : GDKPool.ReturnString(sb);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
@@ -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
|
+
|