class WXModalUIModule extends WXSDKEngine.DestroyableModule {

  @JSMethod(uiThread = true)
  public void confirm(JSONObject jsObj, final JSCallback callback) {

    if (mWXSDKInstance.getContext() instanceof Activity) {
      String message = "";
      String okTitle = OK;
      String cancelTitle = CANCEL;

      if (jsObj != null) {
        try {
          message = jsObj.getString(MESSAGE);
          okTitle = jsObj.getString(OK_TITLE);
          cancelTitle = jsObj.getString(CANCEL_TITLE);
        } 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 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) {
            callback.invoke(okTitleFinal);
          }
        }
      });
      builder.setNegativeButton(cancelTitleFinal, new OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
          if (callback != null) {
            callback.invoke(cancelTitleFinal);
          }
        }
      });
      AlertDialog alertDialog = builder.create();
      alertDialog.setCanceledOnTouchOutside(false);
      alertDialog.show();
      tracking(alertDialog);
    } else {
      WXLogUtils.e("[WXModalUIModule] when call confirm mWXSDKInstance.getContext() must instanceof Activity");
    }
  }

}