From 588bb9a0937eea7e86336076a8d5183029c55174 Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Sun, 27 Aug 2017 13:40:49 +0200
Subject: [PATCH] Refactor FormNotificationBase to store TweetNotification
 instead of copying data

---
 Core/Notification/FormNotificationBase.cs | 27 +++++++++--------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/Core/Notification/FormNotificationBase.cs b/Core/Notification/FormNotificationBase.cs
index fd1fd3f2..2f8ca4e6 100644
--- a/Core/Notification/FormNotificationBase.cs
+++ b/Core/Notification/FormNotificationBase.cs
@@ -79,17 +79,15 @@ public bool CanResizeWindow{
         private readonly ResourceHandlerNotification resourceHandler = new ResourceHandlerNotification();
         private readonly float dpiScale;
 
-        private string currentColumnKey;
-        private string currentChirpId;
-        private string currentColumnTitle;
+        private TweetNotification currentNotification;
         private int pauseCounter;
-
+        
+        public string CurrentTweetUrl => currentNotification?.TweetUrl;
+        public string CurrentQuoteUrl => currentNotification?.QuoteUrl;
         public bool IsPaused => pauseCounter > 0;
-
+        
         public bool FreezeTimer { get; set; }
         public bool ContextMenuOpen { get; set; }
-        public string CurrentTweetUrl { get; private set; }
-        public string CurrentQuoteUrl { get; private set; }
 
         public event EventHandler Initialized;
 
@@ -160,7 +158,7 @@ public virtual void HideNotification(bool loadBlank){
             }
 
             Location = ControlExtensions.InvisibleLocation;
-            currentColumnTitle = null;
+            currentNotification = null;
         }
 
         public virtual void FinishCurrentNotification(){}
@@ -183,13 +181,7 @@ protected virtual string GetTweetHTML(TweetNotification tweet){
         }
 
         protected virtual void LoadTweet(TweetNotification tweet){
-            CurrentTweetUrl = tweet.TweetUrl;
-            CurrentQuoteUrl = tweet.QuoteUrl;
-
-            currentColumnKey = tweet.ColumnKey;
-            currentChirpId = tweet.ChirpId;
-            currentColumnTitle = tweet.ColumnTitle;
-
+            currentNotification = tweet;
             resourceHandler.SetHTML(GetTweetHTML(tweet));
             browser.Load(TwitterUtils.TweetDeckURL);
         }
@@ -203,11 +195,12 @@ protected virtual void OnNotificationReady(){
         }
 
         protected virtual void UpdateTitle(){
-            Text = string.IsNullOrEmpty(currentColumnTitle) || !Program.UserConfig.DisplayNotificationColumn ? Program.BrandName : Program.BrandName+" - "+currentColumnTitle;
+            string title = currentNotification?.ColumnTitle;
+            Text = string.IsNullOrEmpty(title) || !Program.UserConfig.DisplayNotificationColumn ? Program.BrandName : Program.BrandName+" - "+title;
         }
 
         public void ShowTweetDetail(){
-            owner.ShowTweetDetail(currentColumnKey, currentChirpId);
+            owner.ShowTweetDetail(currentNotification.ColumnKey, currentNotification.ChirpId);
         }
 
         public void MoveToVisibleLocation(){