Allow to opt-out from crash reports

This commit is contained in:
stom79 2018-08-30 18:46:40 +02:00
parent 286ffdd711
commit 4f386391e0
4 changed files with 29 additions and 0 deletions

View File

@ -50,6 +50,8 @@ import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import org.acra.ACRA;
import fr.gouv.etalab.mastodon.activities.MainActivity;
import fr.gouv.etalab.mastodon.client.Entities.Account;
import fr.gouv.etalab.mastodon.helper.Helper;
@ -128,6 +130,19 @@ public class SettingsFragment extends Fragment {
}
});
boolean enabledCrash = sharedpreferences.getBoolean(ACRA.PREF_ENABLE_ACRA, true);
final CheckBox set_crash_report = rootView.findViewById(R.id.set_crash_report);
set_crash_report.setChecked(enabledCrash);
set_crash_report.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(ACRA.PREF_ENABLE_ACRA, !set_crash_report.isChecked());
editor.apply();
}
});
boolean preview_reply = sharedpreferences.getBoolean(Helper.SET_PREVIEW_REPLIES, false);
final CheckBox set_preview_reply = rootView.findViewById(R.id.set_preview_reply);
final LinearLayout set_preview_reply_pp_container = rootView.findViewById(R.id.set_preview_reply_pp_container);
@ -148,6 +163,7 @@ public class SettingsFragment extends Fragment {
}
});
if( !preview_reply){
set_preview_reply_pp_container.setVisibility(View.GONE);
}else{

View File

@ -184,6 +184,12 @@
android:text="@string/set_automatically_split_toot"
android:layout_height="wrap_content" />
<CheckBox
android:id="@+id/set_crash_report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send_crash_report"
/>
<!-- Resize pictures -->
<LinearLayout
android:layout_marginTop="10dp"

View File

@ -186,6 +186,12 @@
android:layout_height="wrap_content" />
<CheckBox
android:id="@+id/set_crash_report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send_crash_report"
/>
<!-- Resize pictures -->
<LinearLayout

View File

@ -550,6 +550,7 @@
<string name="which_language">Translate in</string>
<string name="crash_title">Mastalab has stopped :(</string>
<string name="crash_message">You can send me by email the crash report. It will help to fix it :)\n\nYou can add additional content. Thank you!</string>
<string name="send_crash_report">Ask for sending crash reports by email?</string>
<string-array translatable="false" name="proxy_type_choice">
<item>HTTP</item>
<item>SOCKS</item>