forked from organicmaps/organicmaps
[android] Added method for quering purchase details in controller
This commit is contained in:
parent
ab4df6ef0b
commit
af6a048f9a
5 changed files with 16 additions and 15 deletions
|
@ -54,12 +54,6 @@ abstract class AbstractPurchaseController<V, B, UiCallback> implements PurchaseC
|
|||
return mUiCallback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPurchaseDone()
|
||||
{
|
||||
return mValidator.hasActivePurchase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPurchaseSupported()
|
||||
{
|
||||
|
|
|
@ -49,6 +49,12 @@ class AdsRemovalPurchaseController extends AbstractPurchaseController<AdsRemoval
|
|||
getBillingManager().removeCallback(mBillingCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queryPurchaseDetails()
|
||||
{
|
||||
getBillingManager().queryProductDetails(mProductIds);
|
||||
}
|
||||
|
||||
private static class AdValidationCallbackImpl implements AdsRemovalValidationCallback
|
||||
{
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.mapswithme.maps.purchase;
|
|||
import android.app.Activity;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Manages a billing flow for the specific product.
|
||||
*/
|
||||
|
@ -40,7 +42,7 @@ public interface BillingManager<T>
|
|||
* Queries product details for specified products. They will be delivered to the caller
|
||||
* through callback {@link T}.
|
||||
*/
|
||||
void queryProductDetails(@NonNull String... productIds);
|
||||
void queryProductDetails(@NonNull List<String> productIds);
|
||||
|
||||
/**
|
||||
* Adds a billing callback.
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.mapswithme.util.log.Logger;
|
|||
import com.mapswithme.util.log.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class PlayStoreBillingManager implements BillingManager<PlayStoreBillingCallback>,
|
||||
|
@ -60,10 +59,10 @@ public class PlayStoreBillingManager implements BillingManager<PlayStoreBillingC
|
|||
}
|
||||
|
||||
@Override
|
||||
public void queryProductDetails(@NonNull String... productIds)
|
||||
public void queryProductDetails(@NonNull List<String> productIds)
|
||||
{
|
||||
executeBillingRequest(new QueryProductDetailsRequest(getClientOrThrow(), mProductType,
|
||||
mCallback, Arrays.asList(productIds)));
|
||||
mCallback, productIds));
|
||||
}
|
||||
|
||||
private void executeBillingRequest(@NonNull BillingRequest request)
|
||||
|
|
|
@ -21,11 +21,6 @@ public interface PurchaseController<T>
|
|||
*/
|
||||
void destroy();
|
||||
|
||||
/**
|
||||
* Indicates whether the purchase already done or not.
|
||||
*/
|
||||
boolean isPurchaseDone();
|
||||
|
||||
/**
|
||||
* Indicates whether the purchase flow is supported by this device or not.
|
||||
*/
|
||||
|
@ -39,6 +34,11 @@ public interface PurchaseController<T>
|
|||
*/
|
||||
void launchPurchaseFlow(@NonNull String productId);
|
||||
|
||||
/**
|
||||
* Queries purchase details. They will be delivered to the caller through callback {@link T}.
|
||||
*/
|
||||
void queryPurchaseDetails();
|
||||
|
||||
void addCallback(@NonNull T callback);
|
||||
|
||||
void removeCallback();
|
||||
|
|
Loading…
Add table
Reference in a new issue