|
|
|
@ -8,6 +8,7 @@ import 'package:fluffychat/utils/beautify_string_extension.dart';
|
|
|
|
|
import 'package:fluffychat/i18n/i18n.dart';
|
|
|
|
|
import 'package:fluffychat/views/chat_list.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:toast/toast.dart';
|
|
|
|
|
|
|
|
|
|
class ChatEncryptionSettingsView extends StatelessWidget {
|
|
|
|
|
final String id;
|
|
|
|
@ -49,6 +50,7 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
room ??= Matrix.of(context).client.getRoomById(widget.id);
|
|
|
|
|
roomUpdate ??= room.onUpdate.stream.listen((s) => setState(() => null));
|
|
|
|
|
print(Matrix.of(context).client.userDeviceKeys.length);
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
@ -59,15 +61,19 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text(I18n.of(context).encryptionAlgorithm),
|
|
|
|
|
subtitle: Text(room.encryptionAlgorithm ?? I18n.of(context).none),
|
|
|
|
|
trailing: Icon(room.encrypted ? Icons.lock : Icons.lock_open),
|
|
|
|
|
trailing: Icon(room.encrypted ? Icons.lock : Icons.lock_open,
|
|
|
|
|
color: room.encrypted ? Colors.green : Colors.red),
|
|
|
|
|
onTap: () {
|
|
|
|
|
if (room.encrypted) return;
|
|
|
|
|
if (!Matrix.of(context).encryptionEnabled) {
|
|
|
|
|
Toast.show(I18n.of(context).needPantalaimonWarning, context,
|
|
|
|
|
duration: 8);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) => ConfirmDialog(
|
|
|
|
|
I18n.of(context).enableEncryptionWarning +
|
|
|
|
|
" " +
|
|
|
|
|
I18n.of(context).needPantalaimonWarning,
|
|
|
|
|
I18n.of(context).enableEncryptionWarning,
|
|
|
|
|
I18n.of(context).yes,
|
|
|
|
|
(context) => Matrix.of(context).tryRequestWithLoadingDialog(
|
|
|
|
|
room.enableEncryption(),
|
|
|
|
@ -83,6 +89,7 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider(height: 1),
|
|
|
|
|
if (room.encrypted)
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text(
|
|
|
|
|
"${I18n.of(context).participatingUserDevices}:",
|
|
|
|
@ -91,7 +98,8 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Divider(height: 1),
|
|
|
|
|
if (room.encrypted) Divider(height: 1),
|
|
|
|
|
if (room.encrypted)
|
|
|
|
|
FutureBuilder<List<DeviceKeys>>(
|
|
|
|
|
future: room.getUserDeviceKeys(),
|
|
|
|
|
builder: (BuildContext context, snapshot) {
|
|
|
|
|