diff --git a/.gitignore b/.gitignore
index b55874b..5bd8ac3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,9 +3,8 @@
.packages
.pub/
-.idea/*
-.iml
build/
+.idea/
android/.idea/
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..c83a369
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml
new file mode 100644
index 0000000..4d50be1
--- /dev/null
+++ b/.idea/libraries/Dart_SDK.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml
new file mode 100644
index 0000000..53449da
--- /dev/null
+++ b/.idea/libraries/Flutter_Plugins.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..595321e
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/runConfigurations/example_lib_main_dart.xml b/.idea/runConfigurations/example_lib_main_dart.xml
new file mode 100644
index 0000000..5fd9159
--- /dev/null
+++ b/.idea/runConfigurations/example_lib_main_dart.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..be0ea6d
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1620111596787
+
+
+ 1620111596787
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index f839b63..c0e320a 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,8 @@
# flutter_split
-An unofficial Flutter plugin for [Split.io](https://www.split.io) Feature Flags, Dynamic Configuration, Experimentation + Continuous Delivery
+An unofficial Flutter plugin for Split.io Feature Flags, Experimentation + Continuous Delivery
# Useful Links to get started
1. [Split Quick Start Guide](https://help.split.io/hc/en-us/categories/360001538132-Getting-Started)
2. [Split Android SDK](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
3. [Split iOS SDK](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
+4. Test write
diff --git a/android/build.gradle b/android/build.gradle
index f9a194d..38c96f8 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -33,5 +33,5 @@ android {
}
dependencies{
- implementation 'io.split.client:android-client:2.7.0'
-}
\ No newline at end of file
+ implementation 'io.split.client:android-client:2.7.3'
+}
diff --git a/android/src/main/java/com/imumz/flutter_split/FlutterSplitPlugin.java b/android/src/main/java/com/imumz/flutter_split/FlutterSplitPlugin.java
index d9e14f2..dbac19c 100644
--- a/android/src/main/java/com/imumz/flutter_split/FlutterSplitPlugin.java
+++ b/android/src/main/java/com/imumz/flutter_split/FlutterSplitPlugin.java
@@ -11,6 +11,8 @@
import java.util.Map;
import java.util.concurrent.TimeoutException;
+import android.util.Log;
+
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
@@ -23,9 +25,11 @@
import io.split.android.client.SplitFactoryBuilder;
import io.split.android.client.SplitResult;
import io.split.android.client.api.Key;
+import io.split.android.client.dtos.Split;
import io.split.android.client.events.SplitEvent;
import io.split.android.client.events.SplitEventTask;
+
/** FlutterSplitPlugin */
public class FlutterSplitPlugin implements FlutterPlugin, MethodCallHandler {
@@ -36,13 +40,14 @@ public class FlutterSplitPlugin implements FlutterPlugin, MethodCallHandler {
private String apikey;
private String userId;
-
//Split
private SplitClient client;
// error codes
private static String SDK_NOT_INITIALIZED = "SNI001";
+ private static boolean isSDKReady;
+
@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
@@ -51,10 +56,14 @@ public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBindin
channel.setMethodCallHandler(this);
}
-
@Override
- public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
+ public void onMethodCall(@NonNull MethodCall call, final @NonNull Result result) {
if(call.method.equals("initializeSdk")){
+
+
+ Log.i("split_client_init_1", "split_init");
+
+ isSDKReady = false;
this.apikey = call.argument("appKey");
SplitClientConfig config = SplitClientConfig.builder().build();
@@ -64,73 +73,96 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
// Create factory
SplitFactory splitFactory = null;
try {
- System.out.println("INIT SPLIT SDK ");
splitFactory = SplitFactoryBuilder.build(this.apikey, k, config, this.appContext);
- this.client = splitFactory.client();
- System.out.println("SPLITFACTORYRESULT "+client.isReady());
- result.success(true);
+ Log.i("split_client_init_2", "split_init_2");
} catch (IOException e) {
e.printStackTrace();
- result.error(SDK_NOT_INITIALIZED,"Sdk is not initialized","");
} catch (InterruptedException e) {
e.printStackTrace();
- result.error(SDK_NOT_INITIALIZED,"Sdk is not initialized","");
} catch (TimeoutException e) {
e.printStackTrace();
- result.error(SDK_NOT_INITIALIZED,"Sdk is not initialized","");
} catch (URISyntaxException e) {
e.printStackTrace();
- result.error(SDK_NOT_INITIALIZED,"Sdk is not initialized","");
}
+
// Get Split Client instance
+ Log.i("split_client_init_3", "split_init_3");
+ this.client = splitFactory.client();
-
- this.client.on(SplitEvent.SDK_READY,new SplitEventTask(){
+ this.client.on( SplitEvent.SDK_READY,new SplitEventTask() {
@Override
public void onPostExecution(SplitClient client) {
- System.out.println("FLUTTERSPLIT SDK_READY "+client.isReady());
+ super.onPostExecution(client);
+ isSDKReady = true;
+ Log.i("split_sdk_ready1", "split_sdk_ready1");
+ // result.success(true);
}
- });
-
- this.client.on(SplitEvent.SDK_READY_FROM_CACHE,new SplitEventTask(){
@Override
- public void onPostExecution(SplitClient client) {
- System.out.println("FLUTTERSPLIT SDK_READY_FROM_CACHE "+client.isReady());
+ public void onPostExecutionView(SplitClient client) {
+ super.onPostExecutionView(client);
+ // isSDKReady = true;
+
+ Log.i("split_sdk_ready2", "split_sdk_ready2");
+ System.out.println("split_sdk_ready2");
+ // result.success(true);
}
-
});
- this.client.on(SplitEvent.SDK_READY_TIMED_OUT,new SplitEventTask(){
- @Override
- public void onPostExecution(SplitClient client) {
- System.out.println("FLUTTERSPLIT SDK_READY_TIMED_OUT "+client.isReady());
- }
- });
- this.client.on(SplitEvent.SDK_UPDATE,new SplitEventTask(){
- @Override
- public void onPostExecution(SplitClient client) {
- System.out.println("FLUTTERSPLIT SDK_UPDATE");
- }
-
- });
-
- result.success(null);
-
+ // When definitions were loaded from cache
+ this.client.on(SplitEvent.SDK_READY_FROM_CACHE, new SplitEventTask() {
+ @Override
+ public void onPostExecution(SplitClient client) {
+ //Background Code in Here
+ // super.onPostExecution(client);
+ isSDKReady = true;
+ Log.i("split_sdk_ready1", "split_sdk_ready_from_cache " + client.isReady());
+ }
+ @Override
+ public void onPostExecutionView(SplitClient client) {
+ //UI Code in Here
+ }
+ });
+ // When the SDK couldn't fetch definitions befor *config.ready* time
+ this.client.on(SplitEvent.SDK_READY_TIMED_OUT, new SplitEventTask() {
+ @Override
+ public void onPostExecution(SplitClient client) {
+ //Background Code in Here
+ Log.i("split_sdk_ready1", "split_sdk_ready_timed_out");
+ }
+ @Override
+ public void onPostExecutionView(SplitClient client) {
+ //UI Code in Here
+ }
+ });
+
+ } else if(call.method.equals("trackEvent")){
+ String eventType = call.argument("eventName");
+ HashMap map = new HashMap();
+ if(this.client!=null){
+ boolean res = client.track(eventType,map);
+ if(res){
+ result.success(true);
+ }else{
+
+ }
+ }else{
+ result.error(SDK_NOT_INITIALIZED,"Sdk is not initialized","");
+ }
}else if(call.method.equals("getTreatment")){
String key = call.argument("key");
HashMap attr = call.argument("attributes");
- if(this.client.isReady()){
- String treatment = client.getTreatment(key,attr);
- result.success(treatment);
+ if(this.client!=null){
+ String treatment = client.getTreatment(key,attr);
+ result.success(treatment);
}else{
result.error(SDK_NOT_INITIALIZED,"Sdk is not initialized","");
}
}else if(call.method.equals("getTreatmentWithConfig")){
String key = call.argument("key");
HashMap attr = call.argument("attributes");
- if(this.client.isReady()){
+ if(this.client!=null){
SplitResult treatment = client.getTreatmentWithConfig(key,attr);
Map map = new HashMap<>();
map.put("config",treatment.config());
@@ -142,7 +174,7 @@ public void onPostExecution(SplitClient client) {
}else if(call.method.equals("getTreatments")){
List keys = call.argument("keys");
HashMap attr = call.argument("attributes");
- if(this.client.isReady()){
+ if(this.client!=null){
Map treatment = client.getTreatments(keys,attr);
result.success(treatment);
}else{
@@ -151,7 +183,7 @@ public void onPostExecution(SplitClient client) {
}else if(call.method.equals("getTreatmentsWithConfig")){
List keys = call.argument("keys");
HashMap attr = call.argument("attributes");
- if(this.client.isReady()){
+ if(this.client!=null){
Map treatment = client.getTreatmentsWithConfig(keys,attr);
Map> finalResult = new HashMap<>();
for (Map.Entry entry : treatment.entrySet()){
@@ -165,22 +197,12 @@ public void onPostExecution(SplitClient client) {
result.error(SDK_NOT_INITIALIZED,"Sdk is not initialized","");
}
}else if(call.method.equals("dispose")){
- if(this.client.isReady()){
+ if(this.client!=null){
this.client.destroy();
result.success(true);
}else{
result.error(SDK_NOT_INITIALIZED,"Sdk is not initialized","");
}
- }else if(call.method.equals("trackEvent")){
- if(this.client.isReady()){
- String trafficType = call.argument("trafficType");
- String eventType = call.argument("eventType");
- HashMap attr = call.argument("attributes");
- boolean trackResult = this.client.track(trafficType,eventType,attr);
- result.success(trackResult);
- }else{
- result.error(SDK_NOT_INITIALIZED,"Sdk is not initialized","");
- }
}
else {
result.notImplemented();
@@ -191,4 +213,4 @@ public void onPostExecution(SplitClient client) {
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
channel.setMethodCallHandler(null);
}
-}
\ No newline at end of file
+}
diff --git a/example/android/gradle.properties b/example/android/gradle.properties
index 4167249..a673820 100644
--- a/example/android/gradle.properties
+++ b/example/android/gradle.properties
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
-android.enableR8=true
\ No newline at end of file
+android.enableR8=true
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
deleted file mode 100644
index 394affb..0000000
--- a/example/ios/Podfile.lock
+++ /dev/null
@@ -1,29 +0,0 @@
-PODS:
- - Flutter (1.0.0)
- - flutter_split (0.0.1):
- - Flutter
- - Split (~> 2.11.0)
- - Split (2.11.1)
-
-DEPENDENCIES:
- - Flutter (from `Flutter`)
- - flutter_split (from `.symlinks/plugins/flutter_split/ios`)
-
-SPEC REPOS:
- trunk:
- - Split
-
-EXTERNAL SOURCES:
- Flutter:
- :path: Flutter
- flutter_split:
- :path: ".symlinks/plugins/flutter_split/ios"
-
-SPEC CHECKSUMS:
- Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
- flutter_split: f2bbb1b1916c189750fc4d4b0df2ac904d245556
- Split: 02e9be61e4859c39643b5d4ae350b50a092f2990
-
-PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
-
-COCOAPODS: 1.10.1
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 50dc43c..b942bc5 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -8,7 +8,6 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
- 3628A1931C4B982DA8083D8A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFACDF8163FD5C3755E51C7C /* Pods_Runner.framework */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
@@ -32,12 +31,10 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
- 15EC5EDD41677F480DB1BA52 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; 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 = ""; };
- 8D86A7106CDD9A0E86D2EF13 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -45,8 +42,6 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
- BFACDF8163FD5C3755E51C7C /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
- DF02996C8E4750C6D939B45A /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -54,32 +49,12 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 3628A1931C4B982DA8083D8A /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
- 160DED5B8505C09B37417759 /* Pods */ = {
- isa = PBXGroup;
- children = (
- 8D86A7106CDD9A0E86D2EF13 /* Pods-Runner.debug.xcconfig */,
- DF02996C8E4750C6D939B45A /* Pods-Runner.release.xcconfig */,
- 15EC5EDD41677F480DB1BA52 /* Pods-Runner.profile.xcconfig */,
- );
- name = Pods;
- path = Pods;
- sourceTree = "";
- };
- 6B706B0907AEAB7C5D75A4E8 /* Frameworks */ = {
- isa = PBXGroup;
- children = (
- BFACDF8163FD5C3755E51C7C /* Pods_Runner.framework */,
- );
- name = Frameworks;
- sourceTree = "";
- };
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
@@ -97,8 +72,6 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
- 160DED5B8505C09B37417759 /* Pods */,
- 6B706B0907AEAB7C5D75A4E8 /* Frameworks */,
);
sourceTree = "";
};
@@ -132,14 +105,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
- DF119CA90C9CB5F07F210CE4 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
- 9297C6A269C7D0EFBEC539DE /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -212,23 +183,6 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
- 9297C6A269C7D0EFBEC539DE /* [CP] Embed Pods Frameworks */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputFileListPaths = (
- "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
- );
- name = "[CP] Embed Pods Frameworks";
- outputFileListPaths = (
- "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
- showEnvVarsInLog = 0;
- };
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -243,28 +197,6 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
- DF119CA90C9CB5F07F210CE4 /* [CP] Check Pods Manifest.lock */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputFileListPaths = (
- );
- inputPaths = (
- "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
- "${PODS_ROOT}/Manifest.lock",
- );
- name = "[CP] Check Pods Manifest.lock";
- outputFileListPaths = (
- );
- outputPaths = (
- "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
- showEnvVarsInLog = 0;
- };
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcworkspace/contents.xcworkspacedata
index 21a3cc1..1d526a1 100644
--- a/example/ios/Runner.xcworkspace/contents.xcworkspacedata
+++ b/example/ios/Runner.xcworkspace/contents.xcworkspacedata
@@ -4,7 +4,4 @@
-
-
diff --git a/example/pubspec.lock b/example/pubspec.lock
index 7a10c63..9933cd5 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -7,42 +7,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.6.1"
+ version: "2.5.0-nullsafety.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.1.0-nullsafety.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.0-nullsafety.3"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.0-nullsafety.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.0-nullsafety.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
- version: "1.15.0"
+ version: "1.15.0-nullsafety.3"
cupertino_icons:
dependency: "direct main"
description:
@@ -56,7 +56,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.0-nullsafety.1"
flutter:
dependency: "direct main"
description: flutter
@@ -68,7 +68,7 @@ packages:
path: ".."
relative: true
source: path
- version: "0.0.3"
+ version: "0.0.1"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -80,21 +80,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.10"
+ version: "0.12.10-nullsafety.1"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.3.0-nullsafety.3"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.0"
+ version: "1.8.0-nullsafety.1"
sky_engine:
dependency: transitive
description: flutter
@@ -106,56 +106,56 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.1"
+ version: "1.8.0-nullsafety.2"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
- version: "1.10.0"
+ version: "1.10.0-nullsafety.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.1.0-nullsafety.1"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.0-nullsafety.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.0-nullsafety.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.3.0"
+ version: "0.2.19-nullsafety.2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.3.0-nullsafety.3"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.1.0-nullsafety.3"
sdks:
- dart: ">=2.12.0 <3.0.0"
+ dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.20.0"
diff --git a/flutter_split.iml b/flutter_split.iml
index 429df7d..022d450 100644
--- a/flutter_split.iml
+++ b/flutter_split.iml
@@ -8,11 +8,12 @@
+
+
-
diff --git a/ios/Classes/SplitDelegate.swift b/ios/Classes/SplitDelegate.swift
deleted file mode 100644
index 9d927ba..0000000
--- a/ios/Classes/SplitDelegate.swift
+++ /dev/null
@@ -1,87 +0,0 @@
-import Flutter
-import Split
-
-public class SplitDelegate : NSObject {
-
- private var client: SplitClient?;
-
- public func initializeSdk(apiKey : String, user : Key, result : @escaping FlutterResult){
-
- //Config
- let config = SplitClientConfig()
-
- //Factory
- let builder = DefaultSplitFactoryBuilder()
- let factory = builder.setApiKey(apiKey).setKey(user).setConfig(config).build()
-
- //Client
- client = factory?.client
-
- self.client?.on(event: SplitEvent.sdkReady){
- result(nil)
- print("!! Split init !!")
- }
-
- self.client?.on(event: SplitEvent.sdkReadyTimedOut) {
- result(nil)
- print("!! Split SDK timed out !!")
- }
- }
-
- public func dispose(result: @escaping FlutterResult){
- self.client?.destroy();
- result(nil);
- }
-
-
- public func getTreatment(splitName: String,attributes: [String:Any], result: @escaping FlutterResult){
- let treatment = self.client?.getTreatment(splitName, attributes: attributes)
- result(treatment)
- }
-
- public func getTreatmentWithConfig(splitName: String,attributes: [String:Any], result: @escaping FlutterResult){
-
- let splitResult = self.client?.getTreatmentWithConfig(splitName, attributes: attributes)
- let config = try? JSONSerialization.jsonObject(with: splitResult!.config!.data(using: .utf8)!, options: []) as? [String: Any]
- let treatment = splitResult?.treatment
-
- var flutterResult: [String: Any] = [:]
- flutterResult["treatment"]=treatment;
- flutterResult["config"]=try? String(data:JSONSerialization.data(withJSONObject:config!) as! Data,encoding: .utf8);
-
- result(flutterResult)
-
-
- }
-
- public func getTreatments(splitNames: [String],attributes: [String:Any], result: @escaping FlutterResult){
-
-
- let treatments = self.client?.getTreatments(splits: splitNames, attributes: attributes)
- result(treatments)
-
- }
-
- public func getTreatmentsWithConfig(splitNames: [String],attributes: [String:Any], result: @escaping FlutterResult){
-
- let splitResult = self.client?.getTreatmentsWithConfig(splits: splitNames, attributes: attributes)
-
- var flutterResult: [String: Any] = [:]
-
- for split in splitResult!{
- let treatment = split.value.treatment;
- let config = try? JSONSerialization.jsonObject(with: split.value.config!.data(using: .utf8)!, options: []) as? [String: Any]
-
- flutterResult[split.key]=["treatment":treatment,"config":try? String(data:JSONSerialization.data(withJSONObject:config!) as! Data,encoding: .utf8)];
- }
-
- result(flutterResult)
- }
-
- public func trackEvent(eventType: String, trafficType: String, properties: [String:Any], result: @escaping FlutterResult){
- let response = client?.track(trafficType: trafficType, eventType: eventType, properties: properties)
- result(response)
- }
-
-
-}
diff --git a/ios/Classes/SwiftFlutterSplitPlugin.swift b/ios/Classes/SwiftFlutterSplitPlugin.swift
index 6288a85..66b69bc 100644
--- a/ios/Classes/SwiftFlutterSplitPlugin.swift
+++ b/ios/Classes/SwiftFlutterSplitPlugin.swift
@@ -1,94 +1,14 @@
import Flutter
import UIKit
-import Split
public class SwiftFlutterSplitPlugin: NSObject, FlutterPlugin {
- private var splitDelegate: SplitDelegate = SplitDelegate()
- private static var channelName = "flutter_split";
-
- public static func register(with registrar: FlutterPluginRegistrar) {
- let channel = FlutterMethodChannel(name: channelName, binaryMessenger: registrar.messenger())
- let instance = SwiftFlutterSplitPlugin()
-
- registrar.addMethodCallDelegate(instance, channel: channel)
- }
-
- public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
- switch (call.method) {
- case "initializeSdk":
- let args = call.arguments as! Dictionary
- // Split API Key
- let apiKey: String = args["appKey"] as! String
- // User id as Key
- let user: Key = Key(matchingKey: args["userId"] as! String)
-
- splitDelegate.initializeSdk(
- apiKey: apiKey,
- user: user,
- result: result
- );
-
- break;
-
- case "dispose":
- splitDelegate.dispose(result:result)
- break;
-
- case "getTreatment":
- let args = call.arguments as! Dictionary
- let splitName: String = args["key"] as! String
- let attributes: [String:Any] = args["attributes"] as! [String:Any]
-
- splitDelegate.getTreatment(
- splitName: splitName,
- attributes: attributes,
- result: result
- );
-
- break;
-
-
- case "getTreatments":
- let args = call.arguments as! Dictionary
- let splitNames: [String] = args["keys"] as! [String]
- let attributes: [String:Any] = args["attributes"] as! [String:Any]
-
- splitDelegate.getTreatments(splitNames: splitNames,attributes: attributes,result: result)
- break;
-
-
- case "getTreatmentWithConfig":
-
- let args = call.arguments as! Dictionary
- let splitName: String = args["key"] as! String
- let attributes: [String:Any] = args["attributes"] as! [String:Any]
-
- splitDelegate.getTreatmentWithConfig(splitName: splitName,attributes: attributes,result: result)
- break;
-
- case "getTreatmentsWithConfig":
-
- let args = call.arguments as! Dictionary
- let splitNames: [String] = args["keys"] as! [String]
- let attributes: [String:Any] = args["attributes"] as! [String:Any]
-
- splitDelegate.getTreatmentsWithConfig(splitNames: splitNames,attributes: attributes,result: result)
- break;
-
-
- case "trackEvent":
-
- let args = call.arguments as! Dictionary
- let eventType: String = args["eventType"] as! String
- let trafficType: String = args["trafficType"] as! String
- let properties: [String:Any] = args["attributes"] as! [String:Any]
-
- splitDelegate.trackEvent(eventType: eventType,trafficType: trafficType,properties: properties,result: result)
- break;
-
- default:
- break;
-
- }
- }
+ public static func register(with registrar: FlutterPluginRegistrar) {
+ let channel = FlutterMethodChannel(name: "flutter_split", binaryMessenger: registrar.messenger())
+ let instance = SwiftFlutterSplitPlugin()
+ registrar.addMethodCallDelegate(instance, channel: channel)
+ }
+
+ public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
+ result("iOS " + UIDevice.current.systemVersion)
+ }
}
diff --git a/ios/flutter_split.podspec b/ios/flutter_split.podspec
index f6e89da..13b7645 100644
--- a/ios/flutter_split.podspec
+++ b/ios/flutter_split.podspec
@@ -5,18 +5,17 @@
Pod::Spec.new do |s|
s.name = 'flutter_split'
s.version = '0.0.1'
- s.summary = 'An unofficial Flutter plugin for Split Feature Flags, Experimentation + Continuous Delivery'
+ s.summary = 'A new flutter plugin project.'
s.description = <<-DESC
A new flutter plugin project.
DESC
- s.homepage = 'https://www.imumz.com'
+ s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => 'email@example.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
- s.dependency 'Split', '~> 2.11.0'
- s.platform = :ios, '10.0'
+ s.platform = :ios, '8.0'
# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
diff --git a/pubspec.lock b/pubspec.lock
index 4ed2c66..567db0b 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -7,49 +7,49 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.6.1"
+ version: "2.5.0-nullsafety.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.1.0-nullsafety.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.0-nullsafety.3"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.0-nullsafety.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.0-nullsafety.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
- version: "1.15.0"
+ version: "1.15.0-nullsafety.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.0-nullsafety.1"
flutter:
dependency: "direct main"
description: flutter
@@ -66,21 +66,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.10"
+ version: "0.12.10-nullsafety.1"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.3.0-nullsafety.3"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.0"
+ version: "1.8.0-nullsafety.1"
sky_engine:
dependency: transitive
description: flutter
@@ -92,56 +92,56 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.8.1"
+ version: "1.8.0-nullsafety.2"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
- version: "1.10.0"
+ version: "1.10.0-nullsafety.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.1.0-nullsafety.1"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.0"
+ version: "1.1.0-nullsafety.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
- version: "1.2.0"
+ version: "1.2.0-nullsafety.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.3.0"
+ version: "0.2.19-nullsafety.2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
- version: "1.3.0"
+ version: "1.3.0-nullsafety.3"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.1.0-nullsafety.3"
sdks:
- dart: ">=2.12.0 <3.0.0"
+ dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.20.0"
diff --git a/test/flutter_split_test.dart b/test/flutter_split_test.dart
index e994760..34e2088 100644
--- a/test/flutter_split_test.dart
+++ b/test/flutter_split_test.dart
@@ -1,5 +1,6 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
+import 'package:flutter_split/flutter_split.dart';
void main() {
const MethodChannel channel = MethodChannel('flutter_split');
@@ -15,4 +16,8 @@ void main() {
tearDown(() {
channel.setMockMethodCallHandler(null);
});
+
+ test('getPlatformVersion', () async {
+ expect(await FlutterSplit.platformVersion, '42');
+ });
}