aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/Account/AccountDao.java
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-08-19 03:44:19 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-08-19 03:44:19 +0000
commit85d232c7f6254a8ed065637c6f7b21a55fe3f1b4 (patch)
tree767a2ccbe9ed63b4ba45eb59bff0edf1c215489b /app/src/main/java/Account/AccountDao.java
parenta83aaa671a1c930c4402345783839b0db66118b3 (diff)
downloadinfinity-for-reddit-85d232c7f6254a8ed065637c6f7b21a55fe3f1b4.tar
infinity-for-reddit-85d232c7f6254a8ed065637c6f7b21a55fe3f1b4.tar.gz
infinity-for-reddit-85d232c7f6254a8ed065637c6f7b21a55fe3f1b4.tar.bz2
infinity-for-reddit-85d232c7f6254a8ed065637c6f7b21a55fe3f1b4.tar.lz
infinity-for-reddit-85d232c7f6254a8ed065637c6f7b21a55fe3f1b4.tar.xz
infinity-for-reddit-85d232c7f6254a8ed065637c6f7b21a55fe3f1b4.tar.zst
infinity-for-reddit-85d232c7f6254a8ed065637c6f7b21a55fe3f1b4.zip
Fetch all users' messages in PullNotificationWorker. Update the access token in database instead of inserting an account in AccessTokenAuthenticator to hopefully fix the problem that subscriptions database is cleared implicitly.
Diffstat (limited to 'app/src/main/java/Account/AccountDao.java')
-rw-r--r--app/src/main/java/Account/AccountDao.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/src/main/java/Account/AccountDao.java b/app/src/main/java/Account/AccountDao.java
index aa7b7f19..c05e5552 100644
--- a/app/src/main/java/Account/AccountDao.java
+++ b/app/src/main/java/Account/AccountDao.java
@@ -13,6 +13,9 @@ public interface AccountDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(Account account);
+ @Query("SELECT * FROM accounts")
+ List<Account> getAllAccounts();
+
@Query("SELECT * FROM accounts WHERE is_current_user = 0")
List<Account> getAllNonCurrentAccounts();
@@ -43,4 +46,7 @@ public interface AccountDao {
@Query("UPDATE accounts SET is_current_user = 1 WHERE username = :username")
void markAccountCurrent(String username);
+
+ @Query("UPDATE accounts SET access_token = :accessToken WHERE username = :username")
+ void changeAccessToken(String username, String accessToken);
}