com.amanotes.gdk 0.2.49 → 0.2.51
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 +19 -0
- package/Editor/AmaGDKEditor.cs +26 -8
- package/Editor/Extra/GDKLocalBuild.cs +906 -0
- package/Editor/Extra/GDKLocalBuild.cs.meta +3 -0
- package/Editor/Extra/GDKProjectCP.cs +158 -0
- package/Editor/Extra/GDKProjectCP.cs.meta +11 -0
- package/Editor/Extra.meta +8 -0
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/AndroidPostProcessor.unitypackage +0 -0
- package/Extra/{AmaGDKProject.unitypackage.meta → AndroidPostProcessor.unitypackage.meta} +1 -1
- package/Extra/CheckDiskSpace.unitypackage +0 -0
- package/Extra/CheckDiskSpace.unitypackage.meta +7 -0
- package/Extra/SDKVersionTracking.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.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/RevenueCatAdapter.unitypackage +0 -0
- package/Runtime/AmaGDK.Adapters.cs +1 -1
- package/Runtime/AmaGDK.Ads.cs +20 -19
- package/Runtime/AmaGDK.Analytics.cs +148 -107
- package/Runtime/AmaGDK.UserProfile.cs +36 -32
- package/Runtime/AmaGDK.cs +2 -2
- package/Runtime/Internal/AmaGDK.Internal.cs +1 -0
- package/package.json +1 -1
- package/Extra/AmaGDKProject.unitypackage +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
using System;
|
|
2
|
+
using System.Collections.Concurrent;
|
|
2
3
|
using System.Collections.Generic;
|
|
3
4
|
using System.Text;
|
|
4
5
|
using System.Text.RegularExpressions;
|
|
@@ -39,10 +40,7 @@ namespace Amanotes.Core
|
|
|
39
40
|
this.eventName = eventName;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
public bool IsFunnelEvent
|
|
43
|
-
{
|
|
44
|
-
get { return !string.IsNullOrEmpty(funnelSignature); }
|
|
45
|
-
}
|
|
43
|
+
public bool IsFunnelEvent => !string.IsNullOrEmpty(funnelSignature);
|
|
46
44
|
|
|
47
45
|
public bool IsAdapterForbidden(string adapterId)
|
|
48
46
|
{
|
|
@@ -71,31 +69,22 @@ namespace Amanotes.Core
|
|
|
71
69
|
|
|
72
70
|
public static IEventParamsBuilder LogEvent(string eventName)
|
|
73
71
|
{
|
|
74
|
-
|
|
75
|
-
if (localData.GetEventDetail(eventName) == null && localData.eventDetails.Count >= 500)
|
|
76
|
-
{
|
|
77
|
-
LogWarning($" - You have reported 500 types of events. New event <{eventName}> will be ignored.");
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
var result = new EventParams(eventName);
|
|
72
|
+
var result = PrepareEvent(eventName);
|
|
81
73
|
eventQueue.Enqueue(result);
|
|
82
74
|
return result;
|
|
83
75
|
}
|
|
84
76
|
|
|
85
77
|
public static IEventParamsBuilder LogEvent(string eventName, Dictionary<string, object> parameters)
|
|
86
78
|
{
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
var result = PrepareEvent(eventName, parameters);
|
|
80
|
+
eventQueue.Enqueue(result);
|
|
81
|
+
return result;
|
|
89
82
|
}
|
|
90
83
|
|
|
91
84
|
public static IEventParamsBuilder LogEvent(string eventName, params (string, object)[] parameters)
|
|
92
85
|
{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
for (var i = 0; i < parameters.Length; i++)
|
|
96
|
-
{
|
|
97
|
-
result.AddParam(parameters[i].Item1, parameters[i].Item2);
|
|
98
|
-
}
|
|
86
|
+
var result = PrepareEvent(eventName, parameters);
|
|
87
|
+
eventQueue.Enqueue(result);
|
|
99
88
|
return result;
|
|
100
89
|
}
|
|
101
90
|
|
|
@@ -113,6 +102,24 @@ namespace Amanotes.Core
|
|
|
113
102
|
{
|
|
114
103
|
return LogEvent(eventName, parameters).SetAsFunnel(signature);
|
|
115
104
|
}
|
|
105
|
+
|
|
106
|
+
public static void LogEventImmediately(string eventName)
|
|
107
|
+
{
|
|
108
|
+
var eventParams = PrepareEvent(eventName);
|
|
109
|
+
LogEventImmediately(eventParams);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
public static void LogEventImmediately(string eventName, Dictionary<string, object> parameters)
|
|
113
|
+
{
|
|
114
|
+
var eventParams = PrepareEvent(eventName, parameters);
|
|
115
|
+
LogEventImmediately(eventParams);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public static void LogEventImmediately(string eventName, params (string, object)[] parameters)
|
|
119
|
+
{
|
|
120
|
+
var eventParams = PrepareEvent(eventName, parameters);
|
|
121
|
+
LogEventImmediately(eventParams);
|
|
122
|
+
}
|
|
116
123
|
|
|
117
124
|
public static int GetAccumulatedCount(string eventName, bool withinSession = false)
|
|
118
125
|
{
|
|
@@ -128,12 +135,18 @@ namespace Amanotes.Core
|
|
|
128
135
|
|
|
129
136
|
public static void SetUserId(string userId)
|
|
130
137
|
{
|
|
131
|
-
|
|
138
|
+
foreach (AnalyticsAdapter s in listAdapters)
|
|
139
|
+
{
|
|
140
|
+
s.SetUserId(userId);
|
|
141
|
+
}
|
|
132
142
|
}
|
|
133
143
|
|
|
134
144
|
public static void SetUserProperty(string key, string value)
|
|
135
145
|
{
|
|
136
|
-
|
|
146
|
+
foreach (AnalyticsAdapter s in listAdapters)
|
|
147
|
+
{
|
|
148
|
+
s.SetUserProperty(key, value);
|
|
149
|
+
}
|
|
137
150
|
}
|
|
138
151
|
|
|
139
152
|
private static IntegrityFlag MergeData(List<string> funnelEvents, Dictionary<string, int> eventCountMap, bool sumEventCount)
|
|
@@ -237,8 +250,7 @@ namespace Amanotes.Core
|
|
|
237
250
|
|
|
238
251
|
internal static readonly Dictionary<string, EventConfig> sendAtCount = new Dictionary<string, EventConfig>();
|
|
239
252
|
internal static Predicate<EventParams> logEventHook;
|
|
240
|
-
internal static readonly
|
|
241
|
-
internal static readonly Queue<Action> actionQueue = new Queue<Action>();
|
|
253
|
+
internal static readonly ConcurrentQueue<EventParams> eventQueue = new ConcurrentQueue<EventParams>();
|
|
242
254
|
internal static readonly List<AnalyticsAdapter> listAdapters = new List<AnalyticsAdapter>();
|
|
243
255
|
internal static readonly AnalyticsData localData = new AnalyticsData().LoadJsonFromFile();
|
|
244
256
|
internal static readonly SessionStat sessionStat = new SessionStat();
|
|
@@ -298,68 +310,109 @@ namespace Amanotes.Core
|
|
|
298
310
|
// TODO: Refactor Resolve Early Calls
|
|
299
311
|
onFrameUpdate -= ProcessEventQueue;
|
|
300
312
|
onFrameUpdate += ProcessEventQueue;
|
|
301
|
-
|
|
302
|
-
onFrameUpdate -= ProcessActionQueue;
|
|
303
|
-
onFrameUpdate += ProcessActionQueue;
|
|
304
313
|
}
|
|
305
|
-
|
|
314
|
+
|
|
315
|
+
internal static EventParams PrepareEvent(string eventName)
|
|
316
|
+
{
|
|
317
|
+
PrepareEventCheck(eventName);
|
|
318
|
+
var result = new EventParams(eventName);
|
|
319
|
+
PostPrepareEventProcess(result);
|
|
320
|
+
return result;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
internal static EventParams PrepareEvent(string eventName, Dictionary<string, object> parameters)
|
|
324
|
+
{
|
|
325
|
+
if (parameters == null) return PrepareEvent(eventName);
|
|
326
|
+
PrepareEventCheck(eventName);
|
|
327
|
+
var result = new EventParams(eventName);
|
|
328
|
+
result.AddParam(parameters);
|
|
329
|
+
PostPrepareEventProcess(result);
|
|
330
|
+
return result;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
internal static EventParams PrepareEvent(string eventName, params (string, object)[] parameters)
|
|
334
|
+
{
|
|
335
|
+
if (parameters == null) return PrepareEvent(eventName);
|
|
336
|
+
PrepareEventCheck(eventName);
|
|
337
|
+
var result = new EventParams(eventName);
|
|
338
|
+
for (var i = 0; i < parameters.Length; i++)
|
|
339
|
+
{
|
|
340
|
+
result.AddParam(parameters[i].Item1, parameters[i].Item2);
|
|
341
|
+
}
|
|
342
|
+
PostPrepareEventProcess(result);
|
|
343
|
+
return result;
|
|
344
|
+
}
|
|
345
|
+
|
|
306
346
|
internal static void ProcessEventQueue()
|
|
307
347
|
{
|
|
308
348
|
if (eventQueue.Count <= 0) return;
|
|
309
349
|
|
|
310
350
|
Profiler.BeginSample("AmaGDK.Analytics.ProcessEventQueue()");
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
351
|
+
|
|
352
|
+
sessionStat.savedEventStatsInLastFrame.Clear();
|
|
353
|
+
|
|
354
|
+
while (eventQueue.TryDequeue(out var eventData))
|
|
355
|
+
{
|
|
356
|
+
var (eventNameToSend, inUseAdapterIDs) = LogEventActually(eventData);
|
|
357
|
+
if (string.IsNullOrEmpty(eventNameToSend) || inUseAdapterIDs == null) continue;
|
|
358
|
+
sessionStat.Add(eventNameToSend, eventData, inUseAdapterIDs);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
localData.SaveIfDirty();
|
|
362
|
+
sessionStat.Save();
|
|
363
|
+
Profiler.EndSample();
|
|
364
|
+
}
|
|
314
365
|
|
|
315
|
-
|
|
366
|
+
internal static (string eventNameToSend, List<string> inUseAdapterIDs) LogEventActually(EventParams eventParams)
|
|
367
|
+
{
|
|
368
|
+
if (eventParams == null) return ("", null);
|
|
369
|
+
if (!ShouldSendEvent(eventParams)) return ("", null);
|
|
370
|
+
var (countInSession, totalCount) = localData.IncreaseCounter(eventParams);
|
|
371
|
+
if (eventParams.accumulated || eventParams.parameters.ContainsKey("accumulated_count"))
|
|
316
372
|
{
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
UpdateAccumulatedCount(eventData, countInSession, totalCount);
|
|
324
|
-
}
|
|
373
|
+
UpdateAccumulatedCount(eventParams, countInSession, totalCount);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
string eventNameToSend = GetEventNameToSend(eventParams.eventName, countInSession, totalCount);
|
|
377
|
+
AnalyticsConfig config = Config.analytics;
|
|
378
|
+
if (config.normalizeEventName) NormalizeEventName(ref eventNameToSend);
|
|
325
379
|
|
|
326
|
-
|
|
327
|
-
|
|
380
|
+
if (config.showAnalyticsLog)
|
|
381
|
+
{
|
|
382
|
+
Debug.Log($"AmaGDK [Analytics] Event <{eventNameToSend}> (in session: {countInSession}, total: {totalCount})\n{JsonUtils.DictionaryToJson(eventParams.parameters, true)}");
|
|
383
|
+
}
|
|
328
384
|
|
|
329
|
-
|
|
330
|
-
if (config.normalizeEventName) NormalizeEventName(ref eventNameToSend);
|
|
385
|
+
config.quality.CheckEventQuality(eventParams.eventName, eventParams.parameters);
|
|
331
386
|
|
|
332
|
-
|
|
387
|
+
var inUseAdapterIDs = new List<string>();
|
|
388
|
+
foreach (AnalyticsAdapter m in listAdapters)
|
|
389
|
+
{
|
|
390
|
+
if (eventParams.overrideConfig)
|
|
333
391
|
{
|
|
334
|
-
|
|
392
|
+
// IMPORTANT NOTE:
|
|
393
|
+
//
|
|
394
|
+
// Once set overrideConfig, we should skip the adapter config completely!!!
|
|
395
|
+
//
|
|
396
|
+
if (eventParams.IsAdapterForbidden(m.adapterId)) continue;
|
|
335
397
|
}
|
|
336
|
-
|
|
337
|
-
config.quality.CheckEventQuality(eventData.eventName, eventData.parameters);
|
|
338
|
-
|
|
339
|
-
var inUseAdapterIDs = new List<string>();
|
|
340
|
-
foreach (AnalyticsAdapter m in listAdapters)
|
|
398
|
+
else // Do not remove else
|
|
341
399
|
{
|
|
342
|
-
if (
|
|
343
|
-
{
|
|
344
|
-
// IMPORTANT NOTE:
|
|
345
|
-
//
|
|
346
|
-
// Once set overrideConfig, we should skip the adapter config completely!!!
|
|
347
|
-
//
|
|
348
|
-
if (eventData.IsAdapterForbidden(m.adapterId)) continue;
|
|
349
|
-
}
|
|
350
|
-
else // Do not remove else
|
|
351
|
-
{
|
|
352
|
-
if (m.IsForbidden(eventData.eventName)) continue;
|
|
353
|
-
}
|
|
354
|
-
m.LogEvent(eventNameToSend, eventData.parameters);
|
|
355
|
-
inUseAdapterIDs.Add(m.adapterId);
|
|
400
|
+
if (m.IsForbidden(eventParams.eventName)) continue;
|
|
356
401
|
}
|
|
357
|
-
|
|
402
|
+
m.LogEvent(eventNameToSend, eventParams.parameters);
|
|
403
|
+
inUseAdapterIDs.Add(m.adapterId);
|
|
358
404
|
}
|
|
359
405
|
|
|
360
|
-
|
|
406
|
+
return (eventNameToSend, inUseAdapterIDs);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
internal static void LogEventImmediately(EventParams eventParams)
|
|
410
|
+
{
|
|
411
|
+
var (eventNameToSend, inUseAdapterIDs) = LogEventActually(eventParams);
|
|
412
|
+
if (string.IsNullOrEmpty(eventNameToSend) || inUseAdapterIDs == null) return;
|
|
413
|
+
sessionStat.Add(eventNameToSend, eventParams, inUseAdapterIDs);
|
|
361
414
|
sessionStat.Save();
|
|
362
|
-
|
|
415
|
+
localData.SaveIfDirty();
|
|
363
416
|
}
|
|
364
417
|
|
|
365
418
|
internal static void UpdateAccumulatedCount(EventParams eventData, int countInSession, int totalCount)
|
|
@@ -411,7 +464,7 @@ namespace Amanotes.Core
|
|
|
411
464
|
|
|
412
465
|
internal static void NormalizeKeyString(ref string key, StringBuilder warningLog, bool dryRun)
|
|
413
466
|
{
|
|
414
|
-
Profiler.BeginSample("AmaGDK.Analytics.
|
|
467
|
+
Profiler.BeginSample("AmaGDK.Analytics.NormalizeKeyString()");
|
|
415
468
|
{
|
|
416
469
|
if (string.IsNullOrWhiteSpace(key))
|
|
417
470
|
{
|
|
@@ -465,6 +518,22 @@ namespace Amanotes.Core
|
|
|
465
518
|
}
|
|
466
519
|
Profiler.EndSample();
|
|
467
520
|
}
|
|
521
|
+
|
|
522
|
+
internal static void PrepareEventCheck(string eventName)
|
|
523
|
+
{
|
|
524
|
+
NormalizeEventName(ref eventName, true);
|
|
525
|
+
|
|
526
|
+
if (localData.GetEventDetail(eventName) == null && localData.eventDetails.Count >= 500)
|
|
527
|
+
{
|
|
528
|
+
LogWarning($" - You have reported 500 types of events. New event <{eventName}> will be ignored.");
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
internal static void PostPrepareEventProcess(EventParams eventData)
|
|
533
|
+
{
|
|
534
|
+
if (!eventData.parameters.ContainsKey("ama_device_id"))
|
|
535
|
+
eventData.AddParam("ama_device_id", User.AmaDeviceId);
|
|
536
|
+
}
|
|
468
537
|
|
|
469
538
|
internal static bool ShouldSendEvent(EventParams eventData)
|
|
470
539
|
{
|
|
@@ -489,33 +558,6 @@ namespace Amanotes.Core
|
|
|
489
558
|
|
|
490
559
|
return true;
|
|
491
560
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
internal static void ProcessActionQueue()
|
|
495
|
-
{
|
|
496
|
-
if (actionQueue.Count <= 0) return;
|
|
497
|
-
while (actionQueue.Count > 0)
|
|
498
|
-
{
|
|
499
|
-
var action = actionQueue.Dequeue();
|
|
500
|
-
action.Invoke();
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
internal static void InternalSetUserId(string userId)
|
|
505
|
-
{
|
|
506
|
-
foreach (AnalyticsAdapter s in listAdapters)
|
|
507
|
-
{
|
|
508
|
-
s.SetUserId(userId);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
internal static void InternalSetUserProperty(string key, string value)
|
|
513
|
-
{
|
|
514
|
-
foreach (AnalyticsAdapter s in listAdapters)
|
|
515
|
-
{
|
|
516
|
-
s.SetUserProperty(key, value);
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
561
|
}
|
|
520
562
|
|
|
521
563
|
//PERSISTENT DATA
|
|
@@ -645,7 +687,7 @@ namespace Amanotes.Core
|
|
|
645
687
|
migrationLog.count++;
|
|
646
688
|
Log($"Analytics data was migrated {migrationLog.count} times");
|
|
647
689
|
|
|
648
|
-
if (migrationLog.count == 2) LogEvent("migration_error"
|
|
690
|
+
if (migrationLog.count == 2) LogEvent("migration_error", migrationLog.ToDictionary());
|
|
649
691
|
}
|
|
650
692
|
|
|
651
693
|
_dirty = true;
|
|
@@ -659,17 +701,13 @@ namespace Amanotes.Core
|
|
|
659
701
|
private readonly string fileName = nameof(SessionStat) + DateTime.Now.ToString("_yyMMdd_HHmmss") + ".tsv";
|
|
660
702
|
private StringBuilder contents = new StringBuilder();
|
|
661
703
|
private bool isFirstSave = true;
|
|
662
|
-
|
|
704
|
+
private readonly ConcurrentQueue<EventStat> lastFrameEventStats = new ConcurrentQueue<EventStat>();
|
|
705
|
+
internal readonly ConcurrentQueue<EventStat> savedEventStatsInLastFrame = new ConcurrentQueue<EventStat>();
|
|
663
706
|
|
|
664
707
|
internal void Add(string eventNameToSend, EventParams eventParams, List<string> adapterIDs)
|
|
665
708
|
{
|
|
666
709
|
var eventStat = new EventStat(eventNameToSend, eventParams, adapterIDs);
|
|
667
|
-
lastFrameEventStats.
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
internal void ClearLastFrameEventInfo()
|
|
671
|
-
{
|
|
672
|
-
lastFrameEventStats.Clear();
|
|
710
|
+
lastFrameEventStats.Enqueue(eventStat);
|
|
673
711
|
}
|
|
674
712
|
|
|
675
713
|
internal void Save()
|
|
@@ -682,14 +720,17 @@ namespace Amanotes.Core
|
|
|
682
720
|
contents = contents.AppendLine(TSV_HEADER_ROW);
|
|
683
721
|
isFirstSave = false;
|
|
684
722
|
}
|
|
685
|
-
|
|
723
|
+
while (lastFrameEventStats.TryDequeue(out var stat))
|
|
686
724
|
{
|
|
687
725
|
contents.AppendLine(stat.ToTsv());
|
|
726
|
+
savedEventStatsInLastFrame.Enqueue(stat);
|
|
688
727
|
}
|
|
689
728
|
|
|
690
729
|
GDKFileUtils.SaveAppend(fileName, contents.ToString());
|
|
691
730
|
}
|
|
692
731
|
}
|
|
732
|
+
|
|
733
|
+
|
|
693
734
|
}
|
|
694
735
|
}
|
|
695
736
|
|
|
@@ -771,7 +812,7 @@ namespace Amanotes.Core
|
|
|
771
812
|
return ap;
|
|
772
813
|
}
|
|
773
814
|
|
|
774
|
-
|
|
815
|
+
internal static IEventParamsBuilder AddParam(this IEventParamsBuilder ap, string key, object value)
|
|
775
816
|
{
|
|
776
817
|
if (ap == null) return null;
|
|
777
818
|
if (!IsValidKeyValue(ap, ref key, ref value)) return ap;
|
|
@@ -795,7 +836,7 @@ namespace Amanotes.Core
|
|
|
795
836
|
return ap;
|
|
796
837
|
}
|
|
797
838
|
|
|
798
|
-
|
|
839
|
+
internal static IEventParamsBuilder AddParam(this IEventParamsBuilder ap, Dictionary<string, object> dictParams)
|
|
799
840
|
{
|
|
800
841
|
if (ap == null) return null;
|
|
801
842
|
if (dictParams == null)
|
|
@@ -814,7 +855,7 @@ namespace Amanotes.Core
|
|
|
814
855
|
return ap;
|
|
815
856
|
}
|
|
816
857
|
|
|
817
|
-
|
|
858
|
+
internal static IEventParamsBuilder AddParam(this IEventParamsBuilder ap, params (string key, object value)[] parameters)
|
|
818
859
|
{
|
|
819
860
|
if (ap == null) return null;
|
|
820
861
|
if (parameters.Length == 0)
|
|
@@ -200,14 +200,14 @@ namespace Amanotes.Core
|
|
|
200
200
|
#elif UNITY_IOS
|
|
201
201
|
IDFV = SystemInfo.deviceUniqueIdentifier;
|
|
202
202
|
#endif
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
GetAdvertisingId();
|
|
203
|
+
GetAmaDeviceId();
|
|
204
|
+
UpdateUserId();
|
|
206
205
|
}
|
|
207
206
|
|
|
208
207
|
internal void StartModule()
|
|
209
208
|
{
|
|
210
|
-
|
|
209
|
+
// Always get the latest advertising id
|
|
210
|
+
GetAdvertisingId();
|
|
211
211
|
Logging.Log($"[UserProfile] user_id: {_userId}");
|
|
212
212
|
}
|
|
213
213
|
|
|
@@ -231,39 +231,43 @@ namespace Amanotes.Core
|
|
|
231
231
|
GDKUtils.DelayCall(0, () =>
|
|
232
232
|
{
|
|
233
233
|
SetAdvertisingID(advertisingId);
|
|
234
|
-
switch (Application.platform)
|
|
235
|
-
{
|
|
236
|
-
case RuntimePlatform.IPhonePlayer:
|
|
237
|
-
string v = KeyChain.GetKeyChain(AMA_DEVICE_ID_KEY);
|
|
238
|
-
if (string.IsNullOrEmpty(v))
|
|
239
|
-
{
|
|
240
|
-
v = Guid.NewGuid().ToString();
|
|
241
|
-
KeyChain.SetKeyChain(AMA_DEVICE_ID_KEY, v);
|
|
242
|
-
}
|
|
243
|
-
AmaDeviceId = v;
|
|
244
|
-
break;
|
|
245
|
-
|
|
246
|
-
case RuntimePlatform.Android:
|
|
247
|
-
string cachedAmaDeviceId = PlayerPrefs.GetString(AMA_DEVICE_ID_KEY);
|
|
248
|
-
if (string.IsNullOrEmpty(cachedAmaDeviceId))
|
|
249
|
-
{
|
|
250
|
-
cachedAmaDeviceId = SystemInfo.deviceUniqueIdentifier;
|
|
251
|
-
PlayerPrefs.SetString(AMA_DEVICE_ID_KEY, cachedAmaDeviceId);
|
|
252
|
-
}
|
|
253
|
-
AmaDeviceId = cachedAmaDeviceId;
|
|
254
|
-
break;
|
|
255
|
-
|
|
256
|
-
default:
|
|
257
|
-
AmaDeviceId = SystemInfo.deviceUniqueIdentifier;
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
Logging.Log($"[UserProfile] ama_device_id: {_amaDeviceId}");
|
|
262
234
|
Save();
|
|
263
235
|
});
|
|
264
236
|
});
|
|
265
237
|
}
|
|
266
238
|
|
|
239
|
+
private void GetAmaDeviceId()
|
|
240
|
+
{
|
|
241
|
+
if (!string.IsNullOrEmpty(AmaDeviceId)) return;
|
|
242
|
+
switch (Application.platform)
|
|
243
|
+
{
|
|
244
|
+
case RuntimePlatform.IPhonePlayer:
|
|
245
|
+
string v = KeyChain.GetKeyChain(AMA_DEVICE_ID_KEY);
|
|
246
|
+
if (string.IsNullOrEmpty(v))
|
|
247
|
+
{
|
|
248
|
+
v = Guid.NewGuid().ToString();
|
|
249
|
+
KeyChain.SetKeyChain(AMA_DEVICE_ID_KEY, v);
|
|
250
|
+
}
|
|
251
|
+
AmaDeviceId = v;
|
|
252
|
+
break;
|
|
253
|
+
|
|
254
|
+
case RuntimePlatform.Android:
|
|
255
|
+
string cachedAmaDeviceId = PlayerPrefs.GetString(AMA_DEVICE_ID_KEY);
|
|
256
|
+
if (string.IsNullOrEmpty(cachedAmaDeviceId))
|
|
257
|
+
{
|
|
258
|
+
cachedAmaDeviceId = SystemInfo.deviceUniqueIdentifier;
|
|
259
|
+
}
|
|
260
|
+
AmaDeviceId = cachedAmaDeviceId;
|
|
261
|
+
break;
|
|
262
|
+
|
|
263
|
+
default:
|
|
264
|
+
AmaDeviceId = SystemInfo.deviceUniqueIdentifier;
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
Logging.Log($"[UserProfile] Generate ama_device_id: {_amaDeviceId}");
|
|
268
|
+
Save();
|
|
269
|
+
}
|
|
270
|
+
|
|
267
271
|
private string ValidateId (string id, string pattern)
|
|
268
272
|
{
|
|
269
273
|
if (string.IsNullOrWhiteSpace(id)) return null;
|
package/Runtime/AmaGDK.cs
CHANGED
|
@@ -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.51";
|
|
21
21
|
|
|
22
22
|
internal static AmaGDK _instance;
|
|
23
23
|
internal static Status _status = Status.None;
|
|
@@ -182,12 +182,12 @@ namespace Amanotes.Core
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
float startTime = Time.realtimeSinceStartup;
|
|
185
|
-
yield return InitHook();
|
|
186
185
|
|
|
187
186
|
dispatcher.Dispatch(Event.GDK_INIT_START);
|
|
188
187
|
var sb = new StringBuilder();
|
|
189
188
|
InitModules();
|
|
190
189
|
|
|
190
|
+
yield return InitHook();
|
|
191
191
|
yield return WaitForManualInit();
|
|
192
192
|
yield return InitAdapters(sb);
|
|
193
193
|
|
|
@@ -39,6 +39,7 @@ namespace Amanotes.Core.Internal
|
|
|
39
39
|
#endif
|
|
40
40
|
|
|
41
41
|
public const string PACKAGE_PATH = BASE_PATH + "Packages/";
|
|
42
|
+
public const string EXTRA_PATH = BASE_PATH + "Extra/";
|
|
42
43
|
public const string AMAGDK_PREFAB = BASE_PATH + "Runtime/AmaGDK.prefab";
|
|
43
44
|
public const string AMAGDK_CONFIG_PACKAGE = PACKAGE_PATH + "AmaGDKConfig.unitypackage";
|
|
44
45
|
|
package/package.json
CHANGED
|
Binary file
|