翰林优商.apk(点击下载) / e.java


package com.kwad.sdk.core.config.item;

import android.content.SharedPreferences;
import com.kwad.sdk.service.ServiceProvider;
import org.json.JSONObject;

public final class e extends b<JSONObject> {
    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public e() {
        super(((com.kwad.sdk.service.kwai.e) ServiceProvider.get(com.kwad.sdk.service.kwai.e.class)).getIsExternal() ? "commercialExternalReportConf" : "commercialReportConf", new JSONObject());
    }

    @Override // com.kwad.sdk.core.config.item.b
    public final void a(SharedPreferences.Editor editor) {
        String key;
        String str;
        if (getValue() != null) {
            key = getKey();
            str = ((JSONObject) getValue()).toString();
        } else {
            key = getKey();
            str = "";
        }
        editor.putString(key, str);
    }

    @Override // com.kwad.sdk.core.config.item.b
    public final void a(SharedPreferences sharedPreferences) {
        JSONObject jSONObject = (JSONObject) getValue();
        if (jSONObject == null) {
            jSONObject = new JSONObject();
        }
        JSONObject jSONObject2 = null;
        try {
            jSONObject2 = new JSONObject(sharedPreferences.getString(getKey(), ""));
        } catch (Throwable unused) {
        }
        if (jSONObject2 != null) {
            jSONObject = jSONObject2;
        }
        setValue(jSONObject);
    }

    @Override // com.kwad.sdk.core.config.item.b
    public final void e(JSONObject jSONObject) {
        JSONObject optJSONObject;
        if (jSONObject == null || (optJSONObject = jSONObject.optJSONObject(getKey())) == null) {
            setValue(Lw());
        } else {
            setValue(optJSONObject);
        }
    }
}