mirror of
https://github.com/tuskyapp/Tusky
synced 2025-01-31 11:35:06 +01:00
fix crash in AccountListFragment when network calls are cancelled (#3175)
This commit is contained in:
parent
8058c4bc79
commit
acb0e38b88
@ -134,7 +134,7 @@ class AccountListFragment : Fragment(R.layout.fragment_account_list), AccountAct
|
||||
}
|
||||
|
||||
override fun onMute(mute: Boolean, id: String, position: Int, notifications: Boolean) {
|
||||
lifecycleScope.launch {
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
try {
|
||||
if (!mute) {
|
||||
api.unmuteAccount(id)
|
||||
@ -180,7 +180,7 @@ class AccountListFragment : Fragment(R.layout.fragment_account_list), AccountAct
|
||||
}
|
||||
|
||||
override fun onBlock(block: Boolean, id: String, position: Int) {
|
||||
lifecycleScope.launch {
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
try {
|
||||
if (!block) {
|
||||
api.unblockAccount(id)
|
||||
@ -290,7 +290,7 @@ class AccountListFragment : Fragment(R.layout.fragment_account_list), AccountAct
|
||||
binding.recyclerView.post { adapter.setBottomLoading(true) }
|
||||
}
|
||||
|
||||
lifecycleScope.launch {
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
try {
|
||||
val response = getFetchCallByListType(fromId)
|
||||
if (!response.isSuccessful) {
|
||||
@ -307,8 +307,8 @@ class AccountListFragment : Fragment(R.layout.fragment_account_list), AccountAct
|
||||
|
||||
val linkHeader = response.headers()["Link"]
|
||||
onFetchAccountsSuccess(accountList, linkHeader)
|
||||
} catch (throwable: Throwable) {
|
||||
onFetchAccountsFailure(throwable)
|
||||
} catch (exception: IOException) {
|
||||
onFetchAccountsFailure(exception)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user