push back to previous screen when tapping actions in message info screen
This commit is contained in:
parent
1a9e2a51b4
commit
8d4049f0da
|
@ -1645,10 +1645,12 @@ extension ConversationVC:
|
|||
using: dependencies
|
||||
) ?? []
|
||||
|
||||
let messageInfoView = MessageInfoView(actions: actions, messageViewModel: cellViewModel)
|
||||
let hostingViewController = UIHostingController(rootView: messageInfoView)
|
||||
hostingViewController.title = "message_info_title".localized()
|
||||
navigationController?.pushViewController(hostingViewController, animated: true)
|
||||
let messageInfoViewController = MessageInfoViewController(
|
||||
actions: actions,
|
||||
messageViewModel: cellViewModel
|
||||
)
|
||||
messageInfoViewController.title = "message_info_title".localized()
|
||||
navigationController?.pushViewController(messageInfoViewController, animated: true)
|
||||
}
|
||||
|
||||
func retry(_ cellViewModel: MessageViewModel, using dependencies: Dependencies) {
|
||||
|
|
|
@ -381,7 +381,7 @@ struct MessageInfoView: View {
|
|||
.frame(width: .infinity, height: 60)
|
||||
.onTapGesture {
|
||||
actions[index].work()
|
||||
dismiss()
|
||||
dismiss?()
|
||||
}
|
||||
|
||||
if index < (actions.count - 1) {
|
||||
|
@ -444,6 +444,26 @@ struct InfoBlock<Content>: View where Content: View {
|
|||
}
|
||||
}
|
||||
|
||||
final class MessageInfoViewController: UIHostingController<MessageInfoView> {
|
||||
init(actions: [ContextMenuVC.Action], messageViewModel: MessageViewModel) {
|
||||
let messageInfoView = MessageInfoView(
|
||||
actions: actions,
|
||||
messageViewModel: messageViewModel
|
||||
)
|
||||
|
||||
super.init(rootView: messageInfoView)
|
||||
rootView.dismiss = dismiss
|
||||
}
|
||||
|
||||
@MainActor required dynamic init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
func dismiss() {
|
||||
self.navigationController?.popViewController(animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
struct MessageInfoView_Previews: PreviewProvider {
|
||||
static var messageViewModel: MessageViewModel {
|
||||
let result = MessageViewModel(
|
||||
|
|
Loading…
Reference in New Issue