Skip to content

Commit 3cbf17f

Browse files
authored
Release 8.2.0
Release 8.2.0
2 parents 42a7495 + 0fb3e07 commit 3cbf17f

File tree

13 files changed

+35
-36
lines changed

13 files changed

+35
-36
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 8.2.0
2+
* Added an option to load Remote Configs by the specific context keys using the `remoteConfig` method.
3+
14
## 8.1.0
25
* Added 4 new properties for AppMetrica and PushWoosh integrations - `appMetricaDeviceId`, `appMetricaUserProfileId`, `pushWooshHwId`, `pushWooshUserId`.
36
* Updated entitlements cache logic - the case with entitlement expiration during the app session handled.

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:4.1.1"
54+
implementation "io.qonversion.sandwich:sandwich:4.2.0"
5555
implementation 'com.google.code.gson:gson:2.9.0'
5656
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
109109
"userProperties" -> {
110110
return userProperties(result)
111111
}
112-
"remoteConfig" -> {
113-
return remoteConfig(result)
114-
}
115112
"logout" -> {
116113
qonversionSandwich.logout()
117114
return result.success(null)
@@ -130,6 +127,7 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
130127
"initialize" -> initialize(args, result)
131128
"purchase" -> purchase(args, result)
132129
"updatePurchase" -> updatePurchase(args, result)
130+
"remoteConfig" -> remoteConfig(args["contextKey"] as? String, result)
133131
"setDefinedUserProperty" -> setDefinedUserProperty(args, result)
134132
"setCustomUserProperty" -> setCustomUserProperty(args, result)
135133
"addAttributionData" -> addAttributionData(args, result)
@@ -216,8 +214,8 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware {
216214
qonversionSandwich.userProperties(result.toJsonResultListener())
217215
}
218216

219-
private fun remoteConfig(result: Result) {
220-
qonversionSandwich.remoteConfig(result.toJsonResultListener())
217+
private fun remoteConfig(contextKey: String?, result: Result) {
218+
qonversionSandwich.remoteConfig(contextKey, result.toJsonResultListener())
221219
}
222220

223221
private fun products(result: Result) {

ios/Classes/SwiftQonversionPlugin.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin {
5757

5858
case "checkEntitlements":
5959
return checkEntitlements(result)
60-
61-
case "remoteConfig":
62-
return remoteConfig(result)
6360

6461
case "restore":
6562
return restore(result)
@@ -110,6 +107,9 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin {
110107

111108
case "promoPurchase":
112109
return promoPurchase(args["productId"] as? String, result)
110+
111+
case "remoteConfig":
112+
return remoteConfig(args["contextKey"] as? String, result)
113113

114114
case "setDefinedUserProperty":
115115
return setDefinedUserProperty(args, result)
@@ -220,8 +220,8 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin {
220220
qonversionSandwich?.checkEntitlements(getJsonCompletion(result))
221221
}
222222

223-
private func remoteConfig(_ result: @escaping FlutterResult) {
224-
qonversionSandwich?.remoteConfig(getJsonCompletion(result))
223+
private func remoteConfig(_ contextKey: String?, _ result: @escaping FlutterResult) {
224+
qonversionSandwich?.remoteConfig(contextKey, getJsonCompletion(result))
225225
}
226226

227227
private func userInfo(_ 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", "4.1.1"
19+
s.dependency "QonversionSandwich", "4.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/src/dto/remote_configuration_source.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ class QRemoteConfigurationSource {
2626
)
2727
final QRemoteConfigurationAssignmentType assignmentType;
2828

29+
@JsonKey(name: 'contextKey')
30+
final String contextKey;
31+
2932
const QRemoteConfigurationSource(
3033
this.id,
3134
this.name,
3235
this.type,
33-
this.assignmentType
36+
this.assignmentType,
37+
this.contextKey,
3438
);
3539

3640
factory QRemoteConfigurationSource.fromJson(Map<String, dynamic> json) =>

lib/src/dto/remote_configuration_source.g.dart

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/internal/constants.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Constants {
3030
static const kExperimentId = 'experimentId';
3131
static const kGroupId = 'groupId';
3232
static const kRemoteConfigurationId = 'remoteConfigurationId';
33+
static const kContextKey = 'contextKey';
3334

3435
// MethodChannel methods names
3536
static const mInitialize = 'initialize';

lib/src/internal/qonversion_internal.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import 'package:qonversion_flutter/src/internal/utils/string.dart';
1111
import 'constants.dart';
1212

1313
class QonversionInternal implements Qonversion {
14-
static const String _sdkVersion = "8.1.0";
14+
static const String _sdkVersion = "8.2.0";
1515

1616
final MethodChannel _channel = MethodChannel('qonversion_plugin');
1717

@@ -171,8 +171,11 @@ class QonversionInternal implements Qonversion {
171171
}
172172

173173
@override
174-
Future<QRemoteConfig> remoteConfig() async {
175-
final rawResult = await _channel.invokeMethod(Constants.mRemoteConfig);
174+
Future<QRemoteConfig> remoteConfig({String? contextKey}) async {
175+
final args = {
176+
Constants.kContextKey: contextKey,
177+
};
178+
final rawResult = await _channel.invokeMethod(Constants.mRemoteConfig, args);
176179

177180
final result = QMapper.remoteConfigFromJson(rawResult);
178181
if (result == null) {

lib/src/qonversion.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ abstract class Qonversion {
163163
/// On iOS 14.0+ shows up a sheet for users to redeem AppStore offer codes.
164164
Future<void> presentCodeRedemptionSheet();
165165

166-
/// Returns Qonversion remote config object
166+
/// Returns Qonversion remote config object by [contextKey] or default one if the key is not specified.
167167
/// Use this function to get the remote config with specific payload and experiment info.
168-
Future<QRemoteConfig> remoteConfig();
168+
Future<QRemoteConfig> remoteConfig({String? contextKey});
169169

170170
/// This function should be used for the test purposes only. Do not forget to delete the usage of this function before the release.
171171
/// Use this function to attach the user to the experiment.

0 commit comments

Comments
 (0)