com.amanotes.gdk 0.2.65-5 → 0.2.66
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 +27 -0
- package/Editor/Extra/SDKVersionTracking.cs +68 -0
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/CheckDiskSpace.unitypackage +0 -0
- package/Extra/ForceUpdate.unitypackage +0 -0
- package/Extra/GoogleCMP.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/RevenueCatAdapter.unitypackage +0 -0
- package/Packages/SqliteAnalyticsAdapter.unitypackage +0 -0
- package/Runtime/AmaGDK.Ads.cs +1 -1
- package/Runtime/AmaGDK.Analytics.cs +22 -16
- package/Runtime/AmaGDK.cs +1 -1
- package/Runtime/AudioToolkit/Plugins/Android/{AudioDeviceDetector.java → GDKAudioDeviceDetector.java} +1 -1
- package/Runtime/AudioToolkit/Plugins/AudioDeviceDetector.cs +1 -1
- package/Runtime/Core/GDKPool.cs +37 -0
- package/Runtime/Core/GDKPool.cs.meta +3 -0
- package/Runtime/Core/GDKRoutine.cs +41 -17
- package/Runtime/Internal/AmaGDK.Utils.cs +0 -26
- package/package.json +1 -1
- package/Editor/Extra/SDKVersionTracking.AirTable.cs +0 -73
- package/Editor/Extra/SDKVersionTracking.AirTable.cs.meta +0 -3
- /package/Runtime/AudioToolkit/Plugins/Android/{AudioDeviceDetector.java.meta → GDKAudioDeviceDetector.java.meta} +0 -0
- /package/Runtime/AudioToolkit/Plugins/iOS/{AudioDeviceDetector.mm → GDKAudioDeviceDetector.mm} +0 -0
- /package/Runtime/AudioToolkit/Plugins/iOS/{AudioDeviceDetector.mm.meta → GDKAudioDeviceDetector.mm.meta} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.66 - 2024-06-25]
|
|
4
|
+
- [Dev] Verify all fields are reset in Init EventParams
|
|
5
|
+
- [Dev] Add try catch to prevent coroutines to stop silently
|
|
6
|
+
- [Fix] Reset 'isLoggedImmediately' for every new EventParams
|
|
7
|
+
- [Dev] Update Audio native plugin name
|
|
8
|
+
|
|
9
|
+
## [0.2.65-6 - 2024-06-20]
|
|
10
|
+
- [Dev] Improve SDK Version Tracking
|
|
11
|
+
- [Klavar] improve enum converter
|
|
12
|
+
- [Fix] Turn off Google CMP on Editor
|
|
13
|
+
|
|
3
14
|
## [0.2.65-5 - 2024-06-17]
|
|
4
15
|
- [Dev] Update for GDKTest Unity 2022.3 project
|
|
5
16
|
- [Dev] Update for GDKTest Unity 2021.3 project
|
|
@@ -12,6 +23,22 @@
|
|
|
12
23
|
- [Dev] Degrade GDKDev project to Unity 2020
|
|
13
24
|
- [Dev] Audio module supports Unity 2020
|
|
14
25
|
|
|
26
|
+
## [0.2.65-4 - 2024-06-14]
|
|
27
|
+
- [Dev] Audio module supports Unity 2020
|
|
28
|
+
- [Dev] Degrade GDKDev project to Unity 2020
|
|
29
|
+
|
|
30
|
+
## [0.2.65-3 - 2024-06-14]
|
|
31
|
+
- [Dev] Simplify LocalBuild + Minor editor fixes for GDK Analytics
|
|
32
|
+
- [Dev] fix PostBuild unity 2020
|
|
33
|
+
- [Dev] Audio Device Detector and Bluetooth Audio Latency
|
|
34
|
+
- [Dev] Update SDK configs
|
|
35
|
+
|
|
36
|
+
## [0.2.65-2 - 2024-06-13]
|
|
37
|
+
- [Feature] Implement analytics event correction for force kill app
|
|
38
|
+
- [Feature] Upload version tracking to Airtable
|
|
39
|
+
- [Fix] Unity 2020 compatible
|
|
40
|
+
- [Fix] Wrong condition check for first time remote config
|
|
41
|
+
|
|
15
42
|
## [0.2.65 - 2024-06-13]
|
|
16
43
|
- [Dev] Add GDKRoutine
|
|
17
44
|
- [Dev] Add option to preload banners
|
|
@@ -2,12 +2,16 @@ using System;
|
|
|
2
2
|
using System.Collections.Generic;
|
|
3
3
|
using System.IO;
|
|
4
4
|
using System.Linq;
|
|
5
|
+
using System.Net.Http;
|
|
5
6
|
using System.Text;
|
|
6
7
|
using System.Xml;
|
|
8
|
+
using Amanotes.Core.Internal;
|
|
7
9
|
using UnityEditor;
|
|
8
10
|
using UnityEditor.Build;
|
|
9
11
|
using UnityEditor.Build.Reporting;
|
|
10
12
|
using UnityEngine;
|
|
13
|
+
using System.Threading.Tasks;
|
|
14
|
+
using UnityEditor.Callbacks;
|
|
11
15
|
|
|
12
16
|
#if UNITY_IOS
|
|
13
17
|
using UnityEditor.iOS.Xcode;
|
|
@@ -227,6 +231,70 @@ namespace Amanotes.Editor
|
|
|
227
231
|
|
|
228
232
|
WriteToStreamingAssets();
|
|
229
233
|
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
public partial class SDKVersionTracking
|
|
237
|
+
{
|
|
238
|
+
private const string AUTH_TOKEN = "pat1CmLr9XozLt6ZE";
|
|
239
|
+
private const string URL = "https://gdk.amanotes.io/gdkVersionTracking";
|
|
240
|
+
|
|
241
|
+
[PostProcessBuild(999)]
|
|
242
|
+
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
|
|
243
|
+
{
|
|
244
|
+
var rawData = _dicThirdPartyVersion
|
|
245
|
+
.Concat(_dicExtraVersion)
|
|
246
|
+
.Concat(_dicIronSourceAdapterVersion.ToDictionary(kvp => kvp.Key, kvp => (object)("IS_" + kvp.Value)))
|
|
247
|
+
.ToDictionary(x => x.Key, x => x.Value);
|
|
248
|
+
rawData["UnityVersion"] = Application.unityVersion;
|
|
249
|
+
string platform = "";
|
|
250
|
+
#if UNITY_ANDROID
|
|
251
|
+
platform = "Android";
|
|
252
|
+
rawData["Permissions"] = GetAllAndroidPermissions();
|
|
253
|
+
rawData["APILevel"] = (int)PlayerSettings.Android.targetSdkVersion;
|
|
254
|
+
#elif UNITY_IOS
|
|
255
|
+
rawData["SKAdNetwork"] = GetSkAdNetworkCount($"{pathToBuiltProject}/Info.plist");
|
|
256
|
+
platform = "iOS";
|
|
257
|
+
#endif
|
|
258
|
+
|
|
259
|
+
var buildInfo = new Dictionary<string, object>
|
|
260
|
+
{
|
|
261
|
+
{"GameName", Application.productName},
|
|
262
|
+
{"BuildVersion", PlayerSettings.bundleVersion},
|
|
263
|
+
{"BuildNumber", GetBuildNumber()},
|
|
264
|
+
{"BuildTime", GetBuildTime()},
|
|
265
|
+
{"AppId", PlayerSettings.applicationIdentifier },
|
|
266
|
+
{"Platform", platform},
|
|
267
|
+
{"RawData", rawData }
|
|
268
|
+
};
|
|
269
|
+
string json = JsonUtils.DictionaryToJson(buildInfo, false, false);
|
|
270
|
+
Task.Run(()=>SendDataToAirTable(json));
|
|
271
|
+
}
|
|
230
272
|
|
|
273
|
+
private static async Task SendDataToAirTable(string payload)
|
|
274
|
+
{
|
|
275
|
+
try
|
|
276
|
+
{
|
|
277
|
+
var client = new HttpClient();
|
|
278
|
+
var request = new HttpRequestMessage(HttpMethod.Post, URL);
|
|
279
|
+
request.Headers.Add("Authorization", AUTH_TOKEN);
|
|
280
|
+
request.Content = new StringContent(payload, Encoding.UTF8, "application/json");
|
|
281
|
+
|
|
282
|
+
var response = await client.SendAsync(request);
|
|
283
|
+
if (response.IsSuccessStatusCode)
|
|
284
|
+
{
|
|
285
|
+
string responseData = await response.Content.ReadAsStringAsync();
|
|
286
|
+
Debug.Log("AmaGDK | [SDKVersionTracking]: done " + responseData);
|
|
287
|
+
}
|
|
288
|
+
else
|
|
289
|
+
{
|
|
290
|
+
string errorData = await response.Content.ReadAsStringAsync();
|
|
291
|
+
Debug.LogError($"AmaGDK | [SDKVersionTracking] Status code {response.StatusCode} Error Response: {errorData}");
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
catch (HttpRequestException e)
|
|
295
|
+
{
|
|
296
|
+
Debug.LogError("AmaGDK | [SDKVersionTracking] Request Exception: " + e.Message);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
231
299
|
}
|
|
232
300
|
}
|
|
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
|
package/Runtime/AmaGDK.Ads.cs
CHANGED
|
@@ -402,7 +402,7 @@ namespace Amanotes.Core
|
|
|
402
402
|
/// <param name="interstitialCappingTime"></param>
|
|
403
403
|
/// <param name="rewardedVideoCappingTime"></param>
|
|
404
404
|
/// <returns></returns>
|
|
405
|
-
|
|
405
|
+
public static bool IsCapped(float interstitialCappingTime = 0, float rewardedVideoCappingTime = 0)
|
|
406
406
|
{
|
|
407
407
|
bool interCapped = (interstitialCappingTime > 0) && TimeSinceLastInterstitialSucceed < interstitialCappingTime;
|
|
408
408
|
bool rewardCapped = (rewardedVideoCappingTime > 0) && TimeSinceLastVideoRewardSucceed < rewardedVideoCappingTime;
|
|
@@ -25,14 +25,15 @@ namespace Amanotes.Core
|
|
|
25
25
|
|
|
26
26
|
public interface IEventParamsBuilder { }
|
|
27
27
|
|
|
28
|
-
public class EventParams : IEventParamsBuilder
|
|
28
|
+
public class EventParams : IEventParamsBuilder, IPoolItem
|
|
29
29
|
{
|
|
30
30
|
public string eventName { get; private set; }
|
|
31
31
|
public readonly Dictionary<string, object> parameters = new Dictionary<string, object>();
|
|
32
|
-
public string funnelSignature;
|
|
32
|
+
public string funnelSignature = "";
|
|
33
33
|
public bool accumulated;
|
|
34
34
|
public bool withinSession;
|
|
35
35
|
public bool doNotIncreaseCounter;
|
|
36
|
+
internal bool isLoggedImmediately;
|
|
36
37
|
|
|
37
38
|
public bool overrideConfig;
|
|
38
39
|
public HashSet<string> ignoreAdapterIds = null;
|
|
@@ -41,7 +42,7 @@ namespace Amanotes.Core
|
|
|
41
42
|
public int totalCount => detail.totalCount;
|
|
42
43
|
public int totalCountWithinSession => detail.countInSession;
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
internal EventDetail _detail;
|
|
45
46
|
internal EventDetail detail
|
|
46
47
|
{
|
|
47
48
|
get
|
|
@@ -50,23 +51,28 @@ namespace Amanotes.Core
|
|
|
50
51
|
return _detail = localData.GetEventDetail(eventName, true);
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
|
-
internal bool isLoggedImmediately = false;
|
|
54
54
|
|
|
55
|
-
internal EventParams
|
|
55
|
+
internal EventParams SetEventName(string eventName)
|
|
56
56
|
{
|
|
57
57
|
this.eventName = eventName;
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public void Reset()
|
|
62
|
+
{
|
|
63
|
+
eventName = null;
|
|
58
64
|
parameters.Clear();
|
|
59
65
|
funnelSignature = "";
|
|
60
66
|
accumulated = false;
|
|
61
67
|
withinSession = false;
|
|
62
68
|
doNotIncreaseCounter = false;
|
|
69
|
+
isLoggedImmediately = false;
|
|
63
70
|
overrideConfig = false;
|
|
64
71
|
ignoreAdapterIds = null;
|
|
65
72
|
allowAdapterIds = null;
|
|
66
73
|
_detail = null;
|
|
67
|
-
return this;
|
|
68
74
|
}
|
|
69
|
-
|
|
75
|
+
|
|
70
76
|
public bool IsFunnelEvent => !string.IsNullOrEmpty(funnelSignature);
|
|
71
77
|
|
|
72
78
|
public bool IsAdapterForbidden(string adapterId)
|
|
@@ -92,6 +98,7 @@ namespace Amanotes.Core
|
|
|
92
98
|
int accumulatedCount = GetAccumulatedCount(eventName, sendAtCountConfig.withinSession);
|
|
93
99
|
return sendAtCountConfig.listCount != null && !sendAtCountConfig.listCount.Contains(accumulatedCount);
|
|
94
100
|
}
|
|
101
|
+
|
|
95
102
|
}
|
|
96
103
|
|
|
97
104
|
public static IEventParamsBuilder LogEvent(string eventName)
|
|
@@ -287,8 +294,8 @@ namespace Amanotes.Core
|
|
|
287
294
|
internal static readonly List<AnalyticsAdapter> listAdapters = new List<AnalyticsAdapter>();
|
|
288
295
|
internal static readonly AnalyticsData localData = new AnalyticsData().LoadJsonFromFile().BuildCache();
|
|
289
296
|
internal static readonly SessionStat sessionStat = _config.analytics.enableEventStat ? new SessionStat() : null;
|
|
290
|
-
internal static readonly
|
|
291
|
-
internal static readonly
|
|
297
|
+
internal static readonly GDKPool<StringBuilder> sbPool = new GDKPool<StringBuilder>(3);
|
|
298
|
+
internal static readonly GDKPool<EventParams> epPool = new GDKPool<EventParams>(1);
|
|
292
299
|
|
|
293
300
|
internal static readonly Dictionary<string, string> reservedPrefixes = new Dictionary<string, string>()
|
|
294
301
|
{
|
|
@@ -349,7 +356,7 @@ namespace Amanotes.Core
|
|
|
349
356
|
internal static EventParams PrepareEvent(string eventName)
|
|
350
357
|
{
|
|
351
358
|
PrepareEventCheck(eventName);
|
|
352
|
-
var result = epPool.Get().
|
|
359
|
+
var result = epPool.Get().SetEventName(eventName);
|
|
353
360
|
PostPrepareEventProcess(result);
|
|
354
361
|
return result;
|
|
355
362
|
}
|
|
@@ -358,7 +365,7 @@ namespace Amanotes.Core
|
|
|
358
365
|
{
|
|
359
366
|
if (parameters == null) return PrepareEvent(eventName);
|
|
360
367
|
PrepareEventCheck(eventName);
|
|
361
|
-
var result = epPool.Get().
|
|
368
|
+
var result = epPool.Get().SetEventName(eventName);
|
|
362
369
|
result.AddParam(parameters);
|
|
363
370
|
PostPrepareEventProcess(result);
|
|
364
371
|
return result;
|
|
@@ -368,7 +375,7 @@ namespace Amanotes.Core
|
|
|
368
375
|
{
|
|
369
376
|
if (parameters == null) return PrepareEvent(eventName);
|
|
370
377
|
PrepareEventCheck(eventName);
|
|
371
|
-
var result = epPool.Get().
|
|
378
|
+
var result = epPool.Get().SetEventName(eventName);
|
|
372
379
|
for (var i = 0; i < parameters.Length; i++)
|
|
373
380
|
{
|
|
374
381
|
result.AddParam(parameters[i].Item1, parameters[i].Item2);
|
|
@@ -491,7 +498,7 @@ namespace Amanotes.Core
|
|
|
491
498
|
{
|
|
492
499
|
Profiler.BeginSample("AmaGDK.Analytics.NormalizeEventName()");
|
|
493
500
|
{
|
|
494
|
-
|
|
501
|
+
var sb = sbPool.Get();
|
|
495
502
|
sb.Clear();
|
|
496
503
|
NormalizeKeyString(ref eventName, sb, dryRun);
|
|
497
504
|
if (reservedEvents.Contains(eventName))
|
|
@@ -512,10 +519,9 @@ namespace Amanotes.Core
|
|
|
512
519
|
Profiler.EndSample();
|
|
513
520
|
return;
|
|
514
521
|
}
|
|
515
|
-
|
|
522
|
+
|
|
516
523
|
var tempLog = Config.common.logLevel == LogLevel.None ? null : sbPool.Get();
|
|
517
524
|
tempLog?.Clear();
|
|
518
|
-
|
|
519
525
|
var tempKey = sbPool.Get();
|
|
520
526
|
tempKey.Clear();
|
|
521
527
|
|
|
@@ -1056,7 +1062,7 @@ namespace Amanotes.Core
|
|
|
1056
1062
|
{
|
|
1057
1063
|
string eventName = (ap as EventParams)?.eventName;
|
|
1058
1064
|
|
|
1059
|
-
|
|
1065
|
+
var sb = sbPool.Get();
|
|
1060
1066
|
sb.Clear();
|
|
1061
1067
|
NormalizeKeyString(ref key, sb, AmaGDK.Config.analytics.normalizeEventName);
|
|
1062
1068
|
|
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.66";
|
|
21
21
|
|
|
22
22
|
internal static Status _status = Status.None;
|
|
23
23
|
private static ConfigAsset _config = null;
|
|
@@ -21,7 +21,7 @@ namespace Amanotes.Core
|
|
|
21
21
|
#endif
|
|
22
22
|
|
|
23
23
|
#if !UNITY_EDITOR && UNITY_ANDROID
|
|
24
|
-
private readonly AndroidJavaClass _detectorClass = new AndroidJavaClass("com.amanotes.audio.
|
|
24
|
+
private readonly AndroidJavaClass _detectorClass = new AndroidJavaClass("com.amanotes.audio.GDKAudioDeviceDetector");
|
|
25
25
|
#endif
|
|
26
26
|
|
|
27
27
|
private static readonly Dictionary<string, AudioDeviceType> deviceTypeMapping = new Dictionary<string, AudioDeviceType>(StringComparer.OrdinalIgnoreCase)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
using System.Collections.Concurrent;
|
|
2
|
+
|
|
3
|
+
namespace Amanotes.Core.Internal
|
|
4
|
+
{
|
|
5
|
+
public interface IPoolItem
|
|
6
|
+
{
|
|
7
|
+
void Reset();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
public class GDKPool<T> where T : new()
|
|
11
|
+
{
|
|
12
|
+
private readonly ConcurrentQueue<T> _pool;
|
|
13
|
+
|
|
14
|
+
public GDKPool(int initialCapacity)
|
|
15
|
+
{
|
|
16
|
+
_pool = new ConcurrentQueue<T>();
|
|
17
|
+
for (int i = 0; i < initialCapacity; i++)
|
|
18
|
+
{
|
|
19
|
+
_pool.Enqueue(new T());
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public T Get()
|
|
24
|
+
{
|
|
25
|
+
if (!_pool.TryDequeue(out var obj)) return new T();
|
|
26
|
+
if (obj is IPoolItem poolItem) poolItem.Reset();
|
|
27
|
+
return obj;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public void Return(T obj)
|
|
31
|
+
{
|
|
32
|
+
_pool.Enqueue(obj);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public int Count => _pool.Count;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -1,47 +1,71 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using System.Collections;
|
|
3
3
|
using UnityEngine;
|
|
4
|
-
|
|
5
4
|
namespace Amanotes.Core.Internal
|
|
6
5
|
{
|
|
7
6
|
public class GDKRoutine
|
|
8
7
|
{
|
|
9
|
-
[Flags]
|
|
10
|
-
internal enum RoutineStatus
|
|
8
|
+
[Flags] private enum RoutineStatus
|
|
11
9
|
{
|
|
12
10
|
None,
|
|
13
11
|
Started = 1,
|
|
14
12
|
Stopped = 2
|
|
15
13
|
}
|
|
16
14
|
|
|
15
|
+
private readonly IEnumerator userRoutine;
|
|
16
|
+
private Action<Exception> exceptionHandler;
|
|
17
|
+
private Coroutine safeRoutine;
|
|
17
18
|
private RoutineStatus status;
|
|
18
|
-
private readonly IEnumerator action;
|
|
19
|
-
private Coroutine routine;
|
|
20
19
|
|
|
21
|
-
public
|
|
22
|
-
|
|
23
|
-
public GDKRoutine(IEnumerator action)
|
|
20
|
+
public GDKRoutine(IEnumerator routine)
|
|
24
21
|
{
|
|
25
|
-
|
|
22
|
+
userRoutine = routine;
|
|
26
23
|
status = RoutineStatus.None;
|
|
27
24
|
}
|
|
28
25
|
|
|
26
|
+
public bool isAlive => (status & RoutineStatus.Stopped) == 0;
|
|
27
|
+
|
|
28
|
+
public GDKRoutine SetOnExceptionHandler(Action<Exception> handler)
|
|
29
|
+
{
|
|
30
|
+
exceptionHandler = handler;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
|
|
29
34
|
public void StartRoutine()
|
|
30
35
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// StopRoutine() called before start: do nothing
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
+
// StopRoutine() called before start: do nothing
|
|
37
|
+
if (!isAlive) return;
|
|
36
38
|
|
|
37
39
|
status |= RoutineStatus.Started;
|
|
38
|
-
|
|
40
|
+
// Start the coroutine using the safe wrapper
|
|
41
|
+
safeRoutine = AmaGDK._instance.StartCoroutine(SafeCoroutineWrapper(userRoutine));
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
public void StopRoutine()
|
|
42
45
|
{
|
|
43
46
|
status |= RoutineStatus.Stopped;
|
|
44
|
-
if (
|
|
47
|
+
if (safeRoutine != null) AmaGDK._instance.StopCoroutine(safeRoutine);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private IEnumerator SafeCoroutineWrapper(IEnumerator coroutine)
|
|
51
|
+
{
|
|
52
|
+
while (true)
|
|
53
|
+
{
|
|
54
|
+
object current;
|
|
55
|
+
try
|
|
56
|
+
{
|
|
57
|
+
if (!coroutine.MoveNext()) yield break; // Coroutine has finished execution
|
|
58
|
+
current = coroutine.Current; // Get the current yield instruction
|
|
59
|
+
} catch (Exception ex)
|
|
60
|
+
{
|
|
61
|
+
status |= RoutineStatus.Stopped;
|
|
62
|
+
if (exceptionHandler == null) Logging.LogError($"Exception caught in coroutine: {ex}");
|
|
63
|
+
exceptionHandler?.Invoke(ex);
|
|
64
|
+
yield break; // Stop executing the coroutine
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
yield return current;
|
|
68
|
+
}
|
|
45
69
|
}
|
|
46
70
|
}
|
|
47
71
|
|
|
@@ -56,7 +80,7 @@ namespace Amanotes.Core.Internal
|
|
|
56
80
|
|
|
57
81
|
public static void StopCoroutine(GDKRoutine gdkRoutine)
|
|
58
82
|
{
|
|
59
|
-
|
|
83
|
+
DoOnMainThread(() => { gdkRoutine?.StopRoutine(); });
|
|
60
84
|
}
|
|
61
85
|
}
|
|
62
86
|
}
|
|
@@ -598,30 +598,4 @@ namespace Amanotes.Core.Internal
|
|
|
598
598
|
// public T[] items;
|
|
599
599
|
//}
|
|
600
600
|
}
|
|
601
|
-
|
|
602
|
-
internal class Pool<T> where T : new()
|
|
603
|
-
{
|
|
604
|
-
private readonly ConcurrentQueue<T> _pool;
|
|
605
|
-
|
|
606
|
-
public Pool(int initialCapacity)
|
|
607
|
-
{
|
|
608
|
-
_pool = new ConcurrentQueue<T>();
|
|
609
|
-
for (int i = 0; i < initialCapacity; i++)
|
|
610
|
-
{
|
|
611
|
-
_pool.Enqueue(new T());
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
public T Get()
|
|
616
|
-
{
|
|
617
|
-
return _pool.TryDequeue(out var obj) ? obj : new T();
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
public void Return(T obj)
|
|
621
|
-
{
|
|
622
|
-
_pool.Enqueue(obj);
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
public int Count => _pool.Count;
|
|
626
|
-
}
|
|
627
601
|
}
|
package/package.json
CHANGED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
using System.Collections.Generic;
|
|
2
|
-
using System.Net.Http;
|
|
3
|
-
using System.Text;
|
|
4
|
-
using System.Threading.Tasks;
|
|
5
|
-
using Amanotes.Core.Internal;
|
|
6
|
-
using UnityEditor;
|
|
7
|
-
using UnityEditor.Callbacks;
|
|
8
|
-
using UnityEngine;
|
|
9
|
-
|
|
10
|
-
namespace Amanotes.Editor
|
|
11
|
-
{
|
|
12
|
-
public partial class SDKVersionTracking
|
|
13
|
-
{
|
|
14
|
-
private const string AUTH_TOKEN = "pat1CmLr9XozLt6ZE";
|
|
15
|
-
private const string URL = "https://gdk.amanotes.io/gdkVersionTracking";
|
|
16
|
-
|
|
17
|
-
[PostProcessBuild(999)]
|
|
18
|
-
public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
|
|
19
|
-
{
|
|
20
|
-
var rawData = AllVersions;
|
|
21
|
-
rawData["UnityVersion"] = Application.unityVersion;
|
|
22
|
-
#if UNITY_ANDROID
|
|
23
|
-
rawData["Platform"] = "Android";
|
|
24
|
-
rawData["Permissions"] = GetAllAndroidPermissions();
|
|
25
|
-
rawData["APILevel"] = (int)PlayerSettings.Android.targetSdkVersion;
|
|
26
|
-
#elif UNITY_IOS
|
|
27
|
-
rawData["SKAdNetwork"] = GetSkAdNetworkCount($"{pathToBuiltProject}/Info.plist");
|
|
28
|
-
rawData["Platform"] = "iOS";
|
|
29
|
-
#endif
|
|
30
|
-
|
|
31
|
-
var buildInfo = new Dictionary<string, object>
|
|
32
|
-
{
|
|
33
|
-
{"GameName", Application.productName},
|
|
34
|
-
{"BuildVersion", PlayerSettings.bundleVersion},
|
|
35
|
-
{"BuildNumber", GetBuildNumber()},
|
|
36
|
-
{"BuildTime", GetBuildTime()},
|
|
37
|
-
{"AppId", PlayerSettings.applicationIdentifier },
|
|
38
|
-
{"RawData", rawData }
|
|
39
|
-
};
|
|
40
|
-
string json = JsonUtils.DictionaryToJson(buildInfo, false, false);
|
|
41
|
-
Task.Run(()=>SendDataToAirTable(json));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
private static async Task SendDataToAirTable(string payload)
|
|
45
|
-
{
|
|
46
|
-
Debug.Log("AmaGDK | [SDKVersionTracking]: SendDataToAirTable ");
|
|
47
|
-
try
|
|
48
|
-
{
|
|
49
|
-
var client = new HttpClient();
|
|
50
|
-
var request = new HttpRequestMessage(HttpMethod.Post, URL);
|
|
51
|
-
request.Headers.Add("Authorization", AUTH_TOKEN);
|
|
52
|
-
request.Content = new StringContent(payload, Encoding.UTF8, "application/json");
|
|
53
|
-
|
|
54
|
-
var response = await client.SendAsync(request);
|
|
55
|
-
if (response.IsSuccessStatusCode)
|
|
56
|
-
{
|
|
57
|
-
string responseData = await response.Content.ReadAsStringAsync();
|
|
58
|
-
Debug.Log("AmaGDK | [SDKVersionTracking]: done " + responseData);
|
|
59
|
-
}
|
|
60
|
-
else
|
|
61
|
-
{
|
|
62
|
-
Debug.LogError("AmaGDK | [SDKVersionTracking] Error: " + response.StatusCode);
|
|
63
|
-
string errorData = await response.Content.ReadAsStringAsync();
|
|
64
|
-
Debug.LogError("AmaGDK | [SDKVersionTracking] Error Response: " + errorData);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
catch (HttpRequestException e)
|
|
68
|
-
{
|
|
69
|
-
Debug.LogError("AmaGDK | [SDKVersionTracking] Request Exception: " + e.Message);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
File without changes
|
/package/Runtime/AudioToolkit/Plugins/iOS/{AudioDeviceDetector.mm → GDKAudioDeviceDetector.mm}
RENAMED
|
File without changes
|
|
File without changes
|