Merge pull request #3998 from ByteHamster/do-not-store-actions-if-logged-out

Do not store Sync actions if user is not logged in
This commit is contained in:
H. Lehmann 2020-04-03 14:47:47 +02:00 committed by GitHub
commit 0d9587f09c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -113,6 +113,9 @@ public class SyncService extends Worker {
} }
public static void enqueueFeedAdded(Context context, String downloadUrl) { public static void enqueueFeedAdded(Context context, String downloadUrl) {
if (!GpodnetPreferences.loggedIn()) {
return;
}
synchronized (lock) { synchronized (lock) {
try { try {
SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
@ -128,6 +131,9 @@ public class SyncService extends Worker {
} }
public static void enqueueFeedRemoved(Context context, String downloadUrl) { public static void enqueueFeedRemoved(Context context, String downloadUrl) {
if (!GpodnetPreferences.loggedIn()) {
return;
}
synchronized (lock) { synchronized (lock) {
try { try {
SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
@ -143,6 +149,9 @@ public class SyncService extends Worker {
} }
public static void enqueueEpisodeAction(Context context, EpisodeAction action) { public static void enqueueEpisodeAction(Context context, EpisodeAction action) {
if (!GpodnetPreferences.loggedIn()) {
return;
}
synchronized (lock) { synchronized (lock) {
try { try {
SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);