Add Context to Redbox report api

Differential Revision: D6700021

fbshipit-source-id: b8ba8242a68c02e608900c93a7645d61158cc0cb
This commit is contained in:
Andrew Chen (Eng)
2018-01-11 15:08:28 -08:00
committed by Facebook Github Bot
parent 8f358a2088
commit e3c27f585a
3 changed files with 15 additions and 15 deletions

View File

@@ -350,7 +350,7 @@ public class DevSupportManagerImpl implements
// JS errors are reported here after source mapping.
if (mRedBoxHandler != null) {
mRedBoxHandler.handleRedbox(message, stack, RedBoxHandler.ErrorType.JS);
mRedBoxDialog.resetReporting(true);
mRedBoxDialog.resetReporting();
}
mRedBoxDialog.show();
}
@@ -403,10 +403,8 @@ public class DevSupportManagerImpl implements
// inside {@link #updateJSError} after source mapping.
if (mRedBoxHandler != null && errorType == ErrorType.NATIVE) {
mRedBoxHandler.handleRedbox(message, stack, RedBoxHandler.ErrorType.NATIVE);
mRedBoxDialog.resetReporting(true);
} else {
mRedBoxDialog.resetReporting(false);
}
mRedBoxDialog.resetReporting();
mRedBoxDialog.show();
}
});

View File

@@ -99,10 +99,11 @@ import org.json.JSONObject;
String sourceUrl = mDevSupportManager.getSourceUrl();
mRedBoxHandler.reportRedbox(
title,
stack,
sourceUrl,
Assertions.assertNotNull(mReportCompletedListener));
view.getContext(),
title,
stack,
sourceUrl,
Assertions.assertNotNull(mReportCompletedListener));
}
};
@@ -322,7 +323,7 @@ import org.json.JSONObject;
/**
* Show the report button, hide the report textview and the loading indicator.
*/
public void resetReporting(boolean enabled) {
public void resetReporting() {
if (mRedBoxHandler == null || !mRedBoxHandler.isReportEnabled()) {
return;
}
@@ -330,8 +331,7 @@ import org.json.JSONObject;
Assertions.assertNotNull(mReportTextView).setVisibility(View.GONE);
Assertions.assertNotNull(mLoadingIndicator).setVisibility(View.GONE);
Assertions.assertNotNull(mLineSeparator).setVisibility(View.GONE);
Assertions.assertNotNull(mReportButton).setVisibility(
enabled ? View.VISIBLE : View.GONE);
Assertions.assertNotNull(mReportButton).setVisibility(View.VISIBLE);
Assertions.assertNotNull(mReportButton).setEnabled(true);
}

View File

@@ -9,6 +9,7 @@
package com.facebook.react.devsupport;
import android.content.Context;
import android.text.SpannedString;
import com.facebook.react.devsupport.interfaces.StackFrame;
@@ -54,8 +55,9 @@ public interface RedBoxHandler {
* Report the information from the redbox and set up a callback listener.
*/
void reportRedbox(
String title,
StackFrame[] stack,
String sourceUrl,
ReportCompletedListener reportCompletedListener);
Context context,
String title,
StackFrame[] stack,
String sourceUrl,
ReportCompletedListener reportCompletedListener);
}