<commit_before>package com.amplitude.unity.plugins;

import android.app.Application;
import android.content.Context;

import com.amplitude.api.Amplitude;
import com.amplitude.api.Identify;
import com.amplitude.api.Revenue;
import com.amplitude.api.Utils;

import org.json.JSONException;
import org.json.JSONObject;

public class AmplitudePlugin {

    public static JSONObject ToJSONObject(String jsonString) {
        JSONObject properties = null;
        try {
            properties = new JSONObject(jsonString);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return properties;
    }

    public static void init(String instanceName, Context context, String apiKey) {
        Amplitude.getInstance(instanceName).initialize(context, apiKey);
    }

    public static void init(String instanceName, Context context, String apiKey, String userId) {
        Amplitude.getInstance(instanceName).initialize(context, apiKey, userId);
    }

    public static void enableForegroundTracking(String instanceName, Application app) {
        Amplitude.getInstance(instanceName).enableForegroundTracking(app);
    }
<commit_msg>translate dictionary into tracking options<commit_after>package com.amplitude.unity.plugins;

import android.app.Application;
import android.content.Context;

import com.amplitude.api.Amplitude;
import com.amplitude.api.Identify;
import com.amplitude.api.Revenue;
import com.amplitude.api.TrackingOptions;
import com.amplitude.api.Utils;

import org.json.JSONException;
import org.json.JSONObject;

public class AmplitudePlugin {

    public static JSONObject ToJSONObject(String jsonString) {
        JSONObject properties = null;
        try {
            properties = new JSONObject(jsonString);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return properties;
    }

    public static void init(String instanceName, Context context, String apiKey) {
        Amplitude.getInstance(instanceName).initialize(context, apiKey);
    }

    public static void init(String instanceName, Context context, String apiKey, String userId) {
        Amplitude.getInstance(instanceName).initialize(context, apiKey, userId);
    }

    public static void setTrackingOptions(String instanceName, String trackingOptionsJson) {
        JSONObject trackingOptionsDict = ToJSONObject(trackingOptionsJson);
        TrackingOptions trackingOptions = new TrackingOptions();

        if (trackingOptionsDict.optBoolean("disableAdid", false)) {
            trackingOptions.disableAdid();
        }
        if (trackingOptionsDict.optBoolean("disableCarrier", false)) {
            trackingOptions.disableCarrier();
        }
        if (trackingOptionsDict.optBoolean("disableCity", false)) {
            trackingOptions.disableCity();
        }
        if (trackingOptionsDict.optBoolean("disableCountry", false)) {
            trackingOptions.disableCountry();
        }
        if (trackingOptionsDict.optBoolean("disableDeviceBrand", false)) {
            trackingOptions.disableDeviceBrand();
        }
        if (trackingOptionsDict.optBoolean("disableDeviceManufacturer", false)) {
            trackingOptions.disableDeviceManufacturer();
        }
        if (trackingOptionsDict.optBoolean("disableDeviceModel", false)) {
            trackingOptions.disableDeviceModel();
        }
        if (trackingOptionsDict.optBoolean("disableDma", false)) {
            trackingOptions.disableDma();
        }
        if (trackingOptionsDict.optBoolean("disableIpAddress", false)) {
            trackingOptions.disableIpAddress();
        }
        if (trackingOptionsDict.optBoolean("disableLanguage", false)) {
            trackingOptions.disableLanguage();
        }
        if (trackingOptionsDict.optBoolean("disableLatLng", false)) {
            trackingOptions.disableLatLng();
        }
        if (trackingOptionsDict.optBoolean("disableOsName", false)) {
            trackingOptions.disableOsName();
        }
        if (trackingOptionsDict.optBoolean("disableOsVersion", false)) {
            trackingOptions.disableOsVersion();
        }
        if (trackingOptionsDict.optBoolean("disablePlatform", false)) {
            trackingOptions.disablePlatform();
        }
        if (trackingOptionsDict.optBoolean("disableRegion", false)) {
            trackingOptions.disableRegion();
        }
        if (trackingOptionsDict.optBoolean("disableVersionName", false)) {
            trackingOptions.disableVersionName();
        }
        Amplitude.getInstance(instanceName).setTrackingOptions(trackingOptions);
    }

    public static void enableForegroundTracking(String instanceName, Application app) {
        Amplitude.getInstance(instanceName).enableForegroundTracking(app);
    }

{'fraction_non_alphanumeric': 0.09338358458961474, 'fraction_numerical': 0.0, 'mean_word_length': 3.2236958443854995, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1366124', 'n_tokens_mistral': 1216, 'n_tokens_neox': 1174, 'n_words': 229}