|
|
|
@ -72,11 +72,22 @@ extension ClientStoriesExtension on Client {
|
|
|
|
|
invite: invite,
|
|
|
|
|
);
|
|
|
|
|
if (getRoomById(roomId) == null) {
|
|
|
|
|
// Wait for room actually appears in sync
|
|
|
|
|
await onSync.stream
|
|
|
|
|
.firstWhere((sync) => sync.rooms?.join?.containsKey(roomId) ?? false);
|
|
|
|
|
// Wait for room actually appears in sync and is encrypted. This is a
|
|
|
|
|
// workaround for https://github.com/krille-chan/fluffychat/issues/520
|
|
|
|
|
await onSync.stream.firstWhere(
|
|
|
|
|
(sync) =>
|
|
|
|
|
sync.rooms?.join?[roomId]?.state
|
|
|
|
|
?.any((state) => state.type == EventTypes.Encrypted) ??
|
|
|
|
|
false,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
final room = getRoomById(roomId);
|
|
|
|
|
if (room == null || !room.encrypted) {
|
|
|
|
|
throw Exception(
|
|
|
|
|
'Unable to create and wait for encrypted room to appear in Sync.',
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return getRoomById(roomId)!;
|
|
|
|
|
return room;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<Room?> getStoriesRoom(BuildContext context) async {
|
|
|
|
|