diff --git a/CHANGES.rst b/CHANGES.rst index 0caa42b17..2346d22f1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,9 +6,11 @@ Changes to be released in next version 🙌 Improvements * NSE: Add logs for notification delay. + * Templates: Update bridge presenter template to auto-implement iOS 13 pull-down gesture. 🐛 Bugfix * NSE: Fixes to avoid PushKit crashes (#4269). + * Handle pull-down gesture for reactions history view (#4293). ⚠️ API Changes * 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) + } + +} 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) + } + +}