class WXModalUIModule extends WXSDKEngine.DestroyableModule {

  @JSMethod(uiThread = true)
  public void prompt(JSONObject jsObj, final JSCallback callback) {
    if (mWXSDKInstance.getContext() instanceof Activity) {
      String message = "";
      String defaultValue = "";
      String okTitle = OK;
      String cancelTitle = CANCEL;

      if (jsObj != null) {
        try {
          message = jsObj.getString(MESSAGE);
          okTitle = jsObj.getString(OK_TITLE);
          cancelTitle = jsObj.getString(CANCEL_TITLE);
          defaultValue = jsObj.getString(DEFAULT);
        } catch (Exception e) {
          WXLogUtils.e("[WXModalUIModule] confirm param parse error ", e);
        }
      }

      if (TextUtils.isEmpty(message)) {
        message = "";
      }
      AlertDialog.Builder builder = new AlertDialog.Builder(mWXSDKInstance.getContext());
      builder.setMessage(message);

      final EditText editText = new EditText(mWXSDKInstance.getContext());
      editText.setText(defaultValue);
      builder.setView(editText);
      final String okTitleFinal = TextUtils.isEmpty(okTitle) ? OK : okTitle;
      final String cancelTitleFinal = TextUtils.isEmpty(cancelTitle) ? CANCEL : cancelTitle;
      builder.setPositiveButton(okTitleFinal, new OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
          if (callback != null) {
            Map<String, Object> result = new HashMap<String, Object>();
            result.put(RESULT, okTitleFinal);
            result.put(DATA, editText.getText().toString());
            callback.invoke(result);
          }
        }
      }).setNegativeButton(cancelTitleFinal, new OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
          if (callback != null) {
            Map<String, Object> result = new HashMap<String, Object>();
            result.put(RESULT, cancelTitleFinal);
            result.put(DATA, editText.getText().toString());
            callback.invoke(result);
          }

        }
      });
      AlertDialog alertDialog = builder.create();
      alertDialog.setCanceledOnTouchOutside(false);
      alertDialog.show();
      tracking(alertDialog);
    } else {
      WXLogUtils.e("when call prompt mWXSDKInstance.getContext() must instanceof Activity");
    }
  }

}