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.

This commit is contained in:
Alex Ning
2019-08-19 11:44:19 +08:00
parent a83aaa671a
commit 85d232c7f6
10 changed files with 361 additions and 157 deletions

View File

@@ -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);
}