Rename sendReaction as toggleReaction

This commit is contained in:
aringenbach
2023-06-26 17:44:31 +02:00
committed by Stefan Ceriu
parent 7d3dcee5a3
commit 88ac3fb8c6
12 changed files with 32 additions and 32 deletions
@@ -54,7 +54,7 @@ enum RoomScreenViewAction {
case itemTapped(id: String)
case linkClicked(url: URL)
case sendMessage
case sendReaction(key: String, eventID: String)
case toggleReaction(key: String, eventID: String)
case cancelReply
case cancelEdit
/// Mark the entire room as read - this is heavy handed as a starting point for now.
@@ -84,8 +84,8 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
MXLog.warning("Link clicked: \(url)")
case .sendMessage:
Task { await sendCurrentMessage() }
case .sendReaction(let emoji, let itemId):
Task { await timelineController.sendReaction(emoji, to: itemId) }
case .toggleReaction(let emoji, let itemId):
Task { await timelineController.toggleReaction(emoji, to: itemId) }
case .cancelReply:
setComposerMode(.default)
case .cancelEdit:
@@ -94,7 +94,7 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
if !timelineItem.properties.reactions.isEmpty {
TimelineReactionsView(reactions: timelineItem.properties.reactions,
alignment: alignment) { key in
context.send(viewAction: .sendReaction(key: key, eventID: timelineItem.id))
context.send(viewAction: .toggleReaction(key: key, eventID: timelineItem.id))
}
}
}
@@ -117,7 +117,7 @@ struct TimelineItemPlainStylerView<Content: View>: View {
if !timelineItem.properties.reactions.isEmpty {
TimelineReactionsView(reactions: timelineItem.properties.reactions,
alignment: .leading) { key in
context.send(viewAction: .sendReaction(key: key, eventID: timelineItem.id))
context.send(viewAction: .toggleReaction(key: key, eventID: timelineItem.id))
}
}
}
@@ -150,7 +150,7 @@ public struct TimelineItemMenu: View {
private func reactionButton(for emoji: String) -> some View {
Button {
presentationMode.wrappedValue.dismiss()
context.send(viewAction: .sendReaction(key: emoji, eventID: item.id))
context.send(viewAction: .toggleReaction(key: emoji, eventID: item.id))
} label: {
Text(emoji)
.padding(8.0)