Refactoring

pull/194/merge
M66B 4 years ago
parent 41c9f0e631
commit c1199c93e0

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

@ -137,7 +137,7 @@ public class ServiceAuthenticator extends Authenticator {
} }
if (expiration != null && expiration - keep_alive < new Date().getTime()) 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 { interface IAuthenticated {

Loading…
Cancel
Save