Initial commit
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
package com.facebook.appevents.internal;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import bolts.AppLinks;
|
||||
import com.facebook.FacebookSdk;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class SourceApplicationInfo {
|
||||
private String a;
|
||||
private boolean b;
|
||||
|
||||
public static class Factory {
|
||||
public static SourceApplicationInfo a(Activity activity) {
|
||||
ComponentName callingActivity = activity.getCallingActivity();
|
||||
if (callingActivity == null) {
|
||||
return null;
|
||||
}
|
||||
String packageName = callingActivity.getPackageName();
|
||||
if (packageName.equals(activity.getPackageName())) {
|
||||
return null;
|
||||
}
|
||||
Intent intent = activity.getIntent();
|
||||
boolean z = false;
|
||||
if (intent != null && !intent.getBooleanExtra("_fbSourceApplicationHasBeenSet", false)) {
|
||||
intent.putExtra("_fbSourceApplicationHasBeenSet", true);
|
||||
Bundle a = AppLinks.a(intent);
|
||||
if (a != null) {
|
||||
Bundle bundle = a.getBundle("referer_app_link");
|
||||
if (bundle != null) {
|
||||
packageName = bundle.getString("package");
|
||||
}
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
intent.putExtra("_fbSourceApplicationHasBeenSet", true);
|
||||
return new SourceApplicationInfo(packageName, z);
|
||||
}
|
||||
}
|
||||
|
||||
public static void b() {
|
||||
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.b()).edit();
|
||||
edit.remove("com.facebook.appevents.SourceApplicationInfo.callingApplicationPackage");
|
||||
edit.remove("com.facebook.appevents.SourceApplicationInfo.openedByApplink");
|
||||
edit.apply();
|
||||
}
|
||||
|
||||
public static SourceApplicationInfo c() {
|
||||
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.b());
|
||||
if (defaultSharedPreferences.contains("com.facebook.appevents.SourceApplicationInfo.callingApplicationPackage")) {
|
||||
return new SourceApplicationInfo(defaultSharedPreferences.getString("com.facebook.appevents.SourceApplicationInfo.callingApplicationPackage", null), defaultSharedPreferences.getBoolean("com.facebook.appevents.SourceApplicationInfo.openedByApplink", false));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void a() {
|
||||
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(FacebookSdk.b()).edit();
|
||||
edit.putString("com.facebook.appevents.SourceApplicationInfo.callingApplicationPackage", this.a);
|
||||
edit.putBoolean("com.facebook.appevents.SourceApplicationInfo.openedByApplink", this.b);
|
||||
edit.apply();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String str = this.b ? "Applink" : "Unclassified";
|
||||
if (this.a == null) {
|
||||
return str;
|
||||
}
|
||||
return str + "(" + this.a + ")";
|
||||
}
|
||||
|
||||
private SourceApplicationInfo(String str, boolean z) {
|
||||
this.a = str;
|
||||
this.b = z;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user