Add iOS media placeholders
This commit is contained in:
@@ -91,12 +91,67 @@ public struct Reaction: Equatable, Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
public enum MediaDownloadState: Equatable, Sendable {
|
||||
case notDownloaded
|
||||
case downloading
|
||||
case downloaded(path: String)
|
||||
case error(String)
|
||||
}
|
||||
|
||||
public struct PhotoMedia: Equatable, Sendable {
|
||||
public var fileId: Int32
|
||||
public var width: Int32
|
||||
public var height: Int32
|
||||
public var downloadState: MediaDownloadState
|
||||
|
||||
public init(
|
||||
fileId: Int32,
|
||||
width: Int32,
|
||||
height: Int32,
|
||||
downloadState: MediaDownloadState = .notDownloaded
|
||||
) {
|
||||
self.fileId = fileId
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.downloadState = downloadState
|
||||
}
|
||||
}
|
||||
|
||||
public struct VoiceMedia: Equatable, Sendable {
|
||||
public var fileId: Int32
|
||||
public var duration: Int32
|
||||
public var mimeType: String?
|
||||
public var waveform: String?
|
||||
public var downloadState: MediaDownloadState
|
||||
|
||||
public init(
|
||||
fileId: Int32,
|
||||
duration: Int32,
|
||||
mimeType: String? = nil,
|
||||
waveform: String? = nil,
|
||||
downloadState: MediaDownloadState = .notDownloaded
|
||||
) {
|
||||
self.fileId = fileId
|
||||
self.duration = duration
|
||||
self.mimeType = mimeType
|
||||
self.waveform = waveform
|
||||
self.downloadState = downloadState
|
||||
}
|
||||
}
|
||||
|
||||
public enum MessageMedia: Equatable, Sendable {
|
||||
case photo(PhotoMedia)
|
||||
case voice(VoiceMedia)
|
||||
}
|
||||
|
||||
public struct Message: Identifiable, Equatable, Sendable {
|
||||
public var id: Int64
|
||||
public var chatId: Int64
|
||||
public var senderName: String
|
||||
public var text: String
|
||||
public var date: Int32
|
||||
public var mediaAlbumId: Int64?
|
||||
public var media: MessageMedia?
|
||||
public var isOutgoing: Bool
|
||||
public var isRead: Bool
|
||||
public var editDate: Int32?
|
||||
@@ -110,6 +165,8 @@ public struct Message: Identifiable, Equatable, Sendable {
|
||||
senderName: String,
|
||||
text: String,
|
||||
date: Int32 = 0,
|
||||
mediaAlbumId: Int64? = nil,
|
||||
media: MessageMedia? = nil,
|
||||
isOutgoing: Bool,
|
||||
isRead: Bool = true,
|
||||
editDate: Int32? = nil,
|
||||
@@ -122,6 +179,8 @@ public struct Message: Identifiable, Equatable, Sendable {
|
||||
self.senderName = senderName
|
||||
self.text = text
|
||||
self.date = date
|
||||
self.mediaAlbumId = mediaAlbumId
|
||||
self.media = media
|
||||
self.isOutgoing = isOutgoing
|
||||
self.isRead = isRead
|
||||
self.editDate = editDate
|
||||
|
||||
Reference in New Issue
Block a user