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

SubsProductDetailsCallback.java « purchase « maps « mapswithme « com « src « android - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b98adb74ecfa0b4101c2a02052bd49f6230a95f8 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package com.mapswithme.maps.purchase;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

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

import java.util.Collections;
import java.util.List;

class SubsProductDetailsCallback
    extends StatefulPurchaseCallback<BookmarkPaymentState, BookmarkPaymentFragment>
    implements PlayStoreBillingCallback
{
  @Nullable
  private List<SkuDetails> mPendingDetails;

  @Override
  public void onProductDetailsLoaded(@NonNull List<SkuDetails> details)
  {
    if (PurchaseUtils.hasIncorrectSkuDetails(details))
    {
      activateStateSafely(BookmarkPaymentState.SUBS_PRODUCT_DETAILS_FAILURE);
      return;
    }

    if (getUiObject() == null)
      mPendingDetails = Collections.unmodifiableList(details);
    else
      getUiObject().handleSubsProductDetails(details);

    activateStateSafely(BookmarkPaymentState.SUBS_PRODUCT_DETAILS_LOADED);
  }


  @Override
  void onAttach(@NonNull BookmarkPaymentFragment bookmarkPaymentFragment)
  {
    if (mPendingDetails != null)
    {
      bookmarkPaymentFragment.handleProductDetails(mPendingDetails);
      mPendingDetails = null;
    }
  }

  @Override
  public void onPurchaseSuccessful(@NonNull List<Purchase> purchases)
  {
    // Do nothing.
  }

  @Override
  public void onPurchaseFailure(int error)
  {
    // Do nothing.
  }

  @Override
  public void onProductDetailsFailure()
  {
    activateStateSafely(BookmarkPaymentState.SUBS_PRODUCT_DETAILS_FAILURE);
  }

  @Override
  public void onStoreConnectionFailed()
  {
    // Do nothing.
  }

  @Override
  public void onPurchasesLoaded(@NonNull List<Purchase> purchases)
  {
    // Do nothing.
  }

  @Override
  public void onConsumptionSuccess()
  {
    throw new UnsupportedOperationException();
  }

  @Override
  public void onConsumptionFailure()
  {
    throw new UnsupportedOperationException();
  }
}