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

main
Konrad Pozniak 6 years ago committed by GitHub
parent 2de1ee661d
commit 0230f79a42
  1. 4
      app/src/main/java/com/keylesspalace/tusky/db/AccountManager.kt

@ -58,7 +58,9 @@ class AccountManager(db: AppDatabase) {
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)
}

Loading…
Cancel
Save