Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ jobs:
- name: Run Android test
run: cd splitio/example/android/; ./gradlew :splitio:testReleaseUnitTest;

build-ios:
name: Build iOS
runs-on: [ macos-latest ]

steps:
- uses: actions/[email protected]
- uses: subosito/[email protected]
with:
channel: 'stable'
- name: Run Build iOS
run: cd splitio/example/ios; flutter build ios --no-codesign;

test-ios:
name: Test iOS
runs-on: [ macos-latest ]
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ jobs:
run: cd splitio/; flutter pub get
- name: Run flutter test
run: cd splitio/; flutter test
- name: Run flutter splitio_android test
run: cd splitio_android/; flutter test
- name: Run flutter splitio_ios test
run: cd splitio_ios/; flutter test
12 changes: 12 additions & 0 deletions splitio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 0.1.7 (Nov 9, 2023)
* Added support for Flag Sets, which enables grouping feature flags and interacting with the group rather than individually (more details in our documentation):
* Added new variations of the get treatment methods to support evaluating flags in given flag set/s.
* getTreatmentsByFlagSet and getTreatmentsByFlagSets
* getTreatmentWithConfigByFlagSets and getTreatmentsWithConfigByFlagSets
* Added a new optional Split Filter configuration option. This allows the SDK and Split services to only synchronize the flags in the specified flag sets, avoiding unused or unwanted flags from being synced on the SDK instance, bringing all the benefits from a reduced payload.
* Added `defaultTreatment` property to the `SplitView` object returned by the `split` and `splits` methods of the SDK manager.
* Updated iOS SDK to `2.23.0`
* Updated Android SDK to `3.4.0`

# 0.1.7-rc.1 (Nov 9, 2023)

# 0.1.6 (Aug 15, 2023)

* Added `readyTimeout` configuration option. If the SDK is not ready after the amount of time (in seconds) specified by this option, the `whenTimeout` future of the client will be completed. Defaults to 10 seconds. A negative value means no timeout.
Expand Down
8 changes: 4 additions & 4 deletions splitio/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -150,28 +150,28 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.6-rc.1"
version: "0.1.6"
splitio_android:
dependency: transitive
description:
path: "../../splitio_android"
relative: true
source: path
version: "0.1.6-rc.1"
version: "0.1.6"
splitio_ios:
dependency: transitive
description:
path: "../../splitio_ios"
relative: true
source: path
version: "0.1.6-rc.1"
version: "0.1.6"
splitio_platform_interface:
dependency: transitive
description:
path: "../../splitio_platform_interface"
relative: true
source: path
version: "1.3.0-rc.1"
version: "1.3.0"
stack_trace:
dependency: transitive
description:
Expand Down
76 changes: 76 additions & 0 deletions splitio/lib/split_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,46 @@ abstract class SplitClient {
Future<Map<String, String>> getTreatments(List<String> featureFlagNames,
[Map<String, dynamic> attributes = const {}]);

/// Convenience method to perform multiple evaluations by flag set. Returns a [Map] in
/// which the keys are feature flag names and the values are treatments.
///
/// A flag set needs to be specified in [flagSet].
///
/// Optionally, a [Map] can be specified with the [attributes] parameter to
/// take into account when evaluating.
Future<Map<String, String>> getTreatmentsByFlagSet(String flagSet,
[Map<String, dynamic> attributes = const {}]);

/// Convenience method to perform multiple evaluations by flag sets. Returns a [Map] in
/// which the keys are feature flag names and the values are treatments.
///
/// A list of flag sets needs to be specified in [flagSets].
///
/// Optionally, a [Map] can be specified with the [attributes] parameter to
/// take into account when evaluating.
Future<Map<String, String>> getTreatmentsByFlagSets(List<String> flagSets,
[Map<String, dynamic> attributes = const {}]);

/// Convenience method to perform multiple evaluations by flag set. Returns a [Map] in
/// which the keys are feature flag names and the values are [SplitResult] objects.
///
/// A flag set needs to be specified in [flagSet].
///
/// Optionally, a [Map] can be specified with the [attributes] parameter to
/// take into account when evaluating.
Future<Map<String, SplitResult>> getTreatmentsWithConfigByFlagSet(String flagSet,
[Map<String, dynamic> attributes = const {}]);

/// Convenience method to perform multiple evaluations by flag sets. Returns a [Map] in
/// which the keys are feature flag names and the values are [SplitResult] objects.
///
/// A list of flag sets needs to be specified in [flagSets].
///
/// Optionally, a [Map] can be specified with the [attributes] parameter to
/// take into account when evaluating.
Future<Map<String, SplitResult>> getTreatmentsWithConfigByFlagSets(List<String> flagSets,
[Map<String, dynamic> attributes = const {}]);

/// Convenience method to perform multiple evaluations. Returns a [Map] in
/// which the keys are feature flag names and the values are [SplitResult] objects.
///
Expand Down Expand Up @@ -185,6 +225,42 @@ class DefaultSplitClient implements SplitClient {
attributes: attributes);
}

@override
Future<Map<String, String>> getTreatmentsByFlagSet(String flagSet, [Map<String, dynamic> attributes = const {}]) {
return _platform.getTreatmentsByFlagSet(
matchingKey: _matchingKey,
bucketingKey: _bucketingKey,
flagSet: flagSet,
attributes: attributes);
}

@override
Future<Map<String, String>> getTreatmentsByFlagSets(List<String> flagSets, [Map<String, dynamic> attributes = const {}]) {
return _platform.getTreatmentsByFlagSets(
matchingKey: _matchingKey,
bucketingKey: _bucketingKey,
flagSets: flagSets,
attributes: attributes);
}

@override
Future<Map<String, SplitResult>> getTreatmentsWithConfigByFlagSet(String flagSet, [Map<String, dynamic> attributes = const {}]) {
return _platform.getTreatmentsWithConfigByFlagSet(
matchingKey: _matchingKey,
bucketingKey: _bucketingKey,
flagSet: flagSet,
attributes: attributes);
}

@override
Future<Map<String, SplitResult>> getTreatmentsWithConfigByFlagSets(List<String> flagSets, [Map<String, dynamic> attributes = const {}]) {
return _platform.getTreatmentsWithConfigByFlagSets(
matchingKey: _matchingKey,
bucketingKey: _bucketingKey,
flagSets: flagSets,
attributes: attributes);
}

@override
Future<bool> track(String eventType,
{String? trafficType,
Expand Down
8 changes: 4 additions & 4 deletions splitio/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: splitio
description: Official plugin for split.io, the platform for controlled rollouts, which serves features to your users via feature flags to manage your complete customer experience.
version: 0.1.6
version: 0.1.7
homepage: https://split.io/
repository: https://github.com/splitio/flutter-sdk-plugin/tree/main/splitio/

Expand All @@ -19,9 +19,9 @@ flutter:
dependencies:
flutter:
sdk: flutter
splitio_android: ^0.1.6
splitio_ios: ^0.1.6
splitio_platform_interface: ^1.3.0
splitio_android: ^0.1.7
splitio_ios: ^0.1.7
splitio_platform_interface: ^1.4.0

dev_dependencies:
flutter_test:
Expand Down
112 changes: 112 additions & 0 deletions splitio/test/splitio_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,118 @@ void main() {
'attributes': {'attr1': true}
});
});

test('getTreatmentsByFlagSet without attributes', () async {
SplitClient client = _getClient();

client.getTreatmentsByFlagSet('set_1');

expect(_platform.methodName, 'getTreatmentsByFlagSet');
expect(_platform.methodArguments, {
'flagSet': 'set_1',
'matchingKey': 'matching-key',
'bucketingKey': 'bucketing-key',
'attributes': {}
});
});

test('getTreatmentsByFlagSet with attributes', () async {
SplitClient client = _getClient();

client.getTreatmentsByFlagSet('set_1', {'attr1': true});

expect(_platform.methodName, 'getTreatmentsByFlagSet');
expect(_platform.methodArguments, {
'flagSet': 'set_1',
'matchingKey': 'matching-key',
'bucketingKey': 'bucketing-key',
'attributes': {'attr1': true}
});
});

test('getTreatmentsByFlagSets without attributes', () async {
SplitClient client = _getClient();

client.getTreatmentsByFlagSets(['set_1', 'set_2']);

expect(_platform.methodName, 'getTreatmentsByFlagSets');
expect(_platform.methodArguments, {
'flagSets': ['set_1', 'set_2'],
'matchingKey': 'matching-key',
'bucketingKey': 'bucketing-key',
'attributes': {}
});
});

test('getTreatmentsByFlagSets with attributes', () async {
SplitClient client = _getClient();

client.getTreatmentsByFlagSets(['set_1', 'set_2'], {'attr1': true});

expect(_platform.methodName, 'getTreatmentsByFlagSets');
expect(_platform.methodArguments, {
'flagSets': ['set_1', 'set_2'],
'matchingKey': 'matching-key',
'bucketingKey': 'bucketing-key',
'attributes': {'attr1': true}
});
});

test('getTreatmentsWithConfigByFlagSet without attributes', () async {
SplitClient client = _getClient();

client.getTreatmentsWithConfigByFlagSet('set_1');

expect(_platform.methodName, 'getTreatmentsWithConfigByFlagSet');
expect(_platform.methodArguments, {
'flagSet': 'set_1',
'matchingKey': 'matching-key',
'bucketingKey': 'bucketing-key',
'attributes': {}
});
});

test('getTreatmentsWithConfigByFlagSet with attributes', () async {
SplitClient client = _getClient();

client.getTreatmentsWithConfigByFlagSet('set_1', {'attr1': true});

expect(_platform.methodName, 'getTreatmentsWithConfigByFlagSet');
expect(_platform.methodArguments, {
'flagSet': 'set_1',
'matchingKey': 'matching-key',
'bucketingKey': 'bucketing-key',
'attributes': {'attr1': true}
});
});

test('getTreatmentsWithConfigByFlagSets without attributes', () async {
SplitClient client = _getClient();

client.getTreatmentsWithConfigByFlagSets(['set_1', 'set_2']);

expect(_platform.methodName, 'getTreatmentsWithConfigByFlagSets');
expect(_platform.methodArguments, {
'flagSets': ['set_1', 'set_2'],
'matchingKey': 'matching-key',
'bucketingKey': 'bucketing-key',
'attributes': {}
});
});

test('getTreatmentsWithConfigByFlagSets with attributes', () async {
SplitClient client = _getClient();

client.getTreatmentsWithConfigByFlagSets(['set_1', 'set_2'], {'attr1': true});

expect(_platform.methodName, 'getTreatmentsWithConfigByFlagSets');
expect(_platform.methodArguments, {
'flagSets': ['set_1', 'set_2'],
'matchingKey': 'matching-key',
'bucketingKey': 'bucketing-key',
'attributes': {'attr1': true}
});
});
});

group('track', () {
Expand Down
72 changes: 72 additions & 0 deletions splitio/test/splitio_platform_stub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,78 @@ class SplitioPlatformStub
return Future.value({});
}

@override
Future<Map<String, String>> getTreatmentsByFlagSet(
{required String matchingKey,
required String? bucketingKey,
required String flagSet,
Map<String, dynamic> attributes = const {}}) {
methodName = 'getTreatmentsByFlagSet';

methodArguments = {
'matchingKey': matchingKey,
'bucketingKey': bucketingKey,
'flagSet': flagSet,
'attributes': attributes,
};

return Future.value({});
}

@override
Future<Map<String, String>> getTreatmentsByFlagSets(
{required String matchingKey,
required String? bucketingKey,
required List<String> flagSets,
Map<String, dynamic> attributes = const {}}) {
methodName = 'getTreatmentsByFlagSets';

methodArguments = {
'matchingKey': matchingKey,
'bucketingKey': bucketingKey,
'flagSets': flagSets,
'attributes': attributes,
};

return Future.value({});
}

@override
Future<Map<String, SplitResult>> getTreatmentsWithConfigByFlagSet(
{required String matchingKey,
required String? bucketingKey,
required String flagSet,
Map<String, dynamic> attributes = const {}}) {
methodName = 'getTreatmentsWithConfigByFlagSet';

methodArguments = {
'matchingKey': matchingKey,
'bucketingKey': bucketingKey,
'flagSet': flagSet,
'attributes': attributes,
};

return Future.value({});
}

@override
Future<Map<String, SplitResult>> getTreatmentsWithConfigByFlagSets(
{required String matchingKey,
required String? bucketingKey,
required List<String> flagSets,
Map<String, dynamic> attributes = const {}}) {
methodName = 'getTreatmentsWithConfigByFlagSets';

methodArguments = {
'matchingKey': matchingKey,
'bucketingKey': bucketingKey,
'flagSets': flagSets,
'attributes': attributes,
};

return Future.value({});
}

@override
Stream<Impression> impressionsStream() {
methodName = 'impressionsStream';
Expand Down
6 changes: 6 additions & 0 deletions splitio_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.1.7 (Nov 9, 2023)

* Updated Android SDK to `3.4.0`

# 0.1.7-rc.1 (Nov 9, 2023)

# 0.1.6 (Aug 15, 2023)

* Added `readyTimeout` configuration option.
Expand Down
Loading