diff --git a/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java b/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java index d69649aad..feed75360 100644 --- a/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java +++ b/app/src/main/java/org/schabi/newpipe/report/ErrorActivity.java @@ -4,6 +4,7 @@ import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.graphics.Color; import android.net.Uri; import android.os.Build; @@ -19,6 +20,7 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NavUtils; +import androidx.preference.PreferenceManager; import com.google.android.material.snackbar.Snackbar; import com.grack.nanojson.JsonWriter; @@ -94,6 +96,13 @@ public class ErrorActivity extends AppCompatActivity { public static void reportError(final Context context, final List el, final Class returnActivity, final View rootView, final ErrorInfo errorInfo) { + final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + + if (prefs.getBoolean(context + .getString(R.string.disable_error_reports_key), false)) { + return; + } + if (rootView != null) { Snackbar.make(rootView, R.string.error_snackbar_message, 3 * 1000) .setActionTextColor(Color.YELLOW) diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 77343514c..f47f08a5c 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -371,6 +371,7 @@ enable_local_player disable_tablet_ui disable_tv_ui + disable_error_reports system diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ce7c3c117..e095d2e2b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -764,4 +764,6 @@ Ignore tablet layouts. This is intended for specific workarounds. You may need to restart the app to see the effects. Disable TV UI Ignore TV layouts. This is intended for specific workarounds. You may need to restart the app to see the effects. + Disable Error Reporting + Prevent all error reporting screens from appearing. This may result in the app behaving unexpectedly. USE AT YOUR OWN RISK! diff --git a/app/src/main/res/xml/extra_settings.xml b/app/src/main/res/xml/extra_settings.xml index b809ab6cb..2bd3e87cc 100644 --- a/app/src/main/res/xml/extra_settings.xml +++ b/app/src/main/res/xml/extra_settings.xml @@ -30,8 +30,8 @@ + android:key="@string/disable_error_reports_key" + android:summary="@string/disable_error_reports_summary" + android:title="@string/disable_error_reports_title"/> \ No newline at end of file