Simplify API of getReactApplicationContextIfActiveOrWarn

Summary:
Simplify the API of `getReactApplicationContextIfActiveOrWarn`. We don't need to pass so much information into this method to collect good SoftExceptions.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18134400

fbshipit-source-id: 0a250ab0252a44121f3339a31506a0a6c4c7cd35
This commit is contained in:
Joshua Gross
2019-10-25 16:14:21 -07:00
committed by Facebook Github Bot
parent a1a56fe4e5
commit 9446277fc1
14 changed files with 23 additions and 45 deletions
@@ -116,8 +116,7 @@ public class NativeAnimatedModule extends ReactContextBaseJavaModule
@Override
public void initialize() {
ReactApplicationContext reactApplicationContext =
getReactApplicationContextIfActiveOrWarn(NAME, "initialize");
ReactApplicationContext reactApplicationContext = getReactApplicationContextIfActiveOrWarn();
if (reactApplicationContext != null) {
UIManagerModule uiManager = reactApplicationContext.getNativeModule(UIManagerModule.class);
@@ -179,8 +178,7 @@ public class NativeAnimatedModule extends ReactContextBaseJavaModule
private NativeAnimatedNodesManager getNodesManager() {
if (mNodesManager == null) {
ReactApplicationContext reactApplicationContext =
getReactApplicationContextIfActiveOrWarn(NAME, "getNodesManager");
ReactApplicationContext reactApplicationContext = getReactApplicationContextIfActiveOrWarn();
if (reactApplicationContext != null) {
UIManagerModule uiManager = reactApplicationContext.getNativeModule(UIManagerModule.class);
@@ -229,8 +227,7 @@ public class NativeAnimatedModule extends ReactContextBaseJavaModule
onAnimatedValueData.putDouble("value", value);
ReactApplicationContext reactApplicationContext =
getReactApplicationContextIfActiveOrWarn(
NAME, "startListeningToAnimatedNodeValue.onValueUpdate");
getReactApplicationContextIfActiveOrWarn();
if (reactApplicationContext != null) {
reactApplicationContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)