never use 0 account ids to prevent caching problems (#999)

This commit is contained in:
Konrad Pozniak 2019-01-19 21:14:23 +01:00 committed by GitHub
parent 8014b1296d
commit fe535c2e0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,7 +58,9 @@ class AccountManager(db: AppDatabase) {
accountDao.insertOrReplace(it) accountDao.insertOrReplace(it)
} }
activeAccount = AccountEntity(id = 0, domain = domain.toLowerCase(), accessToken = accessToken, isActive = true) val maxAccountId = accounts.maxBy { it.id }?.id ?: 0
val newAccountId = maxAccountId + 1
activeAccount = AccountEntity(id = newAccountId, domain = domain.toLowerCase(), accessToken = accessToken, isActive = true)
} }