package com.baidu.techain.h; import android.content.Context; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.text.TextUtils; import android.util.Base64; import com.baidu.techain.b; import com.baidu.techain.i.c; import com.baidu.techain.i.g; import com.baidu.techain.i.u; import com.xiaomi.mipush.sdk.Constants; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /* compiled from: SharedPreferenceManager */ public final class a { private static a g; public SharedPreferences a; public SharedPreferences.Editor b; public SharedPreferences c; public SharedPreferences.Editor d; public SharedPreferences e; public SharedPreferences.Editor f; private Context h; private int i; private String j = null; private Map<String, SharedPreferences> k = new HashMap(); private a(Context context) { SharedPreferences sharedPreferences = null; this.h = context; this.i = c.a(context); Bundle bundle = new Bundle(); bundle.putString("operation", "querySharedHandler"); Bundle a2 = u.a(this.h, "CallPreferences", bundle, false, "3.5.8.0", true); if (a2 != null) { this.j = a2.getString("handle_platform"); } c cVar = new c(this.h, this.i == 1 ? context.getSharedPreferences("leroadtechaincfg", 0) : null, "leroadtechaincfg", this.i); this.a = cVar; this.b = cVar.edit(); c cVar2 = new c(this.h, (this.i != 1 || !TextUtils.isEmpty(this.j)) ? null : context.getSharedPreferences("leroadcfg", 0), "leroadcfg", true, this.i, this.j); this.c = cVar2; this.d = cVar2.edit(); c cVar3 = new c(this.h, this.i == 1 ? context.getSharedPreferences("retechain_po_rt", 0) : sharedPreferences, "retechain_po_rt", this.i); this.e = cVar3; this.f = cVar3.edit(); } public static synchronized a a(Context context) { synchronized (a.class) { if (context == null) { return g; } if (g == null) { g = new a(context); } return g; } } /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */ /* JADX WARNING: Code restructure failed: missing block: B:44:0x00ab, code lost: if (r2.equals("getString") != false) goto L_0x00c3; */ /* JADX WARNING: Code restructure failed: missing block: B:78:0x0140, code lost: if (r2.equals("putString") != false) goto L_0x014e; */ public final Bundle a(Bundle bundle) { SharedPreferences sharedPreferences; try { String string = bundle.getString("operation"); if (TextUtils.isEmpty(string)) { return null; } if ("querySharedHandler".equals(string)) { Bundle bundle2 = new Bundle(); bundle2.putString("handle_platform", "techain"); return bundle2; } String string2 = bundle.getString("pref_name"); if (TextUtils.isEmpty(string2)) { return null; } String string3 = bundle.getString("key"); if (TextUtils.isEmpty(string3)) { return null; } if (string2.equals("techain")) { sharedPreferences = this.a; } else if (string2.equals("leroadcfg")) { sharedPreferences = this.c; } else if (string2.equals("retechain_po_rt")) { sharedPreferences = this.e; } else { sharedPreferences = a(string2); } char c2 = 0; if (string.startsWith("get")) { String string4 = bundle.getString("defult_value"); if ((!"getString".equals(string) && TextUtils.isEmpty(string4)) || sharedPreferences == null) { return null; } Bundle bundle3 = new Bundle(); switch (string.hashCode()) { case -1249359687: if (string.equals("getInt")) { c2 = 1; break; } c2 = 65535; break; case -75354382: if (string.equals("getLong")) { c2 = 2; break; } c2 = 65535; break; case 804029191: break; case 1101572082: if (string.equals("getBoolean")) { c2 = 4; break; } c2 = 65535; break; case 1953351846: if (string.equals("getFloat")) { c2 = 3; break; } c2 = 65535; break; default: c2 = 65535; break; } if (c2 == 0) { bundle3.putString("result", sharedPreferences.getString(string3, string4)); } else if (c2 == 1) { bundle3.putInt("result", sharedPreferences.getInt(string3, Integer.parseInt(string4))); } else if (c2 == 2) { bundle3.putLong("result", sharedPreferences.getLong(string3, Long.parseLong(string4))); } else if (c2 == 3) { bundle3.putFloat("result", sharedPreferences.getFloat(string3, Float.parseFloat(string4))); } else if (c2 == 4) { bundle3.putBoolean("result", sharedPreferences.getBoolean(string3, Boolean.parseBoolean(string4))); } return bundle3; } if (string.startsWith("put")) { SharedPreferences.Editor edit = sharedPreferences.edit(); switch (string.hashCode()) { case -976920992: if (string.equals("putInt")) { c2 = 1; break; } c2 = 65535; break; case -462997504: break; case -219689429: if (string.equals("putLong")) { c2 = 2; break; } c2 = 65535; break; case 478450201: if (string.equals("putBoolean")) { c2 = 4; break; } c2 = 65535; break; case 1773932685: if (string.equals("putFloat")) { c2 = 3; break; } c2 = 65535; break; default: c2 = 65535; break; } if (c2 == 0) { edit.putString(string3, bundle.getString("value")); } else if (c2 == 1) { edit.putInt(string3, bundle.getInt("value")); } else if (c2 == 2) { edit.putLong(string3, bundle.getLong("value")); } else if (c2 == 3) { edit.putFloat(string3, bundle.getFloat("value")); } else if (c2 == 4) { edit.putBoolean(string3, bundle.getBoolean("value")); } edit.apply(); } return null; } catch (Throwable unused) { c.a(); } } public final SharedPreferences a(String str) { SharedPreferences sharedPreferences; if (TextUtils.isEmpty(str)) { return null; } try { synchronized (this.k) { sharedPreferences = this.k.get(str); if (sharedPreferences == null) { c cVar = new c(this.h, this.i == 1 ? this.h.getSharedPreferences(str, 0) : null, str, this.i); this.k.put(str, cVar); sharedPreferences = cVar; } } return sharedPreferences; } catch (Throwable unused) { c.a(); return null; } } public final String a() { return this.a.getString("svi_n", ""); } public final boolean b() { return this.a.getBoolean("bka", true); } public final void c() { this.b.putLong("pu_ap_fd", System.currentTimeMillis()); this.b.commit(); } public final int d() { return this.a.getInt("wi_fa_pu_ap", 0); } public final void a(int i2) { this.b.putInt("wi_fa_pu_ap", i2); this.b.commit(); } public final int e() { return this.a.getInt("mo_fa_pu_ap", 0); } public final void b(int i2) { this.b.putInt("mo_fa_pu_ap", i2); this.b.commit(); } public final void f() { this.b.putLong("pu_cl_fd", System.currentTimeMillis()); this.b.commit(); } public final void g() { this.b.putLong("se_ae_fd", System.currentTimeMillis()); this.b.commit(); } public final int h() { return this.a.getInt("wi_fa_pu_cl", 0); } public final int i() { return this.a.getInt("mo_fa_pu_cl", 0); } public final int j() { return this.a.getInt("mo_ae_fa_ct", 0); } public final void c(int i2) { this.b.putInt("mo_ae_fa_ct", i2); this.b.commit(); } public final String k() { return this.c.getString("xyus", ""); } public final void b(String str) { this.d.putString("xyus", str); this.d.commit(); } public final String l() { return this.c.getString("xyusec", ""); } public final void c(String str) { this.d.putString("xyusec", str); this.d.commit(); } public final String m() { String string = this.c.getString("xyglsn", ""); if (TextUtils.isEmpty(string)) { return ""; } try { return new String(g.b("MzAyMTIxMDJkaWN1ZGlhYg==".getBytes(), Base64.decode(string, 10)), "UTF-8"); } catch (Throwable unused) { c.a(); return ""; } } public final String n() { String string = this.c.getString("rpiiemn", ""); if (TextUtils.isEmpty(string)) { return ""; } try { return new String(g.b("MzAyMTIxMDJkaWN1ZGlhYg==".getBytes(), Base64.decode(string, 10)), "UTF-8"); } catch (Throwable unused) { c.a(); return ""; } } public final String o() { String string = this.c.getString("rpnewuidn", ""); if (TextUtils.isEmpty(string)) { return ""; } try { return new String(g.b("MzAyMTIxMDJkaWN1ZGlhYg==".getBytes(), Base64.decode(string, 10)), "UTF-8"); } catch (Throwable unused) { c.a(); return ""; } } public final void d(String str) { if (TextUtils.isEmpty(str)) { this.d.putString("rpnewuidn", ""); this.d.commit(); return; } try { this.d.putString("rpnewuidn", new String(Base64.encode(g.a("MzAyMTIxMDJkaWN1ZGlhYg==".getBytes(), str.getBytes("UTF-8")), 10), "UTF-8")); this.d.commit(); } catch (Throwable unused) { c.a(); } } public final List<Integer> p() { String[] split; ArrayList arrayList = new ArrayList(); String string = this.a.getString("hcpk", ""); if (!TextUtils.isEmpty(string) && (split = string.split(Constants.ACCEPT_TIME_SEPARATOR_SERVER)) != null && split.length > 0) { for (int i2 = 0; i2 < split.length; i2++) { try { arrayList.add(Integer.valueOf(Integer.parseInt(split[i2]))); } catch (NumberFormatException e2) { e2.getMessage(); b.c(); } } } return arrayList; } public final void a(int... iArr) { if (iArr == null || iArr.length == 0) { this.b.putString("hcpk", ""); } else { StringBuilder sb = new StringBuilder(); for (int i2 = 0; i2 < iArr.length; i2++) { sb.append(iArr[i2]); if (i2 != iArr.length - 1) { sb.append(Constants.ACCEPT_TIME_SEPARATOR_SERVER); } } this.b.putString("hcpk", sb.toString()); } this.b.commit(); } public final List<Integer> q() { String[] split; ArrayList arrayList = new ArrayList(); String string = this.a.getString("glspk", ""); if (!TextUtils.isEmpty(string) && (split = string.split(Constants.ACCEPT_TIME_SEPARATOR_SERVER)) != null && split.length > 0) { for (int i2 = 0; i2 < split.length; i2++) { try { arrayList.add(Integer.valueOf(Integer.parseInt(split[i2]))); } catch (NumberFormatException e2) { e2.getMessage(); b.c(); } } } return arrayList; } public final void a(List<Integer> list) { if (list.size() == 0) { this.b.putString("glspk", ""); } else { StringBuilder sb = new StringBuilder(); for (int i2 = 0; i2 < list.size(); i2++) { sb.append(list.get(i2)); if (i2 != list.size() - 1) { sb.append(Constants.ACCEPT_TIME_SEPARATOR_SERVER); } } this.b.putString("glspk", sb.toString()); } this.b.commit(); } public final void d(int i2) { this.b.putInt("appal_daa", i2); this.b.commit(); } public final void e(int i2) { this.b.putInt("appal_te", i2); this.b.commit(); } public final void f(int i2) { this.b.putInt("sustfd", i2); this.b.commit(); } public final int r() { return this.a.getInt("sustfd", 0); } public final void g(int i2) { this.b.putInt("sufzfd", i2); this.b.commit(); } public final int s() { return this.a.getInt("sufzfd", 0); } public final void a(long j2) { this.b.putLong("slruct", j2); this.b.commit(); } public final void a(int i2, int i3, int i4) { String str = i2 != 0 ? i2 != 1 ? "" : "suetfite" : "sustfits"; if (!TextUtils.isEmpty(str)) { SharedPreferences.Editor editor = this.b; editor.putInt(str + i3, i4); this.b.commit(); } } public final int a(int i2, int i3) { String str = i2 != 0 ? i2 != 1 ? "" : "suetfite" : "sustfits"; if (TextUtils.isEmpty(str)) { return -1; } SharedPreferences sharedPreferences = this.a; return sharedPreferences.getInt(str + i3, 0); } public final void a(com.baidu.techain.c.a aVar) { String string = this.e.getString("re_con", ""); SharedPreferences.Editor editor = this.f; editor.putString("re_con", string + "||" + com.baidu.techain.c.a.a(aVar)); this.f.commit(); } public final List<com.baidu.techain.c.a> t() { com.baidu.techain.c.a a2; String string = this.e.getString("re_con", ""); if (TextUtils.isEmpty(string)) { return null; } ArrayList arrayList = new ArrayList(); String[] split = string.split("\\|\\|"); for (String str : split) { if (!TextUtils.isEmpty(str) && (a2 = com.baidu.techain.c.a.a(str)) != null) { arrayList.add(a2); } } return arrayList; } public final int u() { int i2 = 24; if ("com.baidu.BaiduMap.meizu".equals(this.h.getPackageName())) { return this.e.getInt("re_net_hr", 24); } int i3 = this.e.getInt("re_net_hr", 3); try { String[] g2 = c.g(this.h); if (g2 == null || g2.length != 2 || TextUtils.isEmpty(g2[0]) || TextUtils.isEmpty(g2[1]) || !"200080".equals(g2[0]) || !"com.baidu.BaiduMap".equals(this.h.getPackageName()) || i3 >= 24) { i2 = i3; } return i2; } catch (Throwable unused) { return i3; } } public final void b(long j2) { this.f.putLong("re_last_ofline_time", j2); this.f.commit(); } public final int v() { return this.e.getInt("up_nu_li", 100); } public final void c(long j2) { this.f.putLong("re_day_len", j2); this.f.commit(); } public final void d(long j2) { this.f.putLong("re_day_b_t", j2); this.f.commit(); } public final String e(String str) { SharedPreferences sharedPreferences = this.e; return sharedPreferences.getString("al_da" + str, ""); } public final void h(int i2) { this.f.putInt("g_r_d_d_n", i2); this.f.commit(); } public final boolean w() { return this.a.getBoolean("s_c_c", true); } public final void a(boolean z) { this.b.putBoolean("se_fg_s", z); this.b.commit(); } public final void b(boolean z) { this.b.putBoolean("a_a_c_b", z); this.b.commit(); } public final String x() { String string = this.a.getString("p_s_i_t", ""); if (TextUtils.isEmpty(string)) { return ""; } try { return new String(g.b("MzAyMTIxMDJkaWN1ZGlhYg==".getBytes(), Base64.decode(string, 10)), "UTF-8"); } catch (Throwable unused) { c.a(); return ""; } } public final String y() { String string = this.a.getString("p_s_a_i_t", ""); if (TextUtils.isEmpty(string)) { return ""; } try { return new String(g.b("MzAyMTIxMDJkaWN1ZGlhYg==".getBytes(), Base64.decode(string, 10)), "UTF-8"); } catch (Throwable unused) { c.a(); return ""; } } public final String z() { String string = this.a.getString("p_s_e_c_t", ""); if (TextUtils.isEmpty(string)) { return ""; } try { return new String(g.b("MzAyMTIxMDJkaWN1ZGlhYg==".getBytes(), Base64.decode(string, 10)), "UTF-8"); } catch (Throwable unused) { c.a(); return ""; } } public final String A() { String string = this.a.getString("p_s_s_c_t", ""); if (TextUtils.isEmpty(string)) { return ""; } try { return new String(g.b("MzAyMTIxMDJkaWN1ZGlhYg==".getBytes(), Base64.decode(string, 10)), "UTF-8"); } catch (Throwable unused) { c.a(); return ""; } } public final String B() { String string = this.a.getString("p_s_o_d_t", ""); if (TextUtils.isEmpty(string)) { return ""; } try { return new String(g.b("MzAyMTIxMDJkaWN1ZGlhYg==".getBytes(), Base64.decode(string, 10)), "UTF-8"); } catch (Throwable unused) { c.a(); return ""; } } public final String C() { String string = this.a.getString("p_s_s_o_t", ""); if (TextUtils.isEmpty(string)) { return ""; } try { return new String(g.b("MzAyMTIxMDJkaWN1ZGlhYg==".getBytes(), Base64.decode(string, 10)), "UTF-8"); } catch (Throwable unused) { c.a(); return ""; } } public final String D() { String string = this.a.getString("p_s_n_o_t", ""); if (TextUtils.isEmpty(string)) { return ""; } try { return new String(g.b("MzAyMTIxMDJkaWN1ZGlhYg==".getBytes(), Base64.decode(string, 10)), "UTF-8"); } catch (Throwable unused) { c.a(); return ""; } } public final String E() { return this.c.getString("xytk", ""); } public final String F() { return this.c.getString("xytk_m", ""); } public final void f(String str) { this.d.putString("xytk_m", str); if (Build.VERSION.SDK_INT >= 9) { this.d.apply(); } else { this.d.commit(); } } }