80 lines
3.0 KiB
Java
80 lines
3.0 KiB
Java
package com.facebook;
|
|
|
|
import android.app.Activity;
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.IntentFilter;
|
|
import android.os.Bundle;
|
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
import com.facebook.internal.CustomTab;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class CustomTabMainActivity extends Activity {
|
|
public static final String c = CustomTabMainActivity.class.getSimpleName() + ".extra_params";
|
|
public static final String d = CustomTabMainActivity.class.getSimpleName() + ".extra_chromePackage";
|
|
public static final String e = CustomTabMainActivity.class.getSimpleName() + ".extra_url";
|
|
public static final String f = CustomTabMainActivity.class.getSimpleName() + ".action_refresh";
|
|
private boolean a = true;
|
|
private BroadcastReceiver b;
|
|
|
|
public static final String a() {
|
|
return "fb" + FacebookSdk.c() + "://authorize";
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onCreate(Bundle bundle) {
|
|
super.onCreate(bundle);
|
|
if (CustomTabActivity.b.equals(getIntent().getAction())) {
|
|
setResult(0);
|
|
finish();
|
|
} else if (bundle == null) {
|
|
Bundle bundleExtra = getIntent().getBundleExtra(c);
|
|
new CustomTab("oauth", bundleExtra).a(this, getIntent().getStringExtra(d));
|
|
this.a = false;
|
|
this.b = new BroadcastReceiver() { // from class: com.facebook.CustomTabMainActivity.1
|
|
@Override // android.content.BroadcastReceiver
|
|
public void onReceive(Context context, Intent intent) {
|
|
Intent intent2 = new Intent(CustomTabMainActivity.this, (Class<?>) CustomTabMainActivity.class);
|
|
intent2.setAction(CustomTabMainActivity.f);
|
|
String str = CustomTabMainActivity.e;
|
|
intent2.putExtra(str, intent.getStringExtra(str));
|
|
intent2.addFlags(603979776);
|
|
CustomTabMainActivity.this.startActivity(intent2);
|
|
}
|
|
};
|
|
LocalBroadcastManager.a(this).a(this.b, new IntentFilter(CustomTabActivity.b));
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onNewIntent(Intent intent) {
|
|
super.onNewIntent(intent);
|
|
if (f.equals(intent.getAction())) {
|
|
LocalBroadcastManager.a(this).a(new Intent(CustomTabActivity.c));
|
|
a(-1, intent);
|
|
} else if (CustomTabActivity.b.equals(intent.getAction())) {
|
|
a(-1, intent);
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onResume() {
|
|
super.onResume();
|
|
if (this.a) {
|
|
a(0, null);
|
|
}
|
|
this.a = true;
|
|
}
|
|
|
|
private void a(int i, Intent intent) {
|
|
LocalBroadcastManager.a(this).a(this.b);
|
|
if (intent != null) {
|
|
setResult(i, intent);
|
|
} else {
|
|
setResult(i);
|
|
}
|
|
finish();
|
|
}
|
|
}
|