From 5d1d7fe5c3faca9b233114a78941cbc03cb35dcc Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 6 Aug 2018 15:20:18 +0200 Subject: [PATCH] User can disable crash reporting. --- .../comunic/client/ui/activities/MainActivity.java | 12 +++++++----- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/app_preferences.xml | 7 +++++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java index 68a8f69..5d42f0d 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java @@ -100,11 +100,13 @@ public class MainActivity extends AppCompatActivity implements protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - //Initialize crash reporter - CrashReporter reporter = new CrashReporter(this, BuildConfig.crash_reporter_url, - BuildConfig.crash_reporter_key); - reporter.uploadAwaitingReport(); - Thread.setDefaultUncaughtExceptionHandler(reporter); + //Initialize crash reporter (if enabled) + if(PreferencesUtils.getBoolean(this, "enable_crash_reporting", true)){ + CrashReporter reporter = new CrashReporter(this, BuildConfig.crash_reporter_url, + BuildConfig.crash_reporter_key); + reporter.uploadAwaitingReport(); + Thread.setDefaultUncaughtExceptionHandler(reporter); + } //Initialize account objects accountHelper = new AccountHelper(this); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2ac8d33..0463eb2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -209,4 +209,6 @@ sent a request to join the group accepted your request to join the group rejected your request to join the group + Send crash reports + Help us improve Comunic by sending anonymous reports when the application crash. diff --git a/app/src/main/res/xml/app_preferences.xml b/app/src/main/res/xml/app_preferences.xml index 8eeb7d4..daa81e4 100644 --- a/app/src/main/res/xml/app_preferences.xml +++ b/app/src/main/res/xml/app_preferences.xml @@ -16,4 +16,11 @@ android:title="@string/preference_debug_mode_title" android:summary="@string/preference_debug_mode_summary" /> + + + \ No newline at end of file