From 2a31cc32c386cdd4c066850b920eec7d082987d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=CC=81=20Ramos?= Date: Fri, 10 Dec 2021 10:55:39 +0000 Subject: [PATCH 1/2] Add onBeforeViewWillAppear in ViewPresentationEventsHandling --- Chatto/sources/ChatController/BaseChatViewController.swift | 4 ++++ .../InputBar/ChatInputBarPresenterProtocol.swift | 1 + 2 files changed, 5 insertions(+) diff --git a/Chatto/sources/ChatController/BaseChatViewController.swift b/Chatto/sources/ChatController/BaseChatViewController.swift index 82684c93..12c85a29 100644 --- a/Chatto/sources/ChatController/BaseChatViewController.swift +++ b/Chatto/sources/ChatController/BaseChatViewController.swift @@ -136,6 +136,10 @@ public final class BaseChatViewController: UIViewController { } override public func viewWillAppear(_ animated: Bool) { + self.viewEventsHandlers.forEach { + $0.onBeforeViewWillAppear() + } + super.viewWillAppear(animated) self.keyboardUpdatesHandler.startTracking() diff --git a/Chatto/sources/ChatController/InputBar/ChatInputBarPresenterProtocol.swift b/Chatto/sources/ChatController/InputBar/ChatInputBarPresenterProtocol.swift index 79a25d4c..8171d72c 100644 --- a/Chatto/sources/ChatController/InputBar/ChatInputBarPresenterProtocol.swift +++ b/Chatto/sources/ChatController/InputBar/ChatInputBarPresenterProtocol.swift @@ -48,6 +48,7 @@ public extension CollectionViewEventsHandling { public protocol ViewPresentationEventsHandling: AnyObject { func onViewDidLoad() + func onBeforeViewWillAppear() func onViewWillAppear() func onViewDidAppear() From 643d9727e3999785ff58b1fe3050cee1cb00452f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=CC=81=20Ramos?= Date: Fri, 10 Dec 2021 11:08:36 +0000 Subject: [PATCH 2/2] Add onBeforeViewWillDisappear in ViewPresentationEventsHandling --- .../sources/ChatController/BaseChatViewController.swift | 8 ++++---- .../InputBar/ChatInputBarPresenterProtocol.swift | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Chatto/sources/ChatController/BaseChatViewController.swift b/Chatto/sources/ChatController/BaseChatViewController.swift index 3a8c7ac1..50e1c315 100644 --- a/Chatto/sources/ChatController/BaseChatViewController.swift +++ b/Chatto/sources/ChatController/BaseChatViewController.swift @@ -132,10 +132,6 @@ public final class BaseChatViewController: UIViewController { } override public func viewWillAppear(_ animated: Bool) { - self.viewEventsHandlers.forEach { - $0.onBeforeViewWillAppear() - } - super.viewWillAppear(animated) self.keyboardUpdatesHandler.startTracking() @@ -154,6 +150,10 @@ public final class BaseChatViewController: UIViewController { } override public func viewWillDisappear(_ animated: Bool) { + self.viewEventsHandlers.forEach { + $0.onBeforeViewWillDisappear() + } + super.viewWillDisappear(animated) self.keyboardUpdatesHandler.stopTracking() diff --git a/Chatto/sources/ChatController/InputBar/ChatInputBarPresenterProtocol.swift b/Chatto/sources/ChatController/InputBar/ChatInputBarPresenterProtocol.swift index 8171d72c..3034fc66 100644 --- a/Chatto/sources/ChatController/InputBar/ChatInputBarPresenterProtocol.swift +++ b/Chatto/sources/ChatController/InputBar/ChatInputBarPresenterProtocol.swift @@ -48,10 +48,10 @@ public extension CollectionViewEventsHandling { public protocol ViewPresentationEventsHandling: AnyObject { func onViewDidLoad() - func onBeforeViewWillAppear() func onViewWillAppear() func onViewDidAppear() + func onBeforeViewWillDisappear() func onViewWillDisappear() func onViewDidDisappear() func onViewDidLayoutSubviews()