Implement key sharing

This commit is contained in:
Christian Pauly 2020-02-22 08:27:08 +01:00
parent 708eae34a3
commit 8cf52ca4fa
12 changed files with 199 additions and 7 deletions

View file

@ -70,6 +70,7 @@ class SimpleDialogs {
Future<bool> askConfirmation({ Future<bool> askConfirmation({
String titleText, String titleText,
String contentText,
String confirmText, String confirmText,
String cancelText, String cancelText,
}) async { }) async {
@ -78,6 +79,7 @@ class SimpleDialogs {
context: context, context: context,
builder: (c) => AlertDialog( builder: (c) => AlertDialog(
title: Text(titleText ?? I18n.of(context).areYouSure), title: Text(titleText ?? I18n.of(context).areYouSure),
content: contentText != null ? Text(contentText) : null,
actions: <Widget>[ actions: <Widget>[
FlatButton( FlatButton(
child: Text( child: Text(

View file

@ -125,6 +125,14 @@ class Message extends StatelessWidget {
event, event,
textColor: textColor, textColor: textColor,
), ),
if (event.type == EventTypes.Encrypted &&
event.messageType == MessageTypes.BadEncrypted &&
event.content["body"] == DecryptError.UNKNOWN_SESSION)
RaisedButton(
child: Text(I18n.of(context).requestPermission),
onPressed: () => Matrix.of(context)
.tryRequestWithLoadingDialog(event.requestKey()),
),
], ],
), ),
), ),

View file

@ -4,6 +4,7 @@ import 'dart:io';
import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/famedlysdk.dart';
import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
@ -13,6 +14,7 @@ import 'package:toast/toast.dart';
import '../i18n/i18n.dart'; import '../i18n/i18n.dart';
import '../utils/app_route.dart'; import '../utils/app_route.dart';
import '../utils/beautify_string_extension.dart';
import '../utils/event_extension.dart'; import '../utils/event_extension.dart';
import '../utils/famedlysdk_store.dart'; import '../utils/famedlysdk_store.dart';
import '../utils/room_extension.dart'; import '../utils/room_extension.dart';
@ -327,11 +329,27 @@ class MatrixState extends State<Matrix> {
"session": session, "session": session,
}; };
StreamSubscription onRoomKeyRequestSub;
@override @override
void initState() { void initState() {
if (widget.client == null) { if (widget.client == null) {
debugPrint("[Matrix] Init matrix client"); debugPrint("[Matrix] Init matrix client");
client = Client(widget.clientName, debug: false); client = Client(widget.clientName, debug: false);
onRoomKeyRequestSub ??=
client.onRoomKeyRequest.stream.listen((RoomKeyRequest request) async {
final Room room = request.room;
final User sender = room.getUserByMXIDSync(request.sender);
if (await SimpleDialogs(context).askConfirmation(
titleText: I18n.of(context).requestToReadOlderMessages,
contentText:
"${sender.id}\n\n${I18n.of(context).device}:\n${request.requestingDevice.deviceId}\n\n${I18n.of(context).identity}:\n${request.requestingDevice.curve25519Key.beautified}",
confirmText: I18n.of(context).verify,
cancelText: I18n.of(context).deny,
)) {
await request.forwardKey();
}
});
_initWithStore(); _initWithStore();
} else { } else {
client = widget.client; client = widget.client;
@ -341,6 +359,7 @@ class MatrixState extends State<Matrix> {
@override @override
void dispose() { void dispose() {
onRoomKeyRequestSub?.cancel();
super.dispose(); super.dispose();
} }

View file

@ -188,6 +188,9 @@ class I18n {
String get changeTheNameOfTheGroup => String get changeTheNameOfTheGroup =>
Intl.message("Change the name of the group"); Intl.message("Change the name of the group");
String get channelCorruptedDecryptError =>
Intl.message("The encryption has been corrupted");
String get chatDetails => Intl.message('Chat details'); String get chatDetails => Intl.message('Chat details');
String get chooseAUsername => Intl.message("Choose a username"); String get chooseAUsername => Intl.message("Choose a username");
@ -256,6 +259,10 @@ class I18n {
String get deleteMessage => Intl.message("Delete message"); String get deleteMessage => Intl.message("Delete message");
String get deny => Intl.message("Deny");
String get device => Intl.message("Device");
String get devices => Intl.message("Devices"); String get devices => Intl.message("Devices");
String get discardPicture => Intl.message("Discard picture"); String get discardPicture => Intl.message("Discard picture");
@ -278,6 +285,8 @@ class I18n {
String get encryptionAlgorithm => Intl.message("Encryption algorithm"); String get encryptionAlgorithm => Intl.message("Encryption algorithm");
String get encryptionNotEnabled => Intl.message("Encryption is not enabled");
String get end2endEncryptionSettings => String get end2endEncryptionSettings =>
Intl.message("End-to-end encryption settings"); Intl.message("End-to-end encryption settings");
@ -328,6 +337,8 @@ class I18n {
String get id => Intl.message("ID"); String get id => Intl.message("ID");
String get identity => Intl.message("Identity");
String get inviteContact => Intl.message("Invite contact"); String get inviteContact => Intl.message("Invite contact");
String inviteContactToGroup(String groupName) => Intl.message( String inviteContactToGroup(String groupName) => Intl.message(
@ -429,6 +440,8 @@ class I18n {
String get none => Intl.message("None"); String get none => Intl.message("None");
String get noPermission => Intl.message("No permission");
String get noRoomsFound => Intl.message("No rooms found..."); String get noRoomsFound => Intl.message("No rooms found...");
String get notSupportedInWeb => Intl.message("Not supported in web"); String get notSupportedInWeb => Intl.message("Not supported in web");
@ -499,6 +512,11 @@ class I18n {
String get reply => Intl.message('Reply'); String get reply => Intl.message('Reply');
String get requestPermission => Intl.message('Request permission');
String get requestToReadOlderMessages =>
Intl.message("Request to read older messages");
String get saturday => Intl.message("Saturday"); String get saturday => Intl.message("Saturday");
String get share => Intl.message("Share"); String get share => Intl.message("Share");
@ -633,6 +651,9 @@ class I18n {
String get unknownDevice => Intl.message("Unknown device"); String get unknownDevice => Intl.message("Unknown device");
String get unknownEncryptionAlgorithm =>
Intl.message("Unknown encryption algorithm");
String unknownEvent(String type) => Intl.message( String unknownEvent(String type) => Intl.message(
"Unknown event '$type'", "Unknown event '$type'",
name: "unknownEvent", name: "unknownEvent",
@ -679,6 +700,8 @@ class I18n {
args: [username, type], args: [username, type],
); );
String get verify => Intl.message("Verify");
String get visibleForAllParticipants => String get visibleForAllParticipants =>
Intl.message("Visible for all participants"); Intl.message("Visible for all participants");

View file

@ -216,6 +216,11 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"The encryption has been corrupted": "Die Verschlüsselung wurde korrumpiert",
"@The encryption has been corrupted": {
"type": "text",
"placeholders": {}
},
"Chat details": "Gruppeninfo", "Chat details": "Gruppeninfo",
"@Chat details": { "@Chat details": {
"type": "text", "type": "text",
@ -340,6 +345,16 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"Deny": "Ablehnen",
"@Deny": {
"type": "text",
"placeholders": {}
},
"Device": "Gerät",
"@Device": {
"type": "text",
"placeholders": {}
},
"Devices": "Geräte", "Devices": "Geräte",
"@Devices": { "@Devices": {
"type": "text", "type": "text",
@ -382,6 +397,11 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"Encryption is not enabled": "Verschlüsselung ist nicht aktiviert",
"@Encryption is not enabled": {
"type": "text",
"placeholders": {}
},
"End-to-end encryption settings": "Ende-zu-Ende-Verschlüsselung", "End-to-end encryption settings": "Ende-zu-Ende-Verschlüsselung",
"@End-to-end encryption settings": { "@End-to-end encryption settings": {
"type": "text", "type": "text",
@ -482,6 +502,11 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"Identity": "Identität",
"@Identity": {
"type": "text",
"placeholders": {}
},
"Invite contact": "Kontakt einladen", "Invite contact": "Kontakt einladen",
"@Invite contact": { "@Invite contact": {
"type": "text", "type": "text",
@ -662,6 +687,11 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"No permission": "Keine Berechtigung",
"@No permission": {
"type": "text",
"placeholders": {}
},
"No rooms found...": "Keine Räume gefunden ...", "No rooms found...": "Keine Räume gefunden ...",
"@No rooms found...": { "@No rooms found...": {
"type": "text", "type": "text",
@ -792,6 +822,16 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"Request permission": "Berechtigung anfragen",
"@Request permission": {
"type": "text",
"placeholders": {}
},
"Request to read older messages": "Anfrage um ältere Nachrichten zu lesen",
"@Request to read older messages": {
"type": "text",
"placeholders": {}
},
"Saturday": "Samstag", "Saturday": "Samstag",
"@Saturday": { "@Saturday": {
"type": "text", "type": "text",
@ -1021,6 +1061,11 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"Unknown encryption algorithm": "Unbekannter Verschlüsselungsalgorithmus",
"@Unknown encryption algorithm": {
"type": "text",
"placeholders": {}
},
"unknownEvent": "Unbekanntes Event '{type}'", "unknownEvent": "Unbekanntes Event '{type}'",
"@unknownEvent": { "@unknownEvent": {
"type": "text", "type": "text",
@ -1079,6 +1124,11 @@
"type": {} "type": {}
} }
}, },
"Verify": "Bestätigen",
"@Verify": {
"type": "text",
"placeholders": {}
},
"Visible for all participants": "Sichtbar für alle Teilnehmer", "Visible for all participants": "Sichtbar für alle Teilnehmer",
"@Visible for all participants": { "@Visible for all participants": {
"type": "text", "type": "text",

View file

@ -1,5 +1,5 @@
{ {
"@@last_modified": "2020-02-19T16:20:13.752724", "@@last_modified": "2020-02-22T08:18:47.225173",
"About": "About", "About": "About",
"@About": { "@About": {
"type": "text", "type": "text",
@ -216,6 +216,11 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"The encryption has been corrupted": "The encryption has been corrupted",
"@The encryption has been corrupted": {
"type": "text",
"placeholders": {}
},
"Chat details": "Chat details", "Chat details": "Chat details",
"@Chat details": { "@Chat details": {
"type": "text", "type": "text",
@ -340,6 +345,16 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"Deny": "Deny",
"@Deny": {
"type": "text",
"placeholders": {}
},
"Device": "Device",
"@Device": {
"type": "text",
"placeholders": {}
},
"Devices": "Devices", "Devices": "Devices",
"@Devices": { "@Devices": {
"type": "text", "type": "text",
@ -382,6 +397,11 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"Encryption is not enabled": "Encryption is not enabled",
"@Encryption is not enabled": {
"type": "text",
"placeholders": {}
},
"End-to-end encryption settings": "End-to-end encryption settings", "End-to-end encryption settings": "End-to-end encryption settings",
"@End-to-end encryption settings": { "@End-to-end encryption settings": {
"type": "text", "type": "text",
@ -482,6 +502,11 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"Identity": "Identity",
"@Identity": {
"type": "text",
"placeholders": {}
},
"Invite contact": "Invite contact", "Invite contact": "Invite contact",
"@Invite contact": { "@Invite contact": {
"type": "text", "type": "text",
@ -662,6 +687,11 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"No permission": "No permission",
"@No permission": {
"type": "text",
"placeholders": {}
},
"No rooms found...": "No rooms found...", "No rooms found...": "No rooms found...",
"@No rooms found...": { "@No rooms found...": {
"type": "text", "type": "text",
@ -792,6 +822,16 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"Request permission": "Request permission",
"@Request permission": {
"type": "text",
"placeholders": {}
},
"Request to read older messages": "Request to read older messages",
"@Request to read older messages": {
"type": "text",
"placeholders": {}
},
"Saturday": "Saturday", "Saturday": "Saturday",
"@Saturday": { "@Saturday": {
"type": "text", "type": "text",
@ -1021,6 +1061,11 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"Unknown encryption algorithm": "Unknown encryption algorithm",
"@Unknown encryption algorithm": {
"type": "text",
"placeholders": {}
},
"unknownEvent": "Unknown event '{type}'", "unknownEvent": "Unknown event '{type}'",
"@unknownEvent": { "@unknownEvent": {
"type": "text", "type": "text",
@ -1079,6 +1124,11 @@
"type": {} "type": {}
} }
}, },
"Verify": "Verify",
"@Verify": {
"type": "text",
"placeholders": {}
},
"Visible for all participants": "Visible for all participants", "Visible for all participants": "Visible for all participants",
"@Visible for all participants": { "@Visible for all participants": {
"type": "text", "type": "text",

View file

@ -170,6 +170,8 @@ class MessageLookup extends MessageLookupByLibrary {
"Dark" : MessageLookupByLibrary.simpleMessage("Dunkel"), "Dark" : MessageLookupByLibrary.simpleMessage("Dunkel"),
"Delete" : MessageLookupByLibrary.simpleMessage("Löschen"), "Delete" : MessageLookupByLibrary.simpleMessage("Löschen"),
"Delete message" : MessageLookupByLibrary.simpleMessage("Nachricht löschen"), "Delete message" : MessageLookupByLibrary.simpleMessage("Nachricht löschen"),
"Deny" : MessageLookupByLibrary.simpleMessage("Ablehnen"),
"Device" : MessageLookupByLibrary.simpleMessage("Gerät"),
"Devices" : MessageLookupByLibrary.simpleMessage("Geräte"), "Devices" : MessageLookupByLibrary.simpleMessage("Geräte"),
"Discard picture" : MessageLookupByLibrary.simpleMessage("Bild verwerfen"), "Discard picture" : MessageLookupByLibrary.simpleMessage("Bild verwerfen"),
"Displayname has been changed" : MessageLookupByLibrary.simpleMessage("Anzeigename wurde geändert"), "Displayname has been changed" : MessageLookupByLibrary.simpleMessage("Anzeigename wurde geändert"),
@ -177,6 +179,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Edit displayname" : MessageLookupByLibrary.simpleMessage("Anzeigename ändern"), "Edit displayname" : MessageLookupByLibrary.simpleMessage("Anzeigename ändern"),
"Empty chat" : MessageLookupByLibrary.simpleMessage("Leerer Chat"), "Empty chat" : MessageLookupByLibrary.simpleMessage("Leerer Chat"),
"Encryption algorithm" : MessageLookupByLibrary.simpleMessage("Verschlüsselungsalgorithmus"), "Encryption algorithm" : MessageLookupByLibrary.simpleMessage("Verschlüsselungsalgorithmus"),
"Encryption is not enabled" : MessageLookupByLibrary.simpleMessage("Verschlüsselung ist nicht aktiviert"),
"End to end encryption is currently in Beta! Use at your own risk!" : MessageLookupByLibrary.simpleMessage("Ende-zu-Ende-Verschlüsselung ist im Beta-Status. Benutzung auf eigene Gefahr!"), "End to end encryption is currently in Beta! Use at your own risk!" : MessageLookupByLibrary.simpleMessage("Ende-zu-Ende-Verschlüsselung ist im Beta-Status. Benutzung auf eigene Gefahr!"),
"End-to-end encryption settings" : MessageLookupByLibrary.simpleMessage("Ende-zu-Ende-Verschlüsselung"), "End-to-end encryption settings" : MessageLookupByLibrary.simpleMessage("Ende-zu-Ende-Verschlüsselung"),
"Enter a group name" : MessageLookupByLibrary.simpleMessage("Gib einen Gruppennamen ein"), "Enter a group name" : MessageLookupByLibrary.simpleMessage("Gib einen Gruppennamen ein"),
@ -195,6 +198,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Help" : MessageLookupByLibrary.simpleMessage("Hilfe"), "Help" : MessageLookupByLibrary.simpleMessage("Hilfe"),
"Homeserver is not compatible" : MessageLookupByLibrary.simpleMessage("Homeserver ist nicht kompatibel"), "Homeserver is not compatible" : MessageLookupByLibrary.simpleMessage("Homeserver ist nicht kompatibel"),
"ID" : MessageLookupByLibrary.simpleMessage("ID"), "ID" : MessageLookupByLibrary.simpleMessage("ID"),
"Identity" : MessageLookupByLibrary.simpleMessage("Identität"),
"Invite contact" : MessageLookupByLibrary.simpleMessage("Kontakt einladen"), "Invite contact" : MessageLookupByLibrary.simpleMessage("Kontakt einladen"),
"Invited" : MessageLookupByLibrary.simpleMessage("Eingeladen"), "Invited" : MessageLookupByLibrary.simpleMessage("Eingeladen"),
"Invited users only" : MessageLookupByLibrary.simpleMessage("Nur eingeladene Benutzer"), "Invited users only" : MessageLookupByLibrary.simpleMessage("Nur eingeladene Benutzer"),
@ -217,6 +221,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Mute chat" : MessageLookupByLibrary.simpleMessage("Stummschalten"), "Mute chat" : MessageLookupByLibrary.simpleMessage("Stummschalten"),
"New message in FluffyChat" : MessageLookupByLibrary.simpleMessage("Neue Nachricht in FluffyChat"), "New message in FluffyChat" : MessageLookupByLibrary.simpleMessage("Neue Nachricht in FluffyChat"),
"New private chat" : MessageLookupByLibrary.simpleMessage("Neuer privater Chat"), "New private chat" : MessageLookupByLibrary.simpleMessage("Neuer privater Chat"),
"No permission" : MessageLookupByLibrary.simpleMessage("Keine Berechtigung"),
"No rooms found..." : MessageLookupByLibrary.simpleMessage("Keine Räume gefunden ..."), "No rooms found..." : MessageLookupByLibrary.simpleMessage("Keine Räume gefunden ..."),
"None" : MessageLookupByLibrary.simpleMessage("Keiner"), "None" : MessageLookupByLibrary.simpleMessage("Keiner"),
"Not supported in web" : MessageLookupByLibrary.simpleMessage("Wird in der Web-Version nicht unterstützt"), "Not supported in web" : MessageLookupByLibrary.simpleMessage("Wird in der Web-Version nicht unterstützt"),
@ -236,6 +241,8 @@ class MessageLookup extends MessageLookupByLibrary {
"Remove exile" : MessageLookupByLibrary.simpleMessage("Verbannung aufheben"), "Remove exile" : MessageLookupByLibrary.simpleMessage("Verbannung aufheben"),
"Remove message" : MessageLookupByLibrary.simpleMessage("Nachricht entfernen"), "Remove message" : MessageLookupByLibrary.simpleMessage("Nachricht entfernen"),
"Reply" : MessageLookupByLibrary.simpleMessage("Antworten"), "Reply" : MessageLookupByLibrary.simpleMessage("Antworten"),
"Request permission" : MessageLookupByLibrary.simpleMessage("Berechtigung anfragen"),
"Request to read older messages" : MessageLookupByLibrary.simpleMessage("Anfrage um ältere Nachrichten zu lesen"),
"Revoke all permissions" : MessageLookupByLibrary.simpleMessage("Alle Berechtigungen zurücknehmen"), "Revoke all permissions" : MessageLookupByLibrary.simpleMessage("Alle Berechtigungen zurücknehmen"),
"Saturday" : MessageLookupByLibrary.simpleMessage("Samstag"), "Saturday" : MessageLookupByLibrary.simpleMessage("Samstag"),
"Search for a chat" : MessageLookupByLibrary.simpleMessage("Durchsuche die Chats"), "Search for a chat" : MessageLookupByLibrary.simpleMessage("Durchsuche die Chats"),
@ -254,14 +261,17 @@ class MessageLookup extends MessageLookupByLibrary {
"Sunday" : MessageLookupByLibrary.simpleMessage("Sonntag"), "Sunday" : MessageLookupByLibrary.simpleMessage("Sonntag"),
"System" : MessageLookupByLibrary.simpleMessage("System"), "System" : MessageLookupByLibrary.simpleMessage("System"),
"Tap to show menu" : MessageLookupByLibrary.simpleMessage("Tippen, um das Menü anzuzeigen"), "Tap to show menu" : MessageLookupByLibrary.simpleMessage("Tippen, um das Menü anzuzeigen"),
"The encryption has been corrupted" : MessageLookupByLibrary.simpleMessage("Die Verschlüsselung wurde korrumpiert"),
"This room has been archived." : MessageLookupByLibrary.simpleMessage("Dieser Raum wurde archiviert."), "This room has been archived." : MessageLookupByLibrary.simpleMessage("Dieser Raum wurde archiviert."),
"Thursday" : MessageLookupByLibrary.simpleMessage("Donnerstag"), "Thursday" : MessageLookupByLibrary.simpleMessage("Donnerstag"),
"Try to send again" : MessageLookupByLibrary.simpleMessage("Nochmal versuchen zu senden"), "Try to send again" : MessageLookupByLibrary.simpleMessage("Nochmal versuchen zu senden"),
"Tuesday" : MessageLookupByLibrary.simpleMessage("Tuesday"), "Tuesday" : MessageLookupByLibrary.simpleMessage("Tuesday"),
"Unknown device" : MessageLookupByLibrary.simpleMessage("Unbekanntes Gerät"), "Unknown device" : MessageLookupByLibrary.simpleMessage("Unbekanntes Gerät"),
"Unknown encryption algorithm" : MessageLookupByLibrary.simpleMessage("Unbekannter Verschlüsselungsalgorithmus"),
"Unmute chat" : MessageLookupByLibrary.simpleMessage("Stumm aus"), "Unmute chat" : MessageLookupByLibrary.simpleMessage("Stumm aus"),
"Use Amoled compatible colors?" : MessageLookupByLibrary.simpleMessage("Amoled optimierte Farben verwenden?"), "Use Amoled compatible colors?" : MessageLookupByLibrary.simpleMessage("Amoled optimierte Farben verwenden?"),
"Username" : MessageLookupByLibrary.simpleMessage("Benutzername"), "Username" : MessageLookupByLibrary.simpleMessage("Benutzername"),
"Verify" : MessageLookupByLibrary.simpleMessage("Bestätigen"),
"Visibility of the chat history" : MessageLookupByLibrary.simpleMessage("Sichtbarkeit des Chat-Verlaufs"), "Visibility of the chat history" : MessageLookupByLibrary.simpleMessage("Sichtbarkeit des Chat-Verlaufs"),
"Visible for all participants" : MessageLookupByLibrary.simpleMessage("Sichtbar für alle Teilnehmer"), "Visible for all participants" : MessageLookupByLibrary.simpleMessage("Sichtbar für alle Teilnehmer"),
"Visible for everyone" : MessageLookupByLibrary.simpleMessage("Für jeden sichtbar"), "Visible for everyone" : MessageLookupByLibrary.simpleMessage("Für jeden sichtbar"),

View file

@ -170,6 +170,8 @@ class MessageLookup extends MessageLookupByLibrary {
"Dark" : MessageLookupByLibrary.simpleMessage("Dark"), "Dark" : MessageLookupByLibrary.simpleMessage("Dark"),
"Delete" : MessageLookupByLibrary.simpleMessage("Delete"), "Delete" : MessageLookupByLibrary.simpleMessage("Delete"),
"Delete message" : MessageLookupByLibrary.simpleMessage("Delete message"), "Delete message" : MessageLookupByLibrary.simpleMessage("Delete message"),
"Deny" : MessageLookupByLibrary.simpleMessage("Deny"),
"Device" : MessageLookupByLibrary.simpleMessage("Device"),
"Devices" : MessageLookupByLibrary.simpleMessage("Devices"), "Devices" : MessageLookupByLibrary.simpleMessage("Devices"),
"Discard picture" : MessageLookupByLibrary.simpleMessage("Discard picture"), "Discard picture" : MessageLookupByLibrary.simpleMessage("Discard picture"),
"Displayname has been changed" : MessageLookupByLibrary.simpleMessage("Displayname has been changed"), "Displayname has been changed" : MessageLookupByLibrary.simpleMessage("Displayname has been changed"),
@ -177,6 +179,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Edit displayname" : MessageLookupByLibrary.simpleMessage("Edit displayname"), "Edit displayname" : MessageLookupByLibrary.simpleMessage("Edit displayname"),
"Empty chat" : MessageLookupByLibrary.simpleMessage("Empty chat"), "Empty chat" : MessageLookupByLibrary.simpleMessage("Empty chat"),
"Encryption algorithm" : MessageLookupByLibrary.simpleMessage("Encryption algorithm"), "Encryption algorithm" : MessageLookupByLibrary.simpleMessage("Encryption algorithm"),
"Encryption is not enabled" : MessageLookupByLibrary.simpleMessage("Encryption is not enabled"),
"End to end encryption is currently in Beta! Use at your own risk!" : MessageLookupByLibrary.simpleMessage("End to end encryption is currently in Beta! Use at your own risk!"), "End to end encryption is currently in Beta! Use at your own risk!" : MessageLookupByLibrary.simpleMessage("End to end encryption is currently in Beta! Use at your own risk!"),
"End-to-end encryption settings" : MessageLookupByLibrary.simpleMessage("End-to-end encryption settings"), "End-to-end encryption settings" : MessageLookupByLibrary.simpleMessage("End-to-end encryption settings"),
"Enter a group name" : MessageLookupByLibrary.simpleMessage("Enter a group name"), "Enter a group name" : MessageLookupByLibrary.simpleMessage("Enter a group name"),
@ -195,6 +198,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Help" : MessageLookupByLibrary.simpleMessage("Help"), "Help" : MessageLookupByLibrary.simpleMessage("Help"),
"Homeserver is not compatible" : MessageLookupByLibrary.simpleMessage("Homeserver is not compatible"), "Homeserver is not compatible" : MessageLookupByLibrary.simpleMessage("Homeserver is not compatible"),
"ID" : MessageLookupByLibrary.simpleMessage("ID"), "ID" : MessageLookupByLibrary.simpleMessage("ID"),
"Identity" : MessageLookupByLibrary.simpleMessage("Identity"),
"Invite contact" : MessageLookupByLibrary.simpleMessage("Invite contact"), "Invite contact" : MessageLookupByLibrary.simpleMessage("Invite contact"),
"Invited" : MessageLookupByLibrary.simpleMessage("Invited"), "Invited" : MessageLookupByLibrary.simpleMessage("Invited"),
"Invited users only" : MessageLookupByLibrary.simpleMessage("Invited users only"), "Invited users only" : MessageLookupByLibrary.simpleMessage("Invited users only"),
@ -217,6 +221,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Mute chat" : MessageLookupByLibrary.simpleMessage("Mute chat"), "Mute chat" : MessageLookupByLibrary.simpleMessage("Mute chat"),
"New message in FluffyChat" : MessageLookupByLibrary.simpleMessage("New message in FluffyChat"), "New message in FluffyChat" : MessageLookupByLibrary.simpleMessage("New message in FluffyChat"),
"New private chat" : MessageLookupByLibrary.simpleMessage("New private chat"), "New private chat" : MessageLookupByLibrary.simpleMessage("New private chat"),
"No permission" : MessageLookupByLibrary.simpleMessage("No permission"),
"No rooms found..." : MessageLookupByLibrary.simpleMessage("No rooms found..."), "No rooms found..." : MessageLookupByLibrary.simpleMessage("No rooms found..."),
"None" : MessageLookupByLibrary.simpleMessage("None"), "None" : MessageLookupByLibrary.simpleMessage("None"),
"Not supported in web" : MessageLookupByLibrary.simpleMessage("Not supported in web"), "Not supported in web" : MessageLookupByLibrary.simpleMessage("Not supported in web"),
@ -236,6 +241,8 @@ class MessageLookup extends MessageLookupByLibrary {
"Remove exile" : MessageLookupByLibrary.simpleMessage("Remove exile"), "Remove exile" : MessageLookupByLibrary.simpleMessage("Remove exile"),
"Remove message" : MessageLookupByLibrary.simpleMessage("Remove message"), "Remove message" : MessageLookupByLibrary.simpleMessage("Remove message"),
"Reply" : MessageLookupByLibrary.simpleMessage("Reply"), "Reply" : MessageLookupByLibrary.simpleMessage("Reply"),
"Request permission" : MessageLookupByLibrary.simpleMessage("Request permission"),
"Request to read older messages" : MessageLookupByLibrary.simpleMessage("Request to read older messages"),
"Revoke all permissions" : MessageLookupByLibrary.simpleMessage("Revoke all permissions"), "Revoke all permissions" : MessageLookupByLibrary.simpleMessage("Revoke all permissions"),
"Saturday" : MessageLookupByLibrary.simpleMessage("Saturday"), "Saturday" : MessageLookupByLibrary.simpleMessage("Saturday"),
"Search for a chat" : MessageLookupByLibrary.simpleMessage("Search for a chat"), "Search for a chat" : MessageLookupByLibrary.simpleMessage("Search for a chat"),
@ -254,14 +261,17 @@ class MessageLookup extends MessageLookupByLibrary {
"Sunday" : MessageLookupByLibrary.simpleMessage("Sunday"), "Sunday" : MessageLookupByLibrary.simpleMessage("Sunday"),
"System" : MessageLookupByLibrary.simpleMessage("System"), "System" : MessageLookupByLibrary.simpleMessage("System"),
"Tap to show menu" : MessageLookupByLibrary.simpleMessage("Tap to show menu"), "Tap to show menu" : MessageLookupByLibrary.simpleMessage("Tap to show menu"),
"The encryption has been corrupted" : MessageLookupByLibrary.simpleMessage("The encryption has been corrupted"),
"This room has been archived." : MessageLookupByLibrary.simpleMessage("This room has been archived."), "This room has been archived." : MessageLookupByLibrary.simpleMessage("This room has been archived."),
"Thursday" : MessageLookupByLibrary.simpleMessage("Thursday"), "Thursday" : MessageLookupByLibrary.simpleMessage("Thursday"),
"Try to send again" : MessageLookupByLibrary.simpleMessage("Try to send again"), "Try to send again" : MessageLookupByLibrary.simpleMessage("Try to send again"),
"Tuesday" : MessageLookupByLibrary.simpleMessage("Tuesday"), "Tuesday" : MessageLookupByLibrary.simpleMessage("Tuesday"),
"Unknown device" : MessageLookupByLibrary.simpleMessage("Unknown device"), "Unknown device" : MessageLookupByLibrary.simpleMessage("Unknown device"),
"Unknown encryption algorithm" : MessageLookupByLibrary.simpleMessage("Unknown encryption algorithm"),
"Unmute chat" : MessageLookupByLibrary.simpleMessage("Unmute chat"), "Unmute chat" : MessageLookupByLibrary.simpleMessage("Unmute chat"),
"Use Amoled compatible colors?" : MessageLookupByLibrary.simpleMessage("Use Amoled compatible colors?"), "Use Amoled compatible colors?" : MessageLookupByLibrary.simpleMessage("Use Amoled compatible colors?"),
"Username" : MessageLookupByLibrary.simpleMessage("Username"), "Username" : MessageLookupByLibrary.simpleMessage("Username"),
"Verify" : MessageLookupByLibrary.simpleMessage("Verify"),
"Visibility of the chat history" : MessageLookupByLibrary.simpleMessage("Visibility of the chat history"), "Visibility of the chat history" : MessageLookupByLibrary.simpleMessage("Visibility of the chat history"),
"Visible for all participants" : MessageLookupByLibrary.simpleMessage("Visible for all participants"), "Visible for all participants" : MessageLookupByLibrary.simpleMessage("Visible for all participants"),
"Visible for everyone" : MessageLookupByLibrary.simpleMessage("Visible for everyone"), "Visible for everyone" : MessageLookupByLibrary.simpleMessage("Visible for everyone"),

View file

@ -192,8 +192,28 @@ extension LocalizedBody on Event {
localizedBody = "* $body"; localizedBody = "* $body";
break; break;
case MessageTypes.BadEncrypted: case MessageTypes.BadEncrypted:
localizedBody = String errorText;
"🔒 " + I18n.of(context).couldNotDecryptMessage + ": " + body; switch (body) {
case DecryptError.CHANNEL_CORRUPTED:
errorText = I18n.of(context).channelCorruptedDecryptError + ".";
break;
case DecryptError.NOT_ENABLED:
errorText = I18n.of(context).encryptionNotEnabled + ".";
break;
case DecryptError.UNKNOWN_ALGORITHM:
errorText = I18n.of(context).unknownEncryptionAlgorithm + ".";
break;
case DecryptError.UNKNOWN_SESSION:
errorText = I18n.of(context).noPermission + ".";
break;
default:
errorText = body;
break;
}
localizedBody = "🔒 " +
I18n.of(context).couldNotDecryptMessage +
": " +
errorText;
break; break;
case MessageTypes.Text: case MessageTypes.Text:
case MessageTypes.Notice: case MessageTypes.Notice:

View file

@ -155,7 +155,7 @@ class _ChatState extends State<_Chat> {
@override @override
void dispose() { void dispose() {
timeline?.sub?.cancel(); timeline?.cancelSubscriptions();
timeline = null; timeline = null;
matrix.activeRoomId = ""; matrix.activeRoomId = "";
super.dispose(); super.dispose();

View file

@ -124,8 +124,8 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "."
ref: f6379597ed403f340601a27a3ef6b2b971ac1c27 ref: "8a3547a1ee0464ef54a212046f742891dd586724"
resolved-ref: f6379597ed403f340601a27a3ef6b2b971ac1c27 resolved-ref: "8a3547a1ee0464ef54a212046f742891dd586724"
url: "https://gitlab.com/famedly/famedlysdk.git" url: "https://gitlab.com/famedly/famedlysdk.git"
source: git source: git
version: "0.0.1" version: "0.0.1"

View file

@ -27,7 +27,7 @@ dependencies:
famedlysdk: famedlysdk:
git: git:
url: https://gitlab.com/famedly/famedlysdk.git url: https://gitlab.com/famedly/famedlysdk.git
ref: 664f97b251ba67a163a5ba37c9344c5011275b54 ref: 8a3547a1ee0464ef54a212046f742891dd586724
localstorage: ^3.0.1+4 localstorage: ^3.0.1+4
bubble: ^1.1.9+1 bubble: ^1.1.9+1