mirror of https://github.com/M66B/FairEmail.git
Refactoring
This commit is contained in:
parent
d281e77a48
commit
de811cbacc
|
@ -67,7 +67,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
};
|
||||
|
||||
private final static String[] RESET_QUESTIONS = new String[]{
|
||||
"welcome", "crash_reports_asked",
|
||||
"welcome", "crash_reports_asked", "crash_report_count",
|
||||
"print_html_confirmed",
|
||||
"identities_asked", "delete_ref_confirmed", "send_dialog"
|
||||
};
|
||||
|
|
|
@ -249,9 +249,23 @@ public class Log {
|
|||
return false;
|
||||
|
||||
Throwable ex = error.getException().getCause();
|
||||
if (ex == null)
|
||||
return true;
|
||||
if (shouldReport(ex)) {
|
||||
error.addToTab("extra", "installer", installer == null ? "-" : installer);
|
||||
error.addToTab("extra", "package", BuildConfig.APPLICATION_ID);
|
||||
error.addToTab("extra", "fingerprint", fingerprint);
|
||||
error.addToTab("extra", "thread", Thread.currentThread().getId());
|
||||
error.addToTab("extra", "free", Log.getFreeMemMb());
|
||||
|
||||
String theme = prefs.getString("theme", "light");
|
||||
error.addToTab("extra", "theme", theme);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean shouldReport(Throwable ex) {
|
||||
if (ex instanceof MessagingException &&
|
||||
(ex.getCause() instanceof IOException ||
|
||||
ex.getCause() instanceof ProtocolException))
|
||||
|
@ -280,22 +294,10 @@ public class Log {
|
|||
return false;
|
||||
|
||||
// Rate limit
|
||||
int count = prefs.getInt("crash_report_count", 0);
|
||||
count++;
|
||||
int count = prefs.getInt("crash_report_count", 0) + 1;
|
||||
prefs.edit().putInt("crash_report_count", count).apply();
|
||||
if (count > MAX_CRASH_REPORTS)
|
||||
return false;
|
||||
|
||||
error.addToTab("extra", "installer", installer == null ? "-" : installer);
|
||||
error.addToTab("extra", "fingerprint", fingerprint);
|
||||
error.addToTab("extra", "thread", Thread.currentThread().getId());
|
||||
error.addToTab("extra", "free", Log.getFreeMemMb());
|
||||
|
||||
String theme = prefs.getString("theme", "light");
|
||||
error.addToTab("extra", "theme", theme);
|
||||
error.addToTab("extra", "package", BuildConfig.APPLICATION_ID);
|
||||
|
||||
return true;
|
||||
return (count <= MAX_CRASH_REPORTS);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue