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 AuthenticationTokenCache { public static final String CACHED_AUTHENTICATION_TOKEN_KEY = "com.facebook.AuthenticationManager.CachedAuthenticationToken"; public static final Companion Companion = new Companion(null); private final SharedPreferences sharedPreferences; public AuthenticationTokenCache(SharedPreferences sharedPreferences) { Intrinsics.checkNotNullParameter(sharedPreferences, "sharedPreferences"); this.sharedPreferences = sharedPreferences; } /* JADX WARN: Illegal instructions before constructor call */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public AuthenticationTokenCache() { /* r3 = this; android.content.Context r0 = com.facebook.FacebookSdk.getApplicationContext() java.lang.String r1 = "com.facebook.AuthenticationTokenManager.SharedPreferences" r2 = 0 android.content.SharedPreferences r0 = r0.getSharedPreferences(r1, r2) java.lang.String r1 = "FacebookSdk.getApplicationContext()\n .getSharedPreferences(\n AuthenticationTokenManager.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE)" kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r0, r1) r3.(r0) return */ throw new UnsupportedOperationException("Method not decompiled: com.facebook.AuthenticationTokenCache.():void"); } public final AuthenticationToken load() { if (hasCachedAuthenticationToken()) { return getCachedAuthenticationToken(); } return null; } public final void save(AuthenticationToken authenticationToken) { Intrinsics.checkNotNullParameter(authenticationToken, "authenticationToken"); try { this.sharedPreferences.edit().putString(CACHED_AUTHENTICATION_TOKEN_KEY, authenticationToken.toJSONObject$facebook_core_release().toString()).apply(); } catch (JSONException unused) { } } public final void clear() { this.sharedPreferences.edit().remove(CACHED_AUTHENTICATION_TOKEN_KEY).apply(); } private final boolean hasCachedAuthenticationToken() { return this.sharedPreferences.contains(CACHED_AUTHENTICATION_TOKEN_KEY); } private final AuthenticationToken getCachedAuthenticationToken() { String string = this.sharedPreferences.getString(CACHED_AUTHENTICATION_TOKEN_KEY, null); if (string == null) { return null; } try { return new AuthenticationToken(new JSONObject(string)); } catch (JSONException unused) { return null; } } public static final class Companion { public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } private Companion() { } } }