Welcome to mirror list, hosted at ThFree Co, Russian Federation.

QueryExistingPurchases.java « purchase « maps « mapswithme « com « src « android - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 493428547a47fc3c6623ad44587a7d50722985c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.mapswithme.maps.purchase;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.android.billingclient.api.BillingClient;
import com.android.billingclient.api.Purchase;

import java.util.List;

class QueryExistingPurchases extends PlayStoreBillingRequest<PlayStoreBillingCallback>
{

  QueryExistingPurchases(@NonNull BillingClient client, @NonNull String productType,
                         @Nullable PlayStoreBillingCallback callback)
  {
    super(client, productType, callback);
  }

  @Override
  public void execute()
  {
    Purchase.PurchasesResult purchasesResult = getClient().queryPurchases(getProductType());
    if (purchasesResult == null)
      return;

    List<Purchase> purchases = purchasesResult.getPurchasesList();
    if (purchases == null)
      return;

    if ( getCallback() != null)
      getCallback().onPurchasesLoaded(purchases);
  }
}