com.amanotes.gdk 0.2.74 → 0.2.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/Extra/AmaGDKInstaller.unitypackage +0 -0
  3. package/Extra/CheckDiskSpace.unitypackage +0 -0
  4. package/Extra/Consent.unitypackage +0 -0
  5. package/Extra/ForceUpdate.unitypackage +0 -0
  6. package/Extra/LegacyGDKUpdateHelper.unitypackage +0 -0
  7. package/Extra/PostProcessor.unitypackage +0 -0
  8. package/Packages/AmaGDKConfig.unitypackage +0 -0
  9. package/Packages/AmaGDKExample.unitypackage +0 -0
  10. package/Packages/AmaGDKTest.unitypackage +0 -0
  11. package/Packages/AppsFlyerAdapter.AdRevenue.unitypackage +0 -0
  12. package/Packages/AppsFlyerAdapter.PurchaseConnector.unitypackage +0 -0
  13. package/Packages/AppsFlyerAdapter.unitypackage +0 -0
  14. package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
  15. package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
  16. package/Packages/IronSourceAdapter.unitypackage +0 -0
  17. package/Packages/MaxAdNetworkAdapter.unitypackage +0 -0
  18. package/Packages/RevenueCatAdapter.unitypackage +0 -0
  19. package/Packages/SqliteAnalyticsAdapter.unitypackage +0 -0
  20. package/Runtime/Ad/AdLogic.cs +9 -10
  21. package/Runtime/Ad/AmaGDK.Ads.cs +2 -1
  22. package/Runtime/AmaGDK.Analytics.cs +4 -1
  23. package/Runtime/AmaGDK.Consent.cs +2 -1
  24. package/Runtime/AmaGDK.Mono.cs +1 -1
  25. package/Runtime/AmaGDK.Singleton.cs +3 -1
  26. package/Runtime/AmaGDK.UserProfile.cs +3 -2
  27. package/Runtime/AmaGDK.cs +8 -4
  28. package/Runtime/Internal/AmaGDK.WebUtils.cs +4 -4
  29. package/Runtime/Internal/ForceQuitMonitor.cs +2 -2
  30. package/Runtime/Internal/GDKGeoLocationcs.cs +2 -1
  31. package/Runtime/Internal/GDKServerTime.cs +2 -1
  32. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.75] - 2024-09-20
4
+ - [Dev] Use GDKUtils.StartCoroutine to capture exceptions
5
+ - [Fix] Initialize modules lazily to fix AmaGDK serialization layout mismatch
6
+
3
7
  ## [0.2.74] - 2024-09-17
4
8
  - [Dev] Add GDKAudio Example
5
9
  - [Feature] Add AudioSource fallback for unsupported platforms
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -27,7 +27,7 @@ namespace Amanotes.Core.Internal
27
27
  }
28
28
  }
29
29
 
30
- internal Coroutine _loadRoutine;
30
+ internal GDKRoutine _loadRoutine;
31
31
 
32
32
  public void StartLoadAd()
33
33
  {
@@ -38,7 +38,7 @@ namespace Amanotes.Core.Internal
38
38
  }
39
39
 
40
40
  Log("[Ad] StartLoadAd");
41
- _loadRoutine = _instance.StartCoroutine(LoadAdRoutine());
41
+ _loadRoutine = GDKUtils.StartCoroutine(LoadAdRoutine());
42
42
  }
43
43
 
44
44
  public void StopLoadAd()
@@ -48,9 +48,8 @@ namespace Amanotes.Core.Internal
48
48
  {
49
49
  _loadState = LoadAdsState.None;
50
50
  }
51
-
52
- if (_loadRoutine == null) return;
53
- _instance.StopCoroutine(_loadRoutine);
51
+
52
+ _loadRoutine?.StopRoutine();
54
53
  _loadRoutine = null;
55
54
  }
56
55
 
@@ -128,7 +127,7 @@ namespace Amanotes.Core.Internal
128
127
 
129
128
  // Show Ad logic
130
129
  internal ShowAdsState _showState = ShowAdsState.None;
131
- private Coroutine _showAdRoutine;
130
+ private GDKRoutine _showAdRoutine;
132
131
  protected bool _isRequesting;
133
132
  protected bool _isInterstitial => adType == AdType.Interstitial;
134
133
 
@@ -160,8 +159,8 @@ namespace Amanotes.Core.Internal
160
159
  _isInterstitial ? AmaGDK.Event.INTER_SHOW_CALLED : AmaGDK.Event.REWARD_VIDEO_SHOW_CALLED
161
160
  );
162
161
 
163
- if (_showAdRoutine != null) _instance.StopCoroutine(_showAdRoutine);
164
- _showAdRoutine = _instance.StartCoroutine(ShowAdRoutine());
162
+ if (_showAdRoutine != null) _showAdRoutine.StopRoutine();
163
+ _showAdRoutine = GDKUtils.StartCoroutine(ShowAdRoutine());
165
164
  }
166
165
 
167
166
  private void OnApplicationFocus(bool focus)
@@ -184,7 +183,7 @@ namespace Amanotes.Core.Internal
184
183
 
185
184
  TriggerOnAfterAdShow();
186
185
  if (_showAdRoutine == null) return;
187
- _instance.StopCoroutine(_showAdRoutine);
186
+ _showAdRoutine.StopRoutine();
188
187
  _showAdRoutine = null;
189
188
 
190
189
  if (Ads.context.adType == AdType.Interstitial)
@@ -260,7 +259,7 @@ namespace Amanotes.Core.Internal
260
259
  if (_loadState != LoadAdsState.Requesting) StartLoadAd();
261
260
  var counter = 0;
262
261
  bool? hasInternet = null;
263
- if (adConfig.checkInternet) _instance.StartCoroutine(WebUtils.CheckInternet(result => hasInternet = result));
262
+ if (adConfig.checkInternet) GDKUtils.StartCoroutine(WebUtils.CheckInternet(result => hasInternet = result));
264
263
 
265
264
  var wait1Sec = new WaitForSecondsRealtime(1f);
266
265
  while (counter < timeout || timeout == -1)
@@ -108,7 +108,8 @@ namespace Amanotes.Core
108
108
  public static bool allowAdRequest = true;
109
109
 
110
110
  // internal use
111
- internal static readonly AdsData localData = new AdsData().LoadJsonFromFile();
111
+ private static readonly Lazy<AdsData> _localData = new Lazy<AdsData>(() => new AdsData().LoadJsonFromFile());
112
+ internal static AdsData localData => _localData.Value;
112
113
 
113
114
  internal protected static AdShowContext context;
114
115
  internal protected static AdAdapter _adapter;
@@ -308,9 +308,12 @@ namespace Amanotes.Core
308
308
  internal static Predicate<EventParams> logEventHook;
309
309
  internal static readonly ConcurrentQueue<EventParams> eventQueue = new ConcurrentQueue<EventParams>();
310
310
  internal static readonly List<AnalyticsAdapter> listAdapters = new List<AnalyticsAdapter>();
311
- internal static readonly AnalyticsData localData = new AnalyticsData().LoadJsonFromFile().BuildCache();
312
311
  internal static SessionStat sessionStat;
313
312
  internal static readonly GDKPool.Pool<EventParams> epPool = new GDKPool.Pool<EventParams>(1);
313
+
314
+ private static readonly Lazy<AnalyticsData> _localData = new Lazy<AnalyticsData>(
315
+ () => new AnalyticsData().LoadJsonFromFile().BuildCache());
316
+ internal static AnalyticsData localData => _localData.Value;
314
317
 
315
318
  internal static readonly Dictionary<string, string> reservedPrefixes = new Dictionary<string, string>()
316
319
  {
@@ -123,7 +123,8 @@ namespace Amanotes.Core
123
123
 
124
124
  public static partial class Consent //Internal
125
125
  {
126
- private static readonly ConsentData data = new ConsentData().LoadJsonFromFile();
126
+ private static readonly Lazy<ConsentData> _data = new Lazy<ConsentData>(() => new ConsentData().LoadJsonFromFile());
127
+ private static ConsentData data => _data.Value;
127
128
  private static Action _onConsentComplete;
128
129
 
129
130
  internal static bool checkedATT => data.att >= Status.Allowed;
@@ -76,7 +76,7 @@ namespace Amanotes.Core.Internal
76
76
 
77
77
  public static void DelayCall(float seconds, Action action)
78
78
  {
79
- DoOnMainThread(() => AmaGDK._instance.StartCoroutine(DelayCallRoutine(seconds, action)));
79
+ DoOnMainThread(() => StartCoroutine(DelayCallRoutine(seconds, action)));
80
80
  }
81
81
 
82
82
  public static IEnumerator Timeout(float timeoutInSecs, Func<bool> completeCheckFunc)
@@ -1,4 +1,5 @@
1
1
 
2
+ using Amanotes.Core.Internal;
2
3
  using System.Threading;
3
4
  using static Amanotes.Core.GDKDebug;
4
5
  using static Amanotes.Core.Internal.Messsage;
@@ -21,7 +22,8 @@ namespace Amanotes.Core
21
22
  _instance = this;
22
23
  mainThreadId = Thread.CurrentThread.ManagedThreadId;
23
24
  DontDestroyOnLoad(this);
24
- StartCoroutine(InitRoutine());
25
+
26
+ GDKUtils.StartCoroutine(InitRoutine());
25
27
  }
26
28
  }
27
29
  }
@@ -13,8 +13,9 @@ namespace Amanotes.Core
13
13
  {
14
14
  public const string GDK_USER_ID_UPDATED = nameof(GDK_USER_ID_UPDATED);
15
15
  }
16
-
17
- public static readonly UserProfile User = new UserProfile();
16
+
17
+ private static readonly Lazy<UserProfile> _user = new Lazy<UserProfile>(() => new UserProfile());
18
+ public static UserProfile User => _user.Value;
18
19
 
19
20
  /// <summary>
20
21
  /// We use multiple IDs to do the user mapping between AppsFlyer, IronSource & Firebase
package/Runtime/AmaGDK.cs CHANGED
@@ -24,15 +24,19 @@ namespace Amanotes.Core
24
24
  {
25
25
  public partial class AmaGDK : MonoBehaviour
26
26
  {
27
- public const string VERSION = "0.2.74";
27
+ public const string VERSION = "0.2.75";
28
28
 
29
29
  internal static Status _status = Status.None;
30
30
  private static ConfigAsset _config = null;
31
31
 
32
+ private static readonly Lazy<GDKGeoLocation> _geoLocation = new Lazy<GDKGeoLocation>(() => new GDKGeoLocation());
33
+ private static readonly Lazy<GDKServerTime> _serverTime = new Lazy<GDKServerTime>(() => new GDKServerTime());
34
+ private static readonly Lazy<ForceQuitMonitor> _forceQuit = new Lazy<ForceQuitMonitor>(() => new ForceQuitMonitor());
35
+
32
36
  internal static readonly GDKDispatcher dispatcher = new GDKDispatcher();
33
- internal static readonly GDKGeoLocation GeoLocation = new GDKGeoLocation();
34
- internal static readonly GDKServerTime ServerTime = new GDKServerTime();
35
- private static readonly ForceQuitMonitor ForceQuit = new ForceQuitMonitor();
37
+ internal static GDKGeoLocation GeoLocation => _geoLocation.Value;
38
+ internal static GDKServerTime ServerTime => _serverTime.Value;
39
+ private static ForceQuitMonitor ForceQuit => _forceQuit.Value;
36
40
 
37
41
  internal static bool _allowInit = false;
38
42
 
@@ -96,12 +96,12 @@ namespace Amanotes.Core.Internal
96
96
 
97
97
  internal class WebUtils
98
98
  {
99
- public static Coroutine PostJson(string url, string jsonData, Action<bool, string> onComplete = null,
99
+ public static GDKRoutine PostJson(string url, string jsonData, Action<bool, string> onComplete = null,
100
100
  Dictionary<string, string> headers = null)
101
101
  {
102
- return AmaGDK._instance.StartCoroutine(PostJsonCoroutine(url, jsonData, onComplete, headers));
102
+ return GDKUtils.StartCoroutine(PostJsonCoroutine(url, jsonData, onComplete, headers));
103
103
  }
104
-
104
+
105
105
  private static IEnumerator PostJsonCoroutine(string url, string jsonData,
106
106
  Action<bool, string> onComplete = null, Dictionary<string, string> headers = null)
107
107
  {
@@ -131,7 +131,7 @@ namespace Amanotes.Core.Internal
131
131
 
132
132
  public static void CheckInternetConnection(Action<bool> hasInternet)
133
133
  {
134
- AmaGDK._instance.StartCoroutine(CheckInternet(hasInternet));
134
+ GDKUtils.StartCoroutine(CheckInternet(hasInternet));
135
135
  }
136
136
 
137
137
  public static IEnumerator CheckInternet(Action<bool> hasInternet)
@@ -38,8 +38,8 @@ namespace Amanotes.Core.Internal
38
38
  isDirty = false;
39
39
  }
40
40
  }
41
-
42
- private readonly ForceQuitData localData = new ForceQuitData();
41
+ private readonly Lazy<ForceQuitData> _localData = new Lazy<ForceQuitData>(() => new ForceQuitData());
42
+ private ForceQuitData localData => _localData.Value;
43
43
 
44
44
  public ForceQuitMonitor()
45
45
  {
@@ -1,3 +1,4 @@
1
+ using Amanotes.Core.Internal;
1
2
  using System;
2
3
  using System.Collections;
3
4
  using UnityEngine;
@@ -86,7 +87,7 @@ namespace Amanotes.Core
86
87
 
87
88
  void IGeoLocationProvider.FetchGeoLocation(Action<GeoLocationData> result)
88
89
  {
89
- AmaGDK._instance.StartCoroutine(FetchGeoLocationRoutine(result));
90
+ GDKUtils.StartCoroutine(FetchGeoLocationRoutine(result));
90
91
  }
91
92
 
92
93
  private IEnumerator FetchGeoLocationRoutine(Action<GeoLocationData> result)
@@ -1,3 +1,4 @@
1
+ using Amanotes.Core.Internal;
1
2
  using System;
2
3
  using System.Collections;
3
4
  using System.Collections.Generic;
@@ -37,7 +38,7 @@ namespace Amanotes.Core
37
38
 
38
39
  public void FetchServerTime(Action<ServerTimeData> result)
39
40
  {
40
- AmaGDK._instance.StartCoroutine(FetchTimeRoutine(result));
41
+ GDKUtils.StartCoroutine(FetchTimeRoutine(result));
41
42
  }
42
43
 
43
44
  private IEnumerator FetchTimeRoutine(Action<ServerTimeData> result)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.gdk",
3
- "version": "0.2.74",
3
+ "version": "0.2.75",
4
4
  "displayName": "AmaGDK",
5
5
  "description": "Amanotes Game Development Kit",
6
6
  "unity": "2019.4",