[android] Fixed disabling of locals ads on the start if subscription is active

This commit is contained in:
Alexander Zatsepin 2018-09-26 18:31:07 +03:00 committed by Daria Volvenkova
parent 1583278a36
commit 14c36ba25c
2 changed files with 3 additions and 4 deletions

View file

@ -92,8 +92,7 @@ class AdsRemovalPurchaseController extends AbstractPurchaseController<AdsRemoval
{
for (Purchase purchase : purchases)
{
LOGGER.i(TAG, "Validating 'ads removal' purchased '" + purchase.getSku()
+ "' on backend server...");
LOGGER.i(TAG, "Validating purchase '" + purchase.getSku() + "' on backend server...");
getValidator().validate(purchase.getOriginalJson());
if (getUiCallback() != null)
getUiCallback().onValidationStarted();

View file

@ -481,8 +481,8 @@ Framework::Framework(FrameworkParams const & params)
// Local ads manager should be initialized after storage initialization.
if (params.m_enableLocalAds)
{
m_localAdsManager.Startup(m_bmManager.get(),
m_purchase->IsSubscriptionActive(SubscriptionType::RemoveAds));
auto const isActive = m_purchase->IsSubscriptionActive(SubscriptionType::RemoveAds);
m_localAdsManager.Startup(m_bmManager.get(), !isActive);
m_purchase->RegisterSubscription(&m_localAdsManager);
}