Skip to content

Commit ab7412d

Browse files
authored
Release 8.0.0
Release 8.0.0
2 parents b25c19b + 91d45d5 commit ab7412d

39 files changed

+1210
-308
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 8.0.0
2+
New major release of Qonversion Android SDK with the new Google Play Billing features support!
3+
* added base plans and offers support;
4+
* Gradle on Android was upgraded to the version 8;
5+
* the `checkTrialIntroEligibility` method improved and now detects the eligibility based on store details on Android;
6+
* the `QProductDuration` and `QTrialDuration` classes were removed;
7+
* the `QProrationMode` enum was removed and replaced with `QPurchaseUpdatePolicy`.
8+
9+
For the complete release notes with the migration guide please see [the documentation](https://documentation.qonversion.io/docs/unity-7-migration-guide).
10+
111
## 7.3.2
212
* Fixed restore issue for iOS
313

android/build.gradle

+11-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ buildscript {
99
}
1010

1111
dependencies {
12-
classpath 'com.android.tools.build:gradle:3.5.4'
12+
classpath 'com.android.tools.build:gradle:8.2.1'
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1414
}
1515
}
@@ -26,7 +26,8 @@ apply plugin: 'com.android.library'
2626
apply plugin: 'kotlin-android'
2727

2828
android {
29-
compileSdkVersion 33
29+
compileSdk 34
30+
namespace "com.qonversion.flutter.sdk.qonversion_flutter_sdk"
3031

3132
sourceSets {
3233
main.java.srcDirs += 'src/main/kotlin'
@@ -39,10 +40,17 @@ android {
3940
lintOptions {
4041
disable 'InvalidPackage'
4142
}
43+
compileOptions {
44+
sourceCompatibility JavaVersion.VERSION_1_8
45+
targetCompatibility JavaVersion.VERSION_1_8
46+
}
47+
kotlinOptions {
48+
jvmTarget = '1.8'
49+
}
4250
}
4351

4452
dependencies {
4553
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
46-
implementation "io.qonversion.sandwich:sandwich:3.3.3"
54+
implementation "io.qonversion.sandwich:sandwich:4.0.0"
4755
implementation 'com.google.code.gson:gson:2.9.0'
4856
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sun Jul 05 12:59:07 MSK 2020
1+
#Thu Jan 11 15:14:08 MSK 2024
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

android/src/main/kotlin/com/qonversion/flutter/sdk/qonversion_flutter_sdk/QonversionPlugin.kt

+12-27
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,8 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
128128
val args = call.arguments() as? Map<String, Any> ?: return result.noNecessaryDataError()
129129
when (call.method) {
130130
"initialize" -> initialize(args, result)
131-
"purchase" -> purchase(args["productId"] as? String, result)
132-
"purchaseProduct" -> purchaseProduct(args, result)
131+
"purchase" -> purchase(args, result)
133132
"updatePurchase" -> updatePurchase(args, result)
134-
"updatePurchaseWithProduct" -> updatePurchaseWithProduct(args, result)
135133
"setDefinedUserProperty" -> setDefinedUserProperty(args, result)
136134
"setCustomUserProperty" -> setCustomUserProperty(args, result)
137135
"addAttributionData" -> addAttributionData(args, result)
@@ -177,40 +175,27 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
177175
result.success(null)
178176
}
179177

180-
private fun purchase(productId: String?, result: Result) {
181-
if (productId == null) {
182-
return result.noNecessaryDataError()
183-
}
184-
185-
qonversionSandwich.purchase(productId, result.toPurchaseResultListener())
186-
}
187-
188-
private fun purchaseProduct(args: Map<String, Any>, result: Result) {
178+
private fun purchase(args: Map<String, Any>, result: Result) {
189179
val productId = args["productId"] as? String ?: return result.noNecessaryDataError()
190-
val offeringId = args["offeringId"] as? String
180+
val offerId = args["offerId"] as? String
181+
val applyOffer = args["applyOffer"] as? Boolean
191182

192-
qonversionSandwich.purchaseProduct(productId, offeringId, result.toPurchaseResultListener())
183+
qonversionSandwich.purchase(productId, offerId, applyOffer, result.toPurchaseResultListener())
193184
}
194185

195186
private fun updatePurchase(args: Map<String, Any>, result: Result) {
196187
val newProductId = args["newProductId"] as? String ?: return result.noNecessaryDataError()
197188
val oldProductId = args["oldProductId"] as? String ?: return result.noNecessaryDataError()
198-
val prorationMode = args["proration_mode"] as? Int
199-
200-
qonversionSandwich.updatePurchase(newProductId, oldProductId, prorationMode, result.toPurchaseResultListener())
201-
}
202-
203-
private fun updatePurchaseWithProduct(args: Map<String, Any>, result: Result) {
204-
val newProductId = args["newProductId"] as? String ?: return result.noNecessaryDataError()
205-
val offeringId = args["offeringId"] as? String
206-
val oldProductId = args["oldProductId"] as? String ?: return result.noNecessaryDataError()
207-
val prorationMode = args["proration_mode"] as? Int
189+
val offerId = args["offerId"] as? String
190+
val applyOffer = args["applyOffer"] as? Boolean
191+
val updatePolicyKey = args["updatePolicyKey"] as? String
208192

209-
qonversionSandwich.updatePurchaseWithProduct(
193+
qonversionSandwich.updatePurchase(
210194
newProductId,
211-
offeringId,
195+
offerId,
196+
applyOffer,
212197
oldProductId,
213-
prorationMode,
198+
updatePolicyKey,
214199
result.toPurchaseResultListener()
215200
)
216201
}

example/android/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727
apply plugin: 'com.google.gms.google-services'
2828

2929
android {
30-
compileSdkVersion 33
30+
compileSdk 34
3131

3232
sourceSets {
3333
main.java.srcDirs += 'src/main/kotlin'

example/android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.6.21'
2+
ext.kotlin_version = '1.8.22'
33
repositories {
44
google()
55
jcenter()

example/lib/home.dart

+3-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ class _HomeViewState extends State<HomeView> {
234234
'' + '\n' + e.value.storeId ??
235235
'' +
236236
'\n' +
237-
e.value.duration.toString() +
237+
e.value.subscriptionPeriod.unitCount.toString() +
238+
' ' +
239+
e.value.subscriptionPeriod.unit.toString() +
238240
'\n' +
239241
e.value.type.toString() +
240242
'\n',

example/lib/products_view.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ class _ProductsViewState extends State<ProductsView> {
134134
textColor: Colors.white,
135135
onPressed: () async {
136136
try {
137+
final purchaseModel = product.toPurchaseModel();
137138
final entitlements =
138-
await Qonversion.getSharedInstance().purchaseProduct(product);
139+
await Qonversion.getSharedInstance().purchase(purchaseModel);
139140
final entitlement = entitlements.values.firstWhere(
140141
(element) => element.productId == product.qonversionId,
141142
orElse: () => null);

ios/Classes/SwiftQonversionPlugin.swift

+1-12
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin {
107107

108108
case "purchase":
109109
return purchase(args["productId"] as? String, result)
110-
111-
case "purchaseProduct":
112-
return purchaseProduct(args["productId"] as? String, args["offeringId"] as? String, result)
113-
110+
114111
case "promoPurchase":
115112
return promoPurchase(args["productId"] as? String, result)
116113

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

214-
private func purchaseProduct(_ productId: String?, _ offeringId: String?, _ result: @escaping FlutterResult) {
215-
guard let productId = productId else {
216-
return result(FlutterError.noNecessaryData)
217-
}
218-
219-
qonversionSandwich?.purchaseProduct(productId, offeringId: offeringId, completion: getPurchaseCompletion(result))
220-
}
221-
222211
private func promoPurchase(_ productId: String?, _ result: @escaping FlutterResult) {
223212
guard let productId = productId else {
224213
return result(FlutterError.noNecessaryData)

ios/qonversion_flutter.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
s.source_files = 'Classes/**/*'
1717
s.dependency 'Flutter'
1818
s.platform = :ios, '9.0'
19-
s.dependency "QonversionSandwich", "3.3.3"
19+
s.dependency "QonversionSandwich", "4.0.0"
2020

2121
# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
2222
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }

lib/qonversion_flutter.dart

+10-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ export 'src/dto/environment.dart';
1313
export 'src/dto/launch_mode.dart';
1414
export 'src/dto/offerings.dart';
1515
export 'src/dto/product.dart';
16-
export 'src/dto/product_duration.dart';
1716
export 'src/dto/product_type.dart';
18-
export 'src/dto/proration_mode.dart';
17+
export 'src/dto/purchase_model.dart';
18+
export 'src/dto/purchase_update_model.dart';
19+
export 'src/dto/purchase_update_policy.dart';
1920
export 'src/dto/purchase_exception.dart';
21+
export 'src/dto/subscription_period.dart';
2022
export 'src/dto/qonversion_error.dart';
2123
export 'src/dto/remote_config.dart';
2224
export 'src/dto/remote_configuration_source.dart';
@@ -30,6 +32,12 @@ export 'src/dto/user_property.dart';
3032
export 'src/dto/user_property_key.dart';
3133
export 'src/dto/sk_product/discount_payment_mode.dart';
3234
export 'src/dto/sk_product/subscription_period_unit.dart';
35+
export 'src/dto/sku_details/sku_details.dart';
36+
export 'src/dto/store_product/product_inapp_details.dart';
37+
export 'src/dto/store_product/product_offer_details.dart';
38+
export 'src/dto/store_product/product_price.dart';
39+
export 'src/dto/store_product/product_pricing_phase.dart';
40+
export 'src/dto/store_product/product_store_details.dart';
3341
export 'src/qonversion.dart';
3442
export 'src/qonversion_config.dart';
3543
export 'src/qonversion_config_builder.dart';

0 commit comments

Comments
 (0)