- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
591 lines
30 KiB
Java
591 lines
30 KiB
Java
package com.facebook;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import android.text.TextUtils;
|
|
import com.facebook.AccessToken;
|
|
import com.facebook.LegacyTokenHelper;
|
|
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
|
|
import com.facebook.internal.Utility;
|
|
import com.facebook.internal.Validate;
|
|
import com.ironsource.mediationsdk.logger.IronSourceError;
|
|
import com.ironsource.v8;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.Collections;
|
|
import java.util.Date;
|
|
import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
import kotlin.collections.CollectionsKt__CollectionsKt;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class AccessToken implements Parcelable {
|
|
public static final String ACCESS_TOKEN_KEY = "access_token";
|
|
private static final String APPLICATION_ID_KEY = "application_id";
|
|
public static final Parcelable.Creator<AccessToken> CREATOR;
|
|
private static final int CURRENT_JSON_FORMAT = 1;
|
|
public static final Companion Companion = new Companion(null);
|
|
public static final String DATA_ACCESS_EXPIRATION_TIME = "data_access_expiration_time";
|
|
private static final String DECLINED_PERMISSIONS_KEY = "declined_permissions";
|
|
private static final AccessTokenSource DEFAULT_ACCESS_TOKEN_SOURCE;
|
|
private static final Date DEFAULT_EXPIRATION_TIME;
|
|
public static final String DEFAULT_GRAPH_DOMAIN = "facebook";
|
|
private static final Date DEFAULT_LAST_REFRESH_TIME;
|
|
private static final String EXPIRED_PERMISSIONS_KEY = "expired_permissions";
|
|
private static final String EXPIRES_AT_KEY = "expires_at";
|
|
public static final String EXPIRES_IN_KEY = "expires_in";
|
|
public static final String GRAPH_DOMAIN = "graph_domain";
|
|
private static final String LAST_REFRESH_KEY = "last_refresh";
|
|
private static final Date MAX_DATE;
|
|
private static final String PERMISSIONS_KEY = "permissions";
|
|
private static final String SOURCE_KEY = "source";
|
|
private static final String TOKEN_KEY = "token";
|
|
public static final String USER_ID_KEY = "user_id";
|
|
private static final String VERSION_KEY = "version";
|
|
private final String applicationId;
|
|
private final Date dataAccessExpirationTime;
|
|
private final Set<String> declinedPermissions;
|
|
private final Set<String> expiredPermissions;
|
|
private final Date expires;
|
|
private final String graphDomain;
|
|
private final Date lastRefresh;
|
|
private final Set<String> permissions;
|
|
private final AccessTokenSource source;
|
|
private final String token;
|
|
private final String userId;
|
|
|
|
public interface AccessTokenCreationCallback {
|
|
void onError(FacebookException facebookException);
|
|
|
|
void onSuccess(AccessToken accessToken);
|
|
}
|
|
|
|
public interface AccessTokenRefreshCallback {
|
|
void OnTokenRefreshFailed(FacebookException facebookException);
|
|
|
|
void OnTokenRefreshed(AccessToken accessToken);
|
|
}
|
|
|
|
public /* synthetic */ class WhenMappings {
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
|
|
|
static {
|
|
int[] iArr = new int[AccessTokenSource.valuesCustom().length];
|
|
iArr[AccessTokenSource.FACEBOOK_APPLICATION_WEB.ordinal()] = 1;
|
|
iArr[AccessTokenSource.CHROME_CUSTOM_TAB.ordinal()] = 2;
|
|
iArr[AccessTokenSource.WEB_VIEW.ordinal()] = 3;
|
|
$EnumSwitchMapping$0 = iArr;
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
|
|
public AccessToken(String accessToken, String applicationId, String userId, Collection<String> collection, Collection<String> collection2, Collection<String> collection3, AccessTokenSource accessTokenSource, Date date, Date date2, Date date3) {
|
|
this(accessToken, applicationId, userId, collection, collection2, collection3, accessTokenSource, date, date2, date3, null, 1024, null);
|
|
Intrinsics.checkNotNullParameter(accessToken, "accessToken");
|
|
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
|
|
Intrinsics.checkNotNullParameter(userId, "userId");
|
|
}
|
|
|
|
public static final void createFromNativeLinkingIntent(Intent intent, String str, AccessTokenCreationCallback accessTokenCreationCallback) {
|
|
Companion.createFromNativeLinkingIntent(intent, str, accessTokenCreationCallback);
|
|
}
|
|
|
|
public static final void expireCurrentAccessToken() {
|
|
Companion.expireCurrentAccessToken();
|
|
}
|
|
|
|
public static final AccessToken getCurrentAccessToken() {
|
|
return Companion.getCurrentAccessToken();
|
|
}
|
|
|
|
public static final boolean isCurrentAccessTokenActive() {
|
|
return Companion.isCurrentAccessTokenActive();
|
|
}
|
|
|
|
public static final boolean isDataAccessActive() {
|
|
return Companion.isDataAccessActive();
|
|
}
|
|
|
|
public static final boolean isLoggedInWithInstagram() {
|
|
return Companion.isLoggedInWithInstagram();
|
|
}
|
|
|
|
public static final void refreshCurrentAccessTokenAsync() {
|
|
Companion.refreshCurrentAccessTokenAsync();
|
|
}
|
|
|
|
public static final void refreshCurrentAccessTokenAsync(AccessTokenRefreshCallback accessTokenRefreshCallback) {
|
|
Companion.refreshCurrentAccessTokenAsync(accessTokenRefreshCallback);
|
|
}
|
|
|
|
public static final void setCurrentAccessToken(AccessToken accessToken) {
|
|
Companion.setCurrentAccessToken(accessToken);
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public int describeContents() {
|
|
return 0;
|
|
}
|
|
|
|
public final String getApplicationId() {
|
|
return this.applicationId;
|
|
}
|
|
|
|
public final Date getDataAccessExpirationTime() {
|
|
return this.dataAccessExpirationTime;
|
|
}
|
|
|
|
public final Set<String> getDeclinedPermissions() {
|
|
return this.declinedPermissions;
|
|
}
|
|
|
|
public final Set<String> getExpiredPermissions() {
|
|
return this.expiredPermissions;
|
|
}
|
|
|
|
public final Date getExpires() {
|
|
return this.expires;
|
|
}
|
|
|
|
public final String getGraphDomain() {
|
|
return this.graphDomain;
|
|
}
|
|
|
|
public final Date getLastRefresh() {
|
|
return this.lastRefresh;
|
|
}
|
|
|
|
public final Set<String> getPermissions() {
|
|
return this.permissions;
|
|
}
|
|
|
|
public final AccessTokenSource getSource() {
|
|
return this.source;
|
|
}
|
|
|
|
public final String getToken() {
|
|
return this.token;
|
|
}
|
|
|
|
public final String getUserId() {
|
|
return this.userId;
|
|
}
|
|
|
|
public /* synthetic */ AccessToken(String str, String str2, String str3, Collection collection, Collection collection2, Collection collection3, AccessTokenSource accessTokenSource, Date date, Date date2, Date date3, String str4, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(str, str2, str3, collection, collection2, collection3, accessTokenSource, date, date2, date3, (i & 1024) != 0 ? "facebook" : str4);
|
|
}
|
|
|
|
public AccessToken(String accessToken, String applicationId, String userId, Collection<String> collection, Collection<String> collection2, Collection<String> collection3, AccessTokenSource accessTokenSource, Date date, Date date2, Date date3, String str) {
|
|
Intrinsics.checkNotNullParameter(accessToken, "accessToken");
|
|
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
|
|
Intrinsics.checkNotNullParameter(userId, "userId");
|
|
Validate.notEmpty(accessToken, SDKConstants.PARAM_ACCESS_TOKEN);
|
|
Validate.notEmpty(applicationId, "applicationId");
|
|
Validate.notEmpty(userId, "userId");
|
|
this.expires = date == null ? DEFAULT_EXPIRATION_TIME : date;
|
|
Set<String> unmodifiableSet = Collections.unmodifiableSet(collection != null ? new HashSet(collection) : new HashSet());
|
|
Intrinsics.checkNotNullExpressionValue(unmodifiableSet, "unmodifiableSet(if (permissions != null) HashSet(permissions) else HashSet())");
|
|
this.permissions = unmodifiableSet;
|
|
Set<String> unmodifiableSet2 = Collections.unmodifiableSet(collection2 != null ? new HashSet(collection2) : new HashSet());
|
|
Intrinsics.checkNotNullExpressionValue(unmodifiableSet2, "unmodifiableSet(\n if (declinedPermissions != null) HashSet(declinedPermissions) else HashSet())");
|
|
this.declinedPermissions = unmodifiableSet2;
|
|
Set<String> unmodifiableSet3 = Collections.unmodifiableSet(collection3 != null ? new HashSet(collection3) : new HashSet());
|
|
Intrinsics.checkNotNullExpressionValue(unmodifiableSet3, "unmodifiableSet(\n if (expiredPermissions != null) HashSet(expiredPermissions) else HashSet())");
|
|
this.expiredPermissions = unmodifiableSet3;
|
|
this.token = accessToken;
|
|
this.source = convertTokenSourceForGraphDomain(accessTokenSource == null ? DEFAULT_ACCESS_TOKEN_SOURCE : accessTokenSource, str);
|
|
this.lastRefresh = date2 == null ? DEFAULT_LAST_REFRESH_TIME : date2;
|
|
this.applicationId = applicationId;
|
|
this.userId = userId;
|
|
this.dataAccessExpirationTime = (date3 == null || date3.getTime() == 0) ? DEFAULT_EXPIRATION_TIME : date3;
|
|
this.graphDomain = str == null ? "facebook" : str;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("{AccessToken");
|
|
sb.append(" token:");
|
|
sb.append(tokenToString());
|
|
appendPermissions(sb);
|
|
sb.append("}");
|
|
String sb2 = sb.toString();
|
|
Intrinsics.checkNotNullExpressionValue(sb2, "builder.toString()");
|
|
return sb2;
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof AccessToken)) {
|
|
return false;
|
|
}
|
|
AccessToken accessToken = (AccessToken) obj;
|
|
if (Intrinsics.areEqual(this.expires, accessToken.expires) && Intrinsics.areEqual(this.permissions, accessToken.permissions) && Intrinsics.areEqual(this.declinedPermissions, accessToken.declinedPermissions) && Intrinsics.areEqual(this.expiredPermissions, accessToken.expiredPermissions) && Intrinsics.areEqual(this.token, accessToken.token) && this.source == accessToken.source && Intrinsics.areEqual(this.lastRefresh, accessToken.lastRefresh) && Intrinsics.areEqual(this.applicationId, accessToken.applicationId) && Intrinsics.areEqual(this.userId, accessToken.userId) && Intrinsics.areEqual(this.dataAccessExpirationTime, accessToken.dataAccessExpirationTime)) {
|
|
String str = this.graphDomain;
|
|
String str2 = accessToken.graphDomain;
|
|
if (str == null) {
|
|
if (str2 == null) {
|
|
return true;
|
|
}
|
|
} else if (Intrinsics.areEqual(str, str2)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public int hashCode() {
|
|
int hashCode = (((((((((((((((((((IronSourceError.ERROR_NON_EXISTENT_INSTANCE + this.expires.hashCode()) * 31) + this.permissions.hashCode()) * 31) + this.declinedPermissions.hashCode()) * 31) + this.expiredPermissions.hashCode()) * 31) + this.token.hashCode()) * 31) + this.source.hashCode()) * 31) + this.lastRefresh.hashCode()) * 31) + this.applicationId.hashCode()) * 31) + this.userId.hashCode()) * 31) + this.dataAccessExpirationTime.hashCode()) * 31;
|
|
String str = this.graphDomain;
|
|
return hashCode + (str == null ? 0 : str.hashCode());
|
|
}
|
|
|
|
public final boolean isExpired() {
|
|
return new Date().after(this.expires);
|
|
}
|
|
|
|
public final boolean isDataAccessExpired() {
|
|
return new Date().after(this.dataAccessExpirationTime);
|
|
}
|
|
|
|
public final boolean isInstagramToken() {
|
|
String str = this.graphDomain;
|
|
return str != null && str.equals(FacebookSdk.INSTAGRAM);
|
|
}
|
|
|
|
public final JSONObject toJSONObject$facebook_core_release() throws JSONException {
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("version", 1);
|
|
jSONObject.put("token", this.token);
|
|
jSONObject.put(EXPIRES_AT_KEY, this.expires.getTime());
|
|
jSONObject.put("permissions", new JSONArray((Collection) this.permissions));
|
|
jSONObject.put(DECLINED_PERMISSIONS_KEY, new JSONArray((Collection) this.declinedPermissions));
|
|
jSONObject.put(EXPIRED_PERMISSIONS_KEY, new JSONArray((Collection) this.expiredPermissions));
|
|
jSONObject.put(LAST_REFRESH_KEY, this.lastRefresh.getTime());
|
|
jSONObject.put("source", this.source.name());
|
|
jSONObject.put(APPLICATION_ID_KEY, this.applicationId);
|
|
jSONObject.put("user_id", this.userId);
|
|
jSONObject.put(DATA_ACCESS_EXPIRATION_TIME, this.dataAccessExpirationTime.getTime());
|
|
String str = this.graphDomain;
|
|
if (str != null) {
|
|
jSONObject.put("graph_domain", str);
|
|
}
|
|
return jSONObject;
|
|
}
|
|
|
|
private final String tokenToString() {
|
|
FacebookSdk facebookSdk = FacebookSdk.INSTANCE;
|
|
return FacebookSdk.isLoggingBehaviorEnabled(LoggingBehavior.INCLUDE_ACCESS_TOKENS) ? this.token : "ACCESS_TOKEN_REMOVED";
|
|
}
|
|
|
|
private final void appendPermissions(StringBuilder sb) {
|
|
sb.append(" permissions:");
|
|
sb.append(v8.i.d);
|
|
sb.append(TextUtils.join(", ", this.permissions));
|
|
sb.append(v8.i.e);
|
|
}
|
|
|
|
private final AccessTokenSource convertTokenSourceForGraphDomain(AccessTokenSource accessTokenSource, String str) {
|
|
if (str == null || !str.equals(FacebookSdk.INSTAGRAM)) {
|
|
return accessTokenSource;
|
|
}
|
|
int i = WhenMappings.$EnumSwitchMapping$0[accessTokenSource.ordinal()];
|
|
if (i == 1) {
|
|
return AccessTokenSource.INSTAGRAM_APPLICATION_WEB;
|
|
}
|
|
if (i != 2) {
|
|
return i != 3 ? accessTokenSource : AccessTokenSource.INSTAGRAM_WEB_VIEW;
|
|
}
|
|
return AccessTokenSource.INSTAGRAM_CUSTOM_CHROME_TAB;
|
|
}
|
|
|
|
public AccessToken(Parcel parcel) {
|
|
Intrinsics.checkNotNullParameter(parcel, "parcel");
|
|
this.expires = new Date(parcel.readLong());
|
|
ArrayList arrayList = new ArrayList();
|
|
parcel.readStringList(arrayList);
|
|
Set<String> unmodifiableSet = Collections.unmodifiableSet(new HashSet(arrayList));
|
|
Intrinsics.checkNotNullExpressionValue(unmodifiableSet, "unmodifiableSet(HashSet(permissionsList))");
|
|
this.permissions = unmodifiableSet;
|
|
arrayList.clear();
|
|
parcel.readStringList(arrayList);
|
|
Set<String> unmodifiableSet2 = Collections.unmodifiableSet(new HashSet(arrayList));
|
|
Intrinsics.checkNotNullExpressionValue(unmodifiableSet2, "unmodifiableSet(HashSet(permissionsList))");
|
|
this.declinedPermissions = unmodifiableSet2;
|
|
arrayList.clear();
|
|
parcel.readStringList(arrayList);
|
|
Set<String> unmodifiableSet3 = Collections.unmodifiableSet(new HashSet(arrayList));
|
|
Intrinsics.checkNotNullExpressionValue(unmodifiableSet3, "unmodifiableSet(HashSet(permissionsList))");
|
|
this.expiredPermissions = unmodifiableSet3;
|
|
this.token = Validate.notNullOrEmpty(parcel.readString(), "token");
|
|
String readString = parcel.readString();
|
|
this.source = readString != null ? AccessTokenSource.valueOf(readString) : DEFAULT_ACCESS_TOKEN_SOURCE;
|
|
this.lastRefresh = new Date(parcel.readLong());
|
|
this.applicationId = Validate.notNullOrEmpty(parcel.readString(), "applicationId");
|
|
this.userId = Validate.notNullOrEmpty(parcel.readString(), "userId");
|
|
this.dataAccessExpirationTime = new Date(parcel.readLong());
|
|
this.graphDomain = parcel.readString();
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public void writeToParcel(Parcel dest, int i) {
|
|
Intrinsics.checkNotNullParameter(dest, "dest");
|
|
dest.writeLong(this.expires.getTime());
|
|
dest.writeStringList(new ArrayList(this.permissions));
|
|
dest.writeStringList(new ArrayList(this.declinedPermissions));
|
|
dest.writeStringList(new ArrayList(this.expiredPermissions));
|
|
dest.writeString(this.token);
|
|
dest.writeString(this.source.name());
|
|
dest.writeLong(this.lastRefresh.getTime());
|
|
dest.writeString(this.applicationId);
|
|
dest.writeString(this.userId);
|
|
dest.writeLong(this.dataAccessExpirationTime.getTime());
|
|
dest.writeString(this.graphDomain);
|
|
}
|
|
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
|
|
public final AccessToken getCurrentAccessToken() {
|
|
return AccessTokenManager.Companion.getInstance().getCurrentAccessToken();
|
|
}
|
|
|
|
public final void setCurrentAccessToken(AccessToken accessToken) {
|
|
AccessTokenManager.Companion.getInstance().setCurrentAccessToken(accessToken);
|
|
}
|
|
|
|
public final boolean isCurrentAccessTokenActive() {
|
|
AccessToken currentAccessToken = AccessTokenManager.Companion.getInstance().getCurrentAccessToken();
|
|
return (currentAccessToken == null || currentAccessToken.isExpired()) ? false : true;
|
|
}
|
|
|
|
public final boolean isDataAccessActive() {
|
|
AccessToken currentAccessToken = AccessTokenManager.Companion.getInstance().getCurrentAccessToken();
|
|
return (currentAccessToken == null || currentAccessToken.isDataAccessExpired()) ? false : true;
|
|
}
|
|
|
|
public final boolean isLoggedInWithInstagram() {
|
|
AccessToken currentAccessToken = AccessTokenManager.Companion.getInstance().getCurrentAccessToken();
|
|
return (currentAccessToken == null || currentAccessToken.isExpired() || !currentAccessToken.isInstagramToken()) ? false : true;
|
|
}
|
|
|
|
public final void expireCurrentAccessToken() {
|
|
AccessToken currentAccessToken = AccessTokenManager.Companion.getInstance().getCurrentAccessToken();
|
|
if (currentAccessToken != null) {
|
|
setCurrentAccessToken(createExpired$facebook_core_release(currentAccessToken));
|
|
}
|
|
}
|
|
|
|
public final void refreshCurrentAccessTokenAsync() {
|
|
AccessTokenManager.Companion.getInstance().refreshCurrentAccessToken(null);
|
|
}
|
|
|
|
public final void refreshCurrentAccessTokenAsync(AccessTokenRefreshCallback accessTokenRefreshCallback) {
|
|
AccessTokenManager.Companion.getInstance().refreshCurrentAccessToken(accessTokenRefreshCallback);
|
|
}
|
|
|
|
public final void createFromNativeLinkingIntent(Intent intent, final String applicationId, final AccessTokenCreationCallback accessTokenCallback) {
|
|
Intrinsics.checkNotNullParameter(intent, "intent");
|
|
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
|
|
Intrinsics.checkNotNullParameter(accessTokenCallback, "accessTokenCallback");
|
|
if (intent.getExtras() == null) {
|
|
accessTokenCallback.onError(new FacebookException("No extras found on intent"));
|
|
return;
|
|
}
|
|
final Bundle bundle = new Bundle(intent.getExtras());
|
|
String string = bundle.getString("access_token");
|
|
if (string == null || string.length() == 0) {
|
|
accessTokenCallback.onError(new FacebookException("No access token found on intent"));
|
|
return;
|
|
}
|
|
String string2 = bundle.getString("user_id");
|
|
if (string2 == null || string2.length() == 0) {
|
|
Utility utility = Utility.INSTANCE;
|
|
Utility.getGraphMeRequestWithCacheAsync(string, new Utility.GraphMeRequestWithCacheCallback() { // from class: com.facebook.AccessToken$Companion$createFromNativeLinkingIntent$1
|
|
@Override // com.facebook.internal.Utility.GraphMeRequestWithCacheCallback
|
|
public void onSuccess(JSONObject jSONObject) {
|
|
String string3;
|
|
AccessToken createFromBundle;
|
|
if (jSONObject == null) {
|
|
string3 = null;
|
|
} else {
|
|
try {
|
|
string3 = jSONObject.getString("id");
|
|
} catch (Exception unused) {
|
|
accessTokenCallback.onError(new FacebookException("Unable to generate access token due to missing user id"));
|
|
return;
|
|
}
|
|
}
|
|
if (string3 == null) {
|
|
throw new IllegalStateException("Required value was null.".toString());
|
|
}
|
|
bundle.putString("user_id", string3);
|
|
AccessToken.AccessTokenCreationCallback accessTokenCreationCallback = accessTokenCallback;
|
|
createFromBundle = AccessToken.Companion.createFromBundle(null, bundle, AccessTokenSource.FACEBOOK_APPLICATION_WEB, new Date(), applicationId);
|
|
accessTokenCreationCallback.onSuccess(createFromBundle);
|
|
}
|
|
|
|
@Override // com.facebook.internal.Utility.GraphMeRequestWithCacheCallback
|
|
public void onFailure(FacebookException facebookException) {
|
|
accessTokenCallback.onError(facebookException);
|
|
}
|
|
});
|
|
} else {
|
|
accessTokenCallback.onSuccess(createFromBundle(null, bundle, AccessTokenSource.FACEBOOK_APPLICATION_WEB, new Date(), applicationId));
|
|
}
|
|
}
|
|
|
|
@SuppressLint({"FieldGetter"})
|
|
public final AccessToken createFromRefresh$facebook_core_release(AccessToken current, Bundle bundle) {
|
|
Intrinsics.checkNotNullParameter(current, "current");
|
|
Intrinsics.checkNotNullParameter(bundle, "bundle");
|
|
if (current.getSource() != AccessTokenSource.FACEBOOK_APPLICATION_WEB && current.getSource() != AccessTokenSource.FACEBOOK_APPLICATION_NATIVE && current.getSource() != AccessTokenSource.FACEBOOK_APPLICATION_SERVICE) {
|
|
throw new FacebookException(Intrinsics.stringPlus("Invalid token source: ", current.getSource()));
|
|
}
|
|
Utility utility = Utility.INSTANCE;
|
|
Date bundleLongAsDate = Utility.getBundleLongAsDate(bundle, AccessToken.EXPIRES_IN_KEY, new Date(0L));
|
|
String string = bundle.getString("access_token");
|
|
if (string == null) {
|
|
return null;
|
|
}
|
|
String string2 = bundle.getString("graph_domain");
|
|
Date bundleLongAsDate2 = Utility.getBundleLongAsDate(bundle, AccessToken.DATA_ACCESS_EXPIRATION_TIME, new Date(0L));
|
|
if (Utility.isNullOrEmpty(string)) {
|
|
return null;
|
|
}
|
|
return new AccessToken(string, current.getApplicationId(), current.getUserId(), current.getPermissions(), current.getDeclinedPermissions(), current.getExpiredPermissions(), current.getSource(), bundleLongAsDate, new Date(), bundleLongAsDate2, string2);
|
|
}
|
|
|
|
public final AccessToken createExpired$facebook_core_release(AccessToken current) {
|
|
Intrinsics.checkNotNullParameter(current, "current");
|
|
return new AccessToken(current.getToken(), current.getApplicationId(), current.getUserId(), current.getPermissions(), current.getDeclinedPermissions(), current.getExpiredPermissions(), current.getSource(), new Date(), new Date(), current.getDataAccessExpirationTime(), null, 1024, null);
|
|
}
|
|
|
|
public final AccessToken createFromLegacyCache$facebook_core_release(Bundle bundle) {
|
|
String string;
|
|
Intrinsics.checkNotNullParameter(bundle, "bundle");
|
|
List<String> permissionsFromBundle$facebook_core_release = getPermissionsFromBundle$facebook_core_release(bundle, LegacyTokenHelper.PERMISSIONS_KEY);
|
|
List<String> permissionsFromBundle$facebook_core_release2 = getPermissionsFromBundle$facebook_core_release(bundle, LegacyTokenHelper.DECLINED_PERMISSIONS_KEY);
|
|
List<String> permissionsFromBundle$facebook_core_release3 = getPermissionsFromBundle$facebook_core_release(bundle, LegacyTokenHelper.EXPIRED_PERMISSIONS_KEY);
|
|
LegacyTokenHelper.Companion companion = LegacyTokenHelper.Companion;
|
|
String applicationId = companion.getApplicationId(bundle);
|
|
if (Utility.isNullOrEmpty(applicationId)) {
|
|
applicationId = FacebookSdk.getApplicationId();
|
|
}
|
|
String str = applicationId;
|
|
String token = companion.getToken(bundle);
|
|
if (token == null) {
|
|
return null;
|
|
}
|
|
JSONObject awaitGetGraphMeRequestWithCache = Utility.awaitGetGraphMeRequestWithCache(token);
|
|
if (awaitGetGraphMeRequestWithCache == null) {
|
|
string = null;
|
|
} else {
|
|
try {
|
|
string = awaitGetGraphMeRequestWithCache.getString("id");
|
|
} catch (JSONException unused) {
|
|
return null;
|
|
}
|
|
}
|
|
if (str == null || string == null) {
|
|
return null;
|
|
}
|
|
return new AccessToken(token, str, string, permissionsFromBundle$facebook_core_release, permissionsFromBundle$facebook_core_release2, permissionsFromBundle$facebook_core_release3, companion.getSource(bundle), companion.getExpirationDate(bundle), companion.getLastRefreshDate(bundle), null, null, 1024, null);
|
|
}
|
|
|
|
public final List<String> getPermissionsFromBundle$facebook_core_release(Bundle bundle, String str) {
|
|
Intrinsics.checkNotNullParameter(bundle, "bundle");
|
|
ArrayList<String> stringArrayList = bundle.getStringArrayList(str);
|
|
if (stringArrayList == null) {
|
|
return CollectionsKt__CollectionsKt.emptyList();
|
|
}
|
|
List<String> unmodifiableList = Collections.unmodifiableList(new ArrayList(stringArrayList));
|
|
Intrinsics.checkNotNullExpressionValue(unmodifiableList, "{\n Collections.unmodifiableList(ArrayList(originalPermissions))\n }");
|
|
return unmodifiableList;
|
|
}
|
|
|
|
public final AccessToken createFromJSONObject$facebook_core_release(JSONObject jsonObject) throws JSONException {
|
|
Collection jsonArrayToStringList;
|
|
Intrinsics.checkNotNullParameter(jsonObject, "jsonObject");
|
|
if (jsonObject.getInt("version") > 1) {
|
|
throw new FacebookException("Unknown AccessToken serialization format.");
|
|
}
|
|
String token = jsonObject.getString("token");
|
|
Date date = new Date(jsonObject.getLong(AccessToken.EXPIRES_AT_KEY));
|
|
JSONArray permissionsArray = jsonObject.getJSONArray("permissions");
|
|
JSONArray declinedPermissionsArray = jsonObject.getJSONArray(AccessToken.DECLINED_PERMISSIONS_KEY);
|
|
JSONArray optJSONArray = jsonObject.optJSONArray(AccessToken.EXPIRED_PERMISSIONS_KEY);
|
|
Date date2 = new Date(jsonObject.getLong(AccessToken.LAST_REFRESH_KEY));
|
|
String string = jsonObject.getString("source");
|
|
Intrinsics.checkNotNullExpressionValue(string, "jsonObject.getString(SOURCE_KEY)");
|
|
AccessTokenSource valueOf = AccessTokenSource.valueOf(string);
|
|
String applicationId = jsonObject.getString(AccessToken.APPLICATION_ID_KEY);
|
|
String userId = jsonObject.getString("user_id");
|
|
Date date3 = new Date(jsonObject.optLong(AccessToken.DATA_ACCESS_EXPIRATION_TIME, 0L));
|
|
String optString = jsonObject.optString("graph_domain", null);
|
|
Intrinsics.checkNotNullExpressionValue(token, "token");
|
|
Intrinsics.checkNotNullExpressionValue(applicationId, "applicationId");
|
|
Intrinsics.checkNotNullExpressionValue(userId, "userId");
|
|
Utility utility = Utility.INSTANCE;
|
|
Intrinsics.checkNotNullExpressionValue(permissionsArray, "permissionsArray");
|
|
List<String> jsonArrayToStringList2 = Utility.jsonArrayToStringList(permissionsArray);
|
|
Intrinsics.checkNotNullExpressionValue(declinedPermissionsArray, "declinedPermissionsArray");
|
|
List<String> jsonArrayToStringList3 = Utility.jsonArrayToStringList(declinedPermissionsArray);
|
|
if (optJSONArray == null) {
|
|
jsonArrayToStringList = new ArrayList();
|
|
} else {
|
|
jsonArrayToStringList = Utility.jsonArrayToStringList(optJSONArray);
|
|
}
|
|
return new AccessToken(token, applicationId, userId, jsonArrayToStringList2, jsonArrayToStringList3, jsonArrayToStringList, valueOf, date, date2, date3, optString);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final AccessToken createFromBundle(List<String> list, Bundle bundle, AccessTokenSource accessTokenSource, Date date, String str) {
|
|
Date bundleLongAsDate;
|
|
String string;
|
|
String string2 = bundle.getString("access_token");
|
|
if (string2 == null || (bundleLongAsDate = Utility.getBundleLongAsDate(bundle, AccessToken.EXPIRES_IN_KEY, date)) == null || (string = bundle.getString("user_id")) == null) {
|
|
return null;
|
|
}
|
|
return new AccessToken(string2, str, string, list, null, null, accessTokenSource, bundleLongAsDate, new Date(), Utility.getBundleLongAsDate(bundle, AccessToken.DATA_ACCESS_EXPIRATION_TIME, new Date(0L)), null, 1024, null);
|
|
}
|
|
}
|
|
|
|
static {
|
|
Date date = new Date(Long.MAX_VALUE);
|
|
MAX_DATE = date;
|
|
DEFAULT_EXPIRATION_TIME = date;
|
|
DEFAULT_LAST_REFRESH_TIME = new Date();
|
|
DEFAULT_ACCESS_TOKEN_SOURCE = AccessTokenSource.FACEBOOK_APPLICATION_WEB;
|
|
CREATOR = new Parcelable.Creator<AccessToken>() { // from class: com.facebook.AccessToken$Companion$CREATOR$1
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // android.os.Parcelable.Creator
|
|
public AccessToken createFromParcel(Parcel source) {
|
|
Intrinsics.checkNotNullParameter(source, "source");
|
|
return new AccessToken(source);
|
|
}
|
|
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // android.os.Parcelable.Creator
|
|
public AccessToken[] newArray(int i) {
|
|
return new AccessToken[i];
|
|
}
|
|
};
|
|
}
|
|
}
|