mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-07-13 20:45:24 +02:00
Preparing to support multi user. Use the database to store accounts' info. LoginActivity is successfully refactored. Any other features are unavailable for now.
This commit is contained in:
22
app/src/main/java/Account/AccountDao.java
Normal file
22
app/src/main/java/Account/AccountDao.java
Normal file
@ -0,0 +1,22 @@
|
||||
package Account;
|
||||
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
|
||||
@Dao
|
||||
public interface AccountDao {
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insert(Account account);
|
||||
|
||||
@Query("DELETE FROM accounts")
|
||||
void deleteAllAccounts();
|
||||
|
||||
@Query("SELECT * FROM accounts WHERE username = :userName COLLATE NOCASE LIMIT 1")
|
||||
LiveData<Account> getAccountLiveData(String userName);
|
||||
|
||||
@Query("SELECT * FROM accounts WHERE username = :userName COLLATE NOCASE LIMIT 1")
|
||||
Account getAccountData(String userName);
|
||||
}
|
Reference in New Issue
Block a user