Skip to content

Commit

Permalink
Merge pull request #54 from qonversion/feature/googleBilling6
Browse files Browse the repository at this point in the history
Google Play Billing Library 6 support
SpertsyanKM authored Jan 22, 2024
2 parents ae180a5 + 08c35b0 commit b6f316f
Showing 23 changed files with 1,193 additions and 335 deletions.
12 changes: 10 additions & 2 deletions plugin/plugin.xml
Original file line number Diff line number Diff line change
@@ -26,6 +26,13 @@
<js-module src="www/Offering.js" name="Offering" />
<js-module src="www/Offerings.js" name="Offerings" />
<js-module src="www/Product.js" name="Product" />
<js-module src="www/ProductInAppDetails.js" name="ProductInAppDetails" />
<js-module src="www/ProductOfferDetails.js" name="ProductOfferDetails" />
<js-module src="www/ProductPrice.js" name="ProductPrice" />
<js-module src="www/ProductPricingPhase.js" name="ProductPricingPhase" />
<js-module src="www/ProductStoreDetails.js" name="ProductStoreDetails" />
<js-module src="www/PurchaseModel.js" name="PurchaseModel" />
<js-module src="www/PurchaseUpdateModel.js" name="PurchaseUpdateModel" />
<js-module src="www/Experiment.js" name="Experiment" />
<js-module src="www/ExperimentGroup.js" name="ExperimentGroup" />
<js-module src="www/RemoteConfig.js" name="RemoteConfig" />
@@ -38,14 +45,15 @@
<js-module src="www/SKProductDiscount.js" name="SKProductDiscount" />
<js-module src="www/SKSubscriptionPeriod.js" name="SKSubscriptionPeriod" />
<js-module src="www/SkuDetails.js" name="SkuDetails" />
<js-module src="www/SubscriptionPeriod.js" name="SubscriptionPeriod" />

<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="QonversionPlugin" >
<param name="android-package" value="com.qonversion.android.sdk.QonversionPlugin"/>
</feature>
</config-file>
<framework src="io.qonversion.sandwich:sandwich:3.3.3" />
<framework src="io.qonversion.sandwich:sandwich:4.0.0" />
<source-file src="src/android/QonversionPlugin.java" target-dir="src/com/qonversion/android/sdk" />
<source-file src="src/android/EntitiesConverter.java" target-dir="src/com/qonversion/android/sdk" />
<source-file src="src/android/Utils.java" target-dir="src/com/qonversion/android/sdk" />
@@ -63,7 +71,7 @@
<source url="https://github.com/CocoaPods/Specs.git"/>
</config>
<pods use-frameworks="true">
<pod name="QonversionSandwich" spec="3.3.3" />
<pod name="QonversionSandwich" spec="4.0.0" />
</pods>
</podspec>
</platform>
49 changes: 13 additions & 36 deletions plugin/src/android/QonversionPlugin.java
Original file line number Diff line number Diff line change
@@ -82,53 +82,30 @@ public void initializeSdk(
entitlementsUpdateCallbackContext.sendPluginResult(result);
}

@PluginAction(thread = ExecutionThread.UI, actionName = "purchaseProduct", isAutofinish = false)
public void purchaseProduct(String productId, String offeringId, CallbackContext callbackContext) {
qonversionSandwich.purchaseProduct(productId, offeringId, getPurchaseResultListener(callbackContext));
}

@PluginAction(thread = ExecutionThread.UI, actionName = "purchase", isAutofinish = false)
public void purchase(String productId, CallbackContext callbackContext) {
qonversionSandwich.purchase(productId, getPurchaseResultListener(callbackContext));
}

@PluginAction(thread = ExecutionThread.UI, actionName = "updateProductWithId", isAutofinish = false)
public void updateProductWithId(
final String productId,
@Nullable final String offeringId,
final String oldProductId,
CallbackContext callbackContext
) {
updateProductWithIdAndProrationMode(productId, offeringId, oldProductId, null, callbackContext);
public void purchase(String productId, @Nullable String offerId, @Nullable Boolean applyOffer, CallbackContext callbackContext) {
qonversionSandwich.purchase(productId, offerId, applyOffer, getPurchaseResultListener(callbackContext));
}

@PluginAction(thread = ExecutionThread.UI, actionName = "updateProductWithIdAndProrationMode", isAutofinish = false)
public void updateProductWithIdAndProrationMode(
final String productId,
@Nullable final String offeringId,
final String oldProductId,
@Nullable final Integer prorationMode,
@PluginAction(thread = ExecutionThread.UI, actionName = "updatePurchase", isAutofinish = false)
public void updatePurchase(
String productId,
@Nullable String offerId,
@Nullable Boolean applyOffer,
String oldProductId,
@Nullable String updatePolicyKey,
CallbackContext callbackContext
) {
qonversionSandwich.updatePurchaseWithProduct(
qonversionSandwich.updatePurchase(
productId,
offeringId,
offerId,
applyOffer,
oldProductId,
prorationMode,
updatePolicyKey,
getPurchaseResultListener(callbackContext)
);
}

@PluginAction(thread = ExecutionThread.UI, actionName = "updatePurchase", isAutofinish = false)
public void updatePurchase(String productId, String oldProductId, CallbackContext callbackContext) {
updatePurchaseWithProrationMode(productId, oldProductId, null, callbackContext);
}

@PluginAction(thread = ExecutionThread.UI, actionName = "updatePurchaseWithProrationMode", isAutofinish = false)
public void updatePurchaseWithProrationMode(String productId, String oldProductId, Integer prorationMode, CallbackContext callbackContext) {
qonversionSandwich.updatePurchase(productId, oldProductId, prorationMode, getPurchaseResultListener(callbackContext));
}

@PluginAction(thread = ExecutionThread.WORKER, actionName = "setDefinedProperty")
public void setDefinedProperty(String key, String value, CallbackContext callbackContext) {
qonversionSandwich.setDefinedProperty(key, value);
1 change: 0 additions & 1 deletion plugin/src/ios/CDVQonversionPlugin.h
Original file line number Diff line number Diff line change
@@ -22,7 +22,6 @@ NS_ASSUME_NONNULL_BEGIN
- (void)userProperties:(CDVInvokedUrlCommand *)command;
- (void)attribution:(CDVInvokedUrlCommand *)command;
- (void)checkEntitlements:(CDVInvokedUrlCommand *)command;
- (void)purchaseProduct:(CDVInvokedUrlCommand *)command;
- (void)purchase:(CDVInvokedUrlCommand *)command;
- (void)products:(CDVInvokedUrlCommand *)command;
- (void)restore:(CDVInvokedUrlCommand *)command;
9 changes: 0 additions & 9 deletions plugin/src/ios/CDVQonversionPlugin.m
Original file line number Diff line number Diff line change
@@ -111,15 +111,6 @@ - (void)checkEntitlements:(CDVInvokedUrlCommand *)command {
}];
}

- (void)purchaseProduct:(CDVInvokedUrlCommand *)command {
NSString *productId = [command argumentAtIndex:0];
NSString *offeringId = [command argumentAtIndex:1];
__block __weak CDVQonversionPlugin *weakSelf = self;
[self.qonversionSandwich purchaseProduct:productId offeringId:offeringId completion:^(NSDictionary<NSString *,id> * _Nullable result, SandwichError * _Nullable error) {
[weakSelf returnCordovaResult:result error:error command:command];
}];
}

- (void)purchase:(CDVInvokedUrlCommand *)command {
NSString *productId = [command argumentAtIndex:0];
__block __weak CDVQonversionPlugin *weakSelf = self;
Loading

0 comments on commit b6f316f

Please sign in to comment.