com.amanotes.gdk 0.2.70 → 0.2.71
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 +18 -0
- package/Editor/Extra/GDKCIBuildCommand.cs +55 -0
- 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/AdModuleConfig.cs +19 -4
- package/Runtime/Ad/AmaGDK.Ads.cs +19 -7
- package/Runtime/AmaGDK.Analytics.cs +63 -48
- package/Runtime/AmaGDK.Device.cs +2 -2
- package/Runtime/AmaGDK.RemoteConfig.cs +1 -1
- package/Runtime/AmaGDK.cs +2 -2
- package/Runtime/AnalyticQualityAsset.cs +5 -4
- package/Runtime/AudioToolkit/Plugins/AudioDeviceDetector.cs +2 -2
- package/Runtime/Core/GDKPool.cs +337 -55
- package/Runtime/Fps/AmaFPS.Utils.cs +1 -1
- package/Runtime/GDKAudio/GDKAudio.cs +305 -0
- package/Runtime/GDKAudio/GDKAudio.cs.meta +3 -0
- package/Runtime/GDKAudio/Plugins/Android/atensor-release.aar +0 -0
- package/Runtime/GDKAudio/Plugins/Android/atensor-release.aar.meta +32 -0
- package/Runtime/GDKAudio/Plugins/Android.meta +3 -0
- package/Runtime/GDKAudio/Plugins/iOS/libatensor.a +0 -0
- package/Runtime/GDKAudio/Plugins/iOS/libatensor.a.meta +68 -0
- package/Runtime/GDKAudio/Plugins/iOS/libcrypto.a +0 -0
- package/Runtime/GDKAudio/Plugins/iOS/libcrypto.a.meta +68 -0
- package/Runtime/GDKAudio/Plugins/iOS/libssl.a +0 -0
- package/Runtime/GDKAudio/Plugins/iOS/libssl.a.meta +68 -0
- package/Runtime/GDKAudio/Plugins/iOS.meta +8 -0
- package/Runtime/GDKAudio/Plugins/macOS/libatensor.dylib +0 -0
- package/Runtime/GDKAudio/Plugins/macOS/libatensor.dylib.meta +81 -0
- package/Runtime/GDKAudio/Plugins/macOS.meta +8 -0
- package/Runtime/GDKAudio/Plugins.meta +8 -0
- package/Runtime/GDKAudio.meta +3 -0
- package/Runtime/Internal/AmaGDK.Utils.cs +3 -3
- package/Runtime/Internal/ForceQuitMonitor.cs +7 -2
- package/Runtime/Utils/GDKUtils.cs +34 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.71 - 2024-08-22]
|
|
4
|
+
- [Dev] Add export stage to reduce pipeline build time
|
|
5
|
+
- [Dev] Cache IL2CPP and Gradle user home
|
|
6
|
+
- [Dev] Improve GDKPool performance main thread by using non-locking structure
|
|
7
|
+
- [Fix] Accidental GC generated with SafeInvoke()
|
|
8
|
+
- [Dev] Add capping config for interstitial
|
|
9
|
+
- [Dev] Add event videoads_closed
|
|
10
|
+
- [Klavar] GDUC 0.3.0
|
|
11
|
+
- [Fix] Missing handle for Rectangle banner in IronSourceAdapter
|
|
12
|
+
- [Feature] Add GDKAudio with Audio Time-Stretching Support
|
|
13
|
+
- - Available on iOS, android, and Editor Apple silicon
|
|
14
|
+
- [Fix] CI Job retry for Unity Editor stuck issue
|
|
15
|
+
- [Dev] Reduce the unit test time
|
|
16
|
+
- [Dev] Improve FirebaseAnalytics GC by reuse Parameter Array
|
|
17
|
+
- [Feature] Add callback Analytics.OnEventSent
|
|
18
|
+
- [Dev] Add support pod install and debug symbol generation in CI script
|
|
19
|
+
- [Fix] Missing handler for various types in FirebaseAnalyticsAdapter
|
|
20
|
+
|
|
3
21
|
## [0.2.70 - 2024-08-02]
|
|
4
22
|
- [Fix] onAdResult call multiple times
|
|
5
23
|
- [Dev] Show SQLite analytics in GDK Inspector
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
using UnityEditor;
|
|
2
2
|
using System.Linq;
|
|
3
3
|
using System;
|
|
4
|
+
using System.Diagnostics;
|
|
4
5
|
using System.IO;
|
|
5
6
|
using UnityEditor.Build;
|
|
6
7
|
using UnityEditor.Build.Reporting;
|
|
7
8
|
using UnityEngine;
|
|
9
|
+
using Debug = UnityEngine.Debug;
|
|
8
10
|
|
|
9
11
|
namespace Amanotes.Core
|
|
10
12
|
{
|
|
@@ -18,8 +20,40 @@ namespace Amanotes.Core
|
|
|
18
20
|
private const string ANDROID_BUNDLE_VERSION_CODE = "VERSION_BUILD_VAR";
|
|
19
21
|
private const string ANDROID_APP_BUNDLE = "BUILD_APP_BUNDLE";
|
|
20
22
|
private const string SCRIPTING_BACKEND_ENV_VAR = "SCRIPTING_BACKEND";
|
|
23
|
+
private const string EXPORT_ANDROID_PROJECT = "EXPORT_ANDROID_PROJECT";
|
|
21
24
|
private const string VERSION_NUMBER_VAR = "VERSION_NUMBER_VAR";
|
|
22
25
|
private const string VERSION_iOS = "VERSION_BUILD_VAR";
|
|
26
|
+
|
|
27
|
+
public static void InstallPod(EventHandler processExit)
|
|
28
|
+
{
|
|
29
|
+
try
|
|
30
|
+
{
|
|
31
|
+
if (TryGetEnv("CI_SCRIPT_DIR", out string scriptDir))
|
|
32
|
+
{
|
|
33
|
+
var startInfo = new ProcessStartInfo()
|
|
34
|
+
{
|
|
35
|
+
FileName = "/bin/bash",
|
|
36
|
+
Arguments = $"{scriptDir}/utils.sh pod-install",
|
|
37
|
+
CreateNoWindow = true
|
|
38
|
+
};
|
|
39
|
+
var proc = new Process
|
|
40
|
+
{
|
|
41
|
+
StartInfo = startInfo,
|
|
42
|
+
EnableRaisingEvents = true
|
|
43
|
+
};
|
|
44
|
+
proc.Exited += processExit;
|
|
45
|
+
proc.Start();
|
|
46
|
+
proc.WaitForExit();
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
{
|
|
50
|
+
Debug.Log("Failed to run pod install: $CI_SCRIPT_DIR not found");
|
|
51
|
+
}
|
|
52
|
+
} catch (Exception e)
|
|
53
|
+
{
|
|
54
|
+
Debug.LogError(e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
23
57
|
|
|
24
58
|
static string GetArgument(string name)
|
|
25
59
|
{
|
|
@@ -200,6 +234,8 @@ namespace Amanotes.Core
|
|
|
200
234
|
HandleAndroidAppBundle();
|
|
201
235
|
HandleAndroidBundleVersionCode();
|
|
202
236
|
HandleAndroidKeystore();
|
|
237
|
+
HandleDebugSymbols();
|
|
238
|
+
HandleExportAndroidProject();
|
|
203
239
|
}
|
|
204
240
|
|
|
205
241
|
var buildPath = GetBuildPath();
|
|
@@ -251,6 +287,16 @@ namespace Amanotes.Core
|
|
|
251
287
|
}
|
|
252
288
|
}
|
|
253
289
|
|
|
290
|
+
private static void HandleExportAndroidProject()
|
|
291
|
+
{
|
|
292
|
+
EditorUserBuildSettings.exportAsGoogleAndroidProject = false;
|
|
293
|
+
if (!TryGetEnv(EXPORT_ANDROID_PROJECT, out string stringValue)) return;
|
|
294
|
+
if (bool.TryParse(stringValue, out bool exportAndroidProject))
|
|
295
|
+
{
|
|
296
|
+
EditorUserBuildSettings.exportAsGoogleAndroidProject = exportAndroidProject;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
254
300
|
private static string GetIosVersion()
|
|
255
301
|
{
|
|
256
302
|
if (TryGetEnv(VERSION_iOS, out string value))
|
|
@@ -311,6 +357,15 @@ namespace Amanotes.Core
|
|
|
311
357
|
PlayerSettings.Android.keystorePass = keystorePass;
|
|
312
358
|
PlayerSettings.Android.keyaliasPass = keystoreAliasPass;
|
|
313
359
|
}
|
|
360
|
+
|
|
361
|
+
private static void HandleDebugSymbols()
|
|
362
|
+
{
|
|
363
|
+
#if UNITY_2021_1_OR_NEWER
|
|
364
|
+
EditorUserBuildSettings.androidCreateSymbols = AndroidCreateSymbols.Debugging;
|
|
365
|
+
#elif UNITY_2019_2_OR_NEWER
|
|
366
|
+
EditorUserBuildSettings.androidCreateSymbolsZip = true;
|
|
367
|
+
#endif
|
|
368
|
+
}
|
|
314
369
|
}
|
|
315
370
|
|
|
316
371
|
public class GDKPreProcessBuild: IPreprocessBuildWithReport
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
using System;
|
|
1
|
+
using System;
|
|
2
2
|
using UnityEngine;
|
|
3
3
|
|
|
4
4
|
namespace Amanotes.Core.Internal
|
|
5
5
|
{
|
|
6
|
+
[Serializable] public class AdCapping
|
|
7
|
+
{
|
|
8
|
+
[Tooltip("Capping time (in seconds, default = 0s) since App Open.")]
|
|
9
|
+
public float sinceAppOpen = 0;
|
|
10
|
+
|
|
11
|
+
[Tooltip("Capping time (in seconds, default = 15s) calculated since last interstitial closed.")]
|
|
12
|
+
public float sinceLastInterstitial = 15;
|
|
13
|
+
|
|
14
|
+
[Tooltip("Capping time (in seconds, default = 10s) calculated since last video reward closed.")]
|
|
15
|
+
public float sinceLastVideoReward = 10;
|
|
16
|
+
}
|
|
17
|
+
|
|
6
18
|
[Serializable] public class AdModuleConfig
|
|
7
19
|
{
|
|
8
20
|
[Tooltip("Automatically retry requesting ad if an ad failed to response in this amount of time (in secs)")]
|
|
@@ -12,11 +24,14 @@ namespace Amanotes.Core.Internal
|
|
|
12
24
|
public int adShowTimeoutInSecs = 5;
|
|
13
25
|
|
|
14
26
|
[Tooltip("When an ad is not ready to show, verify that there is an internet connection by ping the internet check URL .\nIf there is no internet connection, we will not need to wait for adShowTimeout secs")]
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
public bool checkInternet = true;
|
|
28
|
+
|
|
17
29
|
[NonSerialized] public bool enableInterstitial = true;
|
|
18
30
|
[NonSerialized] public bool enableRewarded = true;
|
|
19
|
-
|
|
31
|
+
[NonSerialized] public bool enableBanner = true;
|
|
32
|
+
|
|
33
|
+
[Tooltip("Capping configuration for Interstitial\n\n - All the conditions below must be satisfied for interstitial to show")]
|
|
34
|
+
public AdCapping interstitialCapping;
|
|
20
35
|
|
|
21
36
|
[Tooltip("Before showing an ad: set AudioListener.volume to 0\nAfter the ad is closed: restore the previously saved AudioListener.volume")]
|
|
22
37
|
public bool autoMute = true;
|
package/Runtime/Ad/AmaGDK.Ads.cs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
using System;
|
|
1
|
+
using System;
|
|
2
2
|
using System.Collections;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using UnityEngine;
|
|
@@ -46,7 +46,12 @@ namespace Amanotes.Core
|
|
|
46
46
|
|
|
47
47
|
// persistent
|
|
48
48
|
public int successTotal;
|
|
49
|
-
|
|
49
|
+
public int failedTotal;
|
|
50
|
+
|
|
51
|
+
internal bool IsCapped(float cappingTime)
|
|
52
|
+
{
|
|
53
|
+
return (successTotal > 0) && (Time.realtimeSinceStartup - lastSuccessTime < cappingTime);
|
|
54
|
+
}
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
[Serializable]
|
|
@@ -301,11 +306,18 @@ namespace Amanotes.Core
|
|
|
301
306
|
/// <param name="interstitialCappingTime"></param>
|
|
302
307
|
/// <param name="rewardedVideoCappingTime"></param>
|
|
303
308
|
/// <returns></returns>
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
+
public static bool IsCapped(float? interstitialCappingTime = null, float? rewardedVideoCappingTime = null)
|
|
310
|
+
{
|
|
311
|
+
var config = Config.ad.interstitialCapping;
|
|
312
|
+
|
|
313
|
+
// cap by interstitial
|
|
314
|
+
if (localData.interstitial.IsCapped(interstitialCappingTime ?? config.sinceLastInterstitial)) return true;
|
|
315
|
+
|
|
316
|
+
// cap by rewarded video
|
|
317
|
+
if (localData.reward.IsCapped(rewardedVideoCappingTime ?? config.sinceLastVideoReward)) return true;
|
|
318
|
+
|
|
319
|
+
// cap by app Open
|
|
320
|
+
return Time.realtimeSinceStartup < config.sinceAppOpen;
|
|
309
321
|
}
|
|
310
322
|
|
|
311
323
|
public static int TimeSinceLastInterstitialSucceed => localData.TimeSinceLastShowSuccess(AdType.Interstitial);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
using System;
|
|
1
|
+
using System;
|
|
2
2
|
using System.Collections.Concurrent;
|
|
3
3
|
using System.Collections.Generic;
|
|
4
4
|
using System.Text;
|
|
@@ -15,6 +15,8 @@ namespace Amanotes.Core
|
|
|
15
15
|
//PUBLIC APIS
|
|
16
16
|
public static partial class Analytics
|
|
17
17
|
{
|
|
18
|
+
public static event Action<string, Dictionary<string, object>> OnEventSent;
|
|
19
|
+
|
|
18
20
|
public static bool HasMigrated => localData.migrationLog.count > 0;
|
|
19
21
|
|
|
20
22
|
public static bool enableAnalyticsLog
|
|
@@ -23,9 +25,9 @@ namespace Amanotes.Core
|
|
|
23
25
|
get => Config.analytics.showAnalyticsLog;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
public interface IEventParamsBuilder { }
|
|
28
|
+
public interface IEventParamsBuilder { }
|
|
27
29
|
|
|
28
|
-
public class EventParams : IEventParamsBuilder, IPoolItem
|
|
30
|
+
public class EventParams : IEventParamsBuilder, GDKPool.IPoolItem
|
|
29
31
|
{
|
|
30
32
|
public string eventName { get; private set; }
|
|
31
33
|
public readonly Dictionary<string, object> parameters = new Dictionary<string, object>();
|
|
@@ -54,6 +56,7 @@ namespace Amanotes.Core
|
|
|
54
56
|
|
|
55
57
|
internal EventParams SetEventName(string eventName)
|
|
56
58
|
{
|
|
59
|
+
// Debug.Log($"SetEventName --> {this} : {GetHashCode()}");
|
|
57
60
|
this.eventName = eventName;
|
|
58
61
|
return this;
|
|
59
62
|
}
|
|
@@ -71,6 +74,8 @@ namespace Amanotes.Core
|
|
|
71
74
|
|
|
72
75
|
GDKPool.ReturnAndNullize(ref ignoreAdapterIds);
|
|
73
76
|
GDKPool.ReturnAndNullize(ref allowAdapterIds);
|
|
77
|
+
|
|
78
|
+
//Debug.Log($"Reset --> {this} : {GetHashCode()}");
|
|
74
79
|
_detail = null;
|
|
75
80
|
}
|
|
76
81
|
|
|
@@ -308,7 +313,6 @@ namespace Amanotes.Core
|
|
|
308
313
|
internal static readonly List<AnalyticsAdapter> listAdapters = new List<AnalyticsAdapter>();
|
|
309
314
|
internal static readonly AnalyticsData localData = new AnalyticsData().LoadJsonFromFile().BuildCache();
|
|
310
315
|
internal static SessionStat sessionStat;
|
|
311
|
-
internal static readonly GDKPool.Pool<EventParams> epPool = new GDKPool.Pool<EventParams>(1);
|
|
312
316
|
|
|
313
317
|
internal static readonly Dictionary<string, string> reservedPrefixes = new Dictionary<string, string>()
|
|
314
318
|
{
|
|
@@ -373,7 +377,7 @@ namespace Amanotes.Core
|
|
|
373
377
|
internal static EventParams PrepareEvent(string eventName)
|
|
374
378
|
{
|
|
375
379
|
PrepareEventCheck(eventName);
|
|
376
|
-
var result =
|
|
380
|
+
var result = GDKPool.Take<EventParams>().SetEventName(eventName);
|
|
377
381
|
PostPrepareEventProcess(result);
|
|
378
382
|
return result;
|
|
379
383
|
}
|
|
@@ -382,7 +386,7 @@ namespace Amanotes.Core
|
|
|
382
386
|
{
|
|
383
387
|
if (parameters == null) return PrepareEvent(eventName);
|
|
384
388
|
PrepareEventCheck(eventName);
|
|
385
|
-
var result =
|
|
389
|
+
var result = GDKPool.Take<EventParams>().SetEventName(eventName);
|
|
386
390
|
result.AddParam(parameters);
|
|
387
391
|
PostPrepareEventProcess(result);
|
|
388
392
|
return result;
|
|
@@ -392,7 +396,7 @@ namespace Amanotes.Core
|
|
|
392
396
|
{
|
|
393
397
|
if (parameters == null) return PrepareEvent(eventName);
|
|
394
398
|
PrepareEventCheck(eventName);
|
|
395
|
-
var result =
|
|
399
|
+
var result = GDKPool.Take<EventParams>().SetEventName(eventName);
|
|
396
400
|
for (var i = 0; i < parameters.Length; i++)
|
|
397
401
|
{
|
|
398
402
|
result.AddParam(parameters[i].Item1, parameters[i].Item2);
|
|
@@ -412,11 +416,12 @@ namespace Amanotes.Core
|
|
|
412
416
|
while (eventQueue.TryDequeue(out var eventData))
|
|
413
417
|
{
|
|
414
418
|
if (eventData.isLoggedImmediately) continue;
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
419
|
+
if (Config.analytics.immediatelyLoggedEvents.Contains(eventData.eventName)){
|
|
420
|
+
Utils.ThrowExceptionIfEditor($"This event '{eventData.eventName}' must be sent immediately by AmaGDK.Analytics.LogEvent(eventName).LogImmediately()");
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
LogEventActually(eventData);
|
|
424
|
+
GDKPool.Return(eventData);
|
|
420
425
|
}
|
|
421
426
|
|
|
422
427
|
localData.SaveIfDirty();
|
|
@@ -424,10 +429,10 @@ namespace Amanotes.Core
|
|
|
424
429
|
Profiler.EndSample();
|
|
425
430
|
}
|
|
426
431
|
|
|
427
|
-
|
|
432
|
+
internal static void LogEventActually(EventParams eventParams)
|
|
428
433
|
{
|
|
429
|
-
|
|
430
|
-
if (!ShouldSendEvent(eventParams)) return
|
|
434
|
+
if (eventParams == null) return;
|
|
435
|
+
if (!ShouldSendEvent(eventParams)) return;
|
|
431
436
|
var (countInSession, totalCount) = localData.IncreaseCounter(eventParams);
|
|
432
437
|
if (eventParams.accumulated || eventParams.parameters.ContainsKey("accumulated_count"))
|
|
433
438
|
{
|
|
@@ -442,9 +447,9 @@ namespace Amanotes.Core
|
|
|
442
447
|
{
|
|
443
448
|
Debug.Log($"AmaGDK [Analytics] Event <{eventNameToSend}> (in session: {countInSession}, total: {totalCount})\n{JsonUtils.DictionaryToJson(eventParams.parameters, true)}");
|
|
444
449
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
450
|
+
|
|
451
|
+
config.quality.CheckEventQuality(eventParams.eventName, eventParams.parameters);
|
|
452
|
+
|
|
448
453
|
var inUseAdapterIDs = config.enableEventStat ? new List<string>(listAdapters.Count) : null;
|
|
449
454
|
foreach (AnalyticsAdapter m in listAdapters)
|
|
450
455
|
{
|
|
@@ -463,16 +468,15 @@ namespace Amanotes.Core
|
|
|
463
468
|
m.LogEvent(eventNameToSend, eventParams.parameters);
|
|
464
469
|
inUseAdapterIDs?.Add(m.adapterId);
|
|
465
470
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
471
|
+
|
|
472
|
+
GDKUtils.SafeInvoke(OnEventSent, eventNameToSend, eventParams.parameters);
|
|
473
|
+
sessionStat?.OnEventSent(eventNameToSend, eventParams.parameters, inUseAdapterIDs);
|
|
469
474
|
}
|
|
470
|
-
|
|
475
|
+
|
|
471
476
|
internal static void LogEventImmediately(EventParams eventParams)
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
epPool.Return(eventParams);
|
|
477
|
+
{
|
|
478
|
+
LogEventActually(eventParams);
|
|
479
|
+
GDKPool.Return(eventParams);
|
|
476
480
|
sessionStat?.Save();
|
|
477
481
|
localData.SaveIfDirty();
|
|
478
482
|
}
|
|
@@ -515,7 +519,7 @@ namespace Amanotes.Core
|
|
|
515
519
|
{
|
|
516
520
|
Profiler.BeginSample("AmaGDK.Analytics.NormalizeEventName()");
|
|
517
521
|
{
|
|
518
|
-
var warningLog = GDKPool.
|
|
522
|
+
var warningLog = GDKPool.TakeStringBuilder(8192);
|
|
519
523
|
NormalizeKeyString(ref eventName, warningLog, dryRun);
|
|
520
524
|
if (reservedEvents.Contains(eventName))
|
|
521
525
|
{
|
|
@@ -537,9 +541,9 @@ namespace Amanotes.Core
|
|
|
537
541
|
|
|
538
542
|
Profiler.BeginSample("AmaGDK.Analytics.NormalizeKeyString()");
|
|
539
543
|
{
|
|
540
|
-
|
|
541
|
-
var tempLog = willLog ? GDKPool.
|
|
542
|
-
var tempKey = GDKPool.
|
|
544
|
+
bool willLog = Config.common.logLevel != LogLevel.None;
|
|
545
|
+
var tempLog = willLog ? GDKPool.TakeStringBuilder() : null;
|
|
546
|
+
var tempKey = GDKPool.TakeStringBuilder();
|
|
543
547
|
|
|
544
548
|
var hasChanged = false;
|
|
545
549
|
var trimKey = key.Trim();
|
|
@@ -688,20 +692,22 @@ namespace Amanotes.Core
|
|
|
688
692
|
}
|
|
689
693
|
|
|
690
694
|
[Serializable]
|
|
691
|
-
|
|
695
|
+
internal class EventStat
|
|
692
696
|
{
|
|
693
697
|
public string eventNameToSend;
|
|
698
|
+
public Dictionary<string, object> eventParams;
|
|
699
|
+
internal string eventParamsInJSON;
|
|
694
700
|
public List<string> adapters;
|
|
695
|
-
public string parameters;
|
|
696
701
|
|
|
697
|
-
public EventStat(string eventNameToSend,
|
|
702
|
+
public EventStat(string eventNameToSend, Dictionary<string, object> eventParams, List<string> adapterIDs)
|
|
698
703
|
{
|
|
699
704
|
this.eventNameToSend = eventNameToSend;
|
|
700
|
-
|
|
705
|
+
this.eventParams = eventParams;
|
|
706
|
+
eventParamsInJSON = JsonUtils.DictionaryToJson(eventParams);
|
|
701
707
|
adapters = adapterIDs;
|
|
702
708
|
}
|
|
703
709
|
|
|
704
|
-
|
|
710
|
+
internal void AppendAsTSV(StringBuilder sb)
|
|
705
711
|
{
|
|
706
712
|
sb.Append(eventNameToSend);
|
|
707
713
|
sb.Append("\t");
|
|
@@ -711,7 +717,7 @@ namespace Amanotes.Core
|
|
|
711
717
|
if (i < adapters.Count - 1) sb.Append(",");
|
|
712
718
|
}
|
|
713
719
|
sb.Append("\t");
|
|
714
|
-
sb.
|
|
720
|
+
sb.AppendLine(eventParamsInJSON);
|
|
715
721
|
}
|
|
716
722
|
}
|
|
717
723
|
|
|
@@ -866,15 +872,13 @@ namespace Amanotes.Core
|
|
|
866
872
|
private bool isFirstSave = true;
|
|
867
873
|
private StringBuilder contents = new StringBuilder(8192);
|
|
868
874
|
private readonly ConcurrentQueue<EventStat> lastFrameEventStats = new ConcurrentQueue<EventStat>();
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
}
|
|
877
|
-
|
|
875
|
+
internal readonly ConcurrentQueue<EventStat> savedEventStatsInLastFrame = new ConcurrentQueue<EventStat>();
|
|
876
|
+
|
|
877
|
+
internal void OnEventSent(string eventName, Dictionary<string, object> eventParams, List<string> inUseAdapterIDs)
|
|
878
|
+
{
|
|
879
|
+
lastFrameEventStats.Enqueue(new EventStat(eventName, eventParams, inUseAdapterIDs));
|
|
880
|
+
}
|
|
881
|
+
|
|
878
882
|
internal void Save()
|
|
879
883
|
{
|
|
880
884
|
contents.Clear();
|
|
@@ -979,7 +983,7 @@ namespace Amanotes.Core
|
|
|
979
983
|
}
|
|
980
984
|
|
|
981
985
|
eventData.overrideConfig = true;
|
|
982
|
-
eventData.ignoreAdapterIds ??= GDKPool.
|
|
986
|
+
eventData.ignoreAdapterIds ??= GDKPool.TakeHashSet();
|
|
983
987
|
|
|
984
988
|
foreach (string mId in analyticIds)
|
|
985
989
|
{
|
|
@@ -1005,7 +1009,18 @@ namespace Amanotes.Core
|
|
|
1005
1009
|
}
|
|
1006
1010
|
|
|
1007
1011
|
eventData.overrideConfig = true;
|
|
1008
|
-
eventData.allowAdapterIds
|
|
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
|
+
}
|
|
1009
1024
|
|
|
1010
1025
|
foreach (string mId in analyticIds)
|
|
1011
1026
|
{
|
|
@@ -1087,7 +1102,7 @@ namespace Amanotes.Core
|
|
|
1087
1102
|
{
|
|
1088
1103
|
string eventName = (ap as EventParams)?.eventName;
|
|
1089
1104
|
|
|
1090
|
-
var sb = GDKPool.
|
|
1105
|
+
var sb = GDKPool.TakeStringBuilder();
|
|
1091
1106
|
sb.Clear();
|
|
1092
1107
|
NormalizeKeyString(ref key, sb, AmaGDK.Config.analytics.normalizeEventName);
|
|
1093
1108
|
|
package/Runtime/AmaGDK.Device.cs
CHANGED
|
@@ -67,14 +67,14 @@ namespace Amanotes.Core.Internal
|
|
|
67
67
|
|
|
68
68
|
if (AmaGDK.Config.common.logLevel == LogLevel.Verbose)
|
|
69
69
|
{
|
|
70
|
-
var stringBuilder = GDKPool.
|
|
70
|
+
var stringBuilder = GDKPool.TakeStringBuilder();
|
|
71
71
|
stringBuilder.Append("Device info:");
|
|
72
72
|
stringBuilder.AppendLine("DeviceSpec: " + result);
|
|
73
73
|
stringBuilder.AppendLine("systemMemorySize: " + SystemInfo.systemMemorySize);
|
|
74
74
|
stringBuilder.AppendLine("processorCount: " + SystemInfo.processorCount);
|
|
75
75
|
stringBuilder.AppendLine("processorFrequency: " + SystemInfo.processorFrequency);
|
|
76
76
|
stringBuilder.AppendLine("graphicsMemorySize: " + SystemInfo.graphicsMemorySize);
|
|
77
|
-
Logging.Log(GDKPool.
|
|
77
|
+
Logging.Log(GDKPool.ReturnAndStringify(stringBuilder));
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
return result;
|
|
@@ -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.TakeStringBuilder(8192);
|
|
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}");
|
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.71";
|
|
21
21
|
|
|
22
22
|
internal static Status _status = Status.None;
|
|
23
23
|
private static ConfigAsset _config = null;
|
|
@@ -176,7 +176,7 @@ namespace Amanotes.Core
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
var startTime = Time.realtimeSinceStartup;
|
|
179
|
-
|
|
179
|
+
var sb = GDKPool.TakeStringBuilder(1024);
|
|
180
180
|
|
|
181
181
|
InitModules();
|
|
182
182
|
|
|
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|
|
4
4
|
using System.Linq;
|
|
5
5
|
using System.Text;
|
|
6
6
|
using UnityEngine;
|
|
7
|
+
using UnityEngine.Assertions;
|
|
7
8
|
using static Amanotes.Core.Internal.Logging;
|
|
8
9
|
#if UNITY_EDITOR
|
|
9
10
|
using UnityEditor;
|
|
@@ -83,11 +84,11 @@ namespace Amanotes.Core
|
|
|
83
84
|
|
|
84
85
|
internal void ValidateParams(string eventName, Dictionary<string, object> eventParams)
|
|
85
86
|
{
|
|
86
|
-
var logBuilder = GDKPool.
|
|
87
|
+
var logBuilder = GDKPool.TakeStringBuilder();
|
|
87
88
|
|
|
88
89
|
logBuilder.AppendLine($"Analytics quality violation found for event <{eventName}>");
|
|
89
90
|
var isValid = true;
|
|
90
|
-
HashSet<string> checkedParameters = GDKPool.
|
|
91
|
+
HashSet<string> checkedParameters = GDKPool.TakeHashSet();
|
|
91
92
|
|
|
92
93
|
foreach (var kvp in DicParam)
|
|
93
94
|
{
|
|
@@ -182,7 +183,7 @@ namespace Amanotes.Core
|
|
|
182
183
|
[ContextMenu("Validate Unique EventNames")]
|
|
183
184
|
private void ValidateUniqueEventNames()
|
|
184
185
|
{
|
|
185
|
-
HashSet<string> eventNames = GDKPool.
|
|
186
|
+
HashSet<string> eventNames = GDKPool.TakeHashSet();
|
|
186
187
|
|
|
187
188
|
lstEvent = lstEvent.OrderBy(evt => evt.eventName).ToList();
|
|
188
189
|
|
|
@@ -192,7 +193,7 @@ namespace Amanotes.Core
|
|
|
192
193
|
|
|
193
194
|
if (!eventNames.Add(eventQuality.eventName)) Debug.LogWarning($"Duplicate event name found: {eventQuality.eventName}. Event names must be unique.");
|
|
194
195
|
|
|
195
|
-
HashSet<string> paramNames = GDKPool.
|
|
196
|
+
HashSet<string> paramNames = GDKPool.TakeHashSet();
|
|
196
197
|
|
|
197
198
|
eventQuality.lstParam = eventQuality.lstParam.OrderBy(param => param.paramName).ToList();
|
|
198
199
|
|
|
@@ -176,7 +176,7 @@ namespace Amanotes.Core
|
|
|
176
176
|
{
|
|
177
177
|
if (sb == null)
|
|
178
178
|
{
|
|
179
|
-
sb = GDKPool.
|
|
179
|
+
sb = GDKPool.TakeStringBuilder();
|
|
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.ReturnAndStringify(sb);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|