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: fc9e6e34a710146dcd70e7f48015ba431db0ac51 (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 androidx.annotation.NonNull;
import androidx.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);
  }
}