mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-08 18:13:24 +02:00
Made Bugsbag sessions opt-in
This commit is contained in:
@@ -69,6 +69,7 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bugsnag.android.Bugsnag;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import org.json.JSONArray;
|
||||
@@ -706,6 +707,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
||||
prefs.edit().putBoolean("crash_reports", true).apply();
|
||||
if (cbNotAgain.isChecked())
|
||||
prefs.edit().putBoolean("crash_reports_confirmed", true).apply();
|
||||
Bugsnag.startSession();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
|
||||
|
||||
@@ -108,6 +108,7 @@ public class ApplicationEx extends Application {
|
||||
else
|
||||
config.setReleaseStage(BuildConfig.PLAY_STORE_RELEASE ? "stable/play" : "stable");
|
||||
|
||||
config.setAutoCaptureSessions(false);
|
||||
config.setIgnoreClasses(new String[]{"javax.mail.MessageRemovedException"});
|
||||
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
@@ -115,11 +116,13 @@ public class ApplicationEx extends Application {
|
||||
config.beforeSend(new BeforeSend() {
|
||||
@Override
|
||||
public boolean run(@NonNull Report report) {
|
||||
return prefs.getBoolean("crash_reports", false); // opt-out
|
||||
return prefs.getBoolean("crash_reports", false); // opt-in
|
||||
}
|
||||
});
|
||||
|
||||
Bugsnag.init(this, config);
|
||||
if (prefs.getBoolean("crash_reports", false))
|
||||
Bugsnag.startSession();
|
||||
|
||||
upgrade(this);
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.bugsnag.android.Bugsnag;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
public class FragmentOptionsMisc extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
@@ -164,6 +166,10 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("crash_reports", checked).apply();
|
||||
if (checked)
|
||||
Bugsnag.startSession();
|
||||
else
|
||||
Bugsnag.stopSession();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user