Add comments explaining the expiry field

Co-authored-by: Tobias Groza <TobiGr@users.noreply.github.com>
pull/5474/head
XiangRongLin 2021-01-30 14:24:25 +01:00 zatwierdzone przez GitHub
rodzic e98838ad7e
commit bdc85b435c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 4 dodań i 0 usunięć

Wyświetl plik

@ -179,6 +179,8 @@ public final class CheckForNewAppVersion {
return null;
}
// Check if the last request has happened a certain time ago
// to reduce the number of API requests.
final long expiry = prefs.getLong(app.getString(R.string.update_expiry_key), 0);
if (!manager.isExpired(expiry)) {
return null;
@ -198,6 +200,8 @@ public final class CheckForNewAppVersion {
.subscribe(
response -> {
try {
// Store a timestamp which needs to be exceeded,
// before a new request to the API is made.
final long newExpiry = manager
.coerceExpiry(response.getHeader("expires"));
prefs.edit()