From 0b38787d1fbba8dffd5f9e1bce2c93c2c7450c3a Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 12 Sep 2019 18:32:15 +0200 Subject: [PATCH] Fixed error reporting rate limit --- app/src/main/java/eu/faircode/email/Log.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index 51c7964113..e5a26ad800 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -202,16 +202,11 @@ public class Log { config.beforeSend(new BeforeSend() { @Override public boolean run(@NonNull Report report) { - boolean crash_reports = prefs.getBoolean("crash_reports", false); // opt-in + // opt-in + boolean crash_reports = prefs.getBoolean("crash_reports", false); if (!crash_reports) return false; - int count = prefs.getInt("crash_report_count", 0); - count++; - prefs.edit().putInt("crash_report_count", count).apply(); - if (count > MAX_CRASH_REPORTS) - return false; - Throwable ex = report.getError().getException(); if (ex instanceof MessagingException && @@ -241,6 +236,13 @@ public class Log { ex.getMessage().startsWith("https://autoconfig.thunderbird.net/"))) return false; + // Rate limit + int count = prefs.getInt("crash_report_count", 0); + count++; + prefs.edit().putInt("crash_report_count", count).apply(); + if (count > MAX_CRASH_REPORTS) + return false; + return true; } });