com.amanotes.gdk 0.2.27 → 0.2.29

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.29 - 2023-11-03]
4
+ - Fix accumulated_count
5
+ - Fix missing IDFA
6
+
7
+ ## [0.2.28 - 2023-11-01]
8
+ - Ads: Set timescale to 0 after save
9
+
3
10
  ## [0.2.27 - 2023-11-01]
4
11
  - No longer stop ad
5
12
  - Update ad status by adapter
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -682,7 +682,7 @@ namespace Amanotes.Core.Internal
682
682
  if (willSaveTimeScale)
683
683
  {
684
684
  Ads._savedTimeScale = Time.timeScale;
685
- Ads._savedTimeScale = Time.timeScale;
685
+ Time.timeScale = 0;
686
686
  }
687
687
 
688
688
  Ads._adapter.HandleBeforeAdShow();
@@ -230,28 +230,7 @@ namespace Amanotes.Core
230
230
  config.NeverSend = eventNames;
231
231
  }
232
232
  }
233
-
234
- public static void OnlySendAtCount(string eventName, List<int> listCount, bool withinSession = false, bool appendCountToEventName = false, string numberFormat = "00")
235
- {
236
- var config = new EventConfig
237
- {
238
- listCount = listCount,
239
- withinSession = withinSession,
240
- appendCountToEventName = appendCountToEventName,
241
- numberFormat = numberFormat
242
- };
243
-
244
- if (sendAtCount.ContainsKey(eventName))
245
- {
246
- LogWarning($"{eventName} has already been set list of count number to log.");
247
- sendAtCount[eventName] = config;
248
- }
249
- else
250
- {
251
- sendAtCount.Add(eventName, config);
252
- }
253
- }
254
- }
233
+ }
255
234
 
256
235
  //INTERNAL
257
236
  public static partial class Analytics
@@ -271,11 +250,14 @@ namespace Amanotes.Core
271
250
  internal static readonly List<AdapterContext> listAdapters = new List<AdapterContext>();
272
251
  internal static readonly AnalyticsData localData = new AnalyticsData().LoadJsonFromFile();
273
252
  internal static readonly SessionStat sessionStat = new SessionStat();
253
+ internal static AdapterContext primaryAdapter;
274
254
 
275
255
  internal static void Init()
276
256
  {
277
257
  listAdapters.Clear();
278
258
  listAdapters.AddRange(Adapter.FindAll<IAnalyticAdapter>());
259
+ if (listAdapters.Count != 0)
260
+ primaryAdapter = listAdapters.Find(a => a.adapterId == AdapterID.FIREBASE_ANALYTICS) ?? listAdapters[0];
279
261
 
280
262
  onFrameUpdate -= ProcessEventQueue;
281
263
  onFrameUpdate += ProcessEventQueue;
@@ -294,10 +276,9 @@ namespace Amanotes.Core
294
276
  while (eventQueue.Count > 0)
295
277
  {
296
278
  var eventData = eventQueue.Dequeue();
297
- var (countInSession, totalCount) = localData.IncreaseCounter(eventData.eventName);
298
-
299
279
  if (!ShouldSendEvent(eventData)) continue;
300
-
280
+
281
+ var (countInSession, totalCount) = localData.IncreaseCounter(eventData);
301
282
  if (eventData.accumulated)
302
283
  {
303
284
  eventData.AddParam("accumulated_count", eventData.withinSession ? countInSession : totalCount);
@@ -315,22 +296,9 @@ namespace Amanotes.Core
315
296
  var inUseAdapterIDs = new List<string>();
316
297
  foreach (AdapterContext m in listAdapters)
317
298
  {
299
+ if (IsAdapterForbidden(m, eventData)) continue;
300
+
318
301
  var api = m.GetAdapterApi<IAnalyticAdapter>();
319
- var config = m.GetAdapterConfig<AnalyticsAdapterConfig>();
320
-
321
- if (eventData.overrideConfig)
322
- {
323
- // IMPORTANT NOTE:
324
- //
325
- // Once set overrideConfig, we should skip the adapter config completely!!!
326
- //
327
- if (eventData.IsAdapterForbidden(m.adapterId)) continue;
328
- }
329
- else // Do not remove else
330
- {
331
- if (config.IsForbidden(eventData.eventName)) continue;
332
- }
333
-
334
302
  api.LogEvent(eventNameToSend, eventData.parameters);
335
303
  inUseAdapterIDs.Add(m.adapterId);
336
304
  }
@@ -341,6 +309,27 @@ namespace Amanotes.Core
341
309
  sessionStat.Save();
342
310
  }
343
311
 
312
+ internal static bool IsAdapterForbidden(AdapterContext adapterContext, EventParams eventData)
313
+ {
314
+ if (adapterContext == null) return false;
315
+ var config = adapterContext.GetAdapterConfig<AnalyticsAdapterConfig>();
316
+
317
+ if (eventData.overrideConfig)
318
+ {
319
+ // IMPORTANT NOTE:
320
+ //
321
+ // Once set overrideConfig, we should skip the adapter config completely!!!
322
+ //
323
+ if (eventData.IsAdapterForbidden(adapterContext.adapterId)) return true;
324
+ }
325
+ else // Do not remove else
326
+ {
327
+ if (config.IsForbidden(eventData.eventName)) return true;
328
+ }
329
+
330
+ return false;
331
+ }
332
+
344
333
  internal static string GetEventNameToSend(string eventName, int countInSession, int totalCount)
345
334
  {
346
335
  if (!sendAtCount.TryGetValue(eventName, out var config)) return eventName;
@@ -529,9 +518,11 @@ namespace Amanotes.Core
529
518
  return true;
530
519
  }
531
520
 
532
- internal (int countInSession, int totalCount) IncreaseCounter(string eventName)
521
+ internal (int countInSession, int totalCount) IncreaseCounter(EventParams eventParams)
533
522
  {
534
- EventDetail result = GetEventDetail(eventName, true);
523
+ EventDetail result = GetEventDetail(eventParams.eventName, true);
524
+ if (IsAdapterForbidden(primaryAdapter, eventParams))
525
+ return (result.countInSession, result.totalCount);
535
526
  result.countInSession++;
536
527
  result.totalCount++;
537
528
  _dirty = true;
@@ -57,8 +57,6 @@ namespace Amanotes.Core
57
57
  internal IEnumerator Init()
58
58
  {
59
59
  User.LoadJsonFromFile();
60
- if (IsAmaDeviceIdExist()) yield break;
61
-
62
60
  GetAdvertisingId();
63
61
 
64
62
  float time = 0;
@@ -76,7 +74,7 @@ namespace Amanotes.Core
76
74
  {
77
75
  if (!string.IsNullOrEmpty(amaDeviceId))
78
76
  {
79
- Logging.Log($"AmaDeviceId is already exist: {amaDeviceId}");
77
+ Logging.Log($"AmaDeviceId is already existed: {amaDeviceId}");
80
78
  return true;
81
79
  }
82
80
  return false;
package/Runtime/AmaGDK.cs CHANGED
@@ -14,7 +14,7 @@ namespace Amanotes.Core
14
14
  {
15
15
  public partial class AmaGDK : MonoBehaviour
16
16
  {
17
- public const string VERSION = "0.2.27";
17
+ public const string VERSION = "0.2.29";
18
18
 
19
19
  internal static AmaGDK _instance;
20
20
  internal static Status _status = Status.None;
@@ -114,7 +114,7 @@ namespace Amanotes.Core
114
114
  }
115
115
 
116
116
  var adapterInfo = new AdapterInfo(adapter.adapterId, adapter.adapterVersion, adapter.IsReady);
117
- _adapters.Add(adapter.adapterId, adapterInfo);
117
+ _adapters[adapter.adapterId] = adapterInfo;
118
118
  _onAdapterReadyCallback?.Invoke(adapterInfo);
119
119
  adapterAnnounce.AppendLine(string.Format("[{0}] {1} (adapter v{2})", adapter.IsReady ? "OK" : "FAIL",
120
120
  adapter.adapterId, adapter.adapterVersion));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.gdk",
3
- "version": "0.2.27",
3
+ "version": "0.2.29",
4
4
  "displayName": "AmaGDK",
5
5
  "description": "Amanotes Game Development Kit",
6
6
  "unity": "2019.4",