jimu-decompiled/sources/com/facebook/internal/FacebookDialogFragment.java
2025-05-13 19:24:51 +02:00

119 lines
4.7 KiB
Java

package com.facebook.internal;
import android.app.Dialog;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.internal.WebDialog;
/* loaded from: classes.dex */
public class FacebookDialogFragment extends DialogFragment {
private Dialog j;
/* JADX INFO: Access modifiers changed from: private */
public void b(Bundle bundle) {
FragmentActivity activity = getActivity();
Intent intent = new Intent();
if (bundle == null) {
bundle = new Bundle();
}
intent.putExtras(bundle);
activity.setResult(-1, intent);
activity.finish();
}
@Override // androidx.fragment.app.Fragment, android.content.ComponentCallbacks
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
if ((this.j instanceof WebDialog) && isResumed()) {
((WebDialog) this.j).d();
}
}
@Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
public void onCreate(Bundle bundle) {
WebDialog webDialog;
super.onCreate(bundle);
if (this.j == null) {
FragmentActivity activity = getActivity();
Bundle d = NativeProtocol.d(activity.getIntent());
if (d.getBoolean("is_fallback", false)) {
String string = d.getString("url");
if (Utility.c(string)) {
Utility.a("FacebookDialogFragment", "Cannot start a fallback WebDialog with an empty/missing 'url'");
activity.finish();
return;
} else {
FacebookWebFallbackDialog facebookWebFallbackDialog = new FacebookWebFallbackDialog(activity, string, String.format("fb%s://bridge/", FacebookSdk.c()));
facebookWebFallbackDialog.a(new WebDialog.OnCompleteListener() { // from class: com.facebook.internal.FacebookDialogFragment.2
@Override // com.facebook.internal.WebDialog.OnCompleteListener
public void a(Bundle bundle2, FacebookException facebookException) {
FacebookDialogFragment.this.b(bundle2);
}
});
webDialog = facebookWebFallbackDialog;
}
} else {
String string2 = d.getString("action");
Bundle bundle2 = d.getBundle("params");
if (Utility.c(string2)) {
Utility.a("FacebookDialogFragment", "Cannot start a WebDialog with an empty/missing 'actionName'");
activity.finish();
return;
} else {
WebDialog.Builder builder = new WebDialog.Builder(activity, string2, bundle2);
builder.a(new WebDialog.OnCompleteListener() { // from class: com.facebook.internal.FacebookDialogFragment.1
@Override // com.facebook.internal.WebDialog.OnCompleteListener
public void a(Bundle bundle3, FacebookException facebookException) {
FacebookDialogFragment.this.a(bundle3, facebookException);
}
});
webDialog = builder.a();
}
}
this.j = webDialog;
}
}
@Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
public void onDestroyView() {
if (b() != null && getRetainInstance()) {
b().setDismissMessage(null);
}
super.onDestroyView();
}
@Override // androidx.fragment.app.Fragment
public void onResume() {
super.onResume();
Dialog dialog = this.j;
if (dialog instanceof WebDialog) {
((WebDialog) dialog).d();
}
}
public void a(Dialog dialog) {
this.j = dialog;
}
@Override // androidx.fragment.app.DialogFragment
public Dialog a(Bundle bundle) {
if (this.j == null) {
a((Bundle) null, (FacebookException) null);
b(false);
}
return this.j;
}
/* JADX INFO: Access modifiers changed from: private */
public void a(Bundle bundle, FacebookException facebookException) {
FragmentActivity activity = getActivity();
activity.setResult(facebookException == null ? -1 : 0, NativeProtocol.a(activity.getIntent(), bundle, facebookException));
activity.finish();
}
}