Skip to content

Commit

Permalink
Release 8.0.0
Browse files Browse the repository at this point in the history
Release 8.0.0
  • Loading branch information
SpertsyanKM authored Jan 22, 2024
2 parents b25c19b + 91d45d5 commit ab7412d
Show file tree
Hide file tree
Showing 39 changed files with 1,210 additions and 308 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 8.0.0
New major release of Qonversion Android SDK with the new Google Play Billing features support!
* added base plans and offers support;
* Gradle on Android was upgraded to the version 8;
* the `checkTrialIntroEligibility` method improved and now detects the eligibility based on store details on Android;
* the `QProductDuration` and `QTrialDuration` classes were removed;
* the `QProrationMode` enum was removed and replaced with `QPurchaseUpdatePolicy`.

For the complete release notes with the migration guide please see [the documentation](https://documentation.qonversion.io/docs/unity-7-migration-guide).

## 7.3.2
* Fixed restore issue for iOS

Expand Down
14 changes: 11 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
classpath 'com.android.tools.build:gradle:8.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -26,7 +26,8 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 33
compileSdk 34
namespace "com.qonversion.flutter.sdk.qonversion_flutter_sdk"

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -39,10 +40,17 @@ android {
lintOptions {
disable 'InvalidPackage'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "io.qonversion.sandwich:sandwich:3.3.3"
implementation "io.qonversion.sandwich:sandwich:4.0.0"
implementation 'com.google.code.gson:gson:2.9.0'
}
4 changes: 2 additions & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Jul 05 12:59:07 MSK 2020
#Thu Jan 11 15:14:08 MSK 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,8 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
val args = call.arguments() as? Map<String, Any> ?: return result.noNecessaryDataError()
when (call.method) {
"initialize" -> initialize(args, result)
"purchase" -> purchase(args["productId"] as? String, result)
"purchaseProduct" -> purchaseProduct(args, result)
"purchase" -> purchase(args, result)
"updatePurchase" -> updatePurchase(args, result)
"updatePurchaseWithProduct" -> updatePurchaseWithProduct(args, result)
"setDefinedUserProperty" -> setDefinedUserProperty(args, result)
"setCustomUserProperty" -> setCustomUserProperty(args, result)
"addAttributionData" -> addAttributionData(args, result)
Expand Down Expand Up @@ -177,40 +175,27 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
result.success(null)
}

private fun purchase(productId: String?, result: Result) {
if (productId == null) {
return result.noNecessaryDataError()
}

qonversionSandwich.purchase(productId, result.toPurchaseResultListener())
}

private fun purchaseProduct(args: Map<String, Any>, result: Result) {
private fun purchase(args: Map<String, Any>, result: Result) {
val productId = args["productId"] as? String ?: return result.noNecessaryDataError()
val offeringId = args["offeringId"] as? String
val offerId = args["offerId"] as? String
val applyOffer = args["applyOffer"] as? Boolean

qonversionSandwich.purchaseProduct(productId, offeringId, result.toPurchaseResultListener())
qonversionSandwich.purchase(productId, offerId, applyOffer, result.toPurchaseResultListener())
}

private fun updatePurchase(args: Map<String, Any>, result: Result) {
val newProductId = args["newProductId"] as? String ?: return result.noNecessaryDataError()
val oldProductId = args["oldProductId"] as? String ?: return result.noNecessaryDataError()
val prorationMode = args["proration_mode"] as? Int

qonversionSandwich.updatePurchase(newProductId, oldProductId, prorationMode, result.toPurchaseResultListener())
}

private fun updatePurchaseWithProduct(args: Map<String, Any>, result: Result) {
val newProductId = args["newProductId"] as? String ?: return result.noNecessaryDataError()
val offeringId = args["offeringId"] as? String
val oldProductId = args["oldProductId"] as? String ?: return result.noNecessaryDataError()
val prorationMode = args["proration_mode"] as? Int
val offerId = args["offerId"] as? String
val applyOffer = args["applyOffer"] as? Boolean
val updatePolicyKey = args["updatePolicyKey"] as? String

qonversionSandwich.updatePurchaseWithProduct(
qonversionSandwich.updatePurchase(
newProductId,
offeringId,
offerId,
applyOffer,
oldProductId,
prorationMode,
updatePolicyKey,
result.toPurchaseResultListener()
)
}
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'

android {
compileSdkVersion 33
compileSdk 34

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.6.21'
ext.kotlin_version = '1.8.22'
repositories {
google()
jcenter()
Expand Down
4 changes: 3 additions & 1 deletion example/lib/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ class _HomeViewState extends State<HomeView> {
'' + '\n' + e.value.storeId ??
'' +
'\n' +
e.value.duration.toString() +
e.value.subscriptionPeriod.unitCount.toString() +
' ' +
e.value.subscriptionPeriod.unit.toString() +
'\n' +
e.value.type.toString() +
'\n',
Expand Down
3 changes: 2 additions & 1 deletion example/lib/products_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ class _ProductsViewState extends State<ProductsView> {
textColor: Colors.white,
onPressed: () async {
try {
final purchaseModel = product.toPurchaseModel();
final entitlements =
await Qonversion.getSharedInstance().purchaseProduct(product);
await Qonversion.getSharedInstance().purchase(purchaseModel);
final entitlement = entitlements.values.firstWhere(
(element) => element.productId == product.qonversionId,
orElse: () => null);
Expand Down
13 changes: 1 addition & 12 deletions ios/Classes/SwiftQonversionPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin {

case "purchase":
return purchase(args["productId"] as? String, result)

case "purchaseProduct":
return purchaseProduct(args["productId"] as? String, args["offeringId"] as? String, result)


case "promoPurchase":
return promoPurchase(args["productId"] as? String, result)

Expand Down Expand Up @@ -211,14 +208,6 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin {
qonversionSandwich?.purchase(productId, completion: getPurchaseCompletion(result))
}

private func purchaseProduct(_ productId: String?, _ offeringId: String?, _ result: @escaping FlutterResult) {
guard let productId = productId else {
return result(FlutterError.noNecessaryData)
}

qonversionSandwich?.purchaseProduct(productId, offeringId: offeringId, completion: getPurchaseCompletion(result))
}

private func promoPurchase(_ productId: String?, _ result: @escaping FlutterResult) {
guard let productId = productId else {
return result(FlutterError.noNecessaryData)
Expand Down
2 changes: 1 addition & 1 deletion ios/qonversion_flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.platform = :ios, '9.0'
s.dependency "QonversionSandwich", "3.3.3"
s.dependency "QonversionSandwich", "4.0.0"

# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
Expand Down
12 changes: 10 additions & 2 deletions lib/qonversion_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ export 'src/dto/environment.dart';
export 'src/dto/launch_mode.dart';
export 'src/dto/offerings.dart';
export 'src/dto/product.dart';
export 'src/dto/product_duration.dart';
export 'src/dto/product_type.dart';
export 'src/dto/proration_mode.dart';
export 'src/dto/purchase_model.dart';
export 'src/dto/purchase_update_model.dart';
export 'src/dto/purchase_update_policy.dart';
export 'src/dto/purchase_exception.dart';
export 'src/dto/subscription_period.dart';
export 'src/dto/qonversion_error.dart';
export 'src/dto/remote_config.dart';
export 'src/dto/remote_configuration_source.dart';
Expand All @@ -30,6 +32,12 @@ export 'src/dto/user_property.dart';
export 'src/dto/user_property_key.dart';
export 'src/dto/sk_product/discount_payment_mode.dart';
export 'src/dto/sk_product/subscription_period_unit.dart';
export 'src/dto/sku_details/sku_details.dart';
export 'src/dto/store_product/product_inapp_details.dart';
export 'src/dto/store_product/product_offer_details.dart';
export 'src/dto/store_product/product_price.dart';
export 'src/dto/store_product/product_pricing_phase.dart';
export 'src/dto/store_product/product_store_details.dart';
export 'src/qonversion.dart';
export 'src/qonversion_config.dart';
export 'src/qonversion_config_builder.dart';
Loading

0 comments on commit ab7412d

Please sign in to comment.