package com.kwad.sdk.core.config.item; import android.content.SharedPreferences; import android.text.TextUtils; import com.kwad.sdk.core.e.b; import org.json.JSONException; import org.json.JSONObject; public final class h extends b<a> { public static final class a extends com.kwad.sdk.core.response.kwai.a { public String aUs = ""; public String aUt = ""; } public h() { super("idMapping", new a()); } @Override // com.kwad.sdk.core.config.item.b public final void a(SharedPreferences.Editor editor) { if (getValue() == null || ((a) getValue()).toJson() == null) { editor.putString(getKey(), ""); return; } editor.putString(getKey(), cK(((a) getValue()).toJson().toString())); } @Override // com.kwad.sdk.core.config.item.b public final void a(SharedPreferences sharedPreferences) { a aVar = (a) getValue(); if (aVar == null) { aVar = new a(); } String string = sharedPreferences.getString(getKey(), ""); if (!TextUtils.isEmpty(string)) { try { aVar.parseJson(new JSONObject(cL(string))); } catch (JSONException e) { b.printStackTraceOnly(e); } } setValue(aVar); } @Override // com.kwad.sdk.core.config.item.b public final void e(JSONObject jSONObject) { JSONObject optJSONObject = jSONObject.optJSONObject(getKey()); if (optJSONObject != null) { a aVar = new a(); aVar.parseJson(optJSONObject); setValue(aVar); } } public final String getImei() { a aVar = (a) getValue(); return (aVar == null || TextUtils.isEmpty(aVar.aUs)) ? "" : aVar.aUs; } public final String getOaid() { a aVar = (a) getValue(); return (aVar == null || TextUtils.isEmpty(aVar.aUt)) ? "" : aVar.aUt; } }