mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-28 09:38:14 +03:00
run user repo call in coroutine
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
349d5fe19b
commit
75c8625aee
1 changed files with 13 additions and 5 deletions
|
@ -58,7 +58,6 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ACTIVE_CONVERSATION
|
||||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ID
|
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ID
|
||||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
|
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
|
||||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_USER_ENTITY
|
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_USER_ENTITY
|
||||||
import com.nextcloud.talk.utils.database.user.UserUtils
|
|
||||||
import io.reactivex.Observer
|
import io.reactivex.Observer
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.disposables.Disposable
|
||||||
|
@ -66,6 +65,9 @@ import io.reactivex.schedulers.Schedulers
|
||||||
import io.requery.Persistable
|
import io.requery.Persistable
|
||||||
import io.requery.android.sqlcipher.SqlCipherDatabaseSource
|
import io.requery.android.sqlcipher.SqlCipherDatabaseSource
|
||||||
import io.requery.reactivex.ReactiveEntityStore
|
import io.requery.reactivex.ReactiveEntityStore
|
||||||
|
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||||
|
import kotlinx.coroutines.GlobalScope
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import org.parceler.Parcels
|
import org.parceler.Parcels
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -115,11 +117,17 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||||
onNewIntent(intent)
|
onNewIntent(intent)
|
||||||
} else if (!router!!.hasRootController()) {
|
} else if (!router!!.hasRootController()) {
|
||||||
if (hasDb) {
|
if (hasDb) {
|
||||||
|
GlobalScope.launch {
|
||||||
if (usersRepository.getUsers().isNotEmpty()) {
|
if (usersRepository.getUsers().isNotEmpty()) {
|
||||||
|
runOnUiThread {
|
||||||
setDefaultRootController()
|
setDefaultRootController()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
runOnUiThread {
|
||||||
launchLoginScreen()
|
launchLoginScreen()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
launchLoginScreen()
|
launchLoginScreen()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue