@@ -76,19 +76,6 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
7676 // Get Split Client instance
7777 this .client = splitFactory .client ();
7878
79- }else if (call .method .equals ("trackEvent" )){
80- String eventType = call .argument ("eventName" );
81- HashMap <String ,Object > map = new HashMap <String ,Object >();
82- if (this .client !=null ){
83- boolean res = client .track (eventType ,map );
84- if (res ){
85- result .success (true );
86- }else {
87-
88- }
89- }else {
90- result .error (SDK_NOT_INITIALIZED ,"Sdk is not initialized" ,"" );
91- }
9279 }else if (call .method .equals ("getTreatment" )){
9380 String key = call .argument ("key" );
9481 HashMap <String ,Object > attr = call .argument ("attributes" );
@@ -142,6 +129,16 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
142129 }else {
143130 result .error (SDK_NOT_INITIALIZED ,"Sdk is not initialized" ,"" );
144131 }
132+ }else if (call .method .equals ("trackEvent" )){
133+ if (this .client !=null ){
134+ String trafficType = call .argument ("trafficType" );
135+ String eventType = call .argument ("eventType" );
136+ HashMap <String ,Object > attr = call .argument ("attributes" );
137+ boolean trackResult = this .client .track (trafficType ,eventType ,attr );
138+ result .success (trackResult );
139+ }else {
140+ result .error (SDK_NOT_INITIALIZED ,"Sdk is not initialized" ,"" );
141+ }
145142 }
146143 else {
147144 result .notImplemented ();
0 commit comments