package com.yidianling.uikit.custom.bridge;

import android.text.TextUtils;

import java.util.HashMap;

/**
 * Created by haorui on 2019/5/16.
 * Des:
 */
public class ActionHandlerStorage {

    private static HashMap<String, IP2PCustomActionHandler> plMap;

    public static boolean needLoadNewMsg = false;//返回聊天界面时是否需要加载新的消息

    public static IP2PCustomActionHandler getL(String sessionId) {
        if(plMap == null) {
            return null;
        }
        return plMap.get(sessionId);
    }

    public static void setL(String sessionId , IP2PCustomActionHandler l) {
        if(plMap == null) {
            plMap = new HashMap<>();
        }
        if(TextUtils.isEmpty(sessionId)) {
            return;
        }
        plMap.put(sessionId,l);
    }

    public static void recycleL(String sessionId) {
        if (TextUtils.isEmpty(sessionId) || plMap==null) {
            return;
        }

        plMap.remove(sessionId);

        if (plMap.size() == 0) {
            plMap = null;
        }
    }


}
