com.amanotes.gdk 0.2.40 → 0.2.42

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,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.42 - 2023-11-28]
4
+ - [Fix] AdShowNotReady only trigger for 3 type of status
5
+ - [Fix] WaitForSeconds can not be shared between different routines
6
+
7
+ ## [0.2.41 - 2023-11-28]
8
+ - Add more state callbacks for AdShowReadyStatus
9
+ - Fix not wait for RewardCancel event (not exist any more)
10
+ - Timeout for Adapter init should be 1s
11
+
3
12
  ## [0.2.40 - 2023-11-27]
4
13
  - Fix ShowAdTimeout = 0 should not wait for Ad
5
14
 
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -407,7 +407,9 @@ namespace Amanotes.Core.Internal
407
407
  None,
408
408
  Wifi3GDisabled,
409
409
  NoInternet,
410
- TimeOut
410
+ WaitForAd,
411
+ TimeOut,
412
+ Ready,
411
413
  }
412
414
 
413
415
  public class ShowAdContext : IAdCallback
@@ -450,8 +452,6 @@ namespace Amanotes.Core.Internal
450
452
 
451
453
  public abstract class AdLogic
452
454
  {
453
- private static readonly WaitForSecondsRealtime wait1Sec = new WaitForSecondsRealtime(1f);
454
-
455
455
  internal LoadAdsState _loadState = LoadAdsState.None;
456
456
  internal bool hasAd
457
457
  {
@@ -504,6 +504,7 @@ namespace Amanotes.Core.Internal
504
504
  yield break;
505
505
  }
506
506
 
507
+ var wait1Sec = new WaitForSecondsRealtime(1f);
507
508
  Log("[Ad] LoadAdRoutine start(): isAdReady = " + isAdReady);
508
509
  while (true)
509
510
  {
@@ -645,12 +646,14 @@ namespace Amanotes.Core.Internal
645
646
  }
646
647
 
647
648
  _showState = ShowAdsState.WaitForAd;
648
- if (_loadState != LoadAdsState.Requesting) StartLoadAd();
649
+ OnAdShowReadyStatus(false, AdShowReadyStatus.WaitForAd);
649
650
 
651
+ if (_loadState != LoadAdsState.Requesting) StartLoadAd();
650
652
  var counter = 0;
651
653
  bool? hasInternet = null;
652
654
  _instance.StartCoroutine(WebUtils.CheckInternet(result => hasInternet = result));
653
655
 
656
+ var wait1Sec = new WaitForSecondsRealtime(1f);
654
657
  while (counter < timeout || timeout == -1)
655
658
  {
656
659
  yield return wait1Sec;
@@ -681,7 +684,7 @@ namespace Amanotes.Core.Internal
681
684
  }
682
685
 
683
686
  _showState = ShowAdsState.Showing;
684
- OnAdShowReadyStatus(true, AdShowReadyStatus.None);
687
+ OnAdShowReadyStatus(true, AdShowReadyStatus.Ready);
685
688
  HandleBeforeAdShow();
686
689
  ShowAd();
687
690
 
@@ -707,13 +710,9 @@ namespace Amanotes.Core.Internal
707
710
 
708
711
  if (context.hasClosed)
709
712
  {
710
- while (!context.hasFailedOrCancelled && !context.hasReward)
711
- {
712
- Log($"[Ad] {adType} Waiting for [cancel] or [reward]");
713
- yield return null;
714
- }
715
-
716
- ShowAdRoutineCompleted(!context.hasFailedOrCancelled);
713
+ // wait 1 frame in case hasReward callback after onClose
714
+ if (!context.hasReward) yield return null;
715
+ ShowAdRoutineCompleted(context.hasReward);
717
716
  yield break;
718
717
  }
719
718
 
@@ -876,21 +875,21 @@ namespace Amanotes.Core.Internal
876
875
 
877
876
  protected void OnAdShowReadyStatus(bool isReady, AdShowReadyStatus status)
878
877
  {
879
- if (Ads.context != null)
878
+ if (Ads.context == null)
880
879
  {
880
+ LogWarning("[Ad] OnAdOpen() Something wrong - No AdContext");
881
+ return;
882
+ }
883
+
881
884
  Ads.context.adCallback |= AdCallback.ShowReadyStatus;
882
- if (!isReady)
883
- {
884
885
  Ads.context.onAdShowReadyStatus?.Invoke(status);
885
- OnAdShowNotReady(status);
886
- } else
886
+ if (status == AdShowReadyStatus.Ready)
887
887
  {
888
888
  OnAdShowReady();
889
889
  }
890
- }
891
- else
890
+ else if (status == AdShowReadyStatus.NoInternet || status == AdShowReadyStatus.TimeOut || status == AdShowReadyStatus.Wifi3GDisabled)
892
891
  {
893
- LogWarning("[Ad] OnAdOpen() Something wrong - No AdContext");
892
+ OnAdShowNotReady(status);
894
893
  }
895
894
  }
896
895
 
package/Runtime/AmaGDK.cs CHANGED
@@ -15,7 +15,7 @@ namespace Amanotes.Core
15
15
  {
16
16
  public partial class AmaGDK : MonoBehaviour
17
17
  {
18
- public const string VERSION = "0.2.40";
18
+ public const string VERSION = "0.2.42";
19
19
 
20
20
  internal static AmaGDK _instance;
21
21
  internal static Status _status = Status.None;
@@ -69,7 +69,7 @@ namespace Amanotes.Core
69
69
  yield return StartCoroutine(User.Init());
70
70
 
71
71
  float time = 0;
72
- float timeout = 10;
72
+ float timeout = 1;
73
73
 
74
74
  var counter = 0;
75
75
  const int INIT_TOLERANCE = 10 * 60;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.gdk",
3
- "version": "0.2.40",
3
+ "version": "0.2.42",
4
4
  "displayName": "AmaGDK",
5
5
  "description": "Amanotes Game Development Kit",
6
6
  "unity": "2019.4",