Skip to content

Commit 818933b

Browse files
Merge pull request #332 from qonversion/release/9.0.0
Release/9.0.0
2 parents 1f62d36 + 099bd7f commit 818933b

31 files changed

+662
-87
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 9.0.0
2+
New major release of Qonversion Flutter SDK with the new Google Play Billing Library 7 support!
3+
* installment plans supported for subscriptions
4+
* fallback files support added for improved reliability
5+
* several error code values updated
6+
7+
For the migration steps and the complete list of changes, see the following [guide](https://documentation.qonversion.io/docs/android-8-migration-guide).
8+
19
## 8.5.0
210
* Internal logic update
311

android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ android {
3333
main.java.srcDirs += 'src/main/kotlin'
3434
}
3535
defaultConfig {
36-
minSdkVersion 16
37-
targetSdkVersion 33
36+
minSdkVersion 21
37+
targetSdkVersion 34
3838
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3939
}
4040
lintOptions {
@@ -51,6 +51,6 @@ android {
5151

5252
dependencies {
5353
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
54-
implementation "io.qonversion.sandwich:sandwich:4.5.0"
54+
implementation "io.qonversion.sandwich:sandwich:5.0.2"
5555
implementation 'com.google.code.gson:gson:2.9.0'
5656
}

android/src/main/kotlin/com/qonversion/flutter/sdk/qonversion_flutter_sdk/FlutterResult+CustomErrors.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,3 @@ fun MethodChannel.Result.noNecessaryDataError() {
1414
fun MethodChannel.Result.sandwichError(error: SandwichError) {
1515
return error(error.code, error.description, error.additionalMessage)
1616
}
17-
18-
fun MethodChannel.Result.purchaseError(error: SandwichError, isCancelled: Boolean) {
19-
val errorCode = if (isCancelled) "PurchaseCancelledByUser" else error.code
20-
return error(errorCode, error.description, error.additionalMessage)
21-
}

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
116116
"userInfo" -> {
117117
return userInfo(result)
118118
}
119+
"isFallbackFileAccessible" -> {
120+
return isFallbackFileAccessible(result)
121+
}
119122
"automationsSubscribe" -> {
120123
return automationsPlugin.subscribe()
121124
}
@@ -181,7 +184,7 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
181184
val offerId = args["offerId"] as? String
182185
val applyOffer = args["applyOffer"] as? Boolean
183186

184-
qonversionSandwich.purchase(productId, offerId, applyOffer, result.toPurchaseResultListener())
187+
qonversionSandwich.purchase(productId, offerId, applyOffer, result.toJsonResultListener())
185188
}
186189

187190
private fun updatePurchase(args: Map<String, Any>, result: Result) {
@@ -197,7 +200,7 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
197200
applyOffer,
198201
oldProductId,
199202
updatePolicyKey,
200-
result.toPurchaseResultListener()
203+
result.toJsonResultListener()
201204
)
202205
}
203206

@@ -217,6 +220,9 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
217220
qonversionSandwich.userProperties(result.toJsonResultListener())
218221
}
219222

223+
private fun isFallbackFileAccessible(result: Result) {
224+
qonversionSandwich.isFallbackFileAccessible(result.toJsonResultListener())
225+
}
220226
private fun remoteConfig(contextKey: String?, result: Result) {
221227
qonversionSandwich.remoteConfig(contextKey, result.toJsonResultListener())
222228
}

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package com.qonversion.flutter.sdk.qonversion_flutter_sdk
22

33
import com.google.gson.Gson
44
import io.flutter.plugin.common.MethodChannel
5-
import io.qonversion.sandwich.PurchaseResultListener
65
import io.qonversion.sandwich.ResultListener
76
import io.qonversion.sandwich.SandwichError
87

@@ -29,15 +28,3 @@ internal fun MethodChannel.Result.toJsonResultListener(): ResultListener {
2928
}
3029
}
3130
}
32-
33-
internal fun MethodChannel.Result.toPurchaseResultListener(): PurchaseResultListener {
34-
return object : PurchaseResultListener {
35-
override fun onError(error: SandwichError, isCancelled: Boolean) {
36-
purchaseError(error, isCancelled)
37-
}
38-
39-
override fun onSuccess(data: Map<String, Any?>) {
40-
success(Gson().toJson(data))
41-
}
42-
}
43-
}

example/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ android {
3636
defaultConfig {
3737
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
3838
applicationId "com.qonversion.sample"
39-
minSdkVersion 19
40-
targetSdkVersion 33
39+
minSdkVersion 21
40+
targetSdkVersion 34
4141
versionCode flutterVersionCode.toInteger()
4242
versionName flutterVersionName
4343
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
{
2+
"products": [
3+
{
4+
"id": "android_installment",
5+
"duration": 1,
6+
"store_id": "gb7_test_subscription",
7+
"type": 1,
8+
"base_plan_id": "monthly-installment"
9+
},
10+
{
11+
"id": "android_prepaid_2",
12+
"duration": null,
13+
"store_id": "daniel_prepaid",
14+
"type": 1,
15+
"base_plan_id": "monthly"
16+
},
17+
{
18+
"id": "dan_test",
19+
"duration": null,
20+
"store_id": "dan_test_annual",
21+
"type": null
22+
},
23+
{
24+
"id": "gb6_annual",
25+
"duration": 4,
26+
"store_id": "gb6_test",
27+
"type": 0,
28+
"base_plan_id": "annual"
29+
},
30+
{
31+
"id": "gb6_monthly",
32+
"duration": 1,
33+
"store_id": "gb6_test",
34+
"type": 0,
35+
"base_plan_id": "monthly"
36+
},
37+
{
38+
"id": "gb6_weekly",
39+
"duration": 0,
40+
"store_id": "gb6_test",
41+
"type": 1,
42+
"base_plan_id": "weekly"
43+
},
44+
{
45+
"id": "android_prepaid",
46+
"duration": 2,
47+
"store_id": "gp5_test_subscription_4",
48+
"type": 1,
49+
"base_plan_id": "prepaid-3m"
50+
},
51+
{
52+
"id": "weekly",
53+
"duration": 0,
54+
"store_id": "gp5_test_subscription_4",
55+
"type": 1,
56+
"base_plan_id": "monthly-2"
57+
},
58+
{
59+
"id": "consumable",
60+
"duration": null,
61+
"store_id": "qonversion_inapp_sample",
62+
"type": 2
63+
},
64+
{
65+
"id": "subs_plus_trial",
66+
"duration": 1,
67+
"store_id": "gp5_test_subscription_4",
68+
"type": 0
69+
},
70+
{
71+
"id": "annual",
72+
"duration": 4,
73+
"store_id": "article_test_trial",
74+
"type": 0
75+
},
76+
{
77+
"id": "in_app",
78+
"duration": null,
79+
"store_id": "qonversion_sample_purchase",
80+
"type": 2
81+
}
82+
],
83+
"offerings": [
84+
{
85+
"id": "main",
86+
"tag": 1,
87+
"products": [
88+
{
89+
"id": "weekly",
90+
"duration": 0,
91+
"store_id": "gp5_test_subscription_4",
92+
"type": 1,
93+
"base_plan_id": "monthly-2"
94+
},
95+
{
96+
"id": "annual",
97+
"duration": 4,
98+
"store_id": "article_test_trial",
99+
"type": 0
100+
},
101+
{
102+
"id": "consumable",
103+
"duration": null,
104+
"store_id": "qonversion_inapp_sample",
105+
"type": 2
106+
}
107+
]
108+
},
109+
{
110+
"id": "discounted_offer",
111+
"tag": 0,
112+
"products": []
113+
}
114+
],
115+
"products_permissions": {
116+
"android_installment": [
117+
"standart"
118+
],
119+
"android_prepaid_2": [
120+
"premium"
121+
],
122+
"dan_test": [
123+
"test_permission"
124+
],
125+
"gb6_annual": [
126+
"premium"
127+
],
128+
"gb6_monthly": [
129+
"plus"
130+
],
131+
"gb6_weekly": [
132+
"standart"
133+
],
134+
"android_prepaid": [
135+
"premium"
136+
],
137+
"weekly": [
138+
"plus"
139+
],
140+
"consumable": [],
141+
"subs_plus_trial": [
142+
"standart"
143+
],
144+
"annual": [
145+
"standart",
146+
"sample"
147+
],
148+
"in_app": [
149+
"Premium Movies"
150+
]
151+
},
152+
"remote_config_list": [
153+
{
154+
"experiment": null,
155+
"payload": {
156+
"CTA": "Start Trial",
157+
"CTA_color": "#307BF6",
158+
"main_image": "[IMAGE_URL]",
159+
"product_id": "prod_7d_trial_5.99",
160+
"show_close_button": true
161+
},
162+
"source": {
163+
"assignment_type": "auto",
164+
"context_key": "main_paywall",
165+
"name": "default paywall",
166+
"type": "remote_configuration",
167+
"uid": "0dcb1bd9-9bc3-4668-84aa-4540d1042c5d"
168+
}
169+
},
170+
{
171+
"experiment": null,
172+
"payload": {
173+
"CTA": "Start you trial",
174+
"CTA_color": "red",
175+
"main_image": "111",
176+
"product_id": "123123123123123",
177+
"show_close_button": true
178+
},
179+
"source": {
180+
"assignment_type": "auto",
181+
"context_key": "",
182+
"name": "Default settings",
183+
"type": "remote_configuration",
184+
"uid": "12feb1dd-8096-47bc-a5a1-443fd2828ecc"
185+
}
186+
},
187+
{
188+
"experiment": null,
189+
"payload": {
190+
"test_key": "test_value"
191+
},
192+
"source": {
193+
"assignment_type": "auto",
194+
"context_key": "test_context_key",
195+
"name": "Test with context key1",
196+
"type": "remote_configuration",
197+
"uid": "c5077ec4-acf4-41ea-8b43-05114be5d7ce"
198+
}
199+
},
200+
{
201+
"experiment": null,
202+
"payload": {
203+
"test_key_2": "test_value_2"
204+
},
205+
"source": {
206+
"assignment_type": "auto",
207+
"context_key": "test_context_key_2",
208+
"name": "Test with context key2 - copy",
209+
"type": "remote_configuration",
210+
"uid": "1c000f2a-2f4b-4736-b5dd-75b13bf73deb"
211+
}
212+
},
213+
{
214+
"experiment": null,
215+
"payload": {
216+
"bool": true,
217+
"json": {
218+
"key": "value"
219+
}
220+
},
221+
"source": {
222+
"assignment_type": "auto",
223+
"context_key": "swift_key ",
224+
"name": "Swift",
225+
"type": "remote_configuration",
226+
"uid": "9f85d738-56d8-4f6c-b54a-c08658be2cb4"
227+
}
228+
}
229+
]
230+
}

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 50;
6+
objectVersion = 46;
77
objects = {
88

99
/* Begin PBXBuildFile section */

ios/Classes/FlutterError+Custom.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ extension FlutterError {
2323
static func sandwichError(_ error: SandwichError) -> FlutterError {
2424
return mapSandwichError(error, errorCode: error.code)
2525
}
26-
27-
static func purchaseError(_ error: SandwichError) -> FlutterError {
28-
let isCancelled = error.additionalInfo["isCancelled"] as? Bool ?? false
29-
let code = isCancelled ? "PurchaseCancelledByUser" : error.code
30-
return mapSandwichError(error, errorCode: code)
31-
}
3226

3327
static let serializationError = FlutterError(code: "SerializationError",
3428
message: "Failed to serialize response from native bridge",

0 commit comments

Comments
 (0)