diff --git a/lib/components/encryption_button.dart b/lib/components/encryption_button.dart index c00937ac..b337a7dc 100644 --- a/lib/components/encryption_button.dart +++ b/lib/components/encryption_button.dart @@ -49,6 +49,8 @@ class _EncryptionButtonState extends State { await SimpleDialogs(context).tryRequestWithLoadingDialog( widget.room.enableEncryption(), ); + // we want to enable the lock icon + setState(() => null); } } @@ -60,11 +62,14 @@ class _EncryptionButtonState extends State { @override Widget build(BuildContext context) { - _onSyncSub ??= Matrix.of(context) - .client - .onSync - .stream - .listen((s) => setState(() => null)); + if (widget.room.encrypted) { + _onSyncSub ??= Matrix.of(context) + .client + .onSync + .stream + .where((s) => s.deviceLists != null) + .listen((s) => setState(() => null)); + } return FutureBuilder>( future: widget.room.encrypted ? widget.room.requestParticipants() : null,