com.amanotes.gdk 0.2.36 → 0.2.38
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 +10 -1
- 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 +58 -12
- 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/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.38 - 2023-11-22]
|
|
4
|
+
- Improve Ads API
|
|
5
|
+
- Add Ad Quality
|
|
6
|
+
|
|
7
|
+
## [0.2.37 - 2023-11-21]
|
|
8
|
+
- Improve GDK logs
|
|
9
|
+
- Banner will not show when ad adapter is not ready
|
|
10
|
+
- Fix ama_device_id on Android
|
|
11
|
+
|
|
3
12
|
## [0.2.36 - 2023-11-15]
|
|
4
13
|
- Add OnAdShowReadyStatus callback
|
|
5
|
-
-
|
|
14
|
+
- Revamp AdEventTracking
|
|
6
15
|
|
|
7
16
|
## [0.2.35 - 2023-11-14]
|
|
8
17
|
- [Fix] Save UserID
|
|
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
|
@@ -69,11 +69,23 @@ namespace Amanotes.Core
|
|
|
69
69
|
public static IAdCallback OnAdResult(this IAdCallback ad, Action<bool> callback)
|
|
70
70
|
{
|
|
71
71
|
if (!MakeSureAdNotNull(ad)) return null;
|
|
72
|
-
Ads.context.
|
|
73
|
-
Ads.context.
|
|
72
|
+
Ads.context.onAdResult -= callback;
|
|
73
|
+
Ads.context.onAdResult += callback;
|
|
74
74
|
return ad;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
|
|
77
|
+
/// <summary>
|
|
78
|
+
/// Call right before the ad actually open (that means Ad has already been cached & available to show).
|
|
79
|
+
/// This callback will not be triggered in case Ad is not available or no internet
|
|
80
|
+
/// </summary>
|
|
81
|
+
public static IAdCallback OnBeforeAdOpen(this IAdCallback ad, Action callback)
|
|
82
|
+
{
|
|
83
|
+
if (!MakeSureAdNotNull(ad)) return null;
|
|
84
|
+
Ads.context.onBeforeAdOpen -= callback;
|
|
85
|
+
Ads.context.onBeforeAdOpen += callback;
|
|
86
|
+
return ad;
|
|
87
|
+
}
|
|
88
|
+
|
|
77
89
|
private static bool MakeSureAdNotNull(IAdCallback ad)
|
|
78
90
|
{
|
|
79
91
|
bool isValid = (ad != null);
|
|
@@ -165,6 +177,8 @@ namespace Amanotes.Core
|
|
|
165
177
|
internal static float _savedTimeScale = -1;
|
|
166
178
|
|
|
167
179
|
internal static readonly AdsData localData = new AdsData().LoadJsonFromFile();
|
|
180
|
+
|
|
181
|
+
public static AdAdapterConfig adConfig => _adConfig;
|
|
168
182
|
}
|
|
169
183
|
|
|
170
184
|
public partial class Ads // Public
|
|
@@ -175,6 +189,12 @@ namespace Amanotes.Core
|
|
|
175
189
|
_adConfig = ((AdapterContext)_adapter)?.GetAdapterConfig<AdAdapterConfig>();
|
|
176
190
|
_adapter?.interstitial.StartLoadAd();
|
|
177
191
|
_adapter?.rewardVideo.StartLoadAd();
|
|
192
|
+
|
|
193
|
+
if (_isBannerShowing)
|
|
194
|
+
{
|
|
195
|
+
_isBannerShowing = false;
|
|
196
|
+
ShowBanner(_showingBannerPosition);
|
|
197
|
+
}
|
|
178
198
|
}
|
|
179
199
|
|
|
180
200
|
public static bool HasInterstitial => _adapter.interstitial.hasAd;
|
|
@@ -245,19 +265,28 @@ namespace Amanotes.Core
|
|
|
245
265
|
}
|
|
246
266
|
|
|
247
267
|
private static bool _isBannerShowing;
|
|
268
|
+
private static BannerPosition? _showingBannerPosition = null;
|
|
269
|
+
|
|
248
270
|
public static void ShowBanner(BannerPosition? bannerPosition = null)
|
|
249
271
|
{
|
|
250
272
|
if (_isBannerShowing) return;
|
|
251
273
|
_isBannerShowing = true;
|
|
252
|
-
|
|
253
|
-
|
|
274
|
+
_showingBannerPosition = bannerPosition;
|
|
275
|
+
|
|
276
|
+
if (_adapter == null)
|
|
254
277
|
{
|
|
255
|
-
|
|
278
|
+
//Debug.LogWarning("Adapter not found???");
|
|
279
|
+
return;
|
|
256
280
|
}
|
|
257
|
-
|
|
281
|
+
|
|
282
|
+
if (_adConfig == null)
|
|
258
283
|
{
|
|
259
|
-
|
|
284
|
+
//Debug.LogWarning("_adConfig not found???");
|
|
285
|
+
return;
|
|
260
286
|
}
|
|
287
|
+
|
|
288
|
+
_showingBannerPosition = bannerPosition ?? _adConfig.bannerPosition;
|
|
289
|
+
_adapter.ShowBanner(_showingBannerPosition.Value);
|
|
261
290
|
}
|
|
262
291
|
|
|
263
292
|
public static void HideBanner()
|
|
@@ -277,7 +306,22 @@ namespace Amanotes.Core
|
|
|
277
306
|
else
|
|
278
307
|
_adapter.rewardVideo.StopShowAd();
|
|
279
308
|
}
|
|
280
|
-
|
|
309
|
+
|
|
310
|
+
/// <summary>
|
|
311
|
+
/// Capping for interstitial ad
|
|
312
|
+
/// - Time since last interstitial show success > interstitialCappingTime
|
|
313
|
+
/// - Time since last rewardedVideo show success > rewardVideoCappingTime (for interstitial)
|
|
314
|
+
/// </summary>
|
|
315
|
+
/// <param name="interstitialCappingTime"></param>
|
|
316
|
+
/// <param name="rewardedVideoCappingTime"></param>
|
|
317
|
+
/// <returns></returns>
|
|
318
|
+
public static bool IsCapped(float interstitialCappingTime = 0, float rewardedVideoCappingTime = 0)
|
|
319
|
+
{
|
|
320
|
+
bool interCapped = (interstitialCappingTime > 0) && TimeSinceLastInterstitialSucceed < interstitialCappingTime;
|
|
321
|
+
bool rewardCapped = (rewardedVideoCappingTime > 0) && TimeSinceLastVideoRewardSucceed < rewardedVideoCappingTime;
|
|
322
|
+
return interCapped || rewardCapped;
|
|
323
|
+
}
|
|
324
|
+
|
|
281
325
|
public static int TimeSinceLastInterstitialSucceed => localData.TimeSinceLastShowSuccess(AdType.Interstitial);
|
|
282
326
|
public static int TimeSinceLastVideoRewardSucceed => localData.TimeSinceLastShowSuccess(AdType.VideoReward);
|
|
283
327
|
public static int TimeSinceLastAdSucceed => Math.Min(TimeSinceLastInterstitialSucceed, TimeSinceLastVideoRewardSucceed) ;
|
|
@@ -373,6 +417,7 @@ namespace Amanotes.Core.Internal
|
|
|
373
417
|
public readonly Dictionary<string, object> userData;
|
|
374
418
|
public AdCallback adCallback;
|
|
375
419
|
|
|
420
|
+
internal Action onBeforeAdOpen;
|
|
376
421
|
internal Action onOpened;
|
|
377
422
|
internal Action onRewardReceived;
|
|
378
423
|
internal Action onClicked;
|
|
@@ -380,7 +425,7 @@ namespace Amanotes.Core.Internal
|
|
|
380
425
|
internal Action onShowFailed;
|
|
381
426
|
internal Action onClosed;
|
|
382
427
|
internal Action<AdShowReadyStatus> onAdShowReadyStatus;
|
|
383
|
-
internal Action<bool>
|
|
428
|
+
internal Action<bool> onAdResult;
|
|
384
429
|
|
|
385
430
|
// Stats
|
|
386
431
|
public float showCallAt;
|
|
@@ -623,8 +668,8 @@ namespace Amanotes.Core.Internal
|
|
|
623
668
|
_showState = ShowAdsState.Showing;
|
|
624
669
|
OnAdShowReadyStatus(true, AdShowReadyStatus.None);
|
|
625
670
|
|
|
626
|
-
ShowAd();
|
|
627
671
|
HandleBeforeAdShow();
|
|
672
|
+
ShowAd();
|
|
628
673
|
|
|
629
674
|
ShowAdContext context = Ads.context;
|
|
630
675
|
while (!context.potentiallyCompleted)
|
|
@@ -679,7 +724,7 @@ namespace Amanotes.Core.Internal
|
|
|
679
724
|
|
|
680
725
|
// Extra callback
|
|
681
726
|
Ads.context.showFinishAt = Time.realtimeSinceStartup;
|
|
682
|
-
Ads.context.
|
|
727
|
+
Ads.context.onAdResult?.Invoke(isSuccess);
|
|
683
728
|
|
|
684
729
|
var localData = Ads.localData;
|
|
685
730
|
var stat = _isInterstitial ? localData.interstitial : localData.reward;
|
|
@@ -725,6 +770,7 @@ namespace Amanotes.Core.Internal
|
|
|
725
770
|
Time.timeScale = 0;
|
|
726
771
|
}
|
|
727
772
|
|
|
773
|
+
Ads.context.onBeforeAdOpen?.Invoke();
|
|
728
774
|
Ads._adapter.HandleBeforeAdShow();
|
|
729
775
|
}
|
|
730
776
|
|
|
@@ -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