package de.danielbasedow.reactnativeadjustsdk;

import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustConfig;
import com.adjust.sdk.AdjustEvent;
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);
    }

    @ReactMethod
    public void trackEvent(ReadableMap event) {
        AdjustEvent e = new AdjustEvent(event.getString("token"));
        Adjust.trackEvent(e);
    }
}

@@ -142,16 +142,48 @@
 tEvent;%0A
+import com.adjust.sdk.LogLevel;%0A
 import c
@@ -918,24 +918,196 @@
 vironment);%0A
+        if (config.hasKey(%22logLevel%22) && !config.isNull(%22logLevel%22)) %7B%0A            cfg.setLogLevel(LogLevel.valueOf(config.getString(%22logLevel%22).toUpperCase()));%0A        %7D%0A
         Adju

add log level support to android