fix crash in AccountListFragment when network calls are cancelled (#3175)
This commit is contained in:
parent
8058c4bc79
commit
acb0e38b88
1 changed files with 5 additions and 5 deletions
|
@ -134,7 +134,7 @@ class AccountListFragment : Fragment(R.layout.fragment_account_list), AccountAct
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onMute(mute: Boolean, id: String, position: Int, notifications: Boolean) {
|
override fun onMute(mute: Boolean, id: String, position: Int, notifications: Boolean) {
|
||||||
lifecycleScope.launch {
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
try {
|
try {
|
||||||
if (!mute) {
|
if (!mute) {
|
||||||
api.unmuteAccount(id)
|
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) {
|
override fun onBlock(block: Boolean, id: String, position: Int) {
|
||||||
lifecycleScope.launch {
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
try {
|
try {
|
||||||
if (!block) {
|
if (!block) {
|
||||||
api.unblockAccount(id)
|
api.unblockAccount(id)
|
||||||
|
@ -290,7 +290,7 @@ class AccountListFragment : Fragment(R.layout.fragment_account_list), AccountAct
|
||||||
binding.recyclerView.post { adapter.setBottomLoading(true) }
|
binding.recyclerView.post { adapter.setBottomLoading(true) }
|
||||||
}
|
}
|
||||||
|
|
||||||
lifecycleScope.launch {
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
try {
|
try {
|
||||||
val response = getFetchCallByListType(fromId)
|
val response = getFetchCallByListType(fromId)
|
||||||
if (!response.isSuccessful) {
|
if (!response.isSuccessful) {
|
||||||
|
@ -307,8 +307,8 @@ class AccountListFragment : Fragment(R.layout.fragment_account_list), AccountAct
|
||||||
|
|
||||||
val linkHeader = response.headers()["Link"]
|
val linkHeader = response.headers()["Link"]
|
||||||
onFetchAccountsSuccess(accountList, linkHeader)
|
onFetchAccountsSuccess(accountList, linkHeader)
|
||||||
} catch (throwable: Throwable) {
|
} catch (exception: IOException) {
|
||||||
onFetchAccountsFailure(throwable)
|
onFetchAccountsFailure(exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue