1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 20:54:34 +00:00

Refactoring

This commit is contained in:
M66B 2021-12-01 19:33:29 +01:00
parent 41c9f0e631
commit c1199c93e0
2 changed files with 6 additions and 3 deletions

View file

@ -144,6 +144,9 @@ public class Log {
private static final int MAX_CRASH_REPORTS = 5;
private static final String TAG = "fairemail";
static final String TOKEN_REFRESH_REQUIRED =
"Token refresh required. Is there a VPN based app running?";
public static void setLevel(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean debug = prefs.getBoolean("debug", false);
@ -471,7 +474,7 @@ public class Log {
if (ex instanceof IllegalStateException &&
(no_internet.equals(ex.getMessage()) ||
"Token refreshed".equals(ex.getMessage()) ||
TOKEN_REFRESH_REQUIRED.equals(ex.getMessage()) ||
"Not connected".equals(ex.getMessage()) ||
"This operation is not allowed on a closed folder".equals(ex.getMessage())))
return false;
@ -1505,7 +1508,7 @@ public class Log {
return null;
if (ex instanceof IllegalStateException &&
("Token refreshed".equals(ex.getMessage()) ||
(TOKEN_REFRESH_REQUIRED.equals(ex.getMessage()) ||
"Not connected".equals(ex.getMessage()) ||
"This operation is not allowed on a closed folder".equals(ex.getMessage())))
return null;

View file

@ -137,7 +137,7 @@ public class ServiceAuthenticator extends Authenticator {
}
if (expiration != null && expiration - keep_alive < new Date().getTime())
throw new IllegalStateException("Token refresh required. Is there a VPN based app running?");
throw new IllegalStateException(Log.TOKEN_REFRESH_REQUIRED);
}
interface IAuthenticated {