NetMirror.apk
Download file
package com.facebook.react.modules.appstate;
import D2.h;
import com.facebook.fbreact.specs.NativeAppStateSpec;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.LifecycleEventListener;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.WindowFocusChangeListener;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.common.LifecycleState;
import java.util.Map;
import kotlin.jvm.internal.DefaultConstructorMarker;
import r2.n;
import s2.AbstractC0696D;
import v1.InterfaceC0756a;
/* JADX INFO: loaded from: classes.dex */
@InterfaceC0756a(name = "AppState")
public final class AppStateModule extends NativeAppStateSpec implements LifecycleEventListener, WindowFocusChangeListener {
public static final String APP_STATE_ACTIVE = "active";
public static final String APP_STATE_BACKGROUND = "background";
public static final a Companion = new a(null);
private static final String INITIAL_STATE = "initialAppState";
public static final String NAME = "AppState";
private String appState;
public static final class a {
public /* synthetic */ a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private a() {
}
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public AppStateModule(ReactApplicationContext reactApplicationContext) {
super(reactApplicationContext);
h.f(reactApplicationContext, "reactContext");
reactApplicationContext.addLifecycleEventListener(this);
reactApplicationContext.addWindowFocusChangeListener(this);
this.appState = reactApplicationContext.getLifecycleState() == LifecycleState.f6518d ? APP_STATE_ACTIVE : APP_STATE_BACKGROUND;
}
private final WritableMap createAppStateEventMap() {
WritableMap writableMapCreateMap = Arguments.createMap();
writableMapCreateMap.putString("app_state", this.appState);
h.e(writableMapCreateMap, "apply(...)");
return writableMapCreateMap;
}
private final void sendAppStateChangeEvent() {
sendEvent("appStateDidChange", createAppStateEventMap());
}
private final void sendEvent(String str, Object obj) {
ReactApplicationContext reactApplicationContext = getReactApplicationContext();
if (reactApplicationContext != null && reactApplicationContext.hasActiveReactInstance()) {
reactApplicationContext.emitDeviceEvent(str, obj);
}
}
@Override // com.facebook.fbreact.specs.NativeAppStateSpec
public void addListener(String str) {
}
@Override // com.facebook.fbreact.specs.NativeAppStateSpec
public void getCurrentAppState(Callback callback, Callback callback2) {
h.f(callback, "success");
callback.invoke(createAppStateEventMap());
}
@Override // com.facebook.fbreact.specs.NativeAppStateSpec
public Map<String, Object> getTypedExportedConstants() {
return AbstractC0696D.d(n.a(INITIAL_STATE, this.appState));
}
@Override // com.facebook.react.bridge.BaseJavaModule, com.facebook.react.bridge.NativeModule, com.facebook.react.turbomodule.core.interfaces.TurboModule
public void invalidate() {
super.invalidate();
getReactApplicationContext().removeLifecycleEventListener(this);
}
@Override // com.facebook.react.bridge.LifecycleEventListener
public void onHostDestroy() {
}
@Override // com.facebook.react.bridge.LifecycleEventListener
public void onHostPause() {
this.appState = APP_STATE_BACKGROUND;
sendAppStateChangeEvent();
}
@Override // com.facebook.react.bridge.LifecycleEventListener
public void onHostResume() {
this.appState = APP_STATE_ACTIVE;
sendAppStateChangeEvent();
}
@Override // com.facebook.react.bridge.WindowFocusChangeListener
public void onWindowFocusChange(boolean z3) {
sendEvent("appStateFocusChange", Boolean.valueOf(z3));
}
@Override // com.facebook.fbreact.specs.NativeAppStateSpec
public void removeListeners(double d4) {
}
}
⚠️ 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