Skip to content

Commit

Permalink
krille-chan#96 enable_e2ee
Browse files Browse the repository at this point in the history
  • Loading branch information
Monz Philipp authored and Hannich Matthias committed Apr 26, 2023
1 parent b7882af commit 3904d57
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/pages/chat/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class ChatController extends State<Chat> {
.firstWhere((s) => s.rooms?.leave?.containsKey(room.id) ?? false);
await room.leave();
await waitForSync;
return await client.startDirectChat(userId);
return await client.startDirectChat(userId, enableEncryption: true);
},
);
final roomId = success.result;
Expand Down
10 changes: 8 additions & 2 deletions lib/pages/new_group/new_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,19 @@ class NewGroupController extends State<NewGroup> {
context: context,
future: () async {
final roomId = await client.createGroupChat(
enableEncryption: true,
visibility: sdk.Visibility.private,
preset: sdk.CreateRoomPreset.privateChat,
/* #schulChatSpecific
visibility:
publicGroup ? sdk.Visibility.public : sdk.Visibility.private,
preset: publicGroup
? sdk.CreateRoomPreset.publicChat
preset: publicGroupx
? sdk.CreateRoomPreset.publicChatx
: sdk.CreateRoomPreset.privateChat,
*/
groupName: controller.text.isNotEmpty ? controller.text : null,
);

return roomId;
},
);
Expand Down
6 changes: 4 additions & 2 deletions lib/pages/new_group/new_group_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,20 @@ class NewGroupView extends StatelessWidget {
),
),
),
/* #schulChatSpecific
SwitchListTile.adaptive(
secondary: const Icon(Icons.public_outlined),
title: Text(L10n.of(context)!.groupIsPublic),
value: controller.publicGroup,
value: false, //controller.publicGroup, #schulChatSpecific
onChanged: controller.setPublicGroup,
),
SwitchListTile.adaptive(
secondary: const Icon(Icons.lock_outlined),
title: Text(L10n.of(context)!.enableEncryption),
value: !controller.publicGroup,
value: true , //!controller.publicGroup, #schulChatSpecific
onChanged: null,
),
*/
],
),
),
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/story/story_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ class StoryPageController extends State<StoryPage> {
case PopupStoryAction.message:
final roomIdResult = await showFutureLoadingDialog(
context: context,
future: () =>
currentEvent!.senderFromMemoryOrFallback.startDirectChat(),
future: () => currentEvent!.senderFromMemoryOrFallback
.startDirectChat(enableEncryption: true),
);
if (roomIdResult.error != null) return;
VRouter.of(context).toSegments(['rooms', roomIdResult.result!]);
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/user_bottom_sheet/user_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
case UserBottomSheetAction.message:
final roomIdResult = await showFutureLoadingDialog(
context: context,
future: () => widget.user.startDirectChat(),
future: () => widget.user.startDirectChat(enableEncryption: true),
);
if (roomIdResult.error != null) return;
VRouter.of(widget.outerContext)
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/profile_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ProfileBottomSheet extends StatelessWidget {
final client = Matrix.of(context).client;
final result = await showFutureLoadingDialog<String>(
context: context,
future: () => client.startDirectChat(userId),
future: () => client.startDirectChat(userId, enableEncryption: true),
);
if (result.error == null) {
VRouter.of(context).toSegments(['rooms', result.result!]);
Expand Down

0 comments on commit 3904d57

Please sign in to comment.