119 lines
3.4 KiB
Java
119 lines
3.4 KiB
Java
package com.facebook.internal;
|
|
|
|
import android.app.Activity;
|
|
import android.util.Log;
|
|
import com.facebook.FacebookDialog;
|
|
import com.facebook.FacebookException;
|
|
import com.facebook.FacebookSdk;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class FacebookDialogBase<CONTENT, RESULT> implements FacebookDialog<CONTENT, RESULT> {
|
|
protected static final Object e = new Object();
|
|
private final Activity a;
|
|
private final FragmentWrapper b;
|
|
private List<FacebookDialogBase<CONTENT, RESULT>.ModeHandler> c;
|
|
private int d;
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public abstract class ModeHandler {
|
|
protected ModeHandler(FacebookDialogBase facebookDialogBase) {
|
|
}
|
|
|
|
public abstract AppCall a(CONTENT content);
|
|
|
|
public Object a() {
|
|
return FacebookDialogBase.e;
|
|
}
|
|
|
|
public abstract boolean a(CONTENT content, boolean z);
|
|
}
|
|
|
|
protected FacebookDialogBase(Activity activity, int i) {
|
|
Validate.a(activity, "activity");
|
|
this.a = activity;
|
|
this.b = null;
|
|
this.d = i;
|
|
}
|
|
|
|
private List<FacebookDialogBase<CONTENT, RESULT>.ModeHandler> e() {
|
|
if (this.c == null) {
|
|
this.c = c();
|
|
}
|
|
return this.c;
|
|
}
|
|
|
|
protected abstract AppCall a();
|
|
|
|
public void a(CONTENT content) {
|
|
a(content, e);
|
|
}
|
|
|
|
protected Activity b() {
|
|
Activity activity = this.a;
|
|
if (activity != null) {
|
|
return activity;
|
|
}
|
|
FragmentWrapper fragmentWrapper = this.b;
|
|
if (fragmentWrapper == null) {
|
|
return null;
|
|
}
|
|
fragmentWrapper.a();
|
|
throw null;
|
|
}
|
|
|
|
protected abstract List<FacebookDialogBase<CONTENT, RESULT>.ModeHandler> c();
|
|
|
|
public int d() {
|
|
return this.d;
|
|
}
|
|
|
|
protected void a(CONTENT content, Object obj) {
|
|
AppCall b = b(content, obj);
|
|
if (b == null) {
|
|
Log.e("FacebookDialog", "No code path should ever result in a null appCall");
|
|
if (FacebookSdk.n()) {
|
|
throw new IllegalStateException("No code path should ever result in a null appCall");
|
|
}
|
|
} else {
|
|
FragmentWrapper fragmentWrapper = this.b;
|
|
if (fragmentWrapper == null) {
|
|
DialogPresenter.a(b, this.a);
|
|
} else {
|
|
DialogPresenter.a(b, fragmentWrapper);
|
|
throw null;
|
|
}
|
|
}
|
|
}
|
|
|
|
private AppCall b(CONTENT content, Object obj) {
|
|
boolean z = obj == e;
|
|
AppCall appCall = null;
|
|
Iterator<FacebookDialogBase<CONTENT, RESULT>.ModeHandler> it = e().iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
break;
|
|
}
|
|
FacebookDialogBase<CONTENT, RESULT>.ModeHandler next = it.next();
|
|
if (z || Utility.a(next.a(), obj)) {
|
|
if (next.a(content, true)) {
|
|
try {
|
|
appCall = next.a(content);
|
|
break;
|
|
} catch (FacebookException e2) {
|
|
appCall = a();
|
|
DialogPresenter.b(appCall, e2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (appCall != null) {
|
|
return appCall;
|
|
}
|
|
AppCall a = a();
|
|
DialogPresenter.a(a);
|
|
return a;
|
|
}
|
|
}
|