mirror of https://github.com/M66B/FairEmail.git
Fixed auto update downloaded times
This commit is contained in:
parent
02ccd0d93a
commit
ef2578bd83
|
@ -20,10 +20,12 @@ package eu.faircode.email;
|
|||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.json.JSONException;
|
||||
|
||||
|
@ -40,6 +42,7 @@ import java.net.URL;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -403,6 +406,9 @@ public class Adguard {
|
|||
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
||||
Helper.copy(connection.getInputStream(), os);
|
||||
}
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
prefs.edit().putLong("adguard_last", new Date().getTime()).apply();
|
||||
} finally {
|
||||
connection.disconnect();
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.io.IOException;
|
|||
import java.io.OutputStream;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -132,6 +133,9 @@ public class DisconnectBlacklist {
|
|||
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
||||
Helper.copy(connection.getInputStream(), os);
|
||||
}
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
prefs.edit().putLong("disconnect_last", new Date().getTime()).apply();
|
||||
} finally {
|
||||
connection.disconnect();
|
||||
}
|
||||
|
|
|
@ -255,11 +255,6 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
prefs.edit().putLong("adguard_last", new Date().getTime()).apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(getParentFragmentManager(), ex, !(ex instanceof IOException));
|
||||
|
@ -527,11 +522,6 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
prefs.edit().putLong("disconnect_last", new Date().getTime()).apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(getParentFragmentManager(), ex, !(ex instanceof IOException));
|
||||
|
|
Loading…
Reference in New Issue