fix: Prevent crash on "hidden domains" page (#703)
The crash was caused by an uncaught exception when calling `MastodonApi#domainBlocks`. Update the `BackgroundMessageView` for the error message so it fills the screen like on other pages. Fixes #696
This commit is contained in:
parent
ab08974fc9
commit
5610cd23fa
|
@ -100,13 +100,16 @@ class InstanceListFragment :
|
|||
}
|
||||
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
val response = api.domainBlocks(id, bottomId)
|
||||
val instances = response.body()
|
||||
|
||||
if (response.isSuccessful && instances != null) {
|
||||
onFetchInstancesSuccess(instances, response.headers()["Link"])
|
||||
} else {
|
||||
onFetchInstancesFailure(Exception(response.message()))
|
||||
try {
|
||||
val response = api.domainBlocks(id, bottomId)
|
||||
val instances = response.body()
|
||||
if (response.isSuccessful && instances != null) {
|
||||
onFetchInstancesSuccess(instances, response.headers()["Link"])
|
||||
} else {
|
||||
onFetchInstancesFailure(Exception(response.message()))
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
onFetchInstancesFailure(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,8 @@
|
|||
|
||||
<app.pachli.core.ui.BackgroundMessageView
|
||||
android:id="@+id/messageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
</FrameLayout>
|
||||
|
|
Loading…
Reference in New Issue