package com.kwad.sdk.core; import android.text.TextUtils; import com.kwad.sdk.core.download.DownloadParams; import com.kwad.sdk.core.e.b; import com.kwad.sdk.core.response.model.AdTemplate; import com.kwad.sdk.service.ServiceProvider; import com.kwad.sdk.service.kwai.e; import java.util.concurrent.ConcurrentHashMap; import org.json.JSONException; import org.json.JSONObject; public final class a { private ConcurrentHashMap<String, DownloadParams> aSk; private ConcurrentHashMap<String, AdTemplate> aSl; /* access modifiers changed from: package-private */ /* renamed from: com.kwad.sdk.core.a$a reason: collision with other inner class name */ public static final class C0142a { private static final a aSm = new a((byte) 0); } private a() { this.aSk = new ConcurrentHashMap<>(); this.aSl = new ConcurrentHashMap<>(); } /* synthetic */ a(byte b) { this(); } public static a Ks() { return C0142a.aSm; } public final void a(String str, DownloadParams downloadParams) { if (((e) ServiceProvider.get(e.class)).getContext() != null) { this.aSk.put(str, downloadParams); ((e) ServiceProvider.get(e.class)).getContext().getSharedPreferences("ksadsdk_notification_download_complete", 0).edit().putString(str, downloadParams.toJson().toString()).apply(); } } public final void b(String str, AdTemplate adTemplate) { if (((e) ServiceProvider.get(e.class)).getContext() != null) { this.aSl.put(str, adTemplate); ((e) ServiceProvider.get(e.class)).getContext().getSharedPreferences("ksadsdk_notification_download_complete", 0).edit().putString(str, adTemplate.toJson().toString()).apply(); } } public final void bq(String str) { if (((e) ServiceProvider.get(e.class)).getContext() != null) { this.aSl.remove(str); ((e) ServiceProvider.get(e.class)).getContext().getSharedPreferences("ksadsdk_notification_download_complete", 0).edit().remove(str).apply(); } } public final DownloadParams cE(String str) { if (((e) ServiceProvider.get(e.class)).getContext() == null) { return null; } DownloadParams downloadParams = this.aSk.get(str); if (downloadParams != null) { return downloadParams; } String string = ((e) ServiceProvider.get(e.class)).getContext().getSharedPreferences("ksadsdk_notification_download_complete", 0).getString(str, ""); if (!TextUtils.isEmpty(string)) { DownloadParams downloadParams2 = new DownloadParams(); try { downloadParams2.parseJson(new JSONObject(string)); return downloadParams2; } catch (JSONException e) { b.printStackTrace(e); } } return null; } public final void cF(String str) { if (((e) ServiceProvider.get(e.class)).getContext() != null) { this.aSk.remove(str); ((e) ServiceProvider.get(e.class)).getContext().getSharedPreferences("ksadsdk_notification_download_complete", 0).edit().remove(str).apply(); } } public final AdTemplate cG(String str) { if (((e) ServiceProvider.get(e.class)).getContext() == null) { return null; } AdTemplate adTemplate = this.aSl.get(str); if (adTemplate != null) { return adTemplate; } String string = ((e) ServiceProvider.get(e.class)).getContext().getSharedPreferences("ksadsdk_notification_download_complete", 0).getString(str, ""); if (!TextUtils.isEmpty(string)) { AdTemplate adTemplate2 = new AdTemplate(); try { adTemplate2.parseJson(new JSONObject(string)); return adTemplate2; } catch (JSONException e) { e.printStackTrace(); } } return null; } }