Add message sending methods to the TimelineController that will automatically use the correct timeline proxy instance internally.

This commit is contained in:
Stefan Ceriu
2025-07-22 14:33:26 +03:00
committed by Stefan Ceriu
parent a4c0b7f91c
commit 35195abc35
4 changed files with 175 additions and 6 deletions
@@ -31,6 +31,7 @@ enum TimelineControllerAction {
enum TimelineControllerError: Error {
case generic
case eventNotFound
case timelineProxyError(TimelineProxyError)
}
/// This protocol is a high level abstraction on top of the ``TimelineProxyProtocol``
@@ -98,5 +99,36 @@ protocol TimelineControllerProtocol {
inReplyToEventID: String?,
intentionalMentions: IntentionalMentions) async
func sendVoiceMessage(url: URL, audioInfo: AudioInfo, waveform: [UInt16]) async -> Result<Void, TimelineProxyError>
func sendAudio(url: URL,
audioInfo: AudioInfo,
caption: String?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineControllerError>
func sendFile(url: URL,
fileInfo: FileInfo,
caption: String?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineControllerError>
func sendImage(url: URL,
thumbnailURL: URL,
imageInfo: ImageInfo,
caption: String?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineControllerError>
func sendLocation(body: String,
geoURI: GeoURI,
description: String?,
zoomLevel: UInt8?,
assetType: AssetType?) async -> Result<Void, TimelineControllerError>
func sendVideo(url: URL,
thumbnailURL: URL,
videoInfo: VideoInfo,
caption: String?,
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineControllerError>
func sendVoiceMessage(url: URL,
audioInfo: AudioInfo,
waveform: [UInt16],
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineControllerError>
}