Skip to content

Commit b018128

Browse files
committed
- fix IronSource
- error not show inter and banner ad - error not callback completed and skipped event
1 parent 260a171 commit b018128

File tree

6 files changed

+44
-9
lines changed

6 files changed

+44
-9
lines changed

Runtime/General/AdStatic.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ public static AdUnit OnCompleted(this AdUnit unit, Action onCompleted)
8383
case MaxRewardedInterstitialAdUnit maxRewardInter:
8484
maxRewardInter.completedCallback = onCompleted;
8585
return unit;
86+
case IronSourceInterstitialAdUnit ironSourceInterstitialAdUnit:
87+
ironSourceInterstitialAdUnit.completedCallback = onCompleted;
88+
return unit;
89+
case IronSourceRewardAdUnit ironSourceRewardAdUnit:
90+
ironSourceRewardAdUnit.completedCallback = onCompleted;
91+
return unit;
8692
}
8793

8894
return unit;
@@ -104,6 +110,9 @@ public static AdUnit OnSkipped(this AdUnit unit, Action onSkipped)
104110
case MaxRewardedInterstitialAdUnit maxRewardInter:
105111
maxRewardInter.skippedCallback = onSkipped;
106112
return unit;
113+
case IronSourceRewardAdUnit ironSourceRewardAdUnit:
114+
ironSourceRewardAdUnit.skippedCallback = onSkipped;
115+
return unit;
107116
}
108117

109118
return unit;

Runtime/General/Advertising.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,6 @@ private void ShowPrivacyOptionsForm()
236236

237237
#endregion
238238

239-
#if VIRTUESKY_MAX
240-
private void OnApplicationPause(bool pauseStatus)
241-
{
242-
if (adSettings.CurrentAdNetwork != AdNetwork.Max) return;
243-
if (!pauseStatus && adSettings.MaxAppOpenAdUnit.autoShow && !AdStatic.isShowingAd)
244-
(currentAdClient as MaxAdClient)?.ShowAppOpen();
245-
}
246-
#endif
247-
248239
#if VIRTUESKY_ADS
249240
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
250241
private static void AutoInitialize()

Runtime/IronSource/IronSourceBannerAdUnit.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using UnityEngine;
23
using VirtueSky.Misc;
34

45
namespace VirtueSky.Ads
@@ -74,6 +75,14 @@ protected override void ShowImpl()
7475
#endif
7576
}
7677

78+
public override AdUnit Show()
79+
{
80+
ResetChainCallback();
81+
if (!Application.isMobilePlatform || AdStatic.IsRemoveAd || !IsReady()) return this;
82+
ShowImpl();
83+
return this;
84+
}
85+
7786
public override void Destroy()
7887
{
7988
#if VIRTUESKY_ADS && VIRTUESKY_IRONSOURCE
@@ -131,6 +140,7 @@ void BannerOnAdLoadFailedEvent(IronSourceError ironSourceError)
131140
{
132141
Common.CallActionAndClean(ref failedToLoadCallback);
133142
OnFailedToLoadAdEvent?.Invoke(ironSourceError.ToString());
143+
Load();
134144
}
135145

136146
void BannerOnAdClickedEvent(IronSourceAdInfo adInfo)

Runtime/IronSource/IronSourceClient.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using VirtueSky.Core;
12
using VirtueSky.Tracking;
23

34
namespace VirtueSky.Ads
@@ -15,6 +16,7 @@ public override void Initialize()
1516
adSettings.IosAppKey = "8545d445";
1617
}
1718
#if VIRTUESKY_ADS && VIRTUESKY_IRONSOURCE
19+
App.AddPauseCallback(OnAppStateChange);
1820
IronSourceEvents.onSdkInitializationCompletedEvent += SdkInitializationCompletedEvent;
1921
IronSourceEvents.onImpressionDataReadyEvent += ImpressionDataReadyEvent;
2022
adSettings.IronSourceBannerAdUnit.Init();
@@ -37,6 +39,11 @@ private void ImpressionDataReadyEvent(IronSourceImpressionData impressionData)
3739
impressionData.placement, AdNetwork.IronSource.ToString());
3840
}
3941
}
42+
43+
private void OnAppStateChange(bool pauseStatus)
44+
{
45+
IronSource.Agent.onApplicationPause(pauseStatus);
46+
}
4047
#endif
4148
void SdkInitializationCompletedEvent()
4249
{

Runtime/IronSource/IronSourceInterstitialAdUnit.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using UnityEngine;
23
using VirtueSky.Misc;
34

45
namespace VirtueSky.Ads
@@ -47,6 +48,14 @@ protected override void ShowImpl()
4748
#endif
4849
}
4950

51+
public override AdUnit Show()
52+
{
53+
ResetChainCallback();
54+
if (!Application.isMobilePlatform || AdStatic.IsRemoveAd || !IsReady()) return this;
55+
ShowImpl();
56+
return this;
57+
}
58+
5059
public override void Destroy()
5160
{
5261
}

Runtime/Max/MaxAdClient.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using VirtueSky.Core;
2+
13
namespace VirtueSky.Ads
24
{
35
public class MaxAdClient : AdClient
@@ -13,11 +15,18 @@ public override void Initialize()
1315
adSettings.MaxRewardAdUnit.Init();
1416
adSettings.MaxAppOpenAdUnit.Init();
1517
adSettings.MaxRewardedInterstitialAdUnit.Init();
18+
App.AddPauseCallback(OnAppStateChange);
1619
LoadInterstitial();
1720
LoadRewarded();
1821
LoadRewardedInterstitial();
1922
LoadAppOpen();
2023
#endif
2124
}
25+
#if VIRTUESKY_ADS && VIRTUESKY_MAX
26+
private void OnAppStateChange(bool pauseStatus)
27+
{
28+
if (!pauseStatus && adSettings.MaxAppOpenAdUnit.autoShow && !AdStatic.isShowingAd) ShowAppOpen();
29+
}
30+
#endif
2231
}
2332
}

0 commit comments

Comments
 (0)