com.amanotes.gdk 0.2.35 → 0.2.37
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 +9 -0
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/AmaGDKProject.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.unitypackage +0 -0
- package/Packages/AppsFlyerAdRevenuePlugin.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter_v6.5.4.unitypackage +0 -0
- package/Packages/FirebaseAnalyticsAdapter_v9.1.0.unitypackage +0 -0
- package/Packages/FirebaseRemoteConfigAdapter_v9.1.0.unitypackage +0 -0
- package/Packages/IronSourceAdapter_v7.2.6.unitypackage +0 -0
- package/Packages/RevenueCatAdapter_v6.0.0.unitypackage +0 -0
- package/Runtime/AmaGDK.Ads.cs +132 -62
- package/Runtime/AmaGDK.Analytics.cs +3 -3
- package/Runtime/AmaGDK.UserProfile.cs +13 -1
- package/Runtime/AmaGDK.cs +1 -1
- package/package.json +1 -1
- package/Runtime/AmaGDK.AdEvents.cs +0 -297
- package/Runtime/AmaGDK.AdEvents.cs.meta +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.37 - 2023-11-21]
|
|
4
|
+
- Improve GDK logs
|
|
5
|
+
- Banner will not show when ad adapter is not ready
|
|
6
|
+
- Fix ama_device_id on Android
|
|
7
|
+
|
|
8
|
+
## [0.2.36 - 2023-11-15]
|
|
9
|
+
- Add OnAdShowReadyStatus callback
|
|
10
|
+
- Revamp AdEventTracking
|
|
11
|
+
|
|
3
12
|
## [0.2.35 - 2023-11-14]
|
|
4
13
|
- [Fix] Save UserID
|
|
5
14
|
|
|
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
|
@@ -58,7 +58,15 @@ namespace Amanotes.Core
|
|
|
58
58
|
return ad;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
public static IAdCallback
|
|
61
|
+
public static IAdCallback OnAdShowReadyStatus(this IAdCallback ad, Action<AdShowReadyStatus> callback)
|
|
62
|
+
{
|
|
63
|
+
if (!MakeSureAdNotNull(ad)) return null;
|
|
64
|
+
Ads.context.onAdShowReadyStatus -= callback;
|
|
65
|
+
Ads.context.onAdShowReadyStatus += callback;
|
|
66
|
+
return ad;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public static IAdCallback OnAdResult(this IAdCallback ad, Action<bool> callback)
|
|
62
70
|
{
|
|
63
71
|
if (!MakeSureAdNotNull(ad)) return null;
|
|
64
72
|
Ads.context.onResult -= callback;
|
|
@@ -82,10 +90,15 @@ namespace Amanotes.Core
|
|
|
82
90
|
[Serializable]
|
|
83
91
|
internal class AdStat
|
|
84
92
|
{
|
|
85
|
-
|
|
93
|
+
// per session
|
|
94
|
+
internal float lastCallTime;
|
|
95
|
+
internal int callCount;
|
|
96
|
+
|
|
97
|
+
internal float lastSuccessTime;
|
|
86
98
|
internal int success;
|
|
87
99
|
internal int failed;
|
|
88
|
-
|
|
100
|
+
|
|
101
|
+
// persistent
|
|
89
102
|
public int successTotal;
|
|
90
103
|
public int failedTotal;
|
|
91
104
|
}
|
|
@@ -96,11 +109,26 @@ namespace Amanotes.Core
|
|
|
96
109
|
public AdStat interstitial = new AdStat();
|
|
97
110
|
public AdStat reward = new AdStat();
|
|
98
111
|
|
|
99
|
-
internal
|
|
112
|
+
internal AdStat GetStat(AdType adType)
|
|
100
113
|
{
|
|
101
|
-
return
|
|
114
|
+
return adType == AdType.Interstitial ? interstitial : reward;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
internal int ShowCallCount(AdType adType)
|
|
118
|
+
{
|
|
119
|
+
return GetStat(adType).callCount;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
internal int TimeSinceLastShowCalled(AdType adType)
|
|
123
|
+
{
|
|
124
|
+
return (int)(Time.realtimeSinceStartup - GetStat(adType).lastCallTime);
|
|
102
125
|
}
|
|
103
126
|
|
|
127
|
+
internal int TimeSinceLastShowSuccess(AdType adType)
|
|
128
|
+
{
|
|
129
|
+
return (int)(Time.realtimeSinceStartup - GetStat(adType).lastSuccessTime);
|
|
130
|
+
}
|
|
131
|
+
|
|
104
132
|
internal void Save()
|
|
105
133
|
{
|
|
106
134
|
this.SaveJsonToFile();
|
|
@@ -110,12 +138,10 @@ namespace Amanotes.Core
|
|
|
110
138
|
[Serializable]
|
|
111
139
|
public class AdAdapterConfig
|
|
112
140
|
{
|
|
113
|
-
public bool
|
|
141
|
+
// public bool manualInit;
|
|
114
142
|
public int adLoadTimeoutInSecs = 60;
|
|
115
143
|
public int adShowTimeoutInSecs = 5;
|
|
116
144
|
public BannerPosition bannerPosition = BannerPosition.BOTTOM;
|
|
117
|
-
|
|
118
|
-
public bool checkInternet = true;
|
|
119
145
|
public bool autoLogEvent = true;
|
|
120
146
|
|
|
121
147
|
public bool enableInterstitial = true;
|
|
@@ -149,6 +175,12 @@ namespace Amanotes.Core
|
|
|
149
175
|
_adConfig = ((AdapterContext)_adapter)?.GetAdapterConfig<AdAdapterConfig>();
|
|
150
176
|
_adapter?.interstitial.StartLoadAd();
|
|
151
177
|
_adapter?.rewardVideo.StartLoadAd();
|
|
178
|
+
|
|
179
|
+
if (_isBannerShowing)
|
|
180
|
+
{
|
|
181
|
+
_isBannerShowing = false;
|
|
182
|
+
ShowBanner(_showingBannerPosition);
|
|
183
|
+
}
|
|
152
184
|
}
|
|
153
185
|
|
|
154
186
|
public static bool HasInterstitial => _adapter.interstitial.hasAd;
|
|
@@ -219,19 +251,28 @@ namespace Amanotes.Core
|
|
|
219
251
|
}
|
|
220
252
|
|
|
221
253
|
private static bool _isBannerShowing;
|
|
254
|
+
private static BannerPosition? _showingBannerPosition = null;
|
|
255
|
+
|
|
222
256
|
public static void ShowBanner(BannerPosition? bannerPosition = null)
|
|
223
257
|
{
|
|
224
258
|
if (_isBannerShowing) return;
|
|
225
259
|
_isBannerShowing = true;
|
|
226
|
-
|
|
227
|
-
|
|
260
|
+
_showingBannerPosition = bannerPosition;
|
|
261
|
+
|
|
262
|
+
if (_adapter == null)
|
|
228
263
|
{
|
|
229
|
-
|
|
264
|
+
//Debug.LogWarning("Adapter not found???");
|
|
265
|
+
return;
|
|
230
266
|
}
|
|
231
|
-
|
|
267
|
+
|
|
268
|
+
if (_adConfig == null)
|
|
232
269
|
{
|
|
233
|
-
|
|
270
|
+
//Debug.LogWarning("_adConfig not found???");
|
|
271
|
+
return;
|
|
234
272
|
}
|
|
273
|
+
|
|
274
|
+
_showingBannerPosition = bannerPosition ?? _adConfig.bannerPosition;
|
|
275
|
+
_adapter.ShowBanner(_showingBannerPosition.Value);
|
|
235
276
|
}
|
|
236
277
|
|
|
237
278
|
public static void HideBanner()
|
|
@@ -252,12 +293,15 @@ namespace Amanotes.Core
|
|
|
252
293
|
_adapter.rewardVideo.StopShowAd();
|
|
253
294
|
}
|
|
254
295
|
|
|
255
|
-
public static int
|
|
296
|
+
public static int TimeSinceLastInterstitialSucceed => localData.TimeSinceLastShowSuccess(AdType.Interstitial);
|
|
297
|
+
public static int TimeSinceLastVideoRewardSucceed => localData.TimeSinceLastShowSuccess(AdType.VideoReward);
|
|
298
|
+
public static int TimeSinceLastAdSucceed => Math.Min(TimeSinceLastInterstitialSucceed, TimeSinceLastVideoRewardSucceed) ;
|
|
299
|
+
public static int TimeSinceLastInterstitialShowCalled => localData.TimeSinceLastShowCalled(AdType.Interstitial);
|
|
300
|
+
public static int TimeSinceLastVideoRewardShowCalled => localData.TimeSinceLastShowCalled(AdType.VideoReward);
|
|
256
301
|
|
|
257
|
-
public static int
|
|
302
|
+
public static int InterstitialShowCalledInSession => localData.ShowCallCount(AdType.Interstitial);
|
|
303
|
+
public static int RewardVideoShowCalledInSession => localData.ShowCallCount(AdType.VideoReward);
|
|
258
304
|
|
|
259
|
-
public static int TimeSinceLastAd => Math.Min(TimeSinceLastInterstitial, TimeSinceLastVideoReward) ;
|
|
260
|
-
|
|
261
305
|
public static void SetUserId(string userId)
|
|
262
306
|
{
|
|
263
307
|
_adapter.SetUserId(userId);
|
|
@@ -305,13 +349,15 @@ namespace Amanotes.Core.Internal
|
|
|
305
349
|
public enum AdCallback
|
|
306
350
|
{
|
|
307
351
|
None = 0,
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
352
|
+
ShowCalled = 1,
|
|
353
|
+
ShowReadyStatus = 2,
|
|
354
|
+
Open = 4,
|
|
355
|
+
Reward = 8,
|
|
356
|
+
Click = 16,
|
|
357
|
+
Cancel = 32,
|
|
358
|
+
Close = 64,
|
|
359
|
+
Success = 128,
|
|
360
|
+
Fail = 256
|
|
315
361
|
}
|
|
316
362
|
|
|
317
363
|
public enum BannerPosition
|
|
@@ -326,33 +372,30 @@ namespace Amanotes.Core.Internal
|
|
|
326
372
|
VideoReward,
|
|
327
373
|
Banner
|
|
328
374
|
}
|
|
329
|
-
|
|
330
|
-
public enum
|
|
375
|
+
|
|
376
|
+
public enum AdShowReadyStatus
|
|
331
377
|
{
|
|
332
378
|
None,
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
RequestTimeOut,
|
|
337
|
-
AdapterReturnError
|
|
379
|
+
Wifi3GDisabled,
|
|
380
|
+
NoInternet,
|
|
381
|
+
TimeOut
|
|
338
382
|
}
|
|
339
|
-
|
|
383
|
+
|
|
340
384
|
public class ShowAdContext : IAdCallback
|
|
341
385
|
{
|
|
342
386
|
public readonly AdType adType;
|
|
343
387
|
public readonly string placementName;
|
|
344
|
-
public AdResult result = AdResult.None;
|
|
345
388
|
public readonly Dictionary<string, object> userData;
|
|
346
389
|
public AdCallback adCallback;
|
|
347
|
-
|
|
390
|
+
|
|
348
391
|
internal Action onOpened;
|
|
349
392
|
internal Action onRewardReceived;
|
|
350
393
|
internal Action onClicked;
|
|
351
394
|
internal Action onShowSuccess;
|
|
352
395
|
internal Action onShowFailed;
|
|
353
396
|
internal Action onClosed;
|
|
354
|
-
|
|
355
|
-
internal Action<
|
|
397
|
+
internal Action<AdShowReadyStatus> onAdShowReadyStatus;
|
|
398
|
+
internal Action<bool> onResult;
|
|
356
399
|
|
|
357
400
|
// Stats
|
|
358
401
|
public float showCallAt;
|
|
@@ -442,12 +485,12 @@ namespace Amanotes.Core.Internal
|
|
|
442
485
|
continue;
|
|
443
486
|
}
|
|
444
487
|
|
|
445
|
-
if (
|
|
488
|
+
if (!HasLocalNetworkConnection)
|
|
446
489
|
{
|
|
447
490
|
Log("[Ad] LoadAdRoutine: hasInternet = " + HasLocalNetworkConnection);
|
|
448
491
|
continue;
|
|
449
492
|
}
|
|
450
|
-
|
|
493
|
+
|
|
451
494
|
_loadState = LoadAdsState.Requesting;
|
|
452
495
|
_isRequesting = true;
|
|
453
496
|
Log("[Ad] LoadAdRoutine: RequestAd()");
|
|
@@ -505,6 +548,12 @@ namespace Amanotes.Core.Internal
|
|
|
505
548
|
|
|
506
549
|
Log($"[Ad] {adType} StartShowAd");
|
|
507
550
|
_showState = ShowAdsState.ShowCalled;
|
|
551
|
+
|
|
552
|
+
AdStat stat = Ads.localData.GetStat(adType);
|
|
553
|
+
stat.callCount++;
|
|
554
|
+
stat.lastCallTime = Time.realtimeSinceStartup;
|
|
555
|
+
OnAdShowCalled();
|
|
556
|
+
|
|
508
557
|
if (_showAdRoutine != null) _instance.StopCoroutine(_showAdRoutine);
|
|
509
558
|
_showAdRoutine = _instance.StartCoroutine(ShowAdRoutine());
|
|
510
559
|
}
|
|
@@ -518,6 +567,7 @@ namespace Amanotes.Core.Internal
|
|
|
518
567
|
_loadState = LoadAdsState.None;
|
|
519
568
|
StartLoadAd();
|
|
520
569
|
}
|
|
570
|
+
|
|
521
571
|
HandleAfterAdShow();
|
|
522
572
|
if (_showAdRoutine == null) return;
|
|
523
573
|
_instance.StopCoroutine(_showAdRoutine);
|
|
@@ -546,31 +596,27 @@ namespace Amanotes.Core.Internal
|
|
|
546
596
|
LogWarning("[Ad] Inconsistent state report: isAdReady == false while _loadState == Ready");
|
|
547
597
|
_loadState = LoadAdsState.None;
|
|
548
598
|
}
|
|
599
|
+
|
|
600
|
+
if (!HasLocalNetworkConnection)
|
|
601
|
+
{
|
|
602
|
+
_showState = ShowAdsState.ShowFail;
|
|
603
|
+
OnAdShowReadyStatus(false, AdShowReadyStatus.Wifi3GDisabled);
|
|
604
|
+
ShowAdRoutineCompleted(false);
|
|
605
|
+
yield break;
|
|
606
|
+
}
|
|
549
607
|
|
|
550
|
-
|
|
608
|
+
var hasInternet = false;
|
|
609
|
+
yield return WebUtils.CheckInternet(result => hasInternet = result);
|
|
610
|
+
if (!hasInternet)
|
|
551
611
|
{
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
ShowAdRoutineCompleted(false);
|
|
557
|
-
yield break;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
var hasInternet = false;
|
|
561
|
-
yield return WebUtils.CheckInternet(result => hasInternet = result);
|
|
562
|
-
if (!hasInternet)
|
|
563
|
-
{
|
|
564
|
-
_showState = ShowAdsState.ShowFail;
|
|
565
|
-
Ads.context.result = AdResult.NoInternetAccess;
|
|
566
|
-
ShowAdRoutineCompleted(false);
|
|
567
|
-
yield break;
|
|
568
|
-
}
|
|
612
|
+
_showState = ShowAdsState.ShowFail;
|
|
613
|
+
OnAdShowReadyStatus(false, AdShowReadyStatus.NoInternet);
|
|
614
|
+
ShowAdRoutineCompleted(false);
|
|
615
|
+
yield break;
|
|
569
616
|
}
|
|
570
617
|
|
|
571
618
|
if (_loadState != LoadAdsState.Requesting) StartLoadAd();
|
|
572
619
|
_showState = ShowAdsState.WaitForAd;
|
|
573
|
-
|
|
574
620
|
int timeout = Ads._adConfig.adShowTimeoutInSecs;
|
|
575
621
|
var counter = 0;
|
|
576
622
|
|
|
@@ -583,14 +629,15 @@ namespace Amanotes.Core.Internal
|
|
|
583
629
|
|
|
584
630
|
if (!isAdReady)
|
|
585
631
|
{
|
|
586
|
-
|
|
632
|
+
OnAdShowReadyStatus(false, AdShowReadyStatus.TimeOut);
|
|
587
633
|
ShowAdRoutineCompleted(false);
|
|
588
634
|
yield break;
|
|
589
635
|
}
|
|
590
636
|
}
|
|
591
637
|
|
|
592
638
|
_showState = ShowAdsState.Showing;
|
|
593
|
-
|
|
639
|
+
OnAdShowReadyStatus(true, AdShowReadyStatus.None);
|
|
640
|
+
|
|
594
641
|
ShowAd();
|
|
595
642
|
HandleBeforeAdShow();
|
|
596
643
|
|
|
@@ -644,10 +691,10 @@ namespace Amanotes.Core.Internal
|
|
|
644
691
|
}
|
|
645
692
|
|
|
646
693
|
_showState = isSuccess ? ShowAdsState.ShowSuccess : ShowAdsState.ShowFail;
|
|
694
|
+
|
|
647
695
|
// Extra callback
|
|
648
|
-
if (isSuccess) Ads.context.result = AdResult.Success;
|
|
649
|
-
Ads.context.onResult?.Invoke(Ads.context.result);
|
|
650
696
|
Ads.context.showFinishAt = Time.realtimeSinceStartup;
|
|
697
|
+
Ads.context.onResult?.Invoke(isSuccess);
|
|
651
698
|
|
|
652
699
|
var localData = Ads.localData;
|
|
653
700
|
var stat = _isInterstitial ? localData.interstitial : localData.reward;
|
|
@@ -759,7 +806,6 @@ namespace Amanotes.Core.Internal
|
|
|
759
806
|
if (Ads.context != null)
|
|
760
807
|
{
|
|
761
808
|
Ads.context.adCallback |= AdCallback.Fail;
|
|
762
|
-
Ads.context.result = AdResult.AdapterReturnError;
|
|
763
809
|
Ads.context.onShowFailed?.Invoke();
|
|
764
810
|
}
|
|
765
811
|
else
|
|
@@ -783,6 +829,30 @@ namespace Amanotes.Core.Internal
|
|
|
783
829
|
}
|
|
784
830
|
}
|
|
785
831
|
|
|
832
|
+
protected void OnAdShowReadyStatus(bool isReady, AdShowReadyStatus status)
|
|
833
|
+
{
|
|
834
|
+
if (Ads.context != null)
|
|
835
|
+
{
|
|
836
|
+
Ads.context.adCallback |= AdCallback.ShowReadyStatus;
|
|
837
|
+
if (!isReady)
|
|
838
|
+
{
|
|
839
|
+
Ads.context.onAdShowReadyStatus?.Invoke(status);
|
|
840
|
+
OnAdShowNotReady(status);
|
|
841
|
+
} else
|
|
842
|
+
{
|
|
843
|
+
OnAdShowReady();
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
else
|
|
847
|
+
{
|
|
848
|
+
LogWarning("[Ad] OnAdOpen() Something wrong - No AdContext");
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
protected virtual void OnAdShowCalled(){}
|
|
853
|
+
protected virtual void OnAdShowReady(){}
|
|
854
|
+
protected virtual void OnAdShowNotReady(AdShowReadyStatus status){}
|
|
855
|
+
|
|
786
856
|
protected void OnAdOpen()
|
|
787
857
|
{
|
|
788
858
|
Log($"[Ad] {adType} OnAdOpen");
|
|
@@ -289,7 +289,7 @@ namespace Amanotes.Core
|
|
|
289
289
|
string eventNameToSend = GetEventNameToSend(eventData.eventName, countInSession, totalCount);
|
|
290
290
|
if (common.normalizeEventName) NormalizeEventName(ref eventNameToSend);
|
|
291
291
|
|
|
292
|
-
if (showAnalyticsLog) Debug.Log($"AmaGDK | Event <{eventNameToSend}> (in session: {countInSession}, total: {totalCount})\n{JsonUtils.DictionaryToJson(eventData.parameters, true)}");
|
|
292
|
+
if (showAnalyticsLog) Debug.Log($"AmaGDK | [Analytics] Event <{eventNameToSend}> (in session: {countInSession}, total: {totalCount})\n{JsonUtils.DictionaryToJson(eventData.parameters, true)}");
|
|
293
293
|
|
|
294
294
|
common.quality.CheckEventQuality(eventData.eventName, eventData.parameters);
|
|
295
295
|
|
|
@@ -721,7 +721,7 @@ namespace Amanotes.Core
|
|
|
721
721
|
|
|
722
722
|
private static bool IsValidKeyValue(IEventParamsBuilder ap, string key, object value)
|
|
723
723
|
{
|
|
724
|
-
string eventName = (ap as EventParams)
|
|
724
|
+
string eventName = (ap as EventParams)?.eventName;
|
|
725
725
|
if (string.IsNullOrWhiteSpace(key))
|
|
726
726
|
{
|
|
727
727
|
LogWarning($"Param key is empty. Event name: {eventName}!");
|
|
@@ -729,7 +729,7 @@ namespace Amanotes.Core
|
|
|
729
729
|
}
|
|
730
730
|
if (value == null)
|
|
731
731
|
{
|
|
732
|
-
LogWarning($"Param value is null. Event name: {eventName}!");
|
|
732
|
+
LogWarning($"Param value of key <{key}> is null. Event name: {eventName}!");
|
|
733
733
|
return false;
|
|
734
734
|
}
|
|
735
735
|
|
|
@@ -72,11 +72,23 @@ namespace Amanotes.Core
|
|
|
72
72
|
set => _pseudoId = ValidateId(value, ALPHANUMERIC_PATTERN);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
#if UNITY_IOS
|
|
75
76
|
public string AmaDeviceId
|
|
76
77
|
{
|
|
77
78
|
get => _amaDeviceId;
|
|
78
79
|
set => _amaDeviceId = ValidateId(value, ALPHANUMERIC_HYPHEN_PATTERN);
|
|
79
80
|
}
|
|
81
|
+
#endif
|
|
82
|
+
|
|
83
|
+
#if UNITY_ANDROID
|
|
84
|
+
public string AmaDeviceId
|
|
85
|
+
{
|
|
86
|
+
get => _amaDeviceId;
|
|
87
|
+
set => _amaDeviceId = ValidateId(value, ALPHANUMERIC_PATTERN);
|
|
88
|
+
}
|
|
89
|
+
#endif
|
|
90
|
+
|
|
91
|
+
|
|
80
92
|
|
|
81
93
|
public string AppsFlyerId
|
|
82
94
|
{
|
|
@@ -132,7 +144,7 @@ namespace Amanotes.Core
|
|
|
132
144
|
yield return waitForDuration;
|
|
133
145
|
time += WAIT_TIME;
|
|
134
146
|
if (time <= TIME_OUT) continue;
|
|
135
|
-
Logging.LogWarning($"
|
|
147
|
+
Logging.LogWarning($"| UserProfile <init> timeout: {TIME_OUT} (ama_device_id not exist)");
|
|
136
148
|
break;
|
|
137
149
|
}
|
|
138
150
|
}
|
package/Runtime/AmaGDK.cs
CHANGED
package/package.json
CHANGED
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using System.Collections;
|
|
3
|
-
using System.Collections.Generic;
|
|
4
|
-
using Amanotes.Core.Internal;
|
|
5
|
-
using UnityEngine;
|
|
6
|
-
|
|
7
|
-
namespace Amanotes.Core
|
|
8
|
-
{
|
|
9
|
-
public partial class AmaGDK // Ad events
|
|
10
|
-
{
|
|
11
|
-
public static class AdEventContext
|
|
12
|
-
{
|
|
13
|
-
public delegate void UpdateAdEventContext (string eventName);
|
|
14
|
-
/// <summary>
|
|
15
|
-
/// Update AdEventContext's variables for ad event tracking
|
|
16
|
-
/// </summary>
|
|
17
|
-
public static event UpdateAdEventContext Update;
|
|
18
|
-
|
|
19
|
-
public static string connection;
|
|
20
|
-
public static string location;
|
|
21
|
-
public static string songACMid;
|
|
22
|
-
public static string songName;
|
|
23
|
-
public static string songUnlockType;
|
|
24
|
-
public static string reward;
|
|
25
|
-
public static string mediation;
|
|
26
|
-
public static Dictionary<string, object> customData = new Dictionary<string, object>();
|
|
27
|
-
|
|
28
|
-
internal static void UpdateFor(string eventName)
|
|
29
|
-
{
|
|
30
|
-
connection = null;
|
|
31
|
-
location = null;
|
|
32
|
-
songACMid = null;
|
|
33
|
-
songName = null;
|
|
34
|
-
songUnlockType = null;
|
|
35
|
-
reward = null;
|
|
36
|
-
mediation = null;
|
|
37
|
-
customData.Clear();
|
|
38
|
-
Update?.Invoke(eventName);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public partial class AdEvents //Event name
|
|
43
|
-
{
|
|
44
|
-
const string FULLADS_REQUEST = "fullads_request";
|
|
45
|
-
const string FULLADS_REQUEST_FAILED = "fullads_request_failed";
|
|
46
|
-
const string FULLADS_REQUEST_SUCCESS = "fullads_request_success";
|
|
47
|
-
const string FULLADS_SHOW_READY = "fullads_show_ready";
|
|
48
|
-
const string FULLADS_SHOW_NOTREADY = "fullads_show_notready";
|
|
49
|
-
const string FULLADS_SHOW = "fullads_show";
|
|
50
|
-
const string FULLADS_SHOW_FAILED = "fullads_show_failed";
|
|
51
|
-
const string FULLADS_FINISH = "fullads_finish";
|
|
52
|
-
const string FULLADS_CLICK = "fullads_click";
|
|
53
|
-
|
|
54
|
-
const string VIDEOADS_SHOW_READY = "videoads_show_ready";
|
|
55
|
-
const string VIDEOADS_SHOW_NOTREADY = "videoads_show_notready";
|
|
56
|
-
const string VIDEOADS_SHOW = "videoads_show";
|
|
57
|
-
const string VIDEOADS_SHOW_FAILED = "videoads_show_failed";
|
|
58
|
-
const string VIDEOADS_FINISH = "videoads_finish";
|
|
59
|
-
const string VIDEOADS_CLICK = "videoads_click";
|
|
60
|
-
|
|
61
|
-
const string BANNER_CLICK = "bannerads_click";
|
|
62
|
-
|
|
63
|
-
//Parameter name
|
|
64
|
-
const string PARAM_CONNECTION = "connection";
|
|
65
|
-
const string PARAM_LOCATION = "location";
|
|
66
|
-
const string PARAM_SONG_ACM_ID = "song_acm_id";
|
|
67
|
-
const string PARAM_SONG_NAME = "song_name";
|
|
68
|
-
const string PARAM_SONG_UNLOCK_TYPE = "song_unlock_type";
|
|
69
|
-
const string PARAM_REWARD = "reward";
|
|
70
|
-
const string PARAM_MEDIATION = "mediation";
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public partial class AdEvents //Impression
|
|
74
|
-
{
|
|
75
|
-
public static Action<Dictionary<string, object>> onAdImpression;
|
|
76
|
-
|
|
77
|
-
public static void LogAdImpression(Dictionary<string, object> impressionData)
|
|
78
|
-
{
|
|
79
|
-
Analytics.LogEvent("ad_impression", impressionData)
|
|
80
|
-
.OnlyTo(AmaGDK.AdapterID.FIREBASE_ANALYTICS);
|
|
81
|
-
Analytics.LogEvent("ad_impression_ama", impressionData)
|
|
82
|
-
.OnlyTo(AmaGDK.AdapterID.FIREBASE_ANALYTICS);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public partial class AdEvents //Full ads
|
|
87
|
-
{
|
|
88
|
-
public static void LogFullAdsRequest()
|
|
89
|
-
{
|
|
90
|
-
AdEventContext.UpdateFor(FULLADS_REQUEST);
|
|
91
|
-
var dic = AdEventContext.customData;
|
|
92
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
93
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
94
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
95
|
-
Analytics.LogEvent(FULLADS_REQUEST, dic).SetAsAccumulated();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public static void LogFullAdsRequestFailed()
|
|
99
|
-
{
|
|
100
|
-
AdEventContext.UpdateFor(FULLADS_REQUEST_FAILED);
|
|
101
|
-
var dic = AdEventContext.customData;
|
|
102
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
103
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
104
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
105
|
-
Analytics.LogEvent(FULLADS_REQUEST_FAILED, dic).SetAsAccumulated();
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
public static void LogFullAdsRequestSuccess()
|
|
109
|
-
{
|
|
110
|
-
AdEventContext.UpdateFor(FULLADS_REQUEST_SUCCESS);
|
|
111
|
-
var dic = AdEventContext.customData;
|
|
112
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
113
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
114
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
115
|
-
Analytics.LogEvent(FULLADS_REQUEST_SUCCESS, dic).SetAsAccumulated();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
public static void LogFullAdsShowReady()
|
|
119
|
-
{
|
|
120
|
-
AdEventContext.UpdateFor(FULLADS_SHOW_READY);
|
|
121
|
-
var dic = AdEventContext.customData;
|
|
122
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
123
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
124
|
-
dic[PARAM_SONG_ACM_ID] = AdEventContext.songACMid;
|
|
125
|
-
dic[PARAM_SONG_NAME] = AdEventContext.songName;
|
|
126
|
-
dic[PARAM_SONG_UNLOCK_TYPE] = AdEventContext.songUnlockType;
|
|
127
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
128
|
-
Analytics.LogEvent(FULLADS_SHOW_READY, dic).SetAsAccumulated();
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
public static void LogFullAdsShowNotReady()
|
|
132
|
-
{
|
|
133
|
-
AdEventContext.UpdateFor(FULLADS_SHOW_NOTREADY);
|
|
134
|
-
var dic = AdEventContext.customData;
|
|
135
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
136
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
137
|
-
dic[PARAM_SONG_ACM_ID] = AdEventContext.songACMid;
|
|
138
|
-
dic[PARAM_SONG_NAME] = AdEventContext.songName;
|
|
139
|
-
dic[PARAM_SONG_UNLOCK_TYPE] = AdEventContext.songUnlockType;
|
|
140
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
141
|
-
Analytics.LogEvent(FULLADS_SHOW_NOTREADY, dic).SetAsAccumulated();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
public static void LogFullAdsShow()
|
|
145
|
-
{
|
|
146
|
-
AdEventContext.UpdateFor(FULLADS_SHOW);
|
|
147
|
-
var dic = AdEventContext.customData;
|
|
148
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
149
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
150
|
-
dic[PARAM_SONG_ACM_ID] = AdEventContext.songACMid;
|
|
151
|
-
dic[PARAM_SONG_NAME] = AdEventContext.songName;
|
|
152
|
-
dic[PARAM_SONG_UNLOCK_TYPE] = AdEventContext.songUnlockType;
|
|
153
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
154
|
-
Analytics.LogEvent(FULLADS_SHOW, dic).SetAsAccumulated();
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
public static void LogFullAdsShowFailed()
|
|
158
|
-
{
|
|
159
|
-
AdEventContext.UpdateFor(FULLADS_SHOW_FAILED);
|
|
160
|
-
var dic = AdEventContext.customData;
|
|
161
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
162
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
163
|
-
dic[PARAM_SONG_ACM_ID] = AdEventContext.songACMid;
|
|
164
|
-
dic[PARAM_SONG_NAME] = AdEventContext.songName;
|
|
165
|
-
dic[PARAM_SONG_UNLOCK_TYPE] = AdEventContext.songUnlockType;
|
|
166
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
167
|
-
Analytics.LogEvent(FULLADS_SHOW_FAILED, dic).SetAsAccumulated();
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
public static void LogFullAdsFinish()
|
|
171
|
-
{
|
|
172
|
-
AdEventContext.UpdateFor(FULLADS_FINISH);
|
|
173
|
-
var dic = AdEventContext.customData;
|
|
174
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
175
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
176
|
-
dic[PARAM_SONG_ACM_ID] = AdEventContext.songACMid;
|
|
177
|
-
dic[PARAM_SONG_NAME] = AdEventContext.songName;
|
|
178
|
-
dic[PARAM_SONG_UNLOCK_TYPE] = AdEventContext.songUnlockType;
|
|
179
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
180
|
-
Analytics.LogEvent(FULLADS_FINISH, dic).SetAsAccumulated();
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
public static void LogFullAdsClick()
|
|
184
|
-
{
|
|
185
|
-
AdEventContext.UpdateFor(FULLADS_CLICK);
|
|
186
|
-
var dic = AdEventContext.customData;
|
|
187
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
188
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
189
|
-
dic[PARAM_SONG_ACM_ID] = AdEventContext.songACMid;
|
|
190
|
-
dic[PARAM_SONG_NAME] = AdEventContext.songName;
|
|
191
|
-
dic[PARAM_SONG_UNLOCK_TYPE] = AdEventContext.songUnlockType;
|
|
192
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
193
|
-
Analytics.LogEvent(FULLADS_CLICK, dic).SetAsAccumulated();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
public partial class AdEvents //Rewarded
|
|
198
|
-
{
|
|
199
|
-
public static void LogVideoAdsShowReady()
|
|
200
|
-
{
|
|
201
|
-
AdEventContext.UpdateFor(VIDEOADS_SHOW_READY);
|
|
202
|
-
var dic = AdEventContext.customData;
|
|
203
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
204
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
205
|
-
dic[PARAM_SONG_ACM_ID] = AdEventContext.songACMid;
|
|
206
|
-
dic[PARAM_SONG_NAME] = AdEventContext.songName;
|
|
207
|
-
dic[PARAM_SONG_UNLOCK_TYPE] = AdEventContext.songUnlockType;
|
|
208
|
-
dic[PARAM_REWARD] = AdEventContext.reward;
|
|
209
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
210
|
-
Analytics.LogEvent(VIDEOADS_SHOW_READY, dic).SetAsAccumulated();
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
public static void LogVideoAdsShowNotReady()
|
|
214
|
-
{
|
|
215
|
-
AdEventContext.UpdateFor(VIDEOADS_SHOW_NOTREADY);
|
|
216
|
-
var dic = AdEventContext.customData;
|
|
217
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
218
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
219
|
-
dic[PARAM_SONG_ACM_ID] = AdEventContext.songACMid;
|
|
220
|
-
dic[PARAM_SONG_NAME] = AdEventContext.songName;
|
|
221
|
-
dic[PARAM_SONG_UNLOCK_TYPE] = AdEventContext.songUnlockType;
|
|
222
|
-
dic[PARAM_REWARD] = AdEventContext.reward;
|
|
223
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
224
|
-
Analytics.LogEvent(VIDEOADS_SHOW_NOTREADY, dic).SetAsAccumulated();
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
public static void LogVideoAdsShow()
|
|
228
|
-
{
|
|
229
|
-
AdEventContext.UpdateFor(VIDEOADS_SHOW);
|
|
230
|
-
var dic = AdEventContext.customData;
|
|
231
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
232
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
233
|
-
dic[PARAM_SONG_ACM_ID] = AdEventContext.songACMid;
|
|
234
|
-
dic[PARAM_SONG_NAME] = AdEventContext.songName;
|
|
235
|
-
dic[PARAM_SONG_UNLOCK_TYPE] = AdEventContext.songUnlockType;
|
|
236
|
-
dic[PARAM_REWARD] = AdEventContext.reward;
|
|
237
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
238
|
-
Analytics.LogEvent(VIDEOADS_SHOW, dic).SetAsAccumulated();
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
public static void LogVideoAdsShowFailed()
|
|
242
|
-
{
|
|
243
|
-
AdEventContext.UpdateFor(VIDEOADS_SHOW_FAILED);
|
|
244
|
-
var dic = AdEventContext.customData;
|
|
245
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
246
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
247
|
-
dic[PARAM_SONG_ACM_ID] = AdEventContext.songACMid;
|
|
248
|
-
dic[PARAM_SONG_NAME] = AdEventContext.songName;
|
|
249
|
-
dic[PARAM_SONG_UNLOCK_TYPE] = AdEventContext.songUnlockType;
|
|
250
|
-
dic[PARAM_REWARD] = AdEventContext.reward;
|
|
251
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
252
|
-
Analytics.LogEvent(VIDEOADS_SHOW_FAILED, dic).SetAsAccumulated();
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
public static void LogVideoAdsFinish()
|
|
256
|
-
{
|
|
257
|
-
AdEventContext.UpdateFor(VIDEOADS_FINISH);
|
|
258
|
-
var dic = AdEventContext.customData;
|
|
259
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
260
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
261
|
-
dic[PARAM_SONG_ACM_ID] = AdEventContext.songACMid;
|
|
262
|
-
dic[PARAM_SONG_NAME] = AdEventContext.songName;
|
|
263
|
-
dic[PARAM_SONG_UNLOCK_TYPE] = AdEventContext.songUnlockType;
|
|
264
|
-
dic[PARAM_REWARD] = AdEventContext.reward;
|
|
265
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
266
|
-
Analytics.LogEvent(VIDEOADS_FINISH, dic).SetAsAccumulated();
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
public static void LogVideoAdsClick()
|
|
270
|
-
{
|
|
271
|
-
AdEventContext.UpdateFor(VIDEOADS_CLICK);
|
|
272
|
-
var dic = AdEventContext.customData;
|
|
273
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
274
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
275
|
-
dic[PARAM_SONG_ACM_ID] = AdEventContext.songACMid;
|
|
276
|
-
dic[PARAM_SONG_NAME] = AdEventContext.songName;
|
|
277
|
-
dic[PARAM_SONG_UNLOCK_TYPE] = AdEventContext.songUnlockType;
|
|
278
|
-
dic[PARAM_REWARD] = AdEventContext.reward;
|
|
279
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
280
|
-
Analytics.LogEvent(VIDEOADS_CLICK, dic).SetAsAccumulated();
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
public partial class AdEvents //Banner
|
|
285
|
-
{
|
|
286
|
-
public static void LogBannerClick()
|
|
287
|
-
{
|
|
288
|
-
AdEventContext.UpdateFor(BANNER_CLICK);
|
|
289
|
-
var dic = AdEventContext.customData;
|
|
290
|
-
dic[PARAM_CONNECTION] = AdEventContext.connection;
|
|
291
|
-
dic[PARAM_LOCATION] = AdEventContext.location;
|
|
292
|
-
dic[PARAM_MEDIATION] = AdEventContext.mediation;
|
|
293
|
-
Analytics.LogEvent(BANNER_CLICK, dic).SetAsAccumulated();
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|