From bbde38edc1f2a3e6042e347f0e5c6720a43ed87f Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Wed, 12 May 2021 00:55:58 +0300 Subject: [PATCH 1/3] Implement presentation controller delegate --- .../ReactionHistoryBridgeCoordinatorPresenter.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Riot/Modules/Room/ReactionHistory/ReactionHistoryBridgeCoordinatorPresenter.swift b/Riot/Modules/Room/ReactionHistory/ReactionHistoryBridgeCoordinatorPresenter.swift index 9804af4e8..258f9ef0b 100644 --- a/Riot/Modules/Room/ReactionHistory/ReactionHistoryBridgeCoordinatorPresenter.swift +++ b/Riot/Modules/Room/ReactionHistory/ReactionHistoryBridgeCoordinatorPresenter.swift @@ -60,6 +60,7 @@ final class ReactionHistoryCoordinatorBridgePresenter: NSObject { let coordinatorPresentable = reactionHistoryCoordinator.toPresentable() coordinatorPresentable.modalPresentationStyle = .formSheet + coordinatorPresentable.presentationController?.delegate = self viewController.present(coordinatorPresentable, animated: animated, completion: nil) reactionHistoryCoordinator.start() @@ -87,3 +88,13 @@ extension ReactionHistoryCoordinatorBridgePresenter: ReactionHistoryCoordinatorD self.delegate?.reactionHistoryCoordinatorBridgePresenterDelegateDidClose(self) } } + +// MARK: - UIAdaptivePresentationControllerDelegate + +extension ReactionHistoryCoordinatorBridgePresenter: UIAdaptivePresentationControllerDelegate { + + func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { + self.delegate?.reactionHistoryCoordinatorBridgePresenterDelegateDidClose(self) + } + +} From 866beb6e57a64c7a98fae2d9f7b0cc76803a0a33 Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Wed, 12 May 2021 01:09:28 +0300 Subject: [PATCH 2/3] Update bridge presenter template to auto-implement dismiss gesture --- .../FlowTemplateCoordinatorBridgePresenter.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Tools/Templates/buildable/FlowCoordinatorTemplate/FlowTemplateCoordinatorBridgePresenter.swift b/Tools/Templates/buildable/FlowCoordinatorTemplate/FlowTemplateCoordinatorBridgePresenter.swift index 65bfb1406..bb7f824e4 100644 --- a/Tools/Templates/buildable/FlowCoordinatorTemplate/FlowTemplateCoordinatorBridgePresenter.swift +++ b/Tools/Templates/buildable/FlowCoordinatorTemplate/FlowTemplateCoordinatorBridgePresenter.swift @@ -54,7 +54,9 @@ final class FlowTemplateCoordinatorBridgePresenter: NSObject { func present(from viewController: UIViewController, animated: Bool) { let flowTemplateCoordinator = FlowTemplateCoordinator(session: self.session) flowTemplateCoordinator.delegate = self - viewController.present(flowTemplateCoordinator.toPresentable(), animated: animated, completion: nil) + let presentable = flowTemplateCoordinator.toPresentable() + presentable.presentationController?.delegate = self + viewController.present(presentable, animated: animated, completion: nil) flowTemplateCoordinator.start() self.coordinator = flowTemplateCoordinator @@ -80,3 +82,13 @@ extension FlowTemplateCoordinatorBridgePresenter: FlowTemplateCoordinatorDelegat self.delegate?.flowTemplateCoordinatorBridgePresenterDelegateDidComplete(self) } } + +// MARK: - UIAdaptivePresentationControllerDelegate + +extension FlowTemplateCoordinatorBridgePresenter: UIAdaptivePresentationControllerDelegate { + + func flowTemplateCoordinatorDidComplete(_ presentationController: UIPresentationController) { + self.delegate?.flowTemplateCoordinatorBridgePresenterDelegateDidComplete(self) + } + +} From 5149376138e9773cc762b5e41de9467bb9d9181c Mon Sep 17 00:00:00 2001 From: ismailgulek Date: Wed, 12 May 2021 01:33:22 +0300 Subject: [PATCH 3/3] Update CHANGES.rst --- CHANGES.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index b4107c03e..7cb7587b5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,10 +5,10 @@ Changes to be released in next version * 🙌 Improvements - * + * Templates: Update bridge presenter template to auto-implement iOS 13 pull-down gesture. 🐛 Bugfix - * + * Handle pull-down gesture for reactions history view (#4293). ⚠️ API Changes *