feat: Prevent sending messages if other party has no encryption keys
This commit is contained in:
parent
8cb06d602b
commit
aa010767de
5 changed files with 60 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ import 'package:fluffychat/utils/file_selector.dart';
|
|||
import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/filtered_timeline_extension.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||
import 'package:fluffychat/utils/other_party_can_receive.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/utils/show_scaffold_dialog.dart';
|
||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_modal_action_popup.dart';
|
||||
|
|
@ -237,6 +238,23 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
void _shareItems([_]) {
|
||||
final shareItems = widget.shareItems;
|
||||
if (shareItems == null || shareItems.isEmpty) return;
|
||||
if (!room.otherPartyCanReceiveMessages) {
|
||||
final theme = Theme.of(context);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
backgroundColor: theme.colorScheme.errorContainer,
|
||||
closeIconColor: theme.colorScheme.onErrorContainer,
|
||||
content: Text(
|
||||
L10n.of(context).otherPartyNotLoggedIn,
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.onErrorContainer,
|
||||
),
|
||||
),
|
||||
showCloseIcon: true,
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
for (final item in shareItems) {
|
||||
if (item is FileShareItem) continue;
|
||||
if (item is TextShareItem) room.sendTextEvent(item.value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue