Skip to content

Commit

Permalink
Fix: shower doesn't show ads more then single time
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanMurzak committed Nov 14, 2021
1 parent ddf0cbc commit 710167d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public static void AskConsent()
}
private static bool IsDataCollectingAllowed(Consent consent)
{
if (Config.debug) Debug.Log($"Appodeal IsDataCollectingAllowed {consent}");

if (consent.getZone() == Consent.Zone.NONE) return true;
if (consent.getStatus() == Consent.Status.PERSONALIZED) return true;
if (consent.getAuthorizationStatus() == Consent.AuthorizationStatus.AUTHORIZED) return true;
Expand Down
15 changes: 9 additions & 6 deletions Assets/Appodeal-Simplifier/Scripts/AppodealSimplifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,18 @@ public static void RequestConsentIfNeeded()
{
if (Config.debug) Debug.Log($"Appodeal.RequestConsentIfNeeded");

if (!consent.Value && !IsAskedConsentToday() && !consentAskedInCurrentSession
|| Config.support_GDPR_CCPA_Force && !consentAskedInCurrentSession)
{
AskConsent();
}
else
if (!consentAskedInCurrentSession) return;
if (IsAskedConsentToday() && !Config.support_GDPR_CCPA_Force)
{
if (Config.debug) Debug.Log($"Appodeal.RequestConsentIfNeeded already asked today. Will try tomorrow");
return;
}
if (consent.Value)
{
if (Config.debug) Debug.Log($"Consent already granted.");
return;
}
AskConsent();
}
public static void SetConsent(Consent newConsent)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ protected virtual bool AppodealShow()
onClosedDisposable?.Dispose();
onClosedDisposable = OnClosedAds
.First ()
.Subscribe (_ => onClosed?.Invoke())
.Subscribe (_ =>
{
AdsVisible.Value = false;
onClosed?.Invoke();
})
.AddTo (this);

AdsVisible.Value = Appodeal.show(AdType);
Expand Down Expand Up @@ -101,6 +105,7 @@ public virtual bool TryShow()
{
onLoaded?.Invoke();
onLoadedDisposable?.Dispose();
onLoadedDisposable = null;
AppodealShow();
}).AddTo(this);
}
Expand Down

0 comments on commit 710167d

Please sign in to comment.