package com.ez.ertc;

import android.app.Application;
import android.content.Context;
import android.os.StrictMode;

import androidx.annotation.Nullable;

import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.Logger;

public class YsCoreSDK {

    private static YsCoreSDK instance;

    private boolean debug = false;

    private Context context;

    private YsCoreSDK(){}

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

    public void init(Application application) {
        //Logger
        Logger.addLogAdapter(new AndroidLogAdapter() {
            @Override
            public boolean isLoggable(int priority, @Nullable String tag) {
                return debug;
            }
        });
        context = application.getApplicationContext();
        // android 7.0系统解决拍照的问题
        StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
        StrictMode.setVmPolicy(builder.build());
        builder.detectFileUriExposure();
    }


    public void setDebug(boolean debug) {
        this.debug = debug;
    }

    public boolean isDebug() {
        return debug;
    }


    public Context getContext() {
        return context;
    }

}
