Mark as read button
This commit is contained in:
parent
e8a8bb3b4f
commit
0f563455ff
4 changed files with 21 additions and 4 deletions
|
|
@ -28,7 +28,7 @@ A simple and user-friendly Matrix client made with Flutter and the Matrix Dart S
|
|||
- [x] Rooms / Spaces
|
||||
- [x] Displaying and choosing
|
||||
- [x] Reading, showing unread
|
||||
- [ ] Mark as read button on rooms and spaces
|
||||
- [x] Mark as read button on rooms and spaces
|
||||
- [ ] Searching
|
||||
- [ ] Creating (Rooms, Spaces, and DMs)
|
||||
- [ ] Joining
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class SpacesController extends AsyncNotifier<IList<Space>> {
|
|||
avatar: space.avatar,
|
||||
id: space.roomData.id,
|
||||
roomData: space.roomData,
|
||||
children: IList(await space.roomData.getAllChildren(client)),
|
||||
children: IList(await space.roomData.getAllChildren()),
|
||||
),
|
||||
),
|
||||
)),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import "package:nexus/helpers/extensions/get_full_room.dart";
|
|||
import "package:nexus/models/full_room.dart";
|
||||
|
||||
extension RoomToChildren on Room {
|
||||
Future<IList<FullRoom>> getAllChildren(Client client) async {
|
||||
Future<IList<FullRoom>> getAllChildren() async {
|
||||
final direct = await Future.wait(
|
||||
spaceChildren
|
||||
.map(
|
||||
|
|
@ -19,7 +19,7 @@ extension RoomToChildren on Room {
|
|||
return (await Future.wait(
|
||||
direct.map(
|
||||
(child) async => child.roomData.isSpace
|
||||
? await child.roomData.getAllChildren(client)
|
||||
? await child.roomData.getAllChildren()
|
||||
: [child],
|
||||
),
|
||||
)).expand((list) => list).toIList();
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import "package:clipboard/clipboard.dart";
|
|||
import "package:flutter/material.dart";
|
||||
import "package:flutter_hooks/flutter_hooks.dart";
|
||||
import "package:matrix/matrix.dart";
|
||||
import "package:nexus/helpers/extensions/room_to_children.dart";
|
||||
import "package:nexus/widgets/form_text_input.dart";
|
||||
|
||||
class RoomMenu extends StatelessWidget {
|
||||
|
|
@ -12,6 +13,15 @@ class RoomMenu extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
final danger = Theme.of(context).colorScheme.error;
|
||||
|
||||
void markRead(String roomId) async {
|
||||
for (final child in await room.getAllChildren()) {
|
||||
await child.roomData.setReadMarker(
|
||||
child.roomData.lastEvent?.eventId,
|
||||
mRead: child.roomData.lastEvent?.eventId,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return PopupMenuButton(
|
||||
itemBuilder: (_) => [
|
||||
PopupMenuItem(
|
||||
|
|
@ -21,6 +31,13 @@ class RoomMenu extends StatelessWidget {
|
|||
},
|
||||
child: ListTile(leading: Icon(Icons.link), title: Text("Copy Link")),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: () => markRead(room.id),
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.check),
|
||||
title: Text("Mark as Read"),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: () => showDialog(
|
||||
context: context,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue