From: Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics Date: Wed, 23 Aug 2023 06:31:37 +0000 (+0530) Subject: Adding Dispose and Updating tpk name. X-Git-Tag: accepted/tizen/unified/20230823.173931~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F06%2F297706%2F2;p=profile%2Fiot%2Fapps%2Fdotnet%2Fnotifications.git Adding Dispose and Updating tpk name. Change-Id: I218dc2342af34a71958009428d1e1a0ee232b64e Signed-off-by: Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics --- diff --git a/Notifications/Notifications.cs b/Notifications/Notifications.cs index 4af2278..8f3e27f 100644 --- a/Notifications/Notifications.cs +++ b/Notifications/Notifications.cs @@ -86,6 +86,7 @@ namespace Notifications protected override void OnTerminate() { Tizen.Log.Info(AppConstants.LogTag, "On App Terminate"); + viewManager.Dispose(); base.OnTerminate(); } diff --git a/Notifications/Notifications.csproj b/Notifications/Notifications.csproj index 255472e..c28a26a 100644 --- a/Notifications/Notifications.csproj +++ b/Notifications/Notifications.csproj @@ -3,7 +3,6 @@ Exe tizen11.0 - Notifications diff --git a/Notifications/ViewManager.cs b/Notifications/ViewManager.cs index 34b313c..49471ad 100644 --- a/Notifications/ViewManager.cs +++ b/Notifications/ViewManager.cs @@ -27,6 +27,23 @@ namespace Notifications ThemeManager.ThemeChanged += OnThemeChanged; } + public void Dispose() + { + if (notificationsViewModel != null) + { + notificationsViewModel.NotificationSelected -= OnNotificationSelected; + } + + if(notificationsDetailViewModel != null) + { + notificationsDetailViewModel.DetailContentRemoved -= OnDetailContentRemoved; + } + + baseView.BindingContext = null; + baseView.BackKeyPressed -= OnBackKeyPressed; + baseView.Dispose(); + } + private void OnThemeChanged(object sender, ThemeChangedEventArgs e) { if (e.IsPlatformThemeChanged) diff --git a/Notifications/Views/BaseView.cs b/Notifications/Views/BaseView.cs index 3c38778..7a2bc0a 100644 --- a/Notifications/Views/BaseView.cs +++ b/Notifications/Views/BaseView.cs @@ -206,5 +206,45 @@ namespace Notifications.Views get => (bool)GetValue(IsContentAvailableProperty); set => SetValue(IsContentAvailableProperty, value); } + + protected override void Dispose(DisposeTypes type) + { + if (Disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + RemoveContent(); + + detailContentView?.Dispose(); + detailContentView = null; + + noNotificationsText?.Dispose(); + noNotificationsText = null; + + notificationsView.SelectedItem = null; + notificationsView?.Dispose(); + notificationsView = null; + + clearAllButton?.Dispose(); + clearAllButton = null; + + topView?.Remove(backButton); + backButton?.Dispose(); + backButton = null; + + topView?.Remove(titleText); + titleText?.Dispose(); + titleText = null; + + Remove(topView); + topView?.Dispose(); + topView = null; + } + Tizen.Log.Info(AppConstants.LogTag, "Dispose BaseView"); + base.Dispose(type); + } } } diff --git a/packaging/org.tizen.Notifications-1.0.0.tpk b/packaging/org.tizen.Notifications-1.0.0.tpk deleted file mode 100644 index bca8b0f..0000000 Binary files a/packaging/org.tizen.Notifications-1.0.0.tpk and /dev/null differ diff --git a/packaging/org.tizen.notifications-1.0.0.tpk b/packaging/org.tizen.notifications-1.0.0.tpk new file mode 100644 index 0000000..0685203 Binary files /dev/null and b/packaging/org.tizen.notifications-1.0.0.tpk differ