package com.opos.mobad.model.e; import android.content.Context; import android.text.TextUtils; import com.czhj.sdk.common.Constants; import com.opos.cmn.an.f.a; import com.opos.cmn.an.j.b; import com.opos.cmn.biz.a.e; import com.opos.cmn.biz.web.a.b.a; import com.opos.cmn.biz.web.a.b.b; import com.opos.cmn.biz.web.a.b.c; import com.opos.cmn.func.a.b.d; import java.net.URI; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.json.JSONArray; import org.json.JSONObject; public class m { private static final String a(String str) { if (str.startsWith(Constants.HTTP) || str.startsWith("https")) { return str; } return "https://adsfs.heytapimage.com" + str; } private static final void a(final Context context, final String str) { b.c(new Runnable() { /* class com.opos.mobad.model.e.m.AnonymousClass1 */ public void run() { try { URI create = URI.create(str); String str = create.getScheme() + "://" + create.getHost(); if (create.getPort() > 0) { str = str + ":" + create.getPort(); } HashMap hashMap = new HashMap(); hashMap.put("Route-Data", e.a(context)); com.opos.cmn.func.a.b.e a2 = com.opos.cmn.func.a.b.b.a().a(context, new d.a().a(hashMap).a("GET").b(str).a()); a.b("WebPrepare", "get code:" + a2.a); if (a2 != null && 200 == a2.a) { String a3 = com.opos.mobad.model.utils.b.a(a2.c); a.b("WebPrepare", "get data:" + a3); JSONArray jSONArray = new JSONArray(a3); if (jSONArray.length() > 0) { ArrayList arrayList = new ArrayList(jSONArray.length()); for (int i2 = 0; i2 < jSONArray.length(); i2++) { JSONObject jSONObject = jSONArray.getJSONObject(i2); arrayList.add(new a.C0236a().a(m.b(jSONObject.getString("path"), str)).b(jSONObject.getString("md5")).a()); } m.b(arrayList); } } } catch (Throwable th) { com.opos.cmn.an.f.a.b("WebPrepare", "get resouce fail:", th); } } }); } public static final void a(Context context, String str, List<String> list) { ArrayList arrayList; c.a().a(context, new b.a().a()); if (list == null || list.size() <= 0) { arrayList = null; } else { arrayList = new ArrayList(list.size()); for (String str2 : list) { arrayList.add(new a.C0236a().a(str2).a()); } } b(arrayList); if (!TextUtils.isEmpty(str)) { a(context, str); } } public static final void a(Context context, List<String> list) { c.a().a(context, new b.a().a()); if (list != null && list.size() > 0) { ArrayList arrayList = new ArrayList(list.size()); for (String str : list) { arrayList.add(new a.C0236a().a(a(str)).a()); } b(arrayList); } } /* access modifiers changed from: private */ public static final String b(String str, String str2) { if (str.startsWith(Constants.HTTP) || str.startsWith("https")) { return str; } return str2 + "/" + str; } /* access modifiers changed from: private */ public static final void b(List<com.opos.cmn.biz.web.a.b.a> list) { if (list != null && list.size() > 0) { com.opos.cmn.an.f.a.b("WebPrepare", "cache size:" + list.size()); c.a().a(list); } } }