diff --git a/CHANGELOG.md b/CHANGELOG.md index 108f3bda..931bcec9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,3 @@ -## 5.0.0 -* Updated A/B experiments - ## 5.4.1 * Added native SDK crash tracking. diff --git a/android/build.gradle b/android/build.gradle index 8076adb0..881beb0a 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -43,6 +43,6 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "io.qonversion.sandwich:sandwich:2.0.0" + implementation "io.qonversion.sandwich:sandwich:1.5.2" implementation 'com.google.code.gson:gson:2.9.0' } diff --git a/android/src/main/kotlin/com/qonversion/flutter/sdk/qonversion_flutter_sdk/QonversionPlugin.kt b/android/src/main/kotlin/com/qonversion/flutter/sdk/qonversion_flutter_sdk/QonversionPlugin.kt index 026f92a2..b5935bb0 100644 --- a/android/src/main/kotlin/com/qonversion/flutter/sdk/qonversion_flutter_sdk/QonversionPlugin.kt +++ b/android/src/main/kotlin/com/qonversion/flutter/sdk/qonversion_flutter_sdk/QonversionPlugin.kt @@ -106,9 +106,6 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware { "offerings" -> { return offerings(result) } - "remoteConfig" -> { - return remoteConfig(result) - } "logout" -> { qonversionSandwich.logout() return result.success(null) @@ -133,8 +130,6 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware { "setCustomUserProperty" -> setCustomUserProperty(args, result) "addAttributionData" -> addAttributionData(args, result) "checkTrialIntroEligibility" -> checkTrialIntroEligibility(args, result) - "attachUserToExperiment" -> attachUserToExperiment(args, result) - "detachUserFromExperiment" -> detachUserFromExperiment(args, result) "storeSdkInfo" -> storeSdkInfo(args, result) "identify" -> identify(args["userId"] as? String, result) "automationsSetNotificationsToken" -> automationsPlugin.setNotificationsToken(args["notificationsToken"] as? String, result) @@ -222,10 +217,6 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware { qonversionSandwich.offerings(result.toJsonResultListener()) } - private fun remoteConfig(result: Result) { - qonversionSandwich.remoteConfig(result.toJsonResultListener()) - } - private fun products(result: Result) { qonversionSandwich.products(result.toResultListener()) } @@ -272,21 +263,6 @@ class QonversionPlugin : MethodCallHandler, FlutterPlugin, ActivityAware { qonversionSandwich.checkTrialIntroEligibility(ids, result.toJsonResultListener()) } - private fun attachUserToExperiment(args: Map, result: Result) { - @Suppress("UNCHECKED_CAST") - val experimentId = args["experimentId"] as? String ?: return result.noNecessaryDataError() - val groupId = args["groupId"] as? String ?: return result.noNecessaryDataError() - - qonversionSandwich.attachUserToExperiment(experimentId, groupId, result.toJsonResultListener()) - } - - private fun detachUserFromExperiment(args: Map, result: Result) { - @Suppress("UNCHECKED_CAST") - val experimentId = args["experimentId"] as? String ?: return result.noNecessaryDataError() - - qonversionSandwich.detachUserFromExperiment(experimentId, result.toJsonResultListener()) - } - private fun userInfo(result: Result) { qonversionSandwich.userInfo(result.toResultListener()) } diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 034e525b..46e0be75 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -10,12 +10,6 @@ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 4CB27CA1276762D900DE51FD /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4CB27CA0276762D900DE51FD /* GoogleService-Info.plist */; }; - 70A6004A2A4DE85F00B4378E /* QonversionPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 70A600432A4DE85F00B4378E /* QonversionPlugin.m */; }; - 70A6004B2A4DE85F00B4378E /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70A600442A4DE85F00B4378E /* Extensions.swift */; }; - 70A6004C2A4DE85F00B4378E /* SwiftQonversionPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70A600462A4DE85F00B4378E /* SwiftQonversionPlugin.swift */; }; - 70A6004D2A4DE85F00B4378E /* BaseListenerWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70A600472A4DE85F00B4378E /* BaseListenerWrapper.swift */; }; - 70A6004E2A4DE85F00B4378E /* BaseEventStreamHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70A600482A4DE85F00B4378E /* BaseEventStreamHandler.swift */; }; - 70A6004F2A4DE85F00B4378E /* FlutterError+Custom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70A600492A4DE85F00B4378E /* FlutterError+Custom.swift */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 8876821AD52624FFC742CB13 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B61BD248B3C1CEFD8465871F /* Pods_Runner.framework */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -43,13 +37,6 @@ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 4CB27CA0276762D900DE51FD /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 6A76C3422936312F0071A79A /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; - 70A600432A4DE85F00B4378E /* QonversionPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QonversionPlugin.m; sourceTree = ""; }; - 70A600442A4DE85F00B4378E /* Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; - 70A600452A4DE85F00B4378E /* QonversionPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QonversionPlugin.h; sourceTree = ""; }; - 70A600462A4DE85F00B4378E /* SwiftQonversionPlugin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftQonversionPlugin.swift; sourceTree = ""; }; - 70A600472A4DE85F00B4378E /* BaseListenerWrapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseListenerWrapper.swift; sourceTree = ""; }; - 70A600482A4DE85F00B4378E /* BaseEventStreamHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseEventStreamHandler.swift; sourceTree = ""; }; - 70A600492A4DE85F00B4378E /* FlutterError+Custom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FlutterError+Custom.swift"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -85,21 +72,6 @@ name = Frameworks; sourceTree = ""; }; - 70A600422A4DE85F00B4378E /* Classes */ = { - isa = PBXGroup; - children = ( - 70A600432A4DE85F00B4378E /* QonversionPlugin.m */, - 70A600442A4DE85F00B4378E /* Extensions.swift */, - 70A600452A4DE85F00B4378E /* QonversionPlugin.h */, - 70A600462A4DE85F00B4378E /* SwiftQonversionPlugin.swift */, - 70A600472A4DE85F00B4378E /* BaseListenerWrapper.swift */, - 70A600482A4DE85F00B4378E /* BaseEventStreamHandler.swift */, - 70A600492A4DE85F00B4378E /* FlutterError+Custom.swift */, - ); - name = Classes; - path = ../../macos/Classes; - sourceTree = ""; - }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -114,7 +86,6 @@ 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( - 70A600422A4DE85F00B4378E /* Classes */, 4CB27CA0276762D900DE51FD /* GoogleService-Info.plist */, 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, @@ -122,9 +93,7 @@ BA1CD22BB5800E684769C062 /* Pods */, 59AF16F90FB67258EC083A19 /* Frameworks */, ); - indentWidth = 2; sourceTree = ""; - tabWidth = 2; }; 97C146EF1CF9000F007C117D /* Products */ = { isa = PBXGroup; @@ -343,14 +312,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 70A6004D2A4DE85F00B4378E /* BaseListenerWrapper.swift in Sources */, 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, - 70A6004F2A4DE85F00B4378E /* FlutterError+Custom.swift in Sources */, - 70A6004A2A4DE85F00B4378E /* QonversionPlugin.m in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, - 70A6004B2A4DE85F00B4378E /* Extensions.swift in Sources */, - 70A6004C2A4DE85F00B4378E /* SwiftQonversionPlugin.swift in Sources */, - 70A6004E2A4DE85F00B4378E /* BaseEventStreamHandler.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/ios/Classes/SwiftQonversionPlugin.swift b/ios/Classes/SwiftQonversionPlugin.swift index 3c087218..8367c670 100644 --- a/ios/Classes/SwiftQonversionPlugin.swift +++ b/ios/Classes/SwiftQonversionPlugin.swift @@ -57,9 +57,6 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin { case "checkEntitlements": return checkEntitlements(result) - - case "remoteConfig": - return remoteConfig(result) case "restore": return restore(result) @@ -130,12 +127,6 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin { case "identify": return identify(args["userId"] as? String, result) - case "attachUserToExperiment": - return attachUserToExperiment(args, result) - - case "detachUserFromExperiment": - return detachUserFromExperiment(args, result) - case "automationsSetNotificationsToken": automationsPlugin?.setNotificationsToken(args["notificationsToken"] as? String, result) return @@ -222,10 +213,6 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin { private func checkEntitlements(_ result: @escaping FlutterResult) { qonversionSandwich?.checkEntitlements(getDefaultCompletion(result)) } - - private func remoteConfig(_ result: @escaping FlutterResult) { - qonversionSandwich?.remoteConfig(getJsonCompletion(result)) - } private func restore(_ result: @escaping FlutterResult) { qonversionSandwich?.restore(getDefaultCompletion(result)) @@ -268,23 +255,6 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin { qonversionSandwich?.checkTrialIntroEligibility(ids, completion: getJsonCompletion(result)) } - - private func attachUserToExperiment(_ args: [String: Any], _ result: @escaping FlutterResult) { - guard let experimentId = args["experimentId"] as? String, - let groupId = args["groupId"] as? String else { - return result(FlutterError.noNecessaryData) - } - - qonversionSandwich?.attachUserToExperiment(with: experimentId, groupId: groupId, completion: getJsonCompletion(result)) - } - - private func detachUserFromExperiment(_ args: [String: Any], _ result: @escaping FlutterResult) { - guard let experimentId = args["experimentId"] as? String else { - return result(FlutterError.noNecessaryData) - } - - qonversionSandwich?.detachUserFromExperiment(with: experimentId, completion: getJsonCompletion(result)) - } private func storeSdkInfo(_ args: [String: Any], _ result: @escaping FlutterResult) { guard let version = args["version"] as? String, diff --git a/ios/qonversion_flutter.podspec b/ios/qonversion_flutter.podspec index f9eb8977..f8f70453 100644 --- a/ios/qonversion_flutter.podspec +++ b/ios/qonversion_flutter.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |s| s.source_files = 'Classes/**/*' s.dependency 'Flutter' s.platform = :ios, '9.0' - s.dependency "QonversionSandwich", "2.0.0" + s.dependency "QonversionSandwich", "1.5.2" # 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' } diff --git a/lib/qonversion_flutter.dart b/lib/qonversion_flutter.dart index 570dd567..aec399b0 100644 --- a/lib/qonversion_flutter.dart +++ b/lib/qonversion_flutter.dart @@ -18,7 +18,6 @@ export 'src/dto/product_type.dart'; export 'src/dto/proration_mode.dart'; export 'src/dto/purchase_exception.dart'; export 'src/dto/qonversion_error.dart'; -export 'src/dto/remote_config.dart'; export 'src/dto/screen_presentation_config.dart'; export 'src/dto/screen_presentation_style.dart'; export 'src/dto/user.dart'; diff --git a/lib/src/dto/experiment.dart b/lib/src/dto/experiment.dart deleted file mode 100644 index 01d7b3b0..00000000 --- a/lib/src/dto/experiment.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; - -import 'experiment_group.dart'; - -part 'experiment.g.dart'; - -@JsonSerializable(createToJson: false) -class QExperiment { - /// Experiment's identifier. - @JsonKey(name: 'id') - final String id; - - /// Experiment's name. - @JsonKey(name: 'name') - final String name; - - /// Experiment's group the user has been assigned to. - @JsonKey(name: 'group') - final QExperimentGroup group; - - const QExperiment( - this.id, - this.name, - this.group, - ); - - factory QExperiment.fromJson(Map json) => - _$QExperimentFromJson(json); -} diff --git a/lib/src/dto/experiment.g.dart b/lib/src/dto/experiment.g.dart deleted file mode 100644 index 96c1551b..00000000 --- a/lib/src/dto/experiment.g.dart +++ /dev/null @@ -1,15 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'experiment.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -QExperiment _$QExperimentFromJson(Map json) { - return QExperiment( - json['id'] as String, - json['name'] as String, - QExperimentGroup.fromJson(json['group'] as Map), - ); -} diff --git a/lib/src/dto/experiment_group.dart b/lib/src/dto/experiment_group.dart deleted file mode 100644 index 3bb4ced9..00000000 --- a/lib/src/dto/experiment_group.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; - -import 'experiment_group_type.dart'; - -part 'experiment_group.g.dart'; - -@JsonSerializable(createToJson: false) -class QExperimentGroup { - /// Experiment group's identifier. - @JsonKey(name: 'id') - final String id; - - /// Experiment group's name. The same as you set in Qonversion. You can use it for analytical purposes. - @JsonKey(name: 'name') - final String name; - - /// Type of the experiment's group. Either control or treatment. - @JsonKey( - name: 'type', - unknownEnumValue: QExperimentGroupType.unknown, - ) - final QExperimentGroupType type; - - const QExperimentGroup( - this.id, - this.name, - this.type, - ); - - factory QExperimentGroup.fromJson(Map json) => - _$QExperimentGroupFromJson(json); -} diff --git a/lib/src/dto/experiment_group.g.dart b/lib/src/dto/experiment_group.g.dart deleted file mode 100644 index 2acc3408..00000000 --- a/lib/src/dto/experiment_group.g.dart +++ /dev/null @@ -1,48 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'experiment_group.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -QExperimentGroup _$QExperimentGroupFromJson(Map json) { - return QExperimentGroup( - json['id'] as String, - json['name'] as String, - _$enumDecode(_$QExperimentGroupTypeEnumMap, json['type'], - unknownValue: QExperimentGroupType.unknown), - ); -} - -K _$enumDecode( - Map enumValues, - Object? source, { - K? unknownValue, -}) { - if (source == null) { - throw ArgumentError( - 'A value must be provided. Supported values: ' - '${enumValues.values.join(', ')}', - ); - } - - return enumValues.entries.singleWhere( - (e) => e.value == source, - orElse: () { - if (unknownValue == null) { - throw ArgumentError( - '`$source` is not one of the supported values: ' - '${enumValues.values.join(', ')}', - ); - } - return MapEntry(unknownValue, enumValues.values.first); - }, - ).key; -} - -const _$QExperimentGroupTypeEnumMap = { - QExperimentGroupType.unknown: 'unknown', - QExperimentGroupType.treatment: 'treatment', - QExperimentGroupType.control: 'control', -}; diff --git a/lib/src/dto/experiment_group_type.dart b/lib/src/dto/experiment_group_type.dart deleted file mode 100644 index c1afcbf1..00000000 --- a/lib/src/dto/experiment_group_type.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; - -enum QExperimentGroupType { - /// Unknown group - @JsonValue('unknown') - unknown, - - /// Treatment group - @JsonValue('treatment') - treatment, - - /// Control group - @JsonValue('control') - control, -} diff --git a/lib/src/dto/remote_config.dart b/lib/src/dto/remote_config.dart deleted file mode 100644 index 79dec3c6..00000000 --- a/lib/src/dto/remote_config.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; - -import 'experiment.dart'; - -part 'remote_config.g.dart'; - -@JsonSerializable(createToJson: false) -class QRemoteConfig { - /// JSON payload you have configured using the Qonversion dashboard. - @JsonKey(name: 'payload') - final Map payload; - - /// Object with the experiment's information. - @JsonKey(name: 'experiment') - final QExperiment? experiment; - - const QRemoteConfig( - this.payload, - this.experiment, - ); - - factory QRemoteConfig.fromJson(Map json) => - _$QRemoteConfigFromJson(json); -} diff --git a/lib/src/dto/remote_config.g.dart b/lib/src/dto/remote_config.g.dart deleted file mode 100644 index eeb7a760..00000000 --- a/lib/src/dto/remote_config.g.dart +++ /dev/null @@ -1,16 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'remote_config.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -QRemoteConfig _$QRemoteConfigFromJson(Map json) { - return QRemoteConfig( - json['payload'] as Map, - json['experiment'] == null - ? null - : QExperiment.fromJson(json['experiment'] as Map), - ); -} diff --git a/lib/src/internal/constants.dart b/lib/src/internal/constants.dart index d5c28490..84217dc3 100644 --- a/lib/src/internal/constants.dart +++ b/lib/src/internal/constants.dart @@ -25,8 +25,6 @@ class Constants { static const kLifetime = 'lifetime'; static const kScreenId = 'screenId'; static const kConfigData = 'configData'; - static const kExperimentId = 'experimentId'; - static const kGroupId = 'groupId'; // MethodChannel methods names static const mInitialize = 'initialize'; @@ -53,9 +51,6 @@ class Constants { static const mIdentify = 'identify'; static const mLogout = 'logout'; static const mUserInfo = 'userInfo'; - static const mRemoteConfig = 'remoteConfig'; - static const mAttachUserToExperiment = 'attachUserToExperiment'; - static const mDetachUserFromExperiment = 'detachUserFromExperiment'; static const mCollectAppleSearchAdsAttribution = 'collectAppleSearchAdsAttribution'; static const mPresentCodeRedemptionSheet = 'presentCodeRedemptionSheet'; static const mSubscribeAutomations = 'automationsSubscribe'; diff --git a/lib/src/internal/mapper.dart b/lib/src/internal/mapper.dart index db19ed70..ebf91438 100644 --- a/lib/src/internal/mapper.dart +++ b/lib/src/internal/mapper.dart @@ -1,7 +1,5 @@ import 'dart:convert'; -import 'package:qonversion_flutter/qonversion_flutter.dart'; - import '../dto/qonversion_error.dart'; import '../dto/eligibility.dart'; import '../dto/offerings.dart'; @@ -52,14 +50,6 @@ class QMapper { return QUser.fromJson(userMap); } - static QRemoteConfig? remoteConfigFromJson(String? jsonString) { - if (jsonString == null) return null; - - final remoteConfigMap = Map.from(jsonDecode(jsonString)); - - return QRemoteConfig.fromJson(remoteConfigMap); - } - static Map eligibilityFromJson(String? jsonString) { if (jsonString == null) return {}; diff --git a/lib/src/internal/qonversion_internal.dart b/lib/src/internal/qonversion_internal.dart index ef9a53bc..71776cb3 100644 --- a/lib/src/internal/qonversion_internal.dart +++ b/lib/src/internal/qonversion_internal.dart @@ -11,7 +11,7 @@ import 'package:qonversion_flutter/src/internal/utils/string.dart'; import 'constants.dart'; class QonversionInternal implements Qonversion { - static const String _sdkVersion = "5.0.0"; + static const String _sdkVersion = "5.4.1"; final MethodChannel _channel = MethodChannel('qonversion_plugin'); @@ -210,36 +210,6 @@ class QonversionInternal implements Qonversion { return result; } - @override - Future remoteConfig() async { - final rawResult = await _channel.invokeMethod(Constants.mRemoteConfig); - - final result = QMapper.remoteConfigFromJson(rawResult); - if (result == null) { - throw new Exception("Remote config deserialization failed"); - } - return result; - } - - @override - Future attachUserToExperiment(String experimentId, String groupId) async { - final args = { - Constants.kExperimentId: experimentId, - Constants.kGroupId: groupId, - }; - await _channel.invokeMethod(Constants.mAttachUserToExperiment, args); - return; - } - - @override - Future detachUserFromExperiment(String experimentId) async { - final args = { - Constants.kExperimentId: experimentId, - }; - await _channel.invokeMethod(Constants.mDetachUserFromExperiment, args); - return; - } - @override Future attribution(Map data, QAttributionProvider provider) { final args = { diff --git a/lib/src/qonversion.dart b/lib/src/qonversion.dart index a349cece..c4a1498e 100644 --- a/lib/src/qonversion.dart +++ b/lib/src/qonversion.dart @@ -167,18 +167,6 @@ abstract class Qonversion { /// On iOS 14.0+ shows up a sheet for users to redeem AppStore offer codes. Future presentCodeRedemptionSheet(); - /// Returns Qonversion remote config object - /// Use this function to get the remote config with specific payload and experiment info. - Future remoteConfig(); - - /// This function should be used for the test purposes only. Do not forget to delete the usage of this function before the release. - /// Use this function to attach the user to the experiment. - Future attachUserToExperiment(String experimentId, String groupId); - - /// This function should be used for the test purposes only. Do not forget to delete the usage of this function before the release. - /// Use this function to detach the user from the experiment. - Future detachUserFromExperiment(String experimentId); - /// iOS only. Returns `null` if called on Android. /// /// Starts a promo purchase process with App Store [productId]. diff --git a/macos/Classes/SwiftQonversionPlugin.swift b/macos/Classes/SwiftQonversionPlugin.swift index cce6063a..6629f3ca 100644 --- a/macos/Classes/SwiftQonversionPlugin.swift +++ b/macos/Classes/SwiftQonversionPlugin.swift @@ -48,9 +48,6 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin { case "checkEntitlements": return checkEntitlements(result) - - case "remoteConfig": - return remoteConfig(result) case "restore": return restore(result) @@ -107,12 +104,6 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin { case "identify": return identify(args["userId"] as? String, result) - - case "attachUserToExperiment": - return attachUserToExperiment(args, result) - - case "detachUserFromExperiment": - return detachUserFromExperiment(args, result) default: return result(FlutterMethodNotImplemented) @@ -172,10 +163,6 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin { private func checkEntitlements(_ result: @escaping FlutterResult) { qonversionSandwich?.checkEntitlements(getDefaultCompletion(result)) } - - private func remoteConfig(_ result: @escaping FlutterResult) { - qonversionSandwich?.remoteConfig(getJsonCompletion(result)) - } private func restore(_ result: @escaping FlutterResult) { qonversionSandwich?.restore(getDefaultCompletion(result)) @@ -242,24 +229,7 @@ public class SwiftQonversionPlugin: NSObject, FlutterPlugin { qonversionSandwich?.attribution(providerKey: provider, value: data) result(nil) } - - private func attachUserToExperiment(_ args: [String: Any], _ result: @escaping FlutterResult) { - guard let experimentId = args["experimentId"] as? String, - let groupId = args["groupId"] as? String else { - return result(FlutterError.noNecessaryData) - } - - qonversionSandwich?.attachUserToExperiment(with: experimentId, groupId: groupId, completion: getJsonCompletion(result)) - } - - private func detachUserFromExperiment(_ args: [String: Any], _ result: @escaping FlutterResult) { - guard let experimentId = args["experimentId"] as? String else { - return result(FlutterError.noNecessaryData) - } - - qonversionSandwich?.detachUserFromExperiment(with: experimentId, completion: getJsonCompletion(result)) - } - + private func getDefaultCompletion(_ result: @escaping FlutterResult) -> BridgeCompletion { return { data, error in if let error = error { diff --git a/macos/qonversion_flutter.podspec b/macos/qonversion_flutter.podspec index 1d8d5bb7..8bf4607d 100644 --- a/macos/qonversion_flutter.podspec +++ b/macos/qonversion_flutter.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |s| s.source_files = 'Classes/**/*' s.dependency 'FlutterMacOS' s.platform = :osx, '10.12' - s.dependency "QonversionSandwich", "2.0.0" + s.dependency "QonversionSandwich", "1.5.2" s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } s.swift_version = '5.0' diff --git a/pubspec.lock b/pubspec.lock index 988d33a7..5fa33a5b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -91,7 +91,7 @@ packages: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "8.6.1" + version: "8.4.2" characters: dependency: transitive description: @@ -227,7 +227,7 @@ packages: name: io url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.0.3" js: dependency: transitive description: @@ -283,7 +283,7 @@ packages: name: mime url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.0.2" package_config: dependency: transitive description: @@ -435,7 +435,7 @@ packages: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.2.0" yaml: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 790857e1..19ea70bd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: qonversion_flutter description: Flutter plugin to implement in-app subscriptions and purchases. Validate user receipts and manage cross-platform access to paid content on your app. Android & iOS. -version: 5.0.0 +version: 5.4.1 homepage: 'https://qonversion.io' repository: 'https://github.com/qonversion/flutter-sdk'