package com.siberia.plugin;

import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.PluginResult;

import org.json.JSONArray;
import org.json.JSONException;

import android.util.Log;

public class Discovery extends CordovaPlugin {

  public static final String TAG = "Discovery";

  NsdHelper mNsdHelper;

  @Override
  public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    String serviceName = args.getString(0);
    String serviceType = args.getString(1);
    mNsdHelper = new NsdHelper(cordova.getActivity(), callbackContext, serviceName);
    if (action.equals("initChat")) {
      Log.d(TAG, "initChat");
      // this.initChat(callbackContext);
    }

    else if (action.equals("advertizeChat")) {
      Log.d(TAG, "advertizeChat");
      // this.advertizeChat(callbackContext);
    }

    else if (action.equals("identify")) {
      Log.d(TAG, "identify");
      mNsdHelper.discoverServices(serviceType);
    }

    else if (action.equals("connectChat")) {
      Log.d(TAG, "connectChat");
      // this.connectChat(callbackContext);
    }

    else if (action.equals("sendChatMessage")) {
      Log.d(TAG, "sendChatMessage");
      // String messageString = args.getString(0);
      // this.sendChatMessage(callbackContext, messageString);
    }

    else {
      callbackContext.error(String.format("Discovery - invalid action:", action));
      return false;
    }

    // PluginResult.Status status = PluginResult.Status.NO_RESULT;
    // PluginResult pluginResult = new PluginResult(status);
    // pluginResult.setKeepCallback(true);
    // callbackContext.sendPluginResult(pluginResult);
    return true;
  }

}

@@ -655,711 +655,121 @@
 e);%0A
-    if (action.equals(%22initChat%22)) %7B%0A      Log.d(TAG, %22initChat%22);%0A      // this.initChat(callbackContext);%0A    %7D%0A%0A    else if (action.equals(%22advertizeChat%22)) %7B%0A      Log.d(TAG, %22advertizeChat%22);%0A      // this.advertizeChat(callbackContext);%0A    %7D%0A%0A    else if (action.equals(%22identify%22)) %7B%0A      Log.d(TAG, %22identify%22);%0A      mNsdHelper.discoverServices(serviceType);%0A    %7D%0A%0A    else if (action.equals(%22connectChat%22)) %7B%0A      Log.d(TAG, %22connectChat%22);%0A      // this.connectChat(callbackContext);%0A    %7D%0A%0A    else if (action.equals(%22sendChatMessage%22)) %7B%0A      Log.d(TAG, %22sendChatMessage%22);%0A      // String messageString = args.getString(0);%0A      // this.sendChatMessage(callbackContext, messageString
+%0A    if (action.equals(%22identify%22)) %7B%0A      Log.d(TAG, %22identify%22);%0A      mNsdHelper.discoverServices(serviceType
 );%0A 

Remove unused code