package com.mogo.cloud.tanlu.api;

import android.content.Context;

import com.mogo.cloud.tanlu.bean.UploadInfo;
import com.mogo.cloud.tanlu.core.CosUpload;

/**
 * @author lixiaopeng
 * @description 上报服务管理类
 * @since 2021/1/21
 */
public class MogoUploadManager {
    private static MogoUploadManager sInstance;
    private Context mContext;


    private MogoUploadManager(Context context) {
        mContext = context;
    }

    public static MogoUploadManager getInstance(Context context) {
        if (sInstance == null) {
            synchronized (MogoUploadManager.class) {
                sInstance = new MogoUploadManager(context);
            }
        }
        return sInstance;
    }


    /**
     * 首先，上传文件到cos，然后把文件在cos的路径和其他参数一起上报服务端
     *
     * @param info     上报入参
     * @param callback {@link ITanluUploadCallback}
     */
    public void uploadInfo(UploadInfo info, ITanluUploadCallback callback) {
        CosUpload.getInstance(mContext).init();
        CosUpload.getInstance(mContext).uploadInfo(info, callback);
    }

}
