package com.unit.websdk;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import java.util.concurrent.ConcurrentHashMap;

public class LigthWebview {
    private LigthWebview() {
    }

    private static ConcurrentHashMap<String, Activity> activityMap = new ConcurrentHashMap<>();


    public static void open(Context context, String url) {
        Intent intent = new Intent(context, WebviewActivity.class);
        intent.putExtra("url", url);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }


    public static void preload(Context context, String url) {
        WebViewCache.preload(context, url);
    }

    public static void add(String name, Activity activity){
        activityMap.put(name, activity);
    }
    public static Activity get(String name) {
        return activityMap.get(name);
    }

    public static Activity remove(String name){
        return activityMap.remove(name);
    }
}
