From 710167d9610259249bfde520d629d0a5a6bf6c5e Mon Sep 17 00:00:00 2001 From: Ivan Murzak Date: Sun, 14 Nov 2021 06:24:48 +0200 Subject: [PATCH] Fix: shower doesn't show ads more then single time --- .../Scripts/AppodealSimplifier.Consent.cs | 2 -- .../Scripts/AppodealSimplifier.cs | 15 +++++++++------ .../Scripts/Shower/AppodealShowerBase.cs | 7 ++++++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Assets/Appodeal-Simplifier/Scripts/AppodealSimplifier.Consent.cs b/Assets/Appodeal-Simplifier/Scripts/AppodealSimplifier.Consent.cs index 5e1b395..e4539b7 100644 --- a/Assets/Appodeal-Simplifier/Scripts/AppodealSimplifier.Consent.cs +++ b/Assets/Appodeal-Simplifier/Scripts/AppodealSimplifier.Consent.cs @@ -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; diff --git a/Assets/Appodeal-Simplifier/Scripts/AppodealSimplifier.cs b/Assets/Appodeal-Simplifier/Scripts/AppodealSimplifier.cs index aea4a00..484412b 100644 --- a/Assets/Appodeal-Simplifier/Scripts/AppodealSimplifier.cs +++ b/Assets/Appodeal-Simplifier/Scripts/AppodealSimplifier.cs @@ -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) { diff --git a/Assets/Appodeal-Simplifier/Scripts/Shower/AppodealShowerBase.cs b/Assets/Appodeal-Simplifier/Scripts/Shower/AppodealShowerBase.cs index 00a7124..1df5abf 100644 --- a/Assets/Appodeal-Simplifier/Scripts/Shower/AppodealShowerBase.cs +++ b/Assets/Appodeal-Simplifier/Scripts/Shower/AppodealShowerBase.cs @@ -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); @@ -101,6 +105,7 @@ public virtual bool TryShow() { onLoaded?.Invoke(); onLoadedDisposable?.Dispose(); + onLoadedDisposable = null; AppodealShow(); }).AddTo(this); }