[android] Added subscription deactivation if sdk returns empty purchase list

This commit is contained in:
Alexander Zatsepin 2018-09-26 14:13:51 +03:00 committed by yoksnod
parent 70c190e07a
commit 59404a74d9

View file

@ -68,6 +68,8 @@ class AdsRemovalPurchaseController extends AbstractPurchaseController<AdsRemoval
{
LOGGER.i(TAG, "Validation status of 'ads removal': " + status);
boolean activateSubscription = status != AdsRemovalValidationStatus.NOT_VERIFIED;
LOGGER.i(TAG, "Ads removal subscription "
+ (activateSubscription ? "activated" : "deactivated"));
Framework.nativeSetActiveRemoveAdsSubscription(activateSubscription);
if (activateSubscription)
Statistics.INSTANCE.trackPurchaseProductDelivered(PrivateVariables.adsRemovalVendor());
@ -127,6 +129,11 @@ class AdsRemovalPurchaseController extends AbstractPurchaseController<AdsRemoval
if (TextUtils.isEmpty(purchaseData))
{
LOGGER.i(TAG, "Existing purchase data for 'ads removal' not found");
if (Framework.nativeHasActiveRemoveAdsSubscription())
{
LOGGER.i(TAG, "Ads removal subscription deactivated");
Framework.nativeSetActiveRemoveAdsSubscription(false);
}
return;
}