翰林优商.apk(点击下载) / a.java


package com.kwad.components.ad.fullscreen.a;

import android.content.Context;
import com.kwad.sdk.core.e.b;
import com.kwad.sdk.core.response.model.AdTemplate;
import org.json.JSONObject;

public final class a {
    public static void F(Context context) {
        b G = G(context);
        long currentTimeMillis = System.currentTimeMillis();
        if (G == null) {
            G = new b(currentTimeMillis, 1);
        } else if (!G.e(currentTimeMillis)) {
            G.fY = currentTimeMillis;
            G.fZ = 1;
        } else {
            G.fZ++;
        }
        a(context, G);
    }

    private static b G(Context context) {
        if (context == null) {
            return null;
        }
        try {
            JSONObject jSONObject = new JSONObject(context.getSharedPreferences("ksadsdk_fullscreen_local_ad_count", 0).getString("key_local_info", null));
            b bVar = new b();
            bVar.parseJson(jSONObject);
            return bVar;
        } catch (Exception e) {
            b.printStackTraceOnly(e);
            return null;
        }
    }

    private static void a(Context context, b bVar) {
        if (context == null || bVar == null) {
            b.d("FullScreenLocalHelper", "saveFullScreenLocalInfo illegal arguments.");
            return;
        }
        context.getSharedPreferences("ksadsdk_fullscreen_local_ad_count", 0).edit().putString("key_local_info", bVar.toJson().toString()).apply();
    }

    public static boolean a(Context context, AdTemplate adTemplate) {
        b G = G(context);
        return (G == null || !G.w(com.kwad.components.ad.fullscreen.kwai.b.bI())) && com.kwad.sdk.core.response.a.b.bY(adTemplate);
    }
}