mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Support adding a caption to media uploads. (#3531)
* Add a composer to the MediaUploadPreviewScreen. And send it's content to the media upload's caption. * Use the new compound SendButton (updating relative padding in the toolbar). * Update snapshots. * Add unit tests for sending a caption.
This commit is contained in:
@@ -223,13 +223,14 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
|
||||
func sendAudio(url: URL,
|
||||
audioInfo: AudioInfo,
|
||||
caption: String?,
|
||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
|
||||
MXLog.info("Sending audio")
|
||||
|
||||
let handle = timeline.sendAudio(url: url.path(percentEncoded: false),
|
||||
audioInfo: audioInfo,
|
||||
caption: nil,
|
||||
caption: caption,
|
||||
formattedCaption: nil,
|
||||
progressWatcher: UploadProgressListener { progress in
|
||||
progressSubject?.send(progress)
|
||||
@@ -251,13 +252,14 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
|
||||
func sendFile(url: URL,
|
||||
fileInfo: FileInfo,
|
||||
caption: String?,
|
||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
|
||||
MXLog.info("Sending file")
|
||||
|
||||
let handle = timeline.sendFile(url: url.path(percentEncoded: false),
|
||||
fileInfo: fileInfo,
|
||||
caption: nil,
|
||||
caption: caption,
|
||||
formattedCaption: nil,
|
||||
progressWatcher: UploadProgressListener { progress in
|
||||
progressSubject?.send(progress)
|
||||
@@ -277,9 +279,11 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
return .success(())
|
||||
}
|
||||
|
||||
// swiftlint:disable:next function_parameter_count
|
||||
func sendImage(url: URL,
|
||||
thumbnailURL: URL,
|
||||
imageInfo: ImageInfo,
|
||||
caption: String?,
|
||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
|
||||
MXLog.info("Sending image")
|
||||
@@ -287,7 +291,7 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
let handle = timeline.sendImage(url: url.path(percentEncoded: false),
|
||||
thumbnailUrl: thumbnailURL.path(percentEncoded: false),
|
||||
imageInfo: imageInfo,
|
||||
caption: nil,
|
||||
caption: caption,
|
||||
formattedCaption: nil,
|
||||
progressWatcher: UploadProgressListener { progress in
|
||||
progressSubject?.send(progress)
|
||||
@@ -325,9 +329,11 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
return .success(())
|
||||
}
|
||||
|
||||
// swiftlint:disable:next function_parameter_count
|
||||
func sendVideo(url: URL,
|
||||
thumbnailURL: URL,
|
||||
videoInfo: VideoInfo,
|
||||
caption: String?,
|
||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError> {
|
||||
MXLog.info("Sending video")
|
||||
@@ -335,7 +341,7 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
let handle = timeline.sendVideo(url: url.path(percentEncoded: false),
|
||||
thumbnailUrl: thumbnailURL.path(percentEncoded: false),
|
||||
videoInfo: videoInfo,
|
||||
caption: nil,
|
||||
caption: caption,
|
||||
formattedCaption: nil,
|
||||
progressWatcher: UploadProgressListener { progress in
|
||||
progressSubject?.send(progress)
|
||||
|
||||
@@ -51,17 +51,21 @@ protocol TimelineProxyProtocol {
|
||||
|
||||
func sendAudio(url: URL,
|
||||
audioInfo: AudioInfo,
|
||||
caption: String?,
|
||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>
|
||||
|
||||
func sendFile(url: URL,
|
||||
fileInfo: FileInfo,
|
||||
caption: String?,
|
||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>
|
||||
|
||||
// swiftlint:disable:next function_parameter_count
|
||||
func sendImage(url: URL,
|
||||
thumbnailURL: URL,
|
||||
imageInfo: ImageInfo,
|
||||
caption: String?,
|
||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>
|
||||
|
||||
@@ -71,9 +75,11 @@ protocol TimelineProxyProtocol {
|
||||
zoomLevel: UInt8?,
|
||||
assetType: AssetType?) async -> Result<Void, TimelineProxyError>
|
||||
|
||||
// swiftlint:disable:next function_parameter_count
|
||||
func sendVideo(url: URL,
|
||||
thumbnailURL: URL,
|
||||
videoInfo: VideoInfo,
|
||||
caption: String?,
|
||||
progressSubject: CurrentValueSubject<Double, Never>?,
|
||||
requestHandle: @MainActor (SendAttachmentJoinHandleProtocol) -> Void) async -> Result<Void, TimelineProxyError>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user