Commit a43b7c89 authored by Lucio Maciel's avatar Lucio Maciel

Save to TokenRepository and guard with try/catch

parent 15bbe966
......@@ -91,7 +91,14 @@ class RocketChatApplication : Application(), HasActivityInjector, HasServiceInje
setupCrashlytics()
setupFresco()
setupTimber()
migrateFromLegacy()
// TODO - remove this and all realm stuff when we got to 80% in 2.0
try {
migrateFromLegacy()
} catch (ex: Exception) {
Timber.d(ex, "Error migrating old accounts")
ex.printStackTrace()
}
}
private fun migrateFromLegacy() {
......@@ -144,8 +151,7 @@ class RocketChatApplication : Application(), HasActivityInjector, HasServiceInje
}
val account = Account(url, icon, logo, user.username!!, avatar)
launch(CommonPool) {
val tokenModel = TokenModel(userId!!, authToken)
multiServerRepository.save(url, tokenModel)
tokenRepository.save(url, Token(userId!!, authToken))
accountRepository.save(account)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment