Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 0.1.7

- **Android:** Migrated from jcenter to mavenCentral
- **Android:** Updated Kotlin to 1.6.10
- **Android:** Updated Gradle to 7.0.2
- **Android:** Updated Gradle Build Tools to 7.0.4

# 0.1.6

Remove TODO for onDetachedFromActivity method
Expand Down
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ group 'com.homexlabs.optimizely_dart'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.3.72'
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

rootProject.allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
8 changes: 4 additions & 4 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
2 changes: 1 addition & 1 deletion example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 0 additions & 4 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class _MyAppState extends State<MyApp> {
Future<void> getPriceFilterFlag() async {
String priceFilterFlag;
// Platform messages may fail, so we use a try/catch PlatformException.
var platform =
Theme.of(context).platform.toString().split('.')[1].toLowerCase();
try {
bool? featureEnabled = await optimizelyPlugin.isFeatureEnabled(
'price_filter',
Expand All @@ -69,8 +67,6 @@ class _MyAppState extends State<MyApp> {
Future<void> getPriceFilterMinPrice() async {
String minPriceVariable;
Map<String, dynamic> variables;
var platform =
Theme.of(context).platform.toString().split('.')[1].toLowerCase();
try {
variables = await optimizelyPlugin.getAllFeatureVariables(
'price_filter',
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: optimizely_dart
description: Flutter plugin for Optimizely native SDKs. Check feature flags and feature variables from your Optimizely project.
version: 0.1.6
version: 0.1.7
homepage: https://github.com/HomeXLabs/optimizely-dart
repository: https://github.com/HomeXLabs/optimizely-dart

Expand Down
32 changes: 4 additions & 28 deletions test/optimizely_dart_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,14 @@ void main() {
break;
case 'isFeatureEnabled':
var featureKey = methodCall.arguments['feature_key'];
var userId = methodCall.arguments['user_id'];
if (userId == '[email protected]' && featureKey == 'flutter') {
if (featureKey == 'flutter') {
return true;
}
return false;
case 'getAllFeatureVariables':
var featureKey = methodCall.arguments['feature_key'];
var userId = methodCall.arguments['user_id'];
var attributes = methodCall.arguments['attributes'];
if (featureKey == 'calculator' && userId == '[email protected]') {
switch (attributes['platform']) {
case 'ios':
return {'calc_type': 'scientific'};
case 'android':
return {'calc_type': 'basic'};
default:
return {};
}
if (featureKey == 'calculator') {
return {'calc_type': 'scientific'};
}
return {};
default:
Expand Down Expand Up @@ -60,28 +50,14 @@ void main() {
final optimizelyPlugin = OptimizelyPlugin();
final enabled = await optimizelyPlugin.isFeatureEnabled(
'flutter',
'[email protected]',
{'platform': 'android'},
);
expect(enabled, true);
});

test('getAllFeatureVariablesAndroid', () async {
test('getAllFeatureVariables', () async {
final optimizelyPlugin = OptimizelyPlugin();
var features = await optimizelyPlugin.getAllFeatureVariables(
'calculator',
'[email protected]',
{'platform': 'android'},
);
expect(features['calc_type'], 'basic');
});

test('getAllFeatureVariablesApple', () async {
final optimizelyPlugin = OptimizelyPlugin();
var features = await optimizelyPlugin.getAllFeatureVariables(
'calculator',
'[email protected]',
{'platform': 'ios'},
);
expect(features['calc_type'], 'scientific');
});
Expand Down