package com.mayi.fastdevelop.http;


import java.io.File;

public class HttpProxy {

    private static HttpProxy instance;

    private IHttp iHttp;

    public static HttpProxy getInstance() {
        if (instance == null) {
            instance = new HttpProxy();
        }
        return instance;
    }

    public void init(IHttp iHttp) {
        this.iHttp = iHttp;
    }

    //上传文件
    public void uploadFile(String url, File file, ResultCallback callback) {
        if (iHttp != null) {
            iHttp.uploadFile(url, file, callback);
        }
    }

    //发起get请求
    public void performSynGetHttpRequest(String url, ResultCallback callback) {
        if (iHttp != null) {
            iHttp.performSynGetHttpRequest(url, callback);
        }
    }

    //    //发起post请求
    public void performSynPostHttpRequest(String url, String json, ResultCallback callback) {
        if (iHttp != null) {
            iHttp.performSynPostHttpRequest(url, json, callback);
        }
    }

}
