mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-02-13 10:33:46 +01:00
Prevent to check notifications for remote accounts
This commit is contained in:
parent
b7855cb1a2
commit
950d99b5de
@ -236,6 +236,23 @@ public class AccountDAO {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns all Peertube Account only in db
|
||||
*
|
||||
* @return Account List<Account>
|
||||
*/
|
||||
public List<Account> getAllPeertubeAccount() {
|
||||
|
||||
try {
|
||||
Cursor c = db.query(Sqlite.TABLE_USER_ACCOUNT, null, Sqlite.COL_SOFTWARE + "=? OR " + Sqlite.COL_SOFTWARE + "is null", new String[]{"PEERTUBE"}, null, null, Sqlite.COL_INSTANCE + " ASC", null);
|
||||
return cursorToListUser(c);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an Account by token
|
||||
*
|
||||
|
@ -79,7 +79,7 @@ public class NotificationsWorker extends Worker {
|
||||
public Result doWork() {
|
||||
Context applicationContext = getApplicationContext();
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
List<AccountData.Account> accounts = new AccountDAO(applicationContext, db).getAllAccount();
|
||||
List<AccountData.Account> accounts = new AccountDAO(applicationContext, db).getAllPeertubeAccount();
|
||||
if (accounts == null || accounts.size() == 0) {
|
||||
return Result.success();
|
||||
}
|
||||
@ -92,7 +92,7 @@ public class NotificationsWorker extends Worker {
|
||||
@SuppressWarnings({"SwitchStatementWithoutDefaultBranch", "DuplicateBranchesInSwitch"})
|
||||
private void fetchNotification() {
|
||||
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
List<AccountData.Account> accounts = new AccountDAO(getApplicationContext(), db).getAllAccount();
|
||||
List<AccountData.Account> accounts = new AccountDAO(getApplicationContext(), db).getAllPeertubeAccount();
|
||||
SharedPreferences sharedpreferences = getApplicationContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
for (AccountData.Account account : accounts) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user