feat: Display warning banner on unverified devices

This commit is contained in:
krille-chan 2024-10-12 21:50:15 +02:00
commit d8acd92023
No known key found for this signature in database
6 changed files with 73 additions and 2 deletions

View file

@ -32,6 +32,28 @@ class DevicesSettingsController extends State<DevicesSettings> {
bool loadingDeletingDevices = false;
String? errorDeletingDevices;
bool? chatBackupEnabled;
@override
void initState() {
_checkChatBackup();
super.initState();
}
void _checkChatBackup() async {
final client = Matrix.of(context).client;
if (client.encryption?.keyManager.enabled == true) {
if (await client.encryption?.keyManager.isCached() == false ||
await client.encryption?.crossSigning.isCached() == false ||
client.isUnknownSession && !mounted) {
setState(() {
chatBackupEnabled = false;
});
return;
}
}
}
void removeDevicesAction(List<Device> devices) async {
if (await showOkCancelAlertDialog(
context: context,

View file

@ -48,6 +48,19 @@ class DevicesSettingsView extends StatelessWidget {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
if (controller.chatBackupEnabled == false)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: ListTile(
leading: const CircleAvatar(
child: Icon(Icons.info_outlined),
),
subtitle: Text(
L10n.of(context)
.noticeChatBackupDeviceVerification,
),
),
),
if (controller.thisDevice != null) ...[
Container(
padding: const EdgeInsets.symmetric(