mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-14 18:07:16 +01:00
106 lines
6 KiB
Java
106 lines
6 KiB
Java
package com.facebook.react.packagerconnection;
|
|
|
|
import android.content.Context;
|
|
import android.content.SharedPreferences;
|
|
import android.preference.PreferenceManager;
|
|
import com.dee.app.contacts.common.constants.Constants;
|
|
import com.facebook.common.logging.FLog;
|
|
import com.facebook.react.modules.systeminfo.AndroidInfoHelpers;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
import kotlin.Metadata;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Metadata(d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010%\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0010$\n\u0002\b\u0004\b\u0016\u0018\u0000 \u001c2\u00020\u0001:\u0001\u001cB\u000f\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0004\b\u0004\u0010\u0005J\b\u0010\u0013\u001a\u00020\u0014H\u0016J\u0016\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0016\u001a\u00020\t2\u0006\u0010\u0017\u001a\u00020\tR\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\b\u001a\u00020\t¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000bR\u001a\u0010\f\u001a\u000e\u0012\u0004\u0012\u00020\t\u0012\u0004\u0012\u00020\t0\rX\u0082\u0004¢\u0006\u0002\n\u0000R$\u0010\u000f\u001a\u00020\t2\u0006\u0010\u000e\u001a\u00020\t8V@VX\u0096\u000e¢\u0006\f\u001a\u0004\b\u0010\u0010\u000b\"\u0004\b\u0011\u0010\u0012R\u001d\u0010\u0018\u001a\u000e\u0012\u0004\u0012\u00020\t\u0012\u0004\u0012\u00020\t0\u00198F¢\u0006\u0006\u001a\u0004\b\u001a\u0010\u001b¨\u0006\u001d"}, d2 = {"Lcom/facebook/react/packagerconnection/PackagerConnectionSettings;", "", "appContext", "Landroid/content/Context;", "<init>", "(Landroid/content/Context;)V", "preferences", "Landroid/content/SharedPreferences;", "packageName", "", "getPackageName", "()Ljava/lang/String;", "_additionalOptionsForPackager", "", "host", "debugServerHost", "getDebugServerHost", "setDebugServerHost", "(Ljava/lang/String;)V", "resetDebugServerHost", "", "setAdditionalOptionForPackager", "key", "value", "additionalOptionsForPackager", "", "getAdditionalOptionsForPackager", "()Ljava/util/Map;", "Companion", "ReactAndroid_release"}, k = 1, mv = {2, 1, 0}, xi = 48)
|
|
/* loaded from: classes6.dex */
|
|
public class PackagerConnectionSettings {
|
|
|
|
@NotNull
|
|
private static final String PREFS_DEBUG_SERVER_HOST_KEY = "debug_http_host";
|
|
|
|
@NotNull
|
|
private final Map<String, String> _additionalOptionsForPackager;
|
|
|
|
@NotNull
|
|
private final Context appContext;
|
|
|
|
@NotNull
|
|
private final String packageName;
|
|
|
|
@NotNull
|
|
private final SharedPreferences preferences;
|
|
|
|
@NotNull
|
|
private static final Companion Companion = new Companion(null);
|
|
private static final String TAG = "PackagerConnectionSettings";
|
|
|
|
public PackagerConnectionSettings(@NotNull Context context) {
|
|
context.getClass();
|
|
this.appContext = context;
|
|
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
|
defaultSharedPreferences.getClass();
|
|
this.preferences = defaultSharedPreferences;
|
|
String packageName = context.getPackageName();
|
|
packageName.getClass();
|
|
this.packageName = packageName;
|
|
this._additionalOptionsForPackager = new LinkedHashMap();
|
|
}
|
|
|
|
@NotNull
|
|
public final Map<String, String> getAdditionalOptionsForPackager() {
|
|
return this._additionalOptionsForPackager;
|
|
}
|
|
|
|
@NotNull
|
|
public String getDebugServerHost() {
|
|
String string = this.preferences.getString(PREFS_DEBUG_SERVER_HOST_KEY, null);
|
|
if (string != null && string.length() != 0) {
|
|
return string;
|
|
}
|
|
String serverHost = AndroidInfoHelpers.getServerHost(this.appContext);
|
|
if (Intrinsics.areEqual(serverHost, "localhost")) {
|
|
FLog.w(TAG, "You seem to be running on device. Run '" + AndroidInfoHelpers.getAdbReverseTcpCommand(this.appContext) + "' to forward the debug server's port to the device.");
|
|
}
|
|
return serverHost;
|
|
}
|
|
|
|
@NotNull
|
|
public final String getPackageName() {
|
|
return this.packageName;
|
|
}
|
|
|
|
public void resetDebugServerHost() {
|
|
this.preferences.edit().remove(PREFS_DEBUG_SERVER_HOST_KEY).apply();
|
|
}
|
|
|
|
public final void setAdditionalOptionForPackager(@NotNull String key, @NotNull String value) {
|
|
key.getClass();
|
|
value.getClass();
|
|
this._additionalOptionsForPackager.put(key, value);
|
|
}
|
|
|
|
public void setDebugServerHost(@NotNull String str) {
|
|
str.getClass();
|
|
int length = str.length();
|
|
SharedPreferences sharedPreferences = this.preferences;
|
|
if (length == 0) {
|
|
sharedPreferences.edit().remove(PREFS_DEBUG_SERVER_HOST_KEY).apply();
|
|
} else {
|
|
sharedPreferences.edit().putString(PREFS_DEBUG_SERVER_HOST_KEY, str).apply();
|
|
}
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0082\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003R\u0016\u0010\u0004\u001a\n \u0006*\u0004\u0018\u00010\u00050\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0005X\u0082T¢\u0006\u0002\n\u0000¨\u0006\b"}, d2 = {"Lcom/facebook/react/packagerconnection/PackagerConnectionSettings$Companion;", "", "<init>", "()V", Constants.LOG_TAG, "", "kotlin.jvm.PlatformType", "PREFS_DEBUG_SERVER_HOST_KEY", "ReactAndroid_release"}, k = 1, mv = {2, 1, 0}, xi = 48)
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
}
|
|
}
|