mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-31 01:51:24 +01:00
Bugsnag integration
This commit is contained in:
@@ -37,9 +37,14 @@ import android.os.Handler;
|
||||
import android.os.RemoteException;
|
||||
import android.webkit.CookieManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.bugsnag.android.BeforeSend;
|
||||
import com.bugsnag.android.Bugsnag;
|
||||
import com.bugsnag.android.Report;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@@ -68,6 +73,7 @@ public class ApplicationEx extends Application {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
logMemory("App create version=" + BuildConfig.VERSION_NAME);
|
||||
|
||||
prev = Thread.getDefaultUncaughtExceptionHandler();
|
||||
@@ -91,6 +97,30 @@ public class ApplicationEx extends Application {
|
||||
}
|
||||
});
|
||||
|
||||
// https://docs.bugsnag.com/platforms/android/sdk/
|
||||
com.bugsnag.android.Configuration config =
|
||||
new com.bugsnag.android.Configuration("9d2d57476a0614974449a3ec33f2604a");
|
||||
|
||||
if (BuildConfig.DEBUG)
|
||||
config.setReleaseStage("development");
|
||||
else if (BuildConfig.BETA_RELEASE)
|
||||
config.setReleaseStage(BuildConfig.PLAY_STORE_RELEASE ? "beta/play" : "beta");
|
||||
else
|
||||
config.setReleaseStage(BuildConfig.PLAY_STORE_RELEASE ? "stable/play" : "stable");
|
||||
|
||||
config.setIgnoreClasses(new String[]{"javax.mail.MessageRemovedException"});
|
||||
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
config.beforeSend(new BeforeSend() {
|
||||
@Override
|
||||
public boolean run(@NonNull Report report) {
|
||||
return prefs.getBoolean("crash_reports", false); // opt-out
|
||||
}
|
||||
});
|
||||
|
||||
Bugsnag.init(this, config);
|
||||
|
||||
upgrade(this);
|
||||
|
||||
createNotificationChannels();
|
||||
|
||||
Reference in New Issue
Block a user