Move composer send media selection to it's own coordinator and us e ioS 15 api for sheet

This commit is contained in:
David Langley
2022-10-08 10:46:05 +01:00
parent ae9e05f353
commit d54bcd5a97
13 changed files with 395 additions and 235 deletions

View File

@@ -33,14 +33,13 @@ class SelfSizingHostingController<Content>: UIHostingController<Content> where C
}
}
@available(iOS 16.0, *)
@available(iOS 15.0, *)
class WysiwygInputToolbarView: MXKRoomInputToolbarView, NibLoadable, RoomInputToolbarViewProtocol {
override class func instantiate() -> MXKRoomInputToolbarView! {
return loadFromNib()
}
@objc var startModuleAction: ((ComposerModule) -> Void)?
private weak var toolbarViewDelegate: RoomInputToolbarViewDelegate? {
return (delegate as? RoomInputToolbarViewDelegate) ?? nil
}
@@ -57,9 +56,9 @@ class WysiwygInputToolbarView: MXKRoomInputToolbarView, NibLoadable, RoomInputTo
let composer = Composer(viewModel: viewModel, sendMessageAction: { [weak self] content in
guard let self = self else { return }
self.sendWysiwygMessage(content: content)
}, startModuleAction: { [weak self] module in
}, showSendMediaActions: { [weak self] in
guard let self = self else { return }
self.startModuleAction?(module)
self.showSendMediaActions()
})
hostingViewController = SelfSizingHostingController(rootView: composer)
@@ -105,4 +104,9 @@ class WysiwygInputToolbarView: MXKRoomInputToolbarView, NibLoadable, RoomInputTo
delegate?.roomInputToolbarView?(self, sendFormattedTextMessage: content.html, withRawText: content.plainText)
}
private func showSendMediaActions() {
delegate?.roomInputToolbarViewShowSendMediaActions?(self)
}
}