From 40caa86a9c9d36f6e402ad0873358ef78ec091a5 Mon Sep 17 00:00:00 2001 From: tom79 Date: Thu, 31 Oct 2019 14:38:32 +0100 Subject: [PATCH] comment #324 & #327 - Oops :( --- .../LiveNotificationDelayedService.java | 22 +++++++++---------- .../services/LiveNotificationService.java | 18 +++++++-------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/services/LiveNotificationDelayedService.java b/app/src/main/java/app/fedilab/android/services/LiveNotificationDelayedService.java index 95aceb536..b570de3c8 100644 --- a/app/src/main/java/app/fedilab/android/services/LiveNotificationDelayedService.java +++ b/app/src/main/java/app/fedilab/android/services/LiveNotificationDelayedService.java @@ -107,20 +107,20 @@ public class LiveNotificationDelayedService extends Service { NotificationManager.IMPORTANCE_DEFAULT); ((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel); - SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); - List accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction(); - totalAccount = 0; - for (Account account : accountStreams) { - if (account.getSocial() == null || account.getSocial().equals("MASTODON") || account.getSocial().equals("PLEROMA") || account.getSocial().equals("PIXELFED")) { - final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); - boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true); - if (allowStream) { - totalAccount++; - } + } + SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); + List accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction(); + totalAccount = 0; + for (Account account : accountStreams) { + if (account.getSocial() == null || account.getSocial().equals("MASTODON") || account.getSocial().equals("PLEROMA") || account.getSocial().equals("PIXELFED")) { + final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); + boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true); + if (allowStream) { + totalAccount++; } } - } + if( totalAccount > 0) { Intent myIntent = new Intent(getApplicationContext(), MainActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity( diff --git a/app/src/main/java/app/fedilab/android/services/LiveNotificationService.java b/app/src/main/java/app/fedilab/android/services/LiveNotificationService.java index 0c824faca..9f1dce7f3 100644 --- a/app/src/main/java/app/fedilab/android/services/LiveNotificationService.java +++ b/app/src/main/java/app/fedilab/android/services/LiveNotificationService.java @@ -151,15 +151,15 @@ public class LiveNotificationService extends Service implements NetworkStateRece NotificationManager.IMPORTANCE_DEFAULT); ((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel); - SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); - List accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction(); - totalAccount = 0; - for (Account account : accountStreams) { - if (account.getSocial() == null || account.getSocial().equals("MASTODON") || account.getSocial().equals("PLEROMA")) { - boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true); - if (allowStream) { - totalAccount++; - } + } + SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); + List accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction(); + totalAccount = 0; + for (Account account : accountStreams) { + if (account.getSocial() == null || account.getSocial().equals("MASTODON") || account.getSocial().equals("PLEROMA")) { + boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true); + if (allowStream) { + totalAccount++; } } }