Show error when loading chats fails
@@ -616,6 +616,7 @@ class ConversationsListController(bundle: Bundle) :
handleHttpExceptions(throwable)
withNullableControllerViewBinding {
binding.swipeRefreshLayoutView.isRefreshing = false
+ showErrorDialog()
}
dispose(roomsQueryDisposable)
}) {
@@ -627,6 +628,24 @@ class ConversationsListController(bundle: Bundle) :
+ private fun showErrorDialog() {
+ val dialogBuilder = MaterialAlertDialogBuilder(binding.floatingActionButton.context)
+ .setIcon(
+ viewThemeUtils.dialog.colorMaterialAlertDialogIcon(
+ context,
+ R.drawable.ic_baseline_error_outline_24dp,
+ )
+ .setTitle(R.string.error_loading_chats)
+ .setCancelable(false)
+ .setNegativeButton(R.string.close, null)
+ viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.floatingActionButton.context, dialogBuilder)
+ val dialog = dialogBuilder.show()
+ viewThemeUtils.platform.colorTextButtons(
+ dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
+ }
+
private fun sortConversations(conversationItems: MutableList<AbstractFlexibleItem<*>>) {
conversationItems.sortWith { o1: AbstractFlexibleItem<*>, o2: AbstractFlexibleItem<*> ->
val conversation1 = (o1 as ConversationItem).model
@@ -1344,6 +1363,7 @@ class ConversationsListController(bundle: Bundle) :
@@ -0,0 +1,5 @@
+<vector android:height="24dp" android:tint="#FF0000"
+ android:viewportHeight="24" android:viewportWidth="24"
+ android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M11,15h2v2h-2zM11,7h2v6h-2zM11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
+</vector>
@@ -292,6 +292,8 @@
<string name="nc_new_mention">Unread mentions</string>
<string name="conversations">Conversations</string>
<string name="openConversations">Open conversations</string>
+ <string name="error_loading_chats">There was a problem loading your chats</string>
+ <string name="close">Close</string>
<!-- Chat -->
<string name="nc_hint_enter_a_message">Enter a message …</string>