Skip to content

Commit

Permalink
Merge pull request #1734 from matthiasn/feat/room_accept_invite
Browse files Browse the repository at this point in the history
feat: accept room invite
  • Loading branch information
matthiasn authored Apr 28, 2024
2 parents 7669f03 + 5d1028f commit e39aa60
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/sync/matrix/matrix_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class MatrixService {
Future<void> listen() async {
await startKeyVerificationListener();
await listenToTimeline();
listenToMatrixRoomInvites(service: this);
}

Client get client => _client;
Expand Down
20 changes: 20 additions & 0 deletions lib/sync/matrix/room.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,23 @@ Future<void> inviteToMatrixRoom({
}) async {
await service.syncRoom?.invite(userId);
}

void listenToMatrixRoomInvites({
required MatrixService service,
}) {
final client = service.client;
client.onRoomState.stream.listen((event) async {
final roomIdFromEvent = event.room.id;
if (service.syncRoom?.id == null) {
await saveMatrixRoom(
client: client,
roomId: roomIdFromEvent,
);

await joinMatrixRoom(
roomId: roomIdFromEvent,
service: service,
);
}
});
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: lotti
description: Achieve your goals and keep your data private with Lotti.
publish_to: 'none'
version: 0.9.455+2481
version: 0.9.456+2483

msix_config:
display_name: LottiApp
Expand Down

0 comments on commit e39aa60

Please sign in to comment.