package com.tapjoy; import android.content.Context; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /* loaded from: classes4.dex */ public class TJCurrencyParameters { public final Context a; public final boolean f; public final ArrayList i; public String b = null; public int c = -1; public String d = null; public int e = -1; public final HashMap g = new HashMap(); public final HashMap h = new HashMap(); public TJCurrencyParameters(Context context) { this.f = false; this.i = new ArrayList(); if (context != null && this.a == null) { this.a = context; } Context context2 = this.a; if (context2 == null) { return; } TJKeyValueStorage tJKeyValueStorage = new TJKeyValueStorage(context2, TapjoyConstants.TJC_PREFERENCE); if (tJKeyValueStorage.contains(TapjoyConstants.PREF_SERVER_CURRENCY_IDS)) { String string = tJKeyValueStorage.getString(TapjoyConstants.PREF_SERVER_CURRENCY_IDS, "[]"); ArrayList arrayList = new ArrayList(); try { JSONArray jSONArray = new JSONArray(string); for (int i = 0; i < jSONArray.length(); i++) { JSONObject jSONObject = jSONArray.getJSONObject(i); String optString = jSONObject.optString("currency_id"); this.f = jSONObject.optString(TapjoyConstants.PREF_SERVER_CURRENCY_TYPE).equals("self_managed"); arrayList.add(optString); } } catch (JSONException unused) { TapjoyLog.e("CurrencyParams", "Failed to parse currency id list"); } if (arrayList.isEmpty()) { return; } this.i = arrayList; } } }