72 lines
2.6 KiB
Java
72 lines
2.6 KiB
Java
package com.facebook.internal;
|
|
|
|
import android.content.Context;
|
|
import android.net.Uri;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.webkit.WebView;
|
|
import com.unity3d.ads.metadata.MediationMetaData;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class FacebookWebFallbackDialog extends WebDialog {
|
|
private static final String m = FacebookWebFallbackDialog.class.getName();
|
|
private boolean l;
|
|
|
|
public FacebookWebFallbackDialog(Context context, String str, String str2) {
|
|
super(context, str);
|
|
b(str2);
|
|
}
|
|
|
|
@Override // com.facebook.internal.WebDialog, android.app.Dialog, android.content.DialogInterface
|
|
public void cancel() {
|
|
WebView a = a();
|
|
if (!c() || b() || a == null || !a.isShown()) {
|
|
super.cancel();
|
|
return;
|
|
}
|
|
if (this.l) {
|
|
return;
|
|
}
|
|
this.l = true;
|
|
a.loadUrl("javascript:(function() { var event = document.createEvent('Event'); event.initEvent('fbPlatformDialogMustClose',true,true); document.dispatchEvent(event);})();");
|
|
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { // from class: com.facebook.internal.FacebookWebFallbackDialog.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
FacebookWebFallbackDialog.super.cancel();
|
|
}
|
|
}, 1500L);
|
|
}
|
|
|
|
@Override // com.facebook.internal.WebDialog
|
|
protected Bundle a(String str) {
|
|
Bundle d = Utility.d(Uri.parse(str).getQuery());
|
|
String string = d.getString("bridge_args");
|
|
d.remove("bridge_args");
|
|
if (!Utility.c(string)) {
|
|
try {
|
|
d.putBundle("com.facebook.platform.protocol.BRIDGE_ARGS", BundleJSONConverter.a(new JSONObject(string)));
|
|
} catch (JSONException e) {
|
|
Utility.a(m, "Unable to parse bridge_args JSON", e);
|
|
}
|
|
}
|
|
String string2 = d.getString("method_results");
|
|
d.remove("method_results");
|
|
if (!Utility.c(string2)) {
|
|
if (Utility.c(string2)) {
|
|
string2 = "{}";
|
|
}
|
|
try {
|
|
d.putBundle("com.facebook.platform.protocol.RESULT_ARGS", BundleJSONConverter.a(new JSONObject(string2)));
|
|
} catch (JSONException e2) {
|
|
Utility.a(m, "Unable to parse bridge_args JSON", e2);
|
|
}
|
|
}
|
|
d.remove(MediationMetaData.KEY_VERSION);
|
|
d.putInt("com.facebook.platform.protocol.PROTOCOL_VERSION", NativeProtocol.e());
|
|
return d;
|
|
}
|
|
}
|