mirror of
https://github.com/TeamNewPipe/NewPipe/
synced 2025-01-31 02:54:55 +01:00
made acra catch and report errors
This commit is contained in:
parent
27bc414616
commit
af2cddee91
@ -31,13 +31,8 @@ public class AcraReportSender implements ReportSender {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void send(Context context, CrashReportData report) throws ReportSenderException {
|
public void send(Context context, CrashReportData report) throws ReportSenderException {
|
||||||
Log.e("Newpipe UI ERROR", report.toString());
|
ErrorActivity.reportError(context, report,
|
||||||
try {
|
ErrorActivity.ErrorInfo.make(ErrorActivity.UI_ERROR,"none",
|
||||||
((String)null).length();
|
"App crash, UI failure", R.string.app_ui_crash));
|
||||||
} catch(Exception e) {
|
|
||||||
ErrorActivity.reportError(context, e, null, null,
|
|
||||||
ErrorActivity.ErrorInfo.make(ErrorActivity.SEARCHED,"none",
|
|
||||||
"App crash, UI failure", R.string.app_ui_crash));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@ import android.widget.Button;
|
|||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.acra.ReportField;
|
||||||
|
import org.acra.collector.CrashReportData;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.schabi.newpipe.extractor.Parser;
|
import org.schabi.newpipe.extractor.Parser;
|
||||||
@ -124,6 +126,7 @@ public class ErrorActivity extends AppCompatActivity {
|
|||||||
public static final int SOMETHING_ELSE = 3;
|
public static final int SOMETHING_ELSE = 3;
|
||||||
public static final int USER_REPORT = 4;
|
public static final int USER_REPORT = 4;
|
||||||
public static final int LOAD_IMAGE = 5;
|
public static final int LOAD_IMAGE = 5;
|
||||||
|
public static final int UI_ERROR = 6;
|
||||||
|
|
||||||
// MESSAGE STRING
|
// MESSAGE STRING
|
||||||
public static final String SEARCHED_STRING = "searched";
|
public static final String SEARCHED_STRING = "searched";
|
||||||
@ -132,6 +135,7 @@ public class ErrorActivity extends AppCompatActivity {
|
|||||||
public static final String SOMETHING_ELSE_STRING = "something";
|
public static final String SOMETHING_ELSE_STRING = "something";
|
||||||
public static final String USER_REPORT_STRING = "user report";
|
public static final String USER_REPORT_STRING = "user report";
|
||||||
public static final String LOAD_IMAGE_STRING = "load image";
|
public static final String LOAD_IMAGE_STRING = "load image";
|
||||||
|
public static final String UI_ERROR_STRING = "ui error";
|
||||||
|
|
||||||
|
|
||||||
public static final String ERROR_EMAIL_ADDRESS = "crashreport@newpipe.schabi.org";
|
public static final String ERROR_EMAIL_ADDRESS = "crashreport@newpipe.schabi.org";
|
||||||
@ -211,6 +215,22 @@ public class ErrorActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void reportError(final Context context, final CrashReportData report, final ErrorInfo errorInfo) {
|
||||||
|
// get key first (don't ask about this solution)
|
||||||
|
ReportField key = null;
|
||||||
|
for(ReportField k : report.keySet()) {
|
||||||
|
if(k.toString().equals("STACK_TRACE")) {
|
||||||
|
key = k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String[] el = new String[] { report.get(key) };
|
||||||
|
|
||||||
|
Intent intent = new Intent(context, ErrorActivity.class);
|
||||||
|
intent.putExtra(ERROR_INFO, errorInfo);
|
||||||
|
intent.putExtra(ERROR_LIST, el);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -397,6 +417,8 @@ public class ErrorActivity extends AppCompatActivity {
|
|||||||
return USER_REPORT_STRING;
|
return USER_REPORT_STRING;
|
||||||
case LOAD_IMAGE:
|
case LOAD_IMAGE:
|
||||||
return LOAD_IMAGE_STRING;
|
return LOAD_IMAGE_STRING;
|
||||||
|
case UI_ERROR:
|
||||||
|
return UI_ERROR_STRING;
|
||||||
default:
|
default:
|
||||||
return "Your description is in another castle.";
|
return "Your description is in another castle.";
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||||
mainFragment = getSupportFragmentManager()
|
mainFragment = getSupportFragmentManager()
|
||||||
.findFragmentById(R.id.search_fragment);
|
.findFragmentById(R.id.search_fragment);
|
||||||
|
|
||||||
|
((String)null).length();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user