package com.facebook; import android.content.SharedPreferences; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import org.json.JSONException; import org.json.JSONObject; /* loaded from: classes2.dex */ public final class ProfileCache { public static final String CACHED_PROFILE_KEY = "com.facebook.ProfileManager.CachedProfile"; public static final Companion Companion = new Companion(null); public static final String SHARED_PREFERENCES_NAME = "com.facebook.AccessTokenManager.SharedPreferences"; private final SharedPreferences sharedPreferences; public ProfileCache() { SharedPreferences sharedPreferences = FacebookSdk.getApplicationContext().getSharedPreferences("com.facebook.AccessTokenManager.SharedPreferences", 0); Intrinsics.checkNotNullExpressionValue(sharedPreferences, "FacebookSdk.getApplicationContext()\n .getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)"); this.sharedPreferences = sharedPreferences; } public final Profile load() { String string = this.sharedPreferences.getString(CACHED_PROFILE_KEY, null); if (string != null) { try { return new Profile(new JSONObject(string)); } catch (JSONException unused) { } } return null; } public final void save(Profile profile) { Intrinsics.checkNotNullParameter(profile, "profile"); JSONObject jSONObject = profile.toJSONObject(); if (jSONObject != null) { this.sharedPreferences.edit().putString(CACHED_PROFILE_KEY, jSONObject.toString()).apply(); } } public final void clear() { this.sharedPreferences.edit().remove(CACHED_PROFILE_KEY).apply(); } public static final class Companion { public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } private Companion() { } } }