Permalink
Browse files

Add Context to Redbox report api

Differential Revision: D6700021

fbshipit-source-id: b8ba8242a68c02e608900c93a7645d61158cc0cb
  • Loading branch information...
ayc1 authored and facebook-github-bot committed Jan 11, 2018
1 parent 8f358a2 commit e3c27f585aaeb685e86250f45fc790c06932af0d
@@ -350,7 +350,7 @@ public void run() {
// 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 void run() {
// 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();
}
});
@@ -99,10 +99,11 @@ public void onClick(View view) {
String sourceUrl = mDevSupportManager.getSourceUrl();
mRedBoxHandler.reportRedbox(
title,
stack,
sourceUrl,
Assertions.assertNotNull(mReportCompletedListener));
view.getContext(),
title,
stack,
sourceUrl,
Assertions.assertNotNull(mReportCompletedListener));
}
};
@@ -322,16 +323,15 @@ public void setExceptionDetails(String title, StackFrame[] stack) {
/**
* 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;
}
isReporting = false;
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);
}
@@ -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 String getName() {
* 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);
}

0 comments on commit e3c27f5

Please sign in to comment.