@@ -42,22 +42,7 @@ public void Init()
4242 _repositorySecrecyService . Start ( ) ;
4343
4444 ApplySettings ( ) ;
45-
46- string currentExtensionVersion = VisualStudioHelper . GetExtensionVersion ( ) ;
47- bool updateNotificationsEnabled = _settingsService . Read < bool > ( SettingsKeys . UpdateNotifications ) ;
48-
49- string previousVersion = _settingsService . Read < string > ( SettingsKeys . Version ) ;
50-
51- if ( currentExtensionVersion != previousVersion )
52- {
53- _settingsService . Set ( SettingsKeys . Version , currentExtensionVersion ) ;
54- _settingsService . Save ( ) ;
55-
56- if ( updateNotificationsEnabled )
57- {
58- DisplayVersionUpdateMessage ( previousVersion , currentExtensionVersion ) ;
59- }
60- }
45+ TryShowUpdateMessage ( ) ;
6146 }
6247
6348 public void Clear ( )
@@ -147,6 +132,31 @@ private void ApplySettings()
147132 _discordRpcController . SetPlug < SecondButtonNest > ( _plugService . GetPlugById < BaseButtonPlug > ( secondButtonPlug ) ) ;
148133 }
149134
135+ private void TryShowUpdateMessage ( )
136+ {
137+ string currentExtensionVersion = VisualStudioHelper . GetExtensionVersion ( ) ;
138+ bool updateNotificationsEnabled = _settingsService . Read < bool > ( SettingsKeys . UpdateNotifications ) ;
139+
140+ string previousVersion = _settingsService . Read < string > ( SettingsKeys . Version ) ;
141+
142+ if ( currentExtensionVersion != previousVersion )
143+ {
144+ _settingsService . Set ( SettingsKeys . Version , currentExtensionVersion ) ;
145+ _settingsService . Save ( ) ;
146+
147+ if ( string . IsNullOrEmpty ( previousVersion ) || previousVersion == SettingsDefaults . DefaultVersion )
148+ {
149+ // Do not show the update message for the first time.
150+ return ;
151+ }
152+
153+ if ( updateNotificationsEnabled )
154+ {
155+ DisplayVersionUpdateMessage ( previousVersion , currentExtensionVersion ) ;
156+ }
157+ }
158+ }
159+
150160 private void DisplayVersionUpdateMessage ( string previousVersion , string currentVersion )
151161 {
152162 var releaseNotes = ReadReleaseNotesOfVersionRange ( previousVersion , currentVersion ) ;
0 commit comments