From 839e5f6d3406b3225462537830e62c2747c07691 Mon Sep 17 00:00:00 2001 From: Pavel Leonenko Date: Fri, 29 Nov 2024 20:44:01 +0100 Subject: [PATCH] Added possibility to conditionally notify ViewModel about appearing/disappearing --- .../ViewControllerBase.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Softeq.XToolkit.WhiteLabel.iOS/ViewControllerBase.cs b/Softeq.XToolkit.WhiteLabel.iOS/ViewControllerBase.cs index 5877e2407..08673a14a 100644 --- a/Softeq.XToolkit.WhiteLabel.iOS/ViewControllerBase.cs +++ b/Softeq.XToolkit.WhiteLabel.iOS/ViewControllerBase.cs @@ -66,7 +66,7 @@ public override void ViewDidLoad() public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); - ViewModel.OnAppearing(); + NotifyViewModelAboutAppearing(); AttachBindings(); } @@ -74,7 +74,7 @@ public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); DetachBindings(); - ViewModel.OnDisappearing(); + NotifyViewModelAboutDisappearing(); } public override void ViewDidDisappear(bool animated) @@ -84,6 +84,16 @@ public override void ViewDidDisappear(bool animated) CloseDialogIfNeeded(); } + protected virtual void NotifyViewModelAboutAppearing() + { + ViewModel.OnAppearing(); + } + + protected virtual void NotifyViewModelAboutDisappearing() + { + ViewModel.OnDisappearing(); + } + protected virtual void DoAttachBindings() { }