From 2fef6faa1aa890c110688e8fe4d8f2f4956fb126 Mon Sep 17 00:00:00 2001 From: Krille Date: Mon, 13 Jan 2025 16:08:08 +0100 Subject: [PATCH] chore: Follow up other party has no keys --- lib/pages/chat/send_file_dialog.dart | 8 +++++++- lib/utils/localized_exception_extension.dart | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/pages/chat/send_file_dialog.dart b/lib/pages/chat/send_file_dialog.dart index 00ffae04b6..43c16a0a67 100644 --- a/lib/pages/chat/send_file_dialog.dart +++ b/lib/pages/chat/send_file_dialog.dart @@ -131,9 +131,15 @@ class SendFileDialogState extends State { scaffoldMessenger.clearSnackBars(); } catch (e) { scaffoldMessenger.clearSnackBars(); + final theme = Theme.of(context); scaffoldMessenger.showSnackBar( SnackBar( - content: Text(e.toLocalizedString(widget.outerContext)), + backgroundColor: theme.colorScheme.errorContainer, + closeIconColor: theme.colorScheme.onErrorContainer, + content: Text( + e.toLocalizedString(widget.outerContext), + style: TextStyle(color: theme.colorScheme.onErrorContainer), + ), duration: const Duration(seconds: 30), showCloseIcon: true, ), diff --git a/lib/utils/localized_exception_extension.dart b/lib/utils/localized_exception_extension.dart index d97257d94e..2f7ea51074 100644 --- a/lib/utils/localized_exception_extension.dart +++ b/lib/utils/localized_exception_extension.dart @@ -8,6 +8,7 @@ import 'package:http/http.dart'; import 'package:matrix/encryption.dart'; import 'package:matrix/matrix.dart'; +import 'package:fluffychat/utils/other_party_can_receive.dart'; import 'uia_request_manager.dart'; extension LocalizedExceptionExtension on Object { @@ -34,6 +35,9 @@ extension LocalizedExceptionExtension on Object { _formatFileSize(exception.maxFileSize), ); } + if (this is OtherPartyCanNotReceiveMessages) { + return L10n.of(context).otherPartyNotLoggedIn; + } if (this is MatrixException) { switch ((this as MatrixException).error) { case MatrixError.M_FORBIDDEN: