Add "Mark as read" (#6346)

* Add "Mark as read"

- done
This commit is contained in:
Gil Eluard
2022-06-28 10:44:33 +02:00
committed by GitHub
parent 49943449ff
commit 9d6b4bfac8
5 changed files with 26 additions and 1 deletions
@@ -34,13 +34,15 @@ class RoomActionProvider: RoomActionProviderProtocol {
var menu: UIMenu {
if service.isRoomJoined {
return UIMenu(children: [
var children = service.hasUnread ? [self.markAsReadAction] : []
children.append(contentsOf: [
self.directChatAction,
self.notificationsAction,
self.favouriteAction,
self.lowPriorityAction,
self.leaveAction
])
return UIMenu(children: children)
} else {
if service.roomMembership == .invite {
return UIMenu(children: [
@@ -103,6 +105,15 @@ class RoomActionProvider: RoomActionProviderProtocol {
}
}
private var markAsReadAction: UIAction {
return UIAction(
title: VectorL10n.homeContextMenuMarkAsRead,
image: UIImage(systemName: "envelope.open")) { [weak self] action in
guard let self = self else { return }
self.service.markAsRead()
}
}
private var leaveAction: UIAction {
let image = UIImage(systemName: "rectangle.righthalf.inset.fill.arrow.right")
let action = UIAction(title: VectorL10n.homeContextMenuLeave, image: image) { [weak self] action in