85 lines
3.2 KiB
Java
85 lines
3.2 KiB
Java
package com.facebook.login;
|
|
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import com.facebook.AccessToken;
|
|
import com.facebook.AccessTokenSource;
|
|
import com.facebook.login.LoginClient;
|
|
import java.util.Collection;
|
|
import java.util.Date;
|
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
|
|
|
/* loaded from: classes.dex */
|
|
class DeviceAuthMethodHandler extends LoginMethodHandler {
|
|
public static final Parcelable.Creator<DeviceAuthMethodHandler> CREATOR = new Parcelable.Creator() { // from class: com.facebook.login.DeviceAuthMethodHandler.1
|
|
@Override // android.os.Parcelable.Creator
|
|
public DeviceAuthMethodHandler createFromParcel(Parcel parcel) {
|
|
return new DeviceAuthMethodHandler(parcel);
|
|
}
|
|
|
|
@Override // android.os.Parcelable.Creator
|
|
public DeviceAuthMethodHandler[] newArray(int i) {
|
|
return new DeviceAuthMethodHandler[i];
|
|
}
|
|
};
|
|
private static ScheduledThreadPoolExecutor backgroundExecutor;
|
|
|
|
DeviceAuthMethodHandler(LoginClient loginClient) {
|
|
super(loginClient);
|
|
}
|
|
|
|
public static synchronized ScheduledThreadPoolExecutor getBackgroundExecutor() {
|
|
ScheduledThreadPoolExecutor scheduledThreadPoolExecutor;
|
|
synchronized (DeviceAuthMethodHandler.class) {
|
|
if (backgroundExecutor == null) {
|
|
backgroundExecutor = new ScheduledThreadPoolExecutor(1);
|
|
}
|
|
scheduledThreadPoolExecutor = backgroundExecutor;
|
|
}
|
|
return scheduledThreadPoolExecutor;
|
|
}
|
|
|
|
private void showDialog(LoginClient.Request request) {
|
|
DeviceAuthDialog deviceAuthDialog = new DeviceAuthDialog();
|
|
deviceAuthDialog.a(this.loginClient.getActivity().getSupportFragmentManager(), "login_with_facebook");
|
|
deviceAuthDialog.a(request);
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public int describeContents() {
|
|
return 0;
|
|
}
|
|
|
|
@Override // com.facebook.login.LoginMethodHandler
|
|
String getNameForLogging() {
|
|
return "device_auth";
|
|
}
|
|
|
|
public void onCancel() {
|
|
this.loginClient.completeAndValidate(LoginClient.Result.createCancelResult(this.loginClient.getPendingRequest(), "User canceled log in."));
|
|
}
|
|
|
|
public void onError(Exception exc) {
|
|
this.loginClient.completeAndValidate(LoginClient.Result.createErrorResult(this.loginClient.getPendingRequest(), null, exc.getMessage()));
|
|
}
|
|
|
|
public void onSuccess(String str, String str2, String str3, Collection<String> collection, Collection<String> collection2, AccessTokenSource accessTokenSource, Date date, Date date2) {
|
|
this.loginClient.completeAndValidate(LoginClient.Result.createTokenResult(this.loginClient.getPendingRequest(), new AccessToken(str, str2, str3, collection, collection2, accessTokenSource, date, date2)));
|
|
}
|
|
|
|
@Override // com.facebook.login.LoginMethodHandler
|
|
boolean tryAuthorize(LoginClient.Request request) {
|
|
showDialog(request);
|
|
return true;
|
|
}
|
|
|
|
@Override // com.facebook.login.LoginMethodHandler, android.os.Parcelable
|
|
public void writeToParcel(Parcel parcel, int i) {
|
|
super.writeToParcel(parcel, i);
|
|
}
|
|
|
|
protected DeviceAuthMethodHandler(Parcel parcel) {
|
|
super(parcel);
|
|
}
|
|
}
|