Skip to content

Commit 69156b4

Browse files
authored
Merge pull request #368 from qonversion/release/9.2.0
Release 9.2.0
2 parents 65b0448 + 040e348 commit 69156b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+748
-968
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 9.2.0
2+
* iOS promotional offers supported. For the details see the [documentation](https://documentation.qonversion.io/docs/apple-promotional-offers).
3+
* Minimal supported Dart SDK version is bumped to 2.14.0.
4+
15
## 9.1.5
26
* Attempt to fix crash and race conditions in the User Properties manager.
37
* Fixed popover presentation style for iPad
@@ -18,8 +22,8 @@
1822
* iOS error codes improved
1923

2024
## 9.1.0
21-
* Added option to set context keys, quantity and other options for purchases. Context keys will allow you to associate the purchase with remote configuration if the product info was loaded from there.
22-
* Deprecated old purchase functions. Use new one instead.
25+
* Added option to set context keys, quantity, and other options for purchases. Context keys will allow you to associate the purchase with remote configuration if the product info was loaded from there.
26+
* Deprecated old purchase functions. Use the new one instead.
2327

2428
## 9.0.2
2529
* Fixed bug with `checkEntitlements` calls on Android when the callback might not have been called after subscription state changes during the app session.

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ android {
5151

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

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ publish_to: 'none'
66
version: 1.0.0
77

88
environment:
9-
sdk: ">=2.12.0 <3.0.0"
9+
sdk: ">=2.14.0 <3.0.0"
1010
flutter: ">=1.12.13+hotfix.6"
1111

1212
dependencies:

ios/Classes/SwiftQonversionPlugin.swift

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,12 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin {
107107
switch call.method {
108108
case "initialize":
109109
return initialize(args, result)
110+
111+
case "getPromotionalOffer":
112+
return getPromotionalOffer(args, result)
110113

111114
case "purchase":
112-
return purchase(args["productId"] as? String, quantity: args["quantity"] as? Int, contextKeys: args["contextKeys"] as? [String], result)
115+
return purchase(args, result)
113116

114117
case "promoPurchase":
115118
return promoPurchase(args["productId"] as? String, result)
@@ -204,19 +207,29 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin {
204207
qonversionSandwich?.identify(userId, getDefaultCompletion(result))
205208
}
206209

210+
private func getPromotionalOffer(_ args: [String: Any], _ result: @escaping FlutterResult) {
211+
guard let productId = args["productId"] as? String,
212+
let discountId = args["discountId"] as? String else {
213+
return result(FlutterError.noNecessaryData)
214+
}
215+
216+
qonversionSandwich?.getPromotionalOffer(productId, productDiscountId:discountId, completion:getJsonCompletion(result))
217+
}
218+
207219
private func products(_ result: @escaping FlutterResult) {
208220
qonversionSandwich?.products(getDefaultCompletion(result))
209221
}
210222

211-
private func purchase(_ productId: String?, quantity: Int?, contextKeys: [String]?, _ result: @escaping FlutterResult) {
212-
guard let productId = productId else {
223+
private func purchase(_ args: [String: Any], _ result: @escaping FlutterResult) {
224+
guard let productId = args["productId"] as? String else {
213225
return result(FlutterError.noNecessaryData)
214226
}
215-
216-
let contextKeys = contextKeys ?? []
217-
let quantity = quantity ?? 1
227+
228+
let contextKeys = args["contextKeys"] as? [String] ?? []
229+
let quantity = args["quantity"] as? Int ?? 1
230+
let promoOfferData = args["promoOffer"] as? [String: Any] ?? [:]
218231

219-
qonversionSandwich?.purchase(productId, quantity:quantity, contextKeys:contextKeys, completion: getJsonCompletion(result))
232+
qonversionSandwich?.purchase(productId, quantity:quantity, contextKeys:contextKeys, promoOffer:promoOfferData, completion:getJsonCompletion(result))
220233
}
221234

222235
private func promoPurchase(_ productId: String?, _ result: @escaping FlutterResult) {

ios/qonversion_flutter.podspec

Lines changed: 1 addition & 1 deletion
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", "5.1.7"
19+
s.dependency "QonversionSandwich", "5.2.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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export 'src/dto/automations/event_type.dart';
66
export 'src/dto/attribution_provider.dart';
77
export 'src/dto/eligibility.dart';
88
export 'src/dto/entitlement.dart';
9+
export 'src/dto/entitlement_grant_type.dart';
910
export 'src/dto/entitlement_renew_state.dart';
1011
export 'src/dto/entitlement_source.dart';
1112
export 'src/dto/entitlements_cache_lifetime.dart';
@@ -14,6 +15,7 @@ export 'src/dto/launch_mode.dart';
1415
export 'src/dto/offerings.dart';
1516
export 'src/dto/product.dart';
1617
export 'src/dto/product_type.dart';
18+
export 'src/dto/promotional_offer.dart';
1719
export 'src/dto/purchase_model.dart';
1820
export 'src/dto/purchase_options.dart';
1921
export 'src/dto/purchase_options_builder.dart';
@@ -35,6 +37,10 @@ export 'src/dto/user_properties.dart';
3537
export 'src/dto/user_property.dart';
3638
export 'src/dto/user_property_key.dart';
3739
export 'src/dto/sk_product/discount_payment_mode.dart';
40+
export 'src/dto/sk_product/sk_payment_discount.dart';
41+
export 'src/dto/sk_product/sk_product.dart';
42+
export 'src/dto/sk_product/sk_product_discount.dart';
43+
export 'src/dto/sk_product/subscription_period.dart';
3844
export 'src/dto/sk_product/subscription_period_unit.dart';
3945
export 'src/dto/sku_details/sku_details.dart';
4046
export 'src/dto/store_product/product_inapp_details.dart';

lib/src/dto/automations/action_result.g.dart

Lines changed: 9 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/dto/automations/event.g.dart

Lines changed: 7 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/dto/eligibility.g.dart

Lines changed: 3 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/dto/entitlement.g.dart

Lines changed: 24 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)