NetMirror.apk
Download file
package com.facebook.react.bridge;
import g1.C0542a;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.HashSet;
/* JADX INFO: loaded from: classes.dex */
public final class JavaScriptModuleRegistry {
private final HashMap<Class<? extends JavaScriptModule>, JavaScriptModule> mModuleInstances = new HashMap<>();
private static class JavaScriptModuleInvocationHandler implements InvocationHandler {
private final CatalystInstance mCatalystInstance;
private final Class<? extends JavaScriptModule> mModuleInterface;
private String mName;
public JavaScriptModuleInvocationHandler(CatalystInstance catalystInstance, Class<? extends JavaScriptModule> cls) {
this.mCatalystInstance = catalystInstance;
this.mModuleInterface = cls;
if (C0542a.f9423b) {
HashSet hashSet = new HashSet();
for (Method method : cls.getDeclaredMethods()) {
if (!hashSet.add(method.getName())) {
throw new AssertionError("Method overloading is unsupported: " + this.mModuleInterface.getName() + "#" + method.getName());
}
}
}
}
private String getJSModuleName() {
if (this.mName == null) {
this.mName = JavaScriptModuleRegistry.getJSModuleName(this.mModuleInterface);
}
return this.mName;
}
@Override // java.lang.reflect.InvocationHandler
public Object invoke(Object obj, Method method, Object[] objArr) {
this.mCatalystInstance.callFunction(getJSModuleName(), method.getName(), objArr != null ? Arguments.fromJavaArgs(objArr) : new WritableNativeArray());
return null;
}
}
public static String getJSModuleName(Class<? extends JavaScriptModule> cls) {
String simpleName = cls.getSimpleName();
int iLastIndexOf = simpleName.lastIndexOf(36);
return iLastIndexOf != -1 ? simpleName.substring(iLastIndexOf + 1) : simpleName;
}
public synchronized <T extends JavaScriptModule> T getJavaScriptModule(CatalystInstance catalystInstance, Class<T> cls) {
T t3 = (T) this.mModuleInstances.get(cls);
if (t3 != null) {
return t3;
}
T t4 = (T) Proxy.newProxyInstance(cls.getClassLoader(), new Class[]{cls}, new JavaScriptModuleInvocationHandler(catalystInstance, cls));
this.mModuleInstances.put((Class<? extends JavaScriptModule>) cls, t4);
return t4;
}
}
⚠️ This content was hidden by an advertisement filtering extension in your browser. Please disable it and reload the page to access the decompiled content.
We only display one small text ad to keep this service free. Here's what it looks like:
Read the Docs for Business: You write the docs. We do the rest.
Try it today!Ad by EthicalAds
Download file