Skip to content

Commit

Permalink
Remove separating of subs and inapps
Browse files Browse the repository at this point in the history
leave old interfaces to provide backward compatibility
  • Loading branch information
EugeneButusov committed Mar 5, 2016
1 parent 3a7c285 commit 5133208
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions SoomlaAndroidStore/src/com/soomla/store/billing/IabHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,32 @@ public synchronized void startSetup(final OnIabSetupFinishedListener listener) {
}
}

/**
* Initiate the UI flow for an in-app purchase. Call this method to initiate an in-app purchase,
* which will involve bringing up the Google Play screen. The calling activity will be paused while
* the user interacts with Google Play, and the result will be delivered via the activity's
* {@link android.app.Activity#onActivityResult} method, at which point you must call
* this object's {@link #} method to continue the purchase flow. This method
* MUST be called from the UI thread of the Activity.
*
* @param act The calling activity.
* @param itemType ITEM_TYPE_INAPP or ITEM_TYPE_SUBS
* @param sku The sku of the item to purchase.
* @param listener The listener to notify when the purchase process finishes
* @param extraData Extra data (developer payload), which will be returned with the purchase data
* when the purchase completes. This extra data will be permanently bound to that purchase
* and will always be returned when the purchase is queried.
*/
public void launchPurchaseFlow(Activity act, String itemType, String sku,
OnIabPurchaseFinishedListener listener, String extraData) {
checkSetupDoneAndThrow("launchPurchaseFlow");
flagStartAsync("launchPurchaseFlow");

mPurchaseListener = listener;
mLastOperationSKU = sku;
launchPurchaseFlowInner(act, itemType, sku, extraData);
}

/**
* Initiate the UI flow for an in-app purchase. Call this method to initiate an in-app purchase,
* which will involve bringing up the Google Play screen. The calling activity will be paused while
Expand All @@ -97,7 +123,7 @@ public void launchPurchaseFlow(Activity act, String sku,

mPurchaseListener = listener;
mLastOperationSKU = sku;
launchPurchaseFlowInner(act, sku, extraData);
launchPurchaseFlowInner(act, ITEM_TYPE_INAPP, sku, extraData);
}

/**
Expand All @@ -115,21 +141,6 @@ public void restorePurchasesAsync(RestorePurchasessFinishedListener listener) {
restorePurchasesAsyncInner();
}

/**
* Initiates the restore subscriptions process. All active subscriptions will be fetched
* and returned to the user.
* This method is asynchronous and will invoke the listener when the process is finished.
*
* @param listener The listener to notify when the restore subscription process finishes
*/
public void restoreSubscriptionsAsync(RestorePurchasessFinishedListener listener) {
checkSetupDoneAndThrow("restoreSubscriptions");
flagStartAsync("restore subscriptions");

mRestoreSubscriptionsFinishedListener = listener;
restoreSubscriptionsAsyncInner();
}

/**
* Initiates the fetching of items details. This will fetch the price, title, description or
* any other information associated with your items in the market.
Expand Down Expand Up @@ -231,18 +242,13 @@ public interface FetchSkusDetailsFinishedListener {
/**
* see launchPurchaseFlow
*/
protected abstract void launchPurchaseFlowInner(Activity act, String sku, String extraData);
protected abstract void launchPurchaseFlowInner(Activity act, String itemType, String sku, String extraData);

/**
* see restorePurchasesAsync
*/
protected abstract void restorePurchasesAsyncInner();

/**
* see restoreSubscriptionsAsync
*/
protected abstract void restoreSubscriptionsAsyncInner();

/**
* see fetchSkusDetailsAsync
*/
Expand Down

0 comments on commit 5133208

Please sign in to comment.