package jinkeh.cordova.plugin;

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

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

import com.jkjdkf.LauchActivity;
import android.content.Intent;

/**
 * This class echoes a string called from JavaScript.
 */
public class CustomerServicePlugin extends CordovaPlugin {

    @Override
    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
        if (action.equals("startCustomerService")) {
            final CordovaPlugin that = this;
            cordova.getThreadPool().execute(new Runnable() {
                public void run() {
                    Intent customerService = new Intent(that.cordova.getActivity().getBaseContext(), LauchActivity.class);
                    that.cordova.startActivityForResult(that, customerService, 0);
                }
            });
        } else {
            callbackContext.error("Invalid action: " + action);
            return false;
        }
        return true;
    }

}
