Add support for sending media within threads.

This patch add the `threadRootEventID` as a parameter to media sending functions and forwards the timeline thread root between various application states to the place where its needed.
The 2 missing items are Locations and Polls which currently don't have any support on the Rust side for being sent within threads. That will come in a separate PR.
This commit is contained in:
Stefan Ceriu
2025-06-10 17:18:32 +03:00
committed by Stefan Ceriu
parent 6481093107
commit 558cdf5be3
18 changed files with 340 additions and 247 deletions
@@ -80,6 +80,8 @@ struct ComposerToolbarViewState: BindableState {
var keyCommands: [WysiwygKeyCommand] = []
var isInThread: Bool
var bindings: ComposerToolbarViewStateBindings
var isUploading: Bool {
@@ -46,6 +46,7 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
init(initialText: String? = nil,
roomProxy: JoinedRoomProxyProtocol,
isInThread: Bool = false,
wysiwygViewModel: WysiwygComposerViewModel,
completionSuggestionService: CompletionSuggestionServiceProtocol,
mediaProvider: MediaProviderProtocol,
@@ -68,6 +69,7 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
audioRecorderState: .init(),
isRoomEncrypted: roomProxy.infoPublisher.value.isEncrypted,
isLocationSharingEnabled: appSettings.mapTilerConfiguration.isEnabled,
isInThread: isInThread,
bindings: .init()),
mediaProvider: mediaProvider)
@@ -40,14 +40,16 @@ struct RoomAttachmentPicker: View {
}
.accessibilityIdentifier(A11yIdentifiers.roomScreen.attachmentPickerTextFormatting)
Button {
context.send(viewAction: .attach(.poll))
} label: {
Label(L10n.screenRoomAttachmentSourcePoll, icon: \.polls)
if !context.viewState.isInThread {
Button {
context.send(viewAction: .attach(.poll))
} label: {
Label(L10n.screenRoomAttachmentSourcePoll, icon: \.polls)
}
.accessibilityIdentifier(A11yIdentifiers.roomScreen.attachmentPickerPoll)
}
.accessibilityIdentifier(A11yIdentifiers.roomScreen.attachmentPickerPoll)
if context.viewState.isLocationSharingEnabled {
if !context.viewState.isInThread, context.viewState.isLocationSharingEnabled {
Button {
context.send(viewAction: .attach(.location))
} label: {
@@ -98,6 +98,7 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
parserStyle: .elementX)
let composerViewModel = ComposerToolbarViewModel(initialText: parameters.sharedText,
roomProxy: parameters.roomProxy,
isInThread: false,
wysiwygViewModel: wysiwygViewModel,
completionSuggestionService: parameters.completionSuggestionService,
mediaProvider: parameters.mediaProvider,