Enhanced E2EE UX

This commit is contained in:
Christian Pauly 2020-02-22 08:44:50 +01:00
parent 8cf52ca4fa
commit 3ec2e9f9b5
2 changed files with 46 additions and 18 deletions

View File

@ -129,7 +129,11 @@ class Message extends StatelessWidget {
event.messageType == MessageTypes.BadEncrypted &&
event.content["body"] == DecryptError.UNKNOWN_SESSION)
RaisedButton(
child: Text(I18n.of(context).requestPermission),
color: color.withAlpha(100),
child: Text(
I18n.of(context).requestPermission,
style: TextStyle(color: textColor),
),
onPressed: () => Matrix.of(context)
.tryRequestWithLoadingDialog(event.requestKey()),
),

View File

@ -611,6 +611,47 @@ class _ChatState extends State<_Chat> {
),
],
),
FutureBuilder<List<DeviceKeys>>(
future: room.getUserDeviceKeys(),
builder:
(BuildContext context, snapshot) {
Color color;
if (room.encrypted &&
snapshot.hasData) {
final List<DeviceKeys>
deviceKeysList = snapshot.data;
color = Colors.orange;
if (deviceKeysList.indexWhere(
(DeviceKeys deviceKeys) =>
deviceKeys.verified ==
false &&
deviceKeys.blocked ==
false) ==
-1) {
color = Colors.green[700];
}
} else if (!room.encrypted &&
room.joinRules !=
JoinRules.public) {
color = Colors.red;
}
return IconButton(
icon: Icon(
room.encrypted
? Icons.lock
: Icons.lock_open,
size: 20,
color: color),
onPressed: () =>
Navigator.of(context).push(
AppRoute.defaultRoute(
context,
ChatEncryptionSettingsView(
widget.id),
),
),
);
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
@ -632,23 +673,6 @@ class _ChatState extends State<_Chat> {
hintText:
I18n.of(context).writeAMessage,
border: InputBorder.none,
prefixIcon:
sendController.text.isEmpty
? InkWell(
child: Icon(room.encrypted
? Icons.lock
: Icons.lock_open),
onTap: () =>
Navigator.of(context)
.push(
AppRoute.defaultRoute(
context,
ChatEncryptionSettingsView(
widget.id),
),
),
)
: null,
),
onChanged: (String text) {
this.typingCoolDown?.cancel();