wip
This commit is contained in:
parent
97f2673b55
commit
c084bc4caf
12 changed files with 182 additions and 156 deletions
|
|
@ -1,5 +0,0 @@
|
|||
import "package:matrix/matrix.dart";
|
||||
|
||||
extension GetHeaders on Client {
|
||||
Map<String, String> get headers => {"authorization": "Bearer $accessToken"};
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
import "package:collection/collection.dart";
|
||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:matrix/matrix.dart";
|
||||
import "package:nexus/helpers/extensions/get_full_room.dart";
|
||||
import "package:nexus/models/full_room.dart";
|
||||
|
||||
extension RoomToChildren on Room {
|
||||
Future<IList<FullRoom>> getAllChildren() async {
|
||||
final direct = await Future.wait(
|
||||
spaceChildren
|
||||
.map(
|
||||
(child) => client.rooms
|
||||
.firstWhereOrNull((r) => r.id == child.roomId)
|
||||
?.fullRoom,
|
||||
)
|
||||
.nonNulls,
|
||||
);
|
||||
|
||||
return (await Future.wait(
|
||||
direct.map(
|
||||
(child) async => child.roomData.isSpace
|
||||
? await child.roomData.getAllChildren()
|
||||
: [child],
|
||||
),
|
||||
)).expand((list) => list).toIList();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue