com.amanotes.gdk 0.2.39 → 0.2.40

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,8 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.40 - 2023-11-27]
4
+ - Fix ShowAdTimeout = 0 should not wait for Ad
5
+
3
6
  ## [0.2.39 - 2023-11-27]
4
7
  - Fix variable name and variable value of "ChangeDevMode"
5
- - Fix Timeout = 0 should cancel the wait for Ad
8
+ - Load Ad timeout should cancel
6
9
 
7
10
  ## [0.2.38 - 2023-11-22]
8
11
  - Improve Ads API
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -634,31 +634,46 @@ namespace Amanotes.Core.Internal
634
634
  ShowAdRoutineCompleted(false);
635
635
  yield break;
636
636
  }
637
-
638
- var hasInternet = false;
639
- yield return WebUtils.CheckInternet(result => hasInternet = result);
640
- if (!hasInternet)
637
+
638
+ int timeout = Ads._adConfig.adShowTimeoutInSecs;
639
+ if (timeout == 0) // do not wait for Ad
641
640
  {
642
641
  _showState = ShowAdsState.ShowFail;
643
- OnAdShowReadyStatus(false, AdShowReadyStatus.NoInternet);
642
+ OnAdShowReadyStatus(false, AdShowReadyStatus.TimeOut);
644
643
  ShowAdRoutineCompleted(false);
645
644
  yield break;
646
645
  }
647
-
648
- if (_loadState != LoadAdsState.Requesting) StartLoadAd();
646
+
649
647
  _showState = ShowAdsState.WaitForAd;
650
- int timeout = Ads._adConfig.adShowTimeoutInSecs;
648
+ if (_loadState != LoadAdsState.Requesting) StartLoadAd();
649
+
651
650
  var counter = 0;
652
-
653
- while (counter < timeout || timeout == 0)
651
+ bool? hasInternet = null;
652
+ _instance.StartCoroutine(WebUtils.CheckInternet(result => hasInternet = result));
653
+
654
+ while (counter < timeout || timeout == -1)
654
655
  {
655
656
  yield return wait1Sec;
656
657
  counter++;
657
- if (_loadState == LoadAdsState.Ready) break;
658
- }
659
658
 
659
+ // finish checking internet & result is false
660
+ if (hasInternet == false)
661
+ {
662
+ Log("[Ad] Stop WaitForAd : No internet!");
663
+ _showState = ShowAdsState.ShowFail;
664
+ OnAdShowReadyStatus(false, AdShowReadyStatus.NoInternet);
665
+ ShowAdRoutineCompleted(false);
666
+ yield break;
667
+ }
668
+
669
+ if (_loadState != LoadAdsState.Ready) continue;
670
+ Log("[Ad] WaitForAd success after " + counter + " | timeout = " + timeout + " secs");
671
+ break;
672
+ }
673
+
660
674
  if (!isAdReady)
661
675
  {
676
+ Log("[Ad] WaitForAd failed (timeout) " + counter + " | timeout = " + timeout + " secs");
662
677
  OnAdShowReadyStatus(false, AdShowReadyStatus.TimeOut);
663
678
  ShowAdRoutineCompleted(false);
664
679
  yield break;
@@ -667,7 +682,6 @@ namespace Amanotes.Core.Internal
667
682
 
668
683
  _showState = ShowAdsState.Showing;
669
684
  OnAdShowReadyStatus(true, AdShowReadyStatus.None);
670
-
671
685
  HandleBeforeAdShow();
672
686
  ShowAd();
673
687
 
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.39";
18
+ public const string VERSION = "0.2.40";
19
19
 
20
20
  internal static AmaGDK _instance;
21
21
  internal static Status _status = Status.None;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.gdk",
3
- "version": "0.2.39",
3
+ "version": "0.2.40",
4
4
  "displayName": "AmaGDK",
5
5
  "description": "Amanotes Game Development Kit",
6
6
  "unity": "2019.4",