diff --git a/app/src/main/java/eu/faircode/email/ActivityBase.java b/app/src/main/java/eu/faircode/email/ActivityBase.java index 6d6e934d27..1a96a53425 100644 --- a/app/src/main/java/eu/faircode/email/ActivityBase.java +++ b/app/src/main/java/eu/faircode/email/ActivityBase.java @@ -147,8 +147,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc if (pm != null && !pm.isInteractive()) { Log.i("Stop with screen off"); - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ActivityBase.this); - prefs.edit().remove("last_authentication").apply(); + Helper.clearAuthentication(this); } } diff --git a/app/src/main/java/eu/faircode/email/Helper.java b/app/src/main/java/eu/faircode/email/Helper.java index f6ef3c0f4c..39e309538e 100644 --- a/app/src/main/java/eu/faircode/email/Helper.java +++ b/app/src/main/java/eu/faircode/email/Helper.java @@ -751,6 +751,11 @@ public class Helper { prompt.authenticate(info.build()); } + static void clearAuthentication(Context context) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + prefs.edit().remove("last_authentication").apply(); + } + // Miscellaneous static String sanitizeKeyword(String keyword) {