[android] Added facrory method to create bookmark subscription controller

This commit is contained in:
Александр Зацепин 2019-06-26 19:10:42 +03:00 committed by yoksnod
parent dce2ce87f2
commit f600486c05

View file

@ -33,6 +33,22 @@ public class PurchaseFactory
SubscriptionType.ADS_REMOVAL, productIds);
}
@NonNull
public static PurchaseController<PurchaseCallback> createBookmarksSubscriptionPurchaseController(
@NonNull Context context)
{
BillingManager<PlayStoreBillingCallback> billingManager
= new PlayStoreBillingManager(BillingClient.SkuType.SUBS);
PurchaseOperationObservable observable = PurchaseOperationObservable.from(context);
PurchaseValidator<ValidationCallback> validator = new DefaultPurchaseValidator(observable);
String yearlyProduct = PrivateVariables.bookmarksSubscriptionYearlyProductId();
String monthlyProduct = PrivateVariables.bookmarksSubscriptionMonthlyProductId();
String[] productIds = Utils.concatArrays(PrivateVariables.bookmarksSubscriptionNotUsedList(),
yearlyProduct, monthlyProduct);
return new SubscriptionPurchaseController(validator, billingManager,
SubscriptionType.BOOKMARKS, productIds);
}
@NonNull
public static PurchaseController<PurchaseCallback> createBookmarkPurchaseController(
@NonNull Context context, @Nullable String productId, @Nullable String serverId)