From a817773de8a6a97dfd530976380771b8af0deb85 Mon Sep 17 00:00:00 2001 From: Krille Fear Date: Sat, 13 Nov 2021 11:51:35 +0100 Subject: [PATCH] fix: Dont enable encryption with bots --- lib/pages/new_group/new_group.dart | 15 ++------------- lib/pages/search/search_view.dart | 11 ----------- .../user_bottom_sheet/user_bottom_sheet.dart | 9 --------- lib/widgets/profile_bottom_sheet.dart | 8 -------- 4 files changed, 2 insertions(+), 41 deletions(-) diff --git a/lib/pages/new_group/new_group.dart b/lib/pages/new_group/new_group.dart index b25a7869..7b6666f1 100644 --- a/lib/pages/new_group/new_group.dart +++ b/lib/pages/new_group/new_group.dart @@ -25,23 +25,12 @@ class NewGroupController extends State { final roomID = await showFutureLoadingDialog( context: context, future: () async { - final roomId = await client.createRoom( + final roomId = await client.createGroupChat( preset: publicGroup ? sdk.CreateRoomPreset.publicChat : sdk.CreateRoomPreset.privateChat, - visibility: publicGroup ? sdk.Visibility.public : null, - roomAliasName: publicGroup && controller.text.isNotEmpty - ? controller.text.trim().toLowerCase().replaceAll(' ', '_') - : null, - name: controller.text.isNotEmpty ? controller.text : null, + groupName: controller.text.isNotEmpty ? controller.text : null, ); - if (client.getRoomById(roomId) == null) { - await client.onSync.stream.firstWhere( - (sync) => sync.rooms?.join?.containsKey(roomId) ?? false); - } - if (!publicGroup && client.encryptionEnabled) { - await client.getRoomById(roomId).enableEncryption(); - } return roomId; }, ); diff --git a/lib/pages/search/search_view.dart b/lib/pages/search/search_view.dart index 4ce906c0..1a0dff6f 100644 --- a/lib/pages/search/search_view.dart +++ b/lib/pages/search/search_view.dart @@ -253,17 +253,6 @@ class SearchView extends StatelessWidget { final client = Matrix.of(context).client; final roomId = await client .startDirectChat(foundProfile.userId); - if (client.getRoomById(roomId) == null) { - await client.onSync.stream.firstWhere((sync) => - sync.rooms?.join?.containsKey(roomId) ?? - false); - } - final room = client.getRoomById(roomId); - if (client.encryptionEnabled && !room.encrypted) { - await client - .getRoomById(roomId) - .enableEncryption(); - } return roomId; }, ); diff --git a/lib/pages/user_bottom_sheet/user_bottom_sheet.dart b/lib/pages/user_bottom_sheet/user_bottom_sheet.dart index e96de0a2..c4976b03 100644 --- a/lib/pages/user_bottom_sheet/user_bottom_sheet.dart +++ b/lib/pages/user_bottom_sheet/user_bottom_sheet.dart @@ -88,15 +88,6 @@ class UserBottomSheetController extends State { context: context, future: () async { final roomId = await widget.user.startDirectChat(); - final client = widget.user.room.client; - if (client.getRoomById(roomId) == null) { - await client.onSync.stream.firstWhere( - (sync) => sync.rooms?.join?.containsKey(roomId) ?? false); - } - final room = client.getRoomById(roomId); - if (client.encryptionEnabled && !room.encrypted) { - await client.getRoomById(roomId).enableEncryption(); - } return roomId; }, ); diff --git a/lib/widgets/profile_bottom_sheet.dart b/lib/widgets/profile_bottom_sheet.dart index 9847e2af..03a3186a 100644 --- a/lib/widgets/profile_bottom_sheet.dart +++ b/lib/widgets/profile_bottom_sheet.dart @@ -27,14 +27,6 @@ class ProfileBottomSheet extends StatelessWidget { context: context, future: () async { final roomId = await client.startDirectChat(userId); - if (client.getRoomById(roomId) == null) { - await client.onSync.stream.firstWhere( - (sync) => sync.rooms?.join?.containsKey(roomId) ?? false); - } - final room = client.getRoomById(roomId); - if (client.encryptionEnabled && !room.encrypted) { - await client.getRoomById(roomId).enableEncryption(); - } return roomId; }, );