Skip to content

Commit

Permalink
chore: PR fix: Remove keyEquivalents from MessageMenu items
Browse files Browse the repository at this point in the history
Also format
  • Loading branch information
RemiBardon committed Aug 2, 2022
1 parent d620ec5 commit faf4703
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Prose/ProseLib/Sources/ConversationFeature/Chat/Chat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ struct ChatView: NSViewRepresentable {
}

extension ChatView.Coordinator: NSMenuDelegate {
func menuDidClose(_ menu: NSMenu) {
func menuDidClose(_: NSMenu) {
self.viewStore.send(.menuDidClose)
}
}
Expand Down Expand Up @@ -282,7 +282,7 @@ final class ViewStoreScriptMessageHandler: NSObject, WKScriptMessageHandler {

extension WKUserContentController {
func addEventHandler(_ handler: JSEventHandler, viewStore: ViewStore<Void, MessageAction>) {
let handlerName: String = "handler_" + handler.event.replacingOccurrences(of: ":", with: "_")
let handlerName = "handler_" + handler.event.replacingOccurrences(of: ":", with: "_")

self.add(
ViewStoreScriptMessageHandler(handler: handler, viewStore: viewStore),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//
// File.swift
//
//
// Created by Rémi Bardon on 02/08/2022.
// This file is part of prose-app-macos.
// Copyright (c) 2022 Prose Foundation
//

import ComposableArchitecture
Expand Down Expand Up @@ -163,7 +161,8 @@ let chatReducer = Reducer<
guard let reaction = payload.reaction.first else { return .none }

if let messageId = payload.ids.first {
return environment.proseClient.toggleReaction(state.chatId, messageId, reaction).fireAndForget()
return environment.proseClient.toggleReaction(state.chatId, messageId, reaction)
.fireAndForget()
} else {
logger.notice("Could not toggle reaction: No message selected")
return .none
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ public enum MessageMenuAction: Equatable {
enum Tag: Int {
case copyText, edit, addReaction, remove

var keyEquivalent: String {
switch self {
case .copyText: return "c"
case .edit: return "e"
case .addReaction: return "r"
case .remove: return "d"
}
}

var systemImage: String? {
switch self {
case .copyText: return "doc.on.clipboard"
Expand Down Expand Up @@ -61,11 +52,7 @@ public final class MessageMenu: NSMenu {
action: Action?,
isDisabled: Bool = false
) -> NSMenuItem {
let item = NSMenuItem(
title: title,
action: #selector(self.itemTapped(_:)),
keyEquivalent: action?.tag.keyEquivalent ?? ""
)
let item = NSMenuItem(title: title, action: #selector(self.itemTapped(_:)))

// Set target to receive the events
item.target = self
Expand Down

0 comments on commit faf4703

Please sign in to comment.