<commit_before>package xu.li.cordova.parse;

import android.app.Activity;
import android.content.Intent;

import com.parse.ParseInstallation;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaArgs;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xu.li<AthenaLightenedMyPath> on 1/9/15.
 */

public class ParsePlugin extends CordovaPlugin {
	public final String TAG = "ParsePlugin";
	
	protected String notificationCallback = "";

    public static final String KEY_PUSH_NOTIFICATION = "com.parse.Data";

	@Override
	protected void pluginInitialize() {
        super.pluginInitialize();

        // installation
        ParseInstallation.getCurrentInstallation().saveInBackground();
	}

	@Override
	public boolean execute(String action, CordovaArgs args,
			CallbackContext callbackContext) throws JSONException {

		if ("linkUsernameToInstallation".equals(action)) {
			String name = args.getString(0);
			String key = args.isNull(1) ? "users" : args.getString(1);

			if (name.isEmpty()) {
				callbackContext.error("Username is required.");
				return true;
			}
			
			ParseInstallation installation = ParseInstallation.getCurrentInstallation();
		    List<String> users = installation.getList(key);
		    if (users == null) {
		    	users = new ArrayList<String>();
		    	users.add(name);
		    } else {
		    	if (!users.contains(name)) {
		    		users.add(name);
		    	}
		    }
		    installation.put(key, users);
		    installation.saveInBackground();

		    callbackContext.success();
		    return true;
		}
		
		return super.execute(action, args, callbackContext);
	}

    @Override
    public void onNewIntent(Intent intent) {
        Activity activity = cordova.getActivity();
        Intent oldIntent = activity.getIntent();

        String pushNotification = intent.getExtras().getString(KEY_PUSH_NOTIFICATION);
        if (!pushNotification.isEmpty()) {
            oldIntent.putExtra(KEY_PUSH_NOTIFICATION, pushNotification);
            activity.setIntent(oldIntent);

            // callback
//            webView.sendJavascript();
        }

        super.onNewIntent(intent);
    }

    public String getNotificationCallback() {
		return notificationCallback;
	}

	public void setNotificationCallback(String notificationCallback) {
		this.notificationCallback = notificationCallback;
	}
}<commit_msg>comment out unused code<commit_after>package xu.li.cordova.parse;

import android.app.Activity;
import android.content.Intent;

import com.parse.ParseInstallation;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaArgs;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xu.li<AthenaLightenedMyPath> on 1/9/15.
 */

public class ParsePlugin extends CordovaPlugin {
	public final String TAG = "ParsePlugin";
	
	protected String notificationCallback = "";

    public static final String KEY_PUSH_NOTIFICATION = "com.parse.Data";

	@Override
	protected void pluginInitialize() {
        super.pluginInitialize();

        // installation
        ParseInstallation.getCurrentInstallation().saveInBackground();
	}

	@Override
	public boolean execute(String action, CordovaArgs args,
			CallbackContext callbackContext) throws JSONException {

		if ("linkUsernameToInstallation".equals(action)) {
			String name = args.getString(0);
			String key = args.isNull(1) ? "users" : args.getString(1);

			if (name.isEmpty()) {
				callbackContext.error("Username is required.");
				return true;
			}
			
			ParseInstallation installation = ParseInstallation.getCurrentInstallation();
		    List<String> users = installation.getList(key);
		    if (users == null) {
		    	users = new ArrayList<String>();
		    	users.add(name);
		    } else {
		    	if (!users.contains(name)) {
		    		users.add(name);
		    	}
		    }
		    installation.put(key, users);
		    installation.saveInBackground();

		    callbackContext.success();
		    return true;
		}
		
		return super.execute(action, args, callbackContext);
	}

    @Override
    public void onNewIntent(Intent intent) {
        /*
        Activity activity = cordova.getActivity();
        Intent oldIntent = activity.getIntent();

        String pushNotification = intent.getExtras().getString(KEY_PUSH_NOTIFICATION);
        if (!pushNotification.isEmpty()) {
            oldIntent.putExtra(KEY_PUSH_NOTIFICATION, pushNotification);
            activity.setIntent(oldIntent);

            // callback
//            webView.sendJavascript();
        }
        */

        super.onNewIntent(intent);
    }

    public String getNotificationCallback() {
		return notificationCallback;
	}

	public void setNotificationCallback(String notificationCallback) {
		this.notificationCallback = notificationCallback;
	}
}
{'fraction_non_alphanumeric': 0.10528455284552846, 'fraction_numerical': 0.002845528455284553, 'mean_word_length': 3.3703374777975132, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2618384', 'n_tokens_mistral': 1480, 'n_tokens_neox': 1342, 'n_words': 281}