Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit ac3259d

Browse files
authored
chore: android migrate maven central (#9)
* chore: android migration + fix tests * .
1 parent d8cb393 commit ac3259d

File tree

10 files changed

+24
-45
lines changed

10 files changed

+24
-45
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 0.1.7
2+
3+
- **Android:** Migrated from jcenter to mavenCentral
4+
- **Android:** Updated Kotlin to 1.6.10
5+
- **Android:** Updated Gradle to 7.0.2
6+
- **Android:** Updated Gradle Build Tools to 7.0.4
7+
18
# 0.1.6
29

310
Remove TODO for onDetachedFromActivity method

android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ group 'com.homexlabs.optimizely_dart'
22
version '1.0-SNAPSHOT'
33

44
buildscript {
5-
ext.kotlin_version = '1.3.72'
5+
ext.kotlin_version = '1.6.10'
66
repositories {
77
google()
8-
jcenter()
8+
mavenCentral()
99
}
1010

1111
dependencies {
12-
classpath 'com.android.tools.build:gradle:3.5.0'
12+
classpath 'com.android.tools.build:gradle:7.0.4'
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1414
}
1515
}
1616

1717
rootProject.allprojects {
1818
repositories {
1919
google()
20-
jcenter()
20+
mavenCentral()
2121
}
2222
}
2323

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

example/android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.50'
2+
ext.kotlin_version = '1.6.10'
33
repositories {
44
google()
5-
jcenter()
5+
mavenCentral()
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.1.1'
9+
classpath 'com.android.tools.build:gradle:7.0.4'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}
1313

1414
allprojects {
1515
repositories {
1616
google()
17-
jcenter()
17+
mavenCentral()
1818
}
1919
}
2020

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
97C146E61CF9000F007C117D /* Project object */ = {
156156
isa = PBXProject;
157157
attributes = {
158-
LastUpgradeCheck = 1020;
158+
LastUpgradeCheck = 1300;
159159
ORGANIZATIONNAME = "";
160160
TargetAttributes = {
161161
97C146ED1CF9000F007C117D = {

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1020"
3+
LastUpgradeVersion = "1300"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

example/lib/main.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ class _MyAppState extends State<MyApp> {
4545
Future<void> getPriceFilterFlag() async {
4646
String priceFilterFlag;
4747
// Platform messages may fail, so we use a try/catch PlatformException.
48-
var platform =
49-
Theme.of(context).platform.toString().split('.')[1].toLowerCase();
5048
try {
5149
bool? featureEnabled = await optimizelyPlugin.isFeatureEnabled(
5250
'price_filter',
@@ -69,8 +67,6 @@ class _MyAppState extends State<MyApp> {
6967
Future<void> getPriceFilterMinPrice() async {
7068
String minPriceVariable;
7169
Map<String, dynamic> variables;
72-
var platform =
73-
Theme.of(context).platform.toString().split('.')[1].toLowerCase();
7470
try {
7571
variables = await optimizelyPlugin.getAllFeatureVariables(
7672
'price_filter',

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: optimizely_dart
22
description: Flutter plugin for Optimizely native SDKs. Check feature flags and feature variables from your Optimizely project.
3-
version: 0.1.6
3+
version: 0.1.7
44
homepage: https://github.com/HomeXLabs/optimizely-dart
55
repository: https://github.com/HomeXLabs/optimizely-dart
66

test/optimizely_dart_test.dart

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,14 @@ void main() {
1414
break;
1515
case 'isFeatureEnabled':
1616
var featureKey = methodCall.arguments['feature_key'];
17-
var userId = methodCall.arguments['user_id'];
18-
if (userId == 'user@pg.com' && featureKey == 'flutter') {
17+
if (featureKey == 'flutter') {
1918
return true;
2019
}
2120
return false;
2221
case 'getAllFeatureVariables':
2322
var featureKey = methodCall.arguments['feature_key'];
24-
var userId = methodCall.arguments['user_id'];
25-
var attributes = methodCall.arguments['attributes'];
26-
if (featureKey == 'calculator' && userId == 'user@pg.com') {
27-
switch (attributes['platform']) {
28-
case 'ios':
29-
return {'calc_type': 'scientific'};
30-
case 'android':
31-
return {'calc_type': 'basic'};
32-
default:
33-
return {};
34-
}
23+
if (featureKey == 'calculator') {
24+
return {'calc_type': 'scientific'};
3525
}
3626
return {};
3727
default:
@@ -60,28 +50,14 @@ void main() {
6050
final optimizelyPlugin = OptimizelyPlugin();
6151
final enabled = await optimizelyPlugin.isFeatureEnabled(
6252
'flutter',
63-
'user@pg.com',
64-
{'platform': 'android'},
6553
);
6654
expect(enabled, true);
6755
});
6856

69-
test('getAllFeatureVariablesAndroid', () async {
57+
test('getAllFeatureVariables', () async {
7058
final optimizelyPlugin = OptimizelyPlugin();
7159
var features = await optimizelyPlugin.getAllFeatureVariables(
7260
'calculator',
73-
'user@pg.com',
74-
{'platform': 'android'},
75-
);
76-
expect(features['calc_type'], 'basic');
77-
});
78-
79-
test('getAllFeatureVariablesApple', () async {
80-
final optimizelyPlugin = OptimizelyPlugin();
81-
var features = await optimizelyPlugin.getAllFeatureVariables(
82-
'calculator',
83-
'user@pg.com',
84-
{'platform': 'ios'},
8561
);
8662
expect(features['calc_type'], 'scientific');
8763
});

0 commit comments

Comments
 (0)