com.amanotes.gdk 0.2.78 → 0.2.80

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.80] - 2024-11-13
4
+ - [Dev] Don't use obsolete functions
5
+ - [Dev] Add CrashlyticHook
6
+
7
+ ## [0.2.79] - 2024-11-13
8
+ - [Dev] Add callbacks for IAP module
9
+ - [Fix] Return empty collections instead of null in RevenueCatAdapter
10
+ - [GameOps] Remove durationInSecs
11
+
3
12
  ## [0.2.78] - 2024-11-11
4
13
  - [Dev] Add iOS and Android ad unit configuration for MAX
5
14
  - [Dev] Track Adapters and Third-party packages used in games
Binary file
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  fileFormatVersion: 2
2
- guid: cbf5a5557d9ac40ab83b6587b81640cb
2
+ guid: f1f8828296a16440f8aab012f540cebd
3
3
  DefaultImporter:
4
4
  externalObjects: {}
5
5
  userData:
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -23,6 +23,58 @@ namespace Amanotes.Core
23
23
  public static readonly Dictionary<string, ProductInfo> AllProducts = new Dictionary<string, ProductInfo>();
24
24
  private const string DATE_FORMAT = "yyyy/MM/yy HH:mm:ss";
25
25
 
26
+ public static void SetCallback_OnModuleReady(Action onReady)
27
+ {
28
+ if (onReady == null) return;
29
+
30
+ if (IsModuleReady)
31
+ {
32
+ onReady();
33
+ return;
34
+ }
35
+
36
+ _onModuleReady -= onReady;
37
+ _onModuleReady += onReady;
38
+ }
39
+
40
+ public static void SetCallback_OnGetProductsComplete(Action onComplete)
41
+ {
42
+ if (onComplete == null) return;
43
+
44
+ if (isGetProductComplete)
45
+ {
46
+ onComplete();
47
+ return;
48
+ }
49
+
50
+ _onGetProductsComplete -= onComplete;
51
+ _onGetProductsComplete += onComplete;
52
+ }
53
+
54
+ public static void SetCallback_OnGetCustomerInfoComplete(Action onComplete)
55
+ {
56
+ if (onComplete == null) return;
57
+
58
+ if (isGetCustomerInfoComplete)
59
+ {
60
+ onComplete();
61
+ return;
62
+ }
63
+
64
+ _onGetCustomerInfoComplete -= onComplete;
65
+ _onGetCustomerInfoComplete += onComplete;
66
+ }
67
+
68
+ public static void SyncCustomerInfo(Action<bool> onComplete = null)
69
+ {
70
+ if (_adapter == null)
71
+ {
72
+ onComplete?.Invoke(false);
73
+ return;
74
+ }
75
+ _adapter.SyncCustomerInfo(onComplete);
76
+ }
77
+
26
78
  public static ISetupBuilder GetProducts(bool appendExistingList = false)
27
79
  {
28
80
  if (!appendExistingList)
@@ -129,6 +181,13 @@ namespace Amanotes.Core
129
181
  }
130
182
  }
131
183
 
184
+ private static bool isGetProductComplete;
185
+ private static bool isGetCustomerInfoComplete;
186
+ private static bool IsModuleReady => isGetProductComplete && isGetCustomerInfoComplete;
187
+ private static Action _onGetProductsComplete;
188
+ private static Action _onGetCustomerInfoComplete;
189
+ private static Action _onModuleReady;
190
+
132
191
  internal static bool InitModule()
133
192
  {
134
193
  _adapter = Adapter2.GetAdapter<IAPAdapter>();
@@ -140,8 +199,31 @@ namespace Amanotes.Core
140
199
  internal static void StartModule()
141
200
  {
142
201
  if (_adapter == null) return;
202
+ _adapter.SyncCustomerInfo(
203
+ success =>
204
+ {
205
+ isGetCustomerInfoComplete = true;
206
+ GDKUtils.SafeInvokeAndClear(ref _onGetCustomerInfoComplete);
207
+ if (IsModuleReady) GDKUtils.SafeInvokeAndClear(ref _onModuleReady);
208
+ });
143
209
  localData.Sync();
144
- if (Config.iap.autoGetProducts) GetProducts();
210
+ if (Config.iap.autoGetProducts)
211
+ {
212
+ GetProducts()
213
+ .OnSuccess(_ => OnGetProductsComplete())
214
+ .OnFail(_ => OnGetProductsComplete());
215
+ }
216
+ else
217
+ {
218
+ OnGetProductsComplete();
219
+ }
220
+ }
221
+
222
+ private static void OnGetProductsComplete()
223
+ {
224
+ isGetProductComplete = true;
225
+ GDKUtils.SafeInvokeAndClear(ref _onGetProductsComplete);
226
+ if (IsModuleReady) GDKUtils.SafeInvokeAndClear(ref _onModuleReady);
145
227
  }
146
228
  }
147
229
 
@@ -442,6 +524,7 @@ namespace Amanotes.Core.Internal
442
524
  if (ls == null || ls.Count == 0)
443
525
  {
444
526
  LogWarning("There is no IAP product");
527
+ onSuccess?.Invoke(AllProducts);
445
528
  return;
446
529
  }
447
530
 
@@ -506,8 +589,7 @@ namespace Amanotes.Core.Internal
506
589
  {
507
590
  foreach (var p in pList)
508
591
  {
509
- if (AllProducts.ContainsKey(p.id)) AllProducts[p.id] = p;
510
- else AllProducts.Add(p.id, p);
592
+ AllProducts[p.id] = p;
511
593
  }
512
594
  GDKUtils.DelayCall(0f, GetNextProductsInQueue);
513
595
  }, error => onFail?.Invoke(error));
@@ -573,5 +655,7 @@ namespace Amanotes.Core.Internal
573
655
  public abstract DateTime? GetUnsubscribedDate();
574
656
  public abstract HashSet<PurchaseRecord> GetPurchaseHistory();
575
657
  public abstract DateTime? GetLastPurchaseDate(string productAndPlanId);
658
+
659
+ public abstract void SyncCustomerInfo(Action<bool> onComplete = null);
576
660
  }
577
661
  }
package/Runtime/AmaGDK.cs CHANGED
@@ -27,7 +27,7 @@ namespace Amanotes.Core
27
27
  {
28
28
  public partial class AmaGDK : MonoBehaviour
29
29
  {
30
- public const string VERSION = "0.2.78";
30
+ public const string VERSION = "0.2.80";
31
31
 
32
32
  internal static Status _status = Status.None;
33
33
  private static ConfigAsset _config = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.gdk",
3
- "version": "0.2.78",
3
+ "version": "0.2.80",
4
4
  "displayName": "AmaGDK",
5
5
  "description": "Amanotes Game Development Kit",
6
6
  "unity": "2019.4",