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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add participant actions in channel info view [#982](https://github.com/GetStream/stream-chat-swiftui/pull/982)
- Add support for overriding `onImageTap` in `LinkAttachmentView` [#986](https://github.com/GetStream/stream-chat-swiftui/pull/986)
- Add support for customizing text colors in `LinkAttachmentView` [#992](https://github.com/GetStream/stream-chat-swiftui/pull/992)
- Expose `MediaAttachment` properties and initializer [#1000](https://github.com/GetStream/stream-chat-swiftui/pull/1000)

### 🐞 Fixed
- Fix openChannel not working when searching or another chat shown [#975](https://github.com/GetStream/stream-chat-swiftui/pull/975)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,15 @@ extension ChatMessage {
public struct MediaAttachment: Identifiable, Equatable {
@Injected(\.utils) var utils

let url: URL
let type: MediaAttachmentType
var uploadingState: AttachmentUploadingState?
public let url: URL
public let type: MediaAttachmentType
public var uploadingState: AttachmentUploadingState?

public init(url: URL, type: MediaAttachmentType, uploadingState: AttachmentUploadingState? = nil) {
self.url = url
self.type = type
self.uploadingState = uploadingState
}

public var id: String {
url.absoluteString
Expand Down Expand Up @@ -477,9 +483,14 @@ extension MediaAttachment {
}
}

enum MediaAttachmentType {
case image
case video
public struct MediaAttachmentType: RawRepresentable {
public let rawValue: String
public init(rawValue: String) {
self.rawValue = rawValue
}

public static let image = Self(rawValue: "image")
public static let video = Self(rawValue: "video")
}

/// Options for the gallery view.
Expand Down
Loading