From e4b6e1035ecec230cde9bbb3d67b02bbac3c6b70 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Sun, 27 Dec 2020 11:59:03 +0100 Subject: [PATCH] fix: Don't show loading dialog on request history --- lib/views/chat.dart | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/views/chat.dart b/lib/views/chat.dart index 8a0fed7a..1ca0704d 100644 --- a/lib/views/chat.dart +++ b/lib/views/chat.dart @@ -11,6 +11,7 @@ import 'package:fluffychat/components/avatar.dart'; import 'package:fluffychat/components/chat_settings_popup_menu.dart'; import 'package:fluffychat/components/connection_status_header.dart'; import 'package:fluffychat/components/dialogs/recording_dialog.dart'; +import 'package:flushbar/flushbar_helper.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:fluffychat/components/encryption_button.dart'; import 'package:fluffychat/components/list_items/message.dart'; @@ -114,10 +115,13 @@ class _ChatState extends State<_Chat> { if (_canLoadMore) { setState(() => _loadingHistory = true); - await showFutureLoadingDialog( - context: context, - future: () => timeline.requestHistory(historyCount: _loadHistoryCount), - ); + try { + await timeline.requestHistory(historyCount: _loadHistoryCount); + } catch (err) { + await FlushbarHelper.createError( + message: err.toLocalizedString(context)) + .show(context); + } // we do NOT setState() here as then the event order will be wrong. // instead, we just set our variable to false, and rely on timeline update to set the