package com.maniu.lib_cache.network.proxy;

import android.content.Context;

import com.android.volley.toolbox.Volley;

import java.util.Map;

/**
 * 这个类就是请求的代理类  开发者能通过这个代理类来决定他想要的SDK是哪款
 */
public class HttpProxy implements IHttp{
    private static HttpProxy httpProxy;
    private IHttp http;


    private HttpProxy(){
    }

    public static HttpProxy getInstance(){
        if(httpProxy == null){
            synchronized (HttpProxy.class){
                if(httpProxy == null){
                    httpProxy = new HttpProxy();
                }
            }
        }
        return httpProxy;
    }

    /**
     * 通过这个方法 让开发者决定他需要用到是什么框架
     */
    public void init(IHttp http){
        this.http = http;
    }


    @Override
    public <T> void get(String url, Map<String, Object> params, ICallBack iCallBack) {
        //怎样去根据用户的需求  调用不同的框架???
        http.get(url,params,iCallBack);
    }

    @Override
    public <T> void post(String url, Map<String, Object> params, ICallBack iCallBack) {
        http.post(url,params,iCallBack);
    }
}
