com.amanotes.gdk 0.1.21 → 0.2.1

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 +5 -5
  2. package/Editor/AmaGDKEditor.cs +91 -46
  3. package/Editor/AmaGDKManager.cs +26 -27
  4. package/Editor/Utils/AmaGDKEditor.ExtractVersion.cs +133 -103
  5. package/Editor/Utils/AmaGDKEditor.GUI.cs +54 -51
  6. package/Editor/Utils/AmaGDKEditor.Utils.cs +2 -3
  7. package/Packages/AmaGDKConfig.unitypackage +0 -0
  8. package/Packages/AmaGDKExample.unitypackage +0 -0
  9. package/Packages/AmaGDKTest.unitypackage +0 -0
  10. package/Packages/AmaPassport.ATTSupport.unitypackage +0 -0
  11. package/Packages/AmaPassport.ATTSupport.unitypackage.meta +7 -0
  12. package/Packages/AmaPassport.AdvertisingID.unitypackage +0 -0
  13. package/Packages/AmaPassport.AdvertisingID.unitypackage.meta +7 -0
  14. package/Packages/AppsFlyerAdapter_v6.5.4.unitypackage +0 -0
  15. package/Packages/FirebaseAnalyticsAdapter_v9.1.0.unitypackage +0 -0
  16. package/Packages/FirebaseRemoteConfigAdapter_v9.1.0.unitypackage +0 -0
  17. package/Packages/FirebaseRemoteConfigAdapter_v9.1.0.unitypackage.meta +1 -1
  18. package/Runtime/AmaGDK.Adapters.cs +13 -14
  19. package/Runtime/AmaGDK.Ads.cs +523 -151
  20. package/Runtime/AmaGDK.AmaPassport.cs +433 -0
  21. package/Runtime/AmaGDK.AmaPassport.cs.meta +11 -0
  22. package/Runtime/AmaGDK.Analytics.cs +78 -89
  23. package/Runtime/AmaGDK.Config.cs +23 -19
  24. package/Runtime/AmaGDK.Internal.SemVer.cs +11 -29
  25. package/Runtime/AmaGDK.Internal.cs +16 -10
  26. package/Runtime/AmaGDK.RemoteConfig.cs +32 -23
  27. package/Runtime/AmaGDK.UserProfile.cs +5 -8
  28. package/Runtime/AmaGDK.Utils.cs +40 -50
  29. package/Runtime/AmaGDK.WebUtils.cs +42 -42
  30. package/Runtime/AmaGDK.cs +70 -20
  31. package/Runtime/AssemblyInfo.cs +0 -1
  32. package/package.json +1 -1
package/Runtime/AmaGDK.cs CHANGED
@@ -2,9 +2,6 @@ using System;
2
2
  using System.Collections;
3
3
  using Amanotes.Core.Internal;
4
4
  using UnityEngine;
5
-
6
- using ConfigAsset = Amanotes.Core.Internal.ConfigAsset;
7
- using Status = Amanotes.Core.Internal.Status;
8
5
  using static Amanotes.Core.Internal.Logging;
9
6
  using static Amanotes.Core.Internal.Messsage;
10
7
 
@@ -12,10 +9,9 @@ namespace Amanotes.Core
12
9
  {
13
10
  public partial class AmaGDK : MonoBehaviour
14
11
  {
15
- public const string VERSION = "0.1.21";
12
+ public const string VERSION = "0.2.1";
16
13
 
17
14
  internal static AmaGDK _instance;
18
- internal static event Action _frameUpdate;
19
15
  internal static Status _status = Status.None;
20
16
  internal static Action _onReadyCallback;
21
17
  internal static bool _allowInit = false;
@@ -28,12 +24,13 @@ namespace Amanotes.Core
28
24
  {
29
25
  if (_config != null) return _config;
30
26
  _config = Resources.Load<ConfigAsset>("AmaGDKConfig");
27
+
31
28
  // if (_config == null) LogWarningOnce(CONFIG_NOT_FOUND);
32
29
  return _config;
33
30
  }
34
31
  }
35
32
 
36
- void Awake()
33
+ private void Awake()
37
34
  {
38
35
  if (_instance != null && _instance != this)
39
36
  {
@@ -42,10 +39,7 @@ namespace Amanotes.Core
42
39
  return;
43
40
  }
44
41
 
45
- if (_instance != null)
46
- {
47
- LogWarning("Should never be here!");
48
- }
42
+ if (_instance != null) LogWarning("Should never be here!");
49
43
 
50
44
  _instance = this;
51
45
  DontDestroyOnLoad(this);
@@ -54,7 +48,7 @@ namespace Amanotes.Core
54
48
  _allowInit = _allowInit || autoInit;
55
49
  StartCoroutine(InitRoutine());
56
50
  }
57
-
51
+
58
52
  IEnumerator InitRoutine()
59
53
  {
60
54
  if (Config == null)
@@ -84,10 +78,12 @@ namespace Amanotes.Core
84
78
 
85
79
  // sort on priority
86
80
  Adapter.listAdapters.Sort((a1, a2) => a1.initOrder.CompareTo(a2.initOrder));
87
- foreach (var adapter in Adapter.listAdapters)
81
+ foreach (AdapterContext adapter in Adapter.listAdapters)
88
82
  {
89
- Log($"Initing {adapter.adapterId} --> initOrder: {adapter.initOrder}");
83
+ Log($"Initiating {adapter.adapterId} --> initOrder: {adapter.initOrder}");
90
84
  adapter.Init();
85
+ RegisterUnityCallback(adapter);
86
+
91
87
  time = 0;
92
88
 
93
89
  while (!adapter.IsReady)
@@ -104,6 +100,7 @@ namespace Amanotes.Core
104
100
 
105
101
  // Init modules (Adapter managers)
106
102
  Analytics.Init();
103
+
107
104
  //Ads.Init();
108
105
 
109
106
  _status = Status.Ready;
@@ -112,11 +109,38 @@ namespace Amanotes.Core
112
109
  Debug.Log($"[AmaGDK] {READY}");
113
110
  }
114
111
 
115
- private void Update()
112
+ void RegisterUnityCallback(AdapterContext adapter)
116
113
  {
117
- if (!isReady) return;
118
- _frameUpdate?.Invoke();
114
+ switch (adapter)
115
+ {
116
+ case IOnFrameUpdate a: {
117
+ onFrameUpdate -= a.OnFrameUpdate;
118
+ onFrameUpdate += a.OnFrameUpdate;
119
+ break;
120
+ }
121
+
122
+ case IOnApplicationPause a: {
123
+ onApplicationPause -= a.OnApplicationPause;
124
+ onApplicationPause += a.OnApplicationPause;
125
+ break;
126
+ }
127
+
128
+ case IOnApplicationFocus a:
129
+ {
130
+ applicationFocus -= a.OnApplicationFocus;
131
+ applicationFocus += a.OnApplicationFocus;
132
+ break;
133
+ }
134
+
135
+ case IOnApplicationQuit a:
136
+ {
137
+ applicationQuit -= a.OnApplicationQuit;
138
+ applicationQuit += a.OnApplicationQuit;
139
+ break;
140
+ }
141
+ }
119
142
  }
143
+
120
144
  }
121
145
 
122
146
  public partial class AmaGDK // PUBLIC APIS
@@ -151,8 +175,6 @@ namespace Amanotes.Core
151
175
  _instance = sdk.AddComponent<AmaGDK>();
152
176
  }
153
177
 
154
-
155
-
156
178
  public static void SetOnReadyCallback(Action onReady)
157
179
  {
158
180
  if (onReady == null)
@@ -163,7 +185,6 @@ namespace Amanotes.Core
163
185
  _onReadyCallback -= onReady;
164
186
  _onReadyCallback += onReady;
165
187
  }
166
-
167
188
  }
168
189
 
169
190
  public partial class AmaGDK
@@ -177,4 +198,33 @@ namespace Amanotes.Core
177
198
  public const string REVENUECAT = "RevenueCat";
178
199
  }
179
200
  }
180
- }
201
+
202
+ public partial class AmaGDK
203
+ {
204
+ internal static event Action onFrameUpdate;
205
+ internal static event Action<bool> onApplicationPause;
206
+ internal static event Action<bool> applicationFocus;
207
+ internal static event Action applicationQuit;
208
+
209
+ private void OnApplicationPause(bool pauseStatus)
210
+ {
211
+ onApplicationPause?.Invoke(pauseStatus);
212
+ }
213
+
214
+ private void OnApplicationFocus(bool hasFocus)
215
+ {
216
+ applicationFocus?.Invoke(hasFocus);
217
+ }
218
+
219
+ private void Update()
220
+ {
221
+ if (!isReady) return;
222
+ onFrameUpdate?.Invoke();
223
+ }
224
+
225
+ private void OnApplicationQuit()
226
+ {
227
+ applicationQuit?.Invoke();
228
+ }
229
+ }
230
+ }
@@ -1,5 +1,4 @@
1
1
  using System.Runtime.CompilerServices;
2
-
3
2
  [assembly: InternalsVisibleTo("AmaGDK.Test")]
4
3
 
5
4
  #if UNITY_EDITOR
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.gdk",
3
- "version": "0.1.21",
3
+ "version": "0.2.1",
4
4
  "displayName": "AmaGDK",
5
5
  "description": "Amanotes Game Development Kit",
6
6
  "unity": "2020.3",