Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

# Upcoming

### ✅ Added
- Exposes all the default message actions [#711](https://github.com/GetStream/stream-chat-swiftui/pull/711)
### 🐞 Fixed
- Use bright color for typing indicator animation in dark mode [#702](https://github.com/GetStream/stream-chat-swiftui/pull/702)
- Refresh quoted message preview when the quoted message is deleted [#705](https://github.com/GetStream/stream-chat-swiftui/pull/705)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
import StreamChat
import SwiftUI

extension MessageAction {
// MARK: - Default Message Actions

public extension MessageAction {
/// Returns the default message actions.
///
/// - Parameters:
/// - message: the current message.
/// - chatClient: the chat client.
/// - onDimiss: called when the action is executed.
/// - Returns: array of `MessageAction`.
public static func defaultActions<Factory: ViewFactory>(
static func defaultActions<Factory: ViewFactory>(
factory: Factory,
for message: ChatMessage,
channel: ChatChannel,
Expand Down Expand Up @@ -229,9 +231,8 @@ extension MessageAction {
return messageActions
}

// MARK: - private

private static func copyMessageAction(
/// The action to copy the message text.
static func copyMessageAction(
for message: ChatMessage,
onFinish: @escaping (MessageActionInfo) -> Void
) -> MessageAction {
Expand All @@ -255,7 +256,8 @@ extension MessageAction {
return copyAction
}

private static func editMessageAction(
/// The action to edit the message.
static func editMessageAction(
for message: ChatMessage,
channel: ChatChannel,
onFinish: @escaping (MessageActionInfo) -> Void
Expand All @@ -279,7 +281,8 @@ extension MessageAction {
return editAction
}

private static func pinMessageAction(
/// The action to pin the message.
static func pinMessageAction(
for message: ChatMessage,
channel: ChatChannel,
chatClient: ChatClient,
Expand Down Expand Up @@ -318,7 +321,8 @@ extension MessageAction {
return pinAction
}

private static func unpinMessageAction(
/// The action to unpin the message.
static func unpinMessageAction(
for message: ChatMessage,
channel: ChatChannel,
chatClient: ChatClient,
Expand Down Expand Up @@ -357,7 +361,8 @@ extension MessageAction {
return pinAction
}

private static func replyAction(
/// The action to reply to the message
static func replyAction(
for message: ChatMessage,
channel: ChatChannel,
onFinish: @escaping (MessageActionInfo) -> Void
Expand All @@ -381,7 +386,8 @@ extension MessageAction {
return replyAction
}

private static func threadReplyAction<Factory: ViewFactory>(
/// The action to reply to the message in a thread
static func threadReplyAction<Factory: ViewFactory>(
factory: Factory,
for message: ChatMessage,
channel: ChatChannel
Expand All @@ -404,7 +410,8 @@ extension MessageAction {
return replyThread
}

private static func deleteMessageAction(
/// The action to delete the message.
static func deleteMessageAction(
for message: ChatMessage,
channel: ChatChannel,
chatClient: ChatClient,
Expand Down Expand Up @@ -449,7 +456,8 @@ extension MessageAction {
return deleteMessage
}

private static func flagMessageAction(
/// The action to flag the message.
static func flagMessageAction(
for message: ChatMessage,
channel: ChatChannel,
chatClient: ChatClient,
Expand Down Expand Up @@ -493,8 +501,9 @@ extension MessageAction {

return flagMessage
}

private static func markAsUnreadAction(

/// The action to mark the message as unread.
static func markAsUnreadAction(
for message: ChatMessage,
channel: ChatChannel,
chatClient: ChatClient,
Expand Down Expand Up @@ -530,7 +539,8 @@ extension MessageAction {
return unreadAction
}

private static func markThreadAsUnreadAction(
/// The action to mark the thread as unread.
static func markThreadAsUnreadAction(
messageController: ChatMessageController,
message: ChatMessage,
onFinish: @escaping (MessageActionInfo) -> Void,
Expand Down Expand Up @@ -562,7 +572,8 @@ extension MessageAction {
return unreadAction
}

private static func muteAction(
/// The action to mute the user.
static func muteAction(
for message: ChatMessage,
channel: ChatChannel,
chatClient: ChatClient,
Expand Down Expand Up @@ -597,8 +608,9 @@ extension MessageAction {

return muteUser
}

private static func blockUserAction(

/// The action to block the user
static func blockUserAction(
for message: ChatMessage,
channel: ChatChannel,
chatClient: ChatClient,
Expand Down Expand Up @@ -638,7 +650,8 @@ extension MessageAction {
return blockUser
}

private static func unmuteAction(
/// The action to unmute the user.
static func unmuteAction(
for message: ChatMessage,
channel: ChatChannel,
chatClient: ChatClient,
Expand Down Expand Up @@ -673,8 +686,9 @@ extension MessageAction {

return unmuteUser
}

private static func unblockUserAction(

/// The action to unblock the user.
static func unblockUserAction(
for message: ChatMessage,
channel: ChatChannel,
chatClient: ChatClient,
Expand Down Expand Up @@ -714,7 +728,8 @@ extension MessageAction {
return unblockUser
}

private static func resendMessageAction(
/// The action to resend the message.
static func resendMessageAction(
for message: ChatMessage,
channel: ChatChannel,
chatClient: ChatClient,
Expand Down Expand Up @@ -753,7 +768,8 @@ extension MessageAction {
return messageAction
}

private static func messageNotSentActions(
/// The actions for a message that was not sent.
static func messageNotSentActions(
for message: ChatMessage,
channel: ChatChannel,
chatClient: ChatClient,
Expand Down Expand Up @@ -783,6 +799,8 @@ extension MessageAction {
return messageActions
}

// MARK: - Helpers

private static func editAndDeleteActions(
for message: ChatMessage,
channel: ChatChannel,
Expand Down
Loading