com.amanotes.gdk 0.2.26 → 0.2.27

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.27 - 2023-11-01]
4
+ - No longer stop ad
5
+ - Update ad status by adapter
6
+
3
7
  ## [0.2.26 - 2023-10-30]
4
8
  - Add Ads event tracking
5
9
  - Check real internet connection
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -159,24 +159,26 @@ namespace Amanotes.Core
159
159
  {
160
160
  if (context == null) return true;
161
161
  float duration = Time.realtimeSinceStartup - context.showCallAt;
162
- bool willSkip = duration < Mathf.Max(5f, _adConfig.adShowTimeoutInSecs);
163
- if (willSkip)
164
- {
165
- LogWarning($"[AD] ShowRequest IGNORED as another ad is showing (elapsedTime: {duration:n2}s):\n" + JsonUtility.ToJson(context, true));
166
- return false;
167
- }
168
-
169
- LogWarning($"[AD] FORCE STOPPED the previous ad, as it seems to hang (elapsedTime: {duration:n2}s):\n" + JsonUtility.ToJson(context, true));
170
- // possibly hang: force stop
171
- if (context.adType == AdType.Interstitial)
172
- {
173
- _adapter.interstitial.StopShowAd();
174
- } else
175
- {
176
- _adapter.rewardVideo.StopShowAd();
177
- }
178
- context = null;
179
- return true;
162
+ // bool willSkip = duration < Mathf.Max(60f, _adConfig.adShowTimeoutInSecs);
163
+ LogWarning($"[AD] ShowRequest IGNORED as another ad is showing (elapsedTime: {duration:n2}s):\n" + JsonUtility.ToJson(context, true));
164
+ return false;
165
+
166
+ // if (willSkip)
167
+ // {
168
+ // LogWarning($"[AD] ShowRequest IGNORED as another ad is showing (elapsedTime: {duration:n2}s):\n" + JsonUtility.ToJson(context, true));
169
+ // return false;
170
+ // }
171
+ //
172
+ // LogWarning($"[AD] FORCE STOPPED the previous ad, as it seems to hang (elapsedTime: {duration:n2}s):\n" + JsonUtility.ToJson(context, true));
173
+ // // possibly hang: force stop
174
+ // if (context.adType == AdType.Interstitial)
175
+ // {
176
+ // _adapter.interstitial.StopShowAd();
177
+ // } else
178
+ // {
179
+ // _adapter.rewardVideo.StopShowAd();
180
+ // }
181
+ // return true;
180
182
  }
181
183
 
182
184
  public static IAdCallback ShowInterstitial(string placementName = null, Dictionary<string, object> userData = null)
@@ -242,7 +244,7 @@ namespace Amanotes.Core
242
244
  {
243
245
  if (context == null)
244
246
  return;
245
-
247
+
246
248
  if (context.adType == AdType.Interstitial)
247
249
  _adapter.interstitial.StopShowAd();
248
250
  else
@@ -370,7 +372,20 @@ namespace Amanotes.Core.Internal
370
372
  private static readonly WaitForSeconds wait1Sec = new WaitForSeconds(1f);
371
373
 
372
374
  internal LoadAdsState _loadState = LoadAdsState.None;
373
- internal bool hasAd => _loadState == LoadAdsState.Ready;
375
+ internal bool hasAd
376
+ {
377
+ get
378
+ {
379
+ if (_loadState == LoadAdsState.Ready && !isAdReady)
380
+ {
381
+ LogWarning("[Ad] Inconsistent Ready state (might caused by poor internet condition)");
382
+ _loadState = LoadAdsState.None;
383
+ StartLoadAd();
384
+ }
385
+
386
+ return _loadState == LoadAdsState.Ready;
387
+ }
388
+ }
374
389
 
375
390
  internal Coroutine _loadRoutine;
376
391
 
@@ -499,12 +514,21 @@ namespace Amanotes.Core.Internal
499
514
  if (_showAdRoutine == null) return;
500
515
  _instance.StopCoroutine(_showAdRoutine);
501
516
  _showAdRoutine = null;
517
+
518
+ if (Ads.context.adType == AdType.Interstitial)
519
+ {
520
+ ShowAdRoutineCompleted(!Ads.context.hasFailedOrCancelled);
521
+ }
522
+ else
523
+ {
524
+ ShowAdRoutineCompleted(Ads.context.hasReward);
525
+ }
502
526
  }
503
527
 
504
528
  IEnumerator ShowAdRoutine()
505
529
  {
506
- // Wait 1 frame so that all AdCallback to register
507
- yield return null;
530
+ // Wait to end frame so that all AdCallbacks finish registering
531
+ yield return new WaitForEndOfFrame();
508
532
 
509
533
  // Wait for Ad
510
534
  if (!isAdReady)
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.26";
17
+ public const string VERSION = "0.2.27";
18
18
 
19
19
  internal static AmaGDK _instance;
20
20
  internal static Status _status = Status.None;
@@ -297,6 +297,7 @@ namespace Amanotes.Core
297
297
  }
298
298
 
299
299
  UpdateManifest(output);
300
+ Log("AmaGDK changes to dev mode successfully");
300
301
  }
301
302
 
302
303
  private string RunShellCommand(string command)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.gdk",
3
- "version": "0.2.26",
3
+ "version": "0.2.27",
4
4
  "displayName": "AmaGDK",
5
5
  "description": "Amanotes Game Development Kit",
6
6
  "unity": "2019.4",