Merge pull request #4307 from k9mail/fix-async-bg
Move some async jobs into background thread
This commit is contained in:
commit
d35bee13f0
3 changed files with 3 additions and 3 deletions
|
@ -13,7 +13,7 @@ class AccountsLiveData(val preferences: Preferences) : LiveData<List<Account>>()
|
||||||
|
|
||||||
private fun loadAccountsAsync() {
|
private fun loadAccountsAsync() {
|
||||||
GlobalScope.launch(Dispatchers.Main) {
|
GlobalScope.launch(Dispatchers.Main) {
|
||||||
val accounts = async {
|
val accounts = async(Dispatchers.IO) {
|
||||||
loadAccounts()
|
loadAccounts()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import java.io.InputStream
|
||||||
class AutocryptSetupMessageLiveEvent(val messageCreator: AutocryptTransferMessageCreator) : SingleLiveEvent<AutocryptSetupMessage>() {
|
class AutocryptSetupMessageLiveEvent(val messageCreator: AutocryptTransferMessageCreator) : SingleLiveEvent<AutocryptSetupMessage>() {
|
||||||
fun loadAutocryptSetupMessageAsync(openPgpApi: OpenPgpApi, account: Account) {
|
fun loadAutocryptSetupMessageAsync(openPgpApi: OpenPgpApi, account: Account) {
|
||||||
GlobalScope.launch(Dispatchers.Main) {
|
GlobalScope.launch(Dispatchers.Main) {
|
||||||
val setupMessage = async {
|
val setupMessage = async(Dispatchers.IO) {
|
||||||
loadAutocryptSetupMessage(openPgpApi, account)
|
loadAutocryptSetupMessage(openPgpApi, account)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class AutocryptSetupTransferLiveEvent(
|
||||||
|
|
||||||
fun sendMessageAsync(account: Account, setupMsg: AutocryptSetupMessage) {
|
fun sendMessageAsync(account: Account, setupMsg: AutocryptSetupMessage) {
|
||||||
GlobalScope.launch(Dispatchers.Main) {
|
GlobalScope.launch(Dispatchers.Main) {
|
||||||
val setupMessage = async {
|
val setupMessage = async(Dispatchers.IO) {
|
||||||
messagingController.sendMessageBlocking(account, setupMsg.setupMessage)
|
messagingController.sendMessageBlocking(account, setupMsg.setupMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue