Fix email login loop (can login with email again) (#629)
Merge branch 'master' into fix-email-logins # Conflicts: # app/src/main/java/org/mian/gitnex/activities/LoginActivity.java cleanup Fix emails logins loop Co-authored-by: M M Arif <mmarif@swatian.com> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/629
This commit is contained in:
@@ -18,6 +18,7 @@ public class UserAccountsApi {
|
||||
private static UserAccountsDao userAccountsDao;
|
||||
private static UserAccount userAccount;
|
||||
private static Integer checkAccount;
|
||||
private static long accountId;
|
||||
|
||||
public UserAccountsApi(Context context) {
|
||||
|
||||
@@ -26,7 +27,7 @@ public class UserAccountsApi {
|
||||
userAccountsDao = db.userAccountsDao();
|
||||
}
|
||||
|
||||
public void insertNewAccount(String accountName, String instanceUrl, String userName, String token, String serverVersion) {
|
||||
public long insertNewAccount(String accountName, String instanceUrl, String userName, String token, String serverVersion) {
|
||||
|
||||
UserAccount userAccount = new UserAccount();
|
||||
userAccount.setAccountName(accountName);
|
||||
@@ -35,12 +36,23 @@ public class UserAccountsApi {
|
||||
userAccount.setToken(token);
|
||||
userAccount.setServerVersion(serverVersion);
|
||||
|
||||
insertNewAccountAsync(userAccount);
|
||||
return insertNewAccountAsync(userAccount);
|
||||
}
|
||||
|
||||
private static void insertNewAccountAsync(final UserAccount userAccount) {
|
||||
private static long insertNewAccountAsync(final UserAccount userAccount) {
|
||||
|
||||
new Thread(() -> userAccountsDao.newAccount(userAccount)).start();
|
||||
try {
|
||||
|
||||
Thread thread = new Thread(() -> accountId = userAccountsDao.newAccount(userAccount));
|
||||
thread.start();
|
||||
thread.join();
|
||||
}
|
||||
catch(InterruptedException e) {
|
||||
|
||||
Log.e(StaticGlobalVariables.userAccountsRepository, e.toString());
|
||||
}
|
||||
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public static void updateServerVersion(final String serverVersion, final int accountId) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
public interface UserAccountsDao {
|
||||
|
||||
@Insert
|
||||
void newAccount(UserAccount userAccounts);
|
||||
long newAccount(UserAccount userAccounts);
|
||||
|
||||
@Query("SELECT * FROM UserAccounts ORDER BY accountId ASC")
|
||||
LiveData<List<UserAccount>> fetchAllAccounts();
|
||||
|
||||
Reference in New Issue
Block a user