package de.danielbasedow.reactnativeadjustsdk;

import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustConfig;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;

public class AdjustManager extends ReactContextBaseJavaModule {
    public AdjustManager(ReactApplicationContext reactContext) {
        super(reactContext);
    }

    @Override
    public String getName() {
        return "ReactNativeAdjustSdk";
    }

    @ReactMethod
    public void initialize(ReadableMap config) {
        String token = config.getString("appToken");
        String environment = config.getString("environment");
        AdjustConfig cfg = new AdjustConfig(this.getReactApplicationContext(), token, environment);
        Adjust.onCreate(cfg);
    }
}

@@ -107,16 +107,51 @@
 Config;%0A
+import com.adjust.sdk.AdjustEvent;%0A
 import c
@@ -925,11 +925,180 @@
 );%0A    %7D
+%0A%0A    @ReactMethod%0A    public void trackEvent(ReadableMap event) %7B%0A        AdjustEvent e = new AdjustEvent(event.getString(%22token%22));%0A        Adjust.trackEvent(e);%0A    %7D
 %0A%7D%0A

add event tracking for android