Merge branch 'soru/no-http-in-sync' into 'master'
make sure that no http requests are done inside of /sync Closes app#613 See merge request famedly/famedlysdk!401
This commit is contained in:
commit
654f34cce0
|
@ -72,12 +72,16 @@ class Encryption {
|
|||
}
|
||||
|
||||
Future<void> handleToDeviceEvent(ToDeviceEvent event) async {
|
||||
if (['m.room_key', 'm.room_key_request', 'm.forwarded_room_key']
|
||||
.contains(event.type)) {
|
||||
// a new room key or thelike. We need to handle this asap, before other
|
||||
if (event.type == 'm.room_key') {
|
||||
// a new room key. We need to handle this asap, before other
|
||||
// events in /sync are handled
|
||||
await keyManager.handleToDeviceEvent(event);
|
||||
}
|
||||
if (['m.room_key_request', 'm.forwarded_room_key'].contains(event.type)) {
|
||||
// "just" room key request things. We don't need these asap, so we handle
|
||||
// them in the background
|
||||
unawaited(keyManager.handleToDeviceEvent(event));
|
||||
}
|
||||
if (event.type.startsWith('m.key.verification.')) {
|
||||
// some key verification event. No need to handle it now, we can easily
|
||||
// do this in the background
|
||||
|
|
|
@ -123,6 +123,8 @@ class KeyManager {
|
|||
json.encode(content),
|
||||
json.encode({}),
|
||||
);
|
||||
// Note to self: When adding key-backup that needs to be unawaited(), else
|
||||
// we might accidentally end up with http requests inside of the sync loop
|
||||
// TODO: somehow try to decrypt last message again
|
||||
final room = client.getRoomById(roomId);
|
||||
if (room != null) {
|
||||
|
|
Loading…
Reference in a new issue