package cn.yyxx.commsdk.platform.hnyy.dialog;


import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

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

import cn.yyxx.commsdk.Version;
import cn.yyxx.commsdk.base.utils.Logger;
import cn.yyxx.support.AppUtils;


public class JsBaseDialog extends Dialog {


    public JsBaseDialog(@NonNull Context context) {
        super(context);
    }

    public JsBaseDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    protected JsBaseDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    public void zfColse() {   //提供给js调用的方法
        Logger.i("zfColse");
    }



    public void showJsMsg(String message) {
        Logger.i("showJsMsg:" + message);
    }

    public void modifyPwd(String message) {
        Logger.i("modifyPwd:" + message);
    }

    public void zfOrder(String message) {   //提供给js调用的方法
        Logger.i("zfOrder:" + message);
    }

    public void openq0q0(String url)  {

        Logger.i("openq0q0:" + url);

    }
    public void switchAccount()  {

        Logger.i("switchAccount");

    }

    public String webExt(){

        JSONObject json = new JSONObject();


        try {
            if (AppUtils.isLandscape(getContext())){

                json.put("orientation","landscape");

            }else{

                json.put("orientation","portrait");

            }

            json.put("version", Version.VERSION_NAME);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        Logger.i("webExt : " + json.toString());
        return json.toString();
    }

    public void realNameResult(String json){
        Logger.i("realNameResult:"+ json);
    }
}
