mirror of https://github.com/M66B/FairEmail.git
parent
c3e40d914f
commit
d281e77a48
|
@ -198,7 +198,7 @@ dependencies {
|
||||||
def openpgp_version = "12.0"
|
def openpgp_version = "12.0"
|
||||||
def requery_version = "3.29.0"
|
def requery_version = "3.29.0"
|
||||||
def badge_version = "1.1.22"
|
def badge_version = "1.1.22"
|
||||||
def bugsnag_version = "4.17.2"
|
def bugsnag_version = "4.21.1"
|
||||||
def biweekly_version = "0.6.3"
|
def biweekly_version = "0.6.3"
|
||||||
def photoview_version = "2.3.0"
|
def photoview_version = "2.3.0"
|
||||||
def relinker_version = "1.3.1"
|
def relinker_version = "1.3.1"
|
||||||
|
|
|
@ -45,7 +45,6 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.bugsnag.android.BeforeNotify;
|
import com.bugsnag.android.BeforeNotify;
|
||||||
import com.bugsnag.android.BeforeSend;
|
|
||||||
import com.bugsnag.android.BreadcrumbType;
|
import com.bugsnag.android.BreadcrumbType;
|
||||||
import com.bugsnag.android.Bugsnag;
|
import com.bugsnag.android.Bugsnag;
|
||||||
import com.bugsnag.android.Callback;
|
import com.bugsnag.android.Callback;
|
||||||
|
@ -212,15 +211,46 @@ public class Log {
|
||||||
|
|
||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
|
||||||
config.beforeSend(new BeforeSend() {
|
Bugsnag.init(context, config);
|
||||||
|
|
||||||
|
Client client = Bugsnag.getClient();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Log.i("Disabling orientation listener");
|
||||||
|
Field fOrientationListener = Client.class.getDeclaredField("orientationListener");
|
||||||
|
fOrientationListener.setAccessible(true);
|
||||||
|
OrientationEventListener orientationListener = (OrientationEventListener) fOrientationListener.get(client);
|
||||||
|
orientationListener.disable();
|
||||||
|
Log.i("Disabled orientation listener");
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.e(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
String uuid = prefs.getString("uuid", null);
|
||||||
|
if (uuid == null) {
|
||||||
|
uuid = UUID.randomUUID().toString();
|
||||||
|
prefs.edit().putString("uuid", uuid).apply();
|
||||||
|
}
|
||||||
|
Log.i("uuid=" + uuid);
|
||||||
|
client.setUserId(uuid);
|
||||||
|
|
||||||
|
if (prefs.getBoolean("crash_reports", false))
|
||||||
|
Bugsnag.startSession();
|
||||||
|
|
||||||
|
final String installer = context.getPackageManager().getInstallerPackageName(BuildConfig.APPLICATION_ID);
|
||||||
|
final boolean fingerprint = Helper.hasValidFingerprint(context);
|
||||||
|
|
||||||
|
Bugsnag.beforeNotify(new BeforeNotify() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run(@NonNull Report report) {
|
public boolean run(@NonNull Error error) {
|
||||||
// opt-in
|
// opt-in
|
||||||
boolean crash_reports = prefs.getBoolean("crash_reports", false);
|
boolean crash_reports = prefs.getBoolean("crash_reports", false);
|
||||||
if (!crash_reports)
|
if (!crash_reports)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Throwable ex = report.getError().getException();
|
Throwable ex = error.getException().getCause();
|
||||||
|
if (ex == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (ex instanceof MessagingException &&
|
if (ex instanceof MessagingException &&
|
||||||
(ex.getCause() instanceof IOException ||
|
(ex.getCause() instanceof IOException ||
|
||||||
|
@ -256,42 +286,6 @@ public class Log {
|
||||||
if (count > MAX_CRASH_REPORTS)
|
if (count > MAX_CRASH_REPORTS)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Bugsnag.init(context, config);
|
|
||||||
|
|
||||||
Client client = Bugsnag.getClient();
|
|
||||||
|
|
||||||
try {
|
|
||||||
Log.i("Disabling orientation listener");
|
|
||||||
Field fOrientationListener = Client.class.getDeclaredField("orientationListener");
|
|
||||||
fOrientationListener.setAccessible(true);
|
|
||||||
OrientationEventListener orientationListener = (OrientationEventListener) fOrientationListener.get(client);
|
|
||||||
orientationListener.disable();
|
|
||||||
Log.i("Disabled orientation listener");
|
|
||||||
} catch (Throwable ex) {
|
|
||||||
Log.e(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
String uuid = prefs.getString("uuid", null);
|
|
||||||
if (uuid == null) {
|
|
||||||
uuid = UUID.randomUUID().toString();
|
|
||||||
prefs.edit().putString("uuid", uuid).apply();
|
|
||||||
}
|
|
||||||
Log.i("uuid=" + uuid);
|
|
||||||
client.setUserId(uuid);
|
|
||||||
|
|
||||||
if (prefs.getBoolean("crash_reports", false))
|
|
||||||
Bugsnag.startSession();
|
|
||||||
|
|
||||||
final String installer = context.getPackageManager().getInstallerPackageName(BuildConfig.APPLICATION_ID);
|
|
||||||
final boolean fingerprint = Helper.hasValidFingerprint(context);
|
|
||||||
|
|
||||||
Bugsnag.beforeNotify(new BeforeNotify() {
|
|
||||||
@Override
|
|
||||||
public boolean run(@NonNull Error error) {
|
|
||||||
error.addToTab("extra", "installer", installer == null ? "-" : installer);
|
error.addToTab("extra", "installer", installer == null ? "-" : installer);
|
||||||
error.addToTab("extra", "fingerprint", fingerprint);
|
error.addToTab("extra", "fingerprint", fingerprint);
|
||||||
error.addToTab("extra", "thread", Thread.currentThread().getId());
|
error.addToTab("extra", "thread", Thread.currentThread().getId());
|
||||||
|
@ -300,6 +294,7 @@ public class Log {
|
||||||
String theme = prefs.getString("theme", "light");
|
String theme = prefs.getString("theme", "light");
|
||||||
error.addToTab("extra", "theme", theme);
|
error.addToTab("extra", "theme", theme);
|
||||||
error.addToTab("extra", "package", BuildConfig.APPLICATION_ID);
|
error.addToTab("extra", "package", BuildConfig.APPLICATION_ID);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue