From 85d232c7f6254a8ed065637c6f7b21a55fe3f1b4 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Mon, 19 Aug 2019 11:44:19 +0800 Subject: 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. --- app/src/main/java/Account/AccountDao.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/src/main/java/Account') 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 getAllAccounts(); + @Query("SELECT * FROM accounts WHERE is_current_user = 0") List 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); } -- cgit v1.2.3