comment #324 & #327 - Oops :(

This commit is contained in:
tom79 2019-10-31 14:38:32 +01:00
parent b76b560cd3
commit 40caa86a9c
2 changed files with 20 additions and 20 deletions

View File

@ -107,20 +107,20 @@ public class LiveNotificationDelayedService extends Service {
NotificationManager.IMPORTANCE_DEFAULT); NotificationManager.IMPORTANCE_DEFAULT);
((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel); ((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel);
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); }
List<Account> accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction(); SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
totalAccount = 0; List<Account> accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction();
for (Account account : accountStreams) { totalAccount = 0;
if (account.getSocial() == null || account.getSocial().equals("MASTODON") || account.getSocial().equals("PLEROMA") || account.getSocial().equals("PIXELFED")) { for (Account account : accountStreams) {
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); if (account.getSocial() == null || account.getSocial().equals("MASTODON") || account.getSocial().equals("PLEROMA") || account.getSocial().equals("PIXELFED")) {
boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true); final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
if (allowStream) { boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true);
totalAccount++; if (allowStream) {
} totalAccount++;
} }
} }
} }
if( totalAccount > 0) { if( totalAccount > 0) {
Intent myIntent = new Intent(getApplicationContext(), MainActivity.class); Intent myIntent = new Intent(getApplicationContext(), MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity( PendingIntent pendingIntent = PendingIntent.getActivity(

View File

@ -151,15 +151,15 @@ public class LiveNotificationService extends Service implements NetworkStateRece
NotificationManager.IMPORTANCE_DEFAULT); NotificationManager.IMPORTANCE_DEFAULT);
((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel); ((NotificationManager) Objects.requireNonNull(getSystemService(Context.NOTIFICATION_SERVICE))).createNotificationChannel(channel);
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); }
List<Account> accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction(); SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
totalAccount = 0; List<Account> accountStreams = new AccountDAO(getApplicationContext(), db).getAllAccountCrossAction();
for (Account account : accountStreams) { totalAccount = 0;
if (account.getSocial() == null || account.getSocial().equals("MASTODON") || account.getSocial().equals("PLEROMA")) { for (Account account : accountStreams) {
boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true); if (account.getSocial() == null || account.getSocial().equals("MASTODON") || account.getSocial().equals("PLEROMA")) {
if (allowStream) { boolean allowStream = sharedpreferences.getBoolean(Helper.SET_ALLOW_STREAM + account.getId() + account.getInstance(), true);
totalAccount++; if (allowStream) {
} totalAccount++;
} }
} }
} }