|
|
@ -16,12 +16,17 @@ extension ContextMenuVC {
|
|
|
|
let title: String
|
|
|
|
let title: String
|
|
|
|
let expirationInfo: ExpirationInfo?
|
|
|
|
let expirationInfo: ExpirationInfo?
|
|
|
|
let themeColor: ThemeValue
|
|
|
|
let themeColor: ThemeValue
|
|
|
|
let isEmojiAction: Bool
|
|
|
|
let actionType: ActionType
|
|
|
|
let isEmojiPlus: Bool
|
|
|
|
|
|
|
|
let isDismissAction: Bool
|
|
|
|
|
|
|
|
let accessibilityLabel: String?
|
|
|
|
let accessibilityLabel: String?
|
|
|
|
let work: () -> Void
|
|
|
|
let work: () -> Void
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum ActionType {
|
|
|
|
|
|
|
|
case emoji
|
|
|
|
|
|
|
|
case emojiPlus
|
|
|
|
|
|
|
|
case dismiss
|
|
|
|
|
|
|
|
case generic
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: - Initialization
|
|
|
|
// MARK: - Initialization
|
|
|
|
|
|
|
|
|
|
|
|
init(
|
|
|
|
init(
|
|
|
@ -29,9 +34,7 @@ extension ContextMenuVC {
|
|
|
|
title: String = "",
|
|
|
|
title: String = "",
|
|
|
|
expirationInfo: ExpirationInfo? = nil,
|
|
|
|
expirationInfo: ExpirationInfo? = nil,
|
|
|
|
themeColor: ThemeValue = .textPrimary,
|
|
|
|
themeColor: ThemeValue = .textPrimary,
|
|
|
|
isEmojiAction: Bool = false,
|
|
|
|
actionType: ActionType = .generic,
|
|
|
|
isEmojiPlus: Bool = false,
|
|
|
|
|
|
|
|
isDismissAction: Bool = false,
|
|
|
|
|
|
|
|
accessibilityLabel: String? = nil,
|
|
|
|
accessibilityLabel: String? = nil,
|
|
|
|
work: @escaping () -> Void
|
|
|
|
work: @escaping () -> Void
|
|
|
|
) {
|
|
|
|
) {
|
|
|
@ -39,9 +42,7 @@ extension ContextMenuVC {
|
|
|
|
self.title = title
|
|
|
|
self.title = title
|
|
|
|
self.expirationInfo = expirationInfo
|
|
|
|
self.expirationInfo = expirationInfo
|
|
|
|
self.themeColor = themeColor
|
|
|
|
self.themeColor = themeColor
|
|
|
|
self.isEmojiAction = isEmojiAction
|
|
|
|
self.actionType = actionType
|
|
|
|
self.isEmojiPlus = isEmojiPlus
|
|
|
|
|
|
|
|
self.isDismissAction = isDismissAction
|
|
|
|
|
|
|
|
self.accessibilityLabel = accessibilityLabel
|
|
|
|
self.accessibilityLabel = accessibilityLabel
|
|
|
|
self.work = work
|
|
|
|
self.work = work
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -134,20 +135,20 @@ extension ContextMenuVC {
|
|
|
|
static func react(_ cellViewModel: MessageViewModel, _ emoji: EmojiWithSkinTones, _ delegate: ContextMenuActionDelegate?, using dependencies: Dependencies) -> Action {
|
|
|
|
static func react(_ cellViewModel: MessageViewModel, _ emoji: EmojiWithSkinTones, _ delegate: ContextMenuActionDelegate?, using dependencies: Dependencies) -> Action {
|
|
|
|
return Action(
|
|
|
|
return Action(
|
|
|
|
title: emoji.rawValue,
|
|
|
|
title: emoji.rawValue,
|
|
|
|
isEmojiAction: true
|
|
|
|
actionType: .emoji
|
|
|
|
) { delegate?.react(cellViewModel, with: emoji, using: dependencies) }
|
|
|
|
) { delegate?.react(cellViewModel, with: emoji, using: dependencies) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static func emojiPlusButton(_ cellViewModel: MessageViewModel, _ delegate: ContextMenuActionDelegate?, using dependencies: Dependencies) -> Action {
|
|
|
|
static func emojiPlusButton(_ cellViewModel: MessageViewModel, _ delegate: ContextMenuActionDelegate?, using dependencies: Dependencies) -> Action {
|
|
|
|
return Action(
|
|
|
|
return Action(
|
|
|
|
isEmojiPlus: true,
|
|
|
|
actionType: .emojiPlus,
|
|
|
|
accessibilityLabel: "Add emoji"
|
|
|
|
accessibilityLabel: "Add emoji"
|
|
|
|
) { delegate?.showFullEmojiKeyboard(cellViewModel, using: dependencies) }
|
|
|
|
) { delegate?.showFullEmojiKeyboard(cellViewModel, using: dependencies) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static func dismiss(_ delegate: ContextMenuActionDelegate?) -> Action {
|
|
|
|
static func dismiss(_ delegate: ContextMenuActionDelegate?) -> Action {
|
|
|
|
return Action(
|
|
|
|
return Action(
|
|
|
|
isDismissAction: true
|
|
|
|
actionType: .dismiss
|
|
|
|
) { delegate?.contextMenuDismissed() }
|
|
|
|
) { delegate?.contextMenuDismissed() }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|