@@ -43,6 +43,7 @@ import { INotificationService, IPromptChoice, Severity } from 'vs/platform/notif
43
43
import { IStorageService , StorageScope , StorageTarget } from 'vs/platform/storage/common/storage' ;
44
44
import { isWeb } from 'vs/base/common/platform' ;
45
45
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
46
+ import { IHostService } from 'vs/workbench/services/host/browser/host' ;
46
47
47
48
export const manageExtensionIcon = registerIcon ( 'theme-selection-manage-extension' , Codicon . gear , localize ( 'manageExtensionIcon' , 'Icon for the \'Manage\' action in the theme selection quick pick.' ) ) ;
48
49
@@ -711,27 +712,32 @@ class DefaultThemeUpdatedNotificationContribution implements IWorkbenchContribut
711
712
@IStorageService private readonly _storageService : IStorageService ,
712
713
@ICommandService private readonly _commandService : ICommandService ,
713
714
@ITelemetryService private readonly _telemetryService : ITelemetryService ,
715
+ @IHostService private readonly _hostService : IHostService ,
714
716
) {
715
717
if ( _storageService . getBoolean ( DefaultThemeUpdatedNotificationContribution . STORAGE_KEY , StorageScope . APPLICATION ) ) {
716
718
return ;
717
719
}
718
- if ( this . _workbenchThemeService . hasUpdatedDefaultThemes ( ) ) {
719
- setTimeout ( ( ) => {
720
- this . _showYouGotMigratedNotification ( ) ;
721
- } , 6000 ) ;
722
- } else {
723
- const currentTheme = this . _workbenchThemeService . getColorTheme ( ) . settingsId ;
724
- if ( currentTheme === ThemeSettingDefaults . COLOR_THEME_LIGHT_OLD || currentTheme === ThemeSettingDefaults . COLOR_THEME_DARK_OLD ) {
725
- setTimeout ( ( ) => {
726
- this . _tryNewThemeNotification ( ) ;
727
- } , 6000 ) ;
720
+ setTimeout ( async ( ) => {
721
+ if ( _storageService . getBoolean ( DefaultThemeUpdatedNotificationContribution . STORAGE_KEY , StorageScope . APPLICATION ) ) {
722
+ return ;
728
723
}
729
- }
724
+ if ( await this . _hostService . hadLastFocus ( ) ) {
725
+ this . _storageService . store ( DefaultThemeUpdatedNotificationContribution . STORAGE_KEY , true , StorageScope . APPLICATION , StorageTarget . USER ) ;
726
+ if ( this . _workbenchThemeService . hasUpdatedDefaultThemes ( ) ) {
727
+ this . _showYouGotMigratedNotification ( ) ;
728
+ } else {
729
+ const currentTheme = this . _workbenchThemeService . getColorTheme ( ) . settingsId ;
730
+ if ( currentTheme === ThemeSettingDefaults . COLOR_THEME_LIGHT_OLD || currentTheme === ThemeSettingDefaults . COLOR_THEME_DARK_OLD ) {
731
+ this . _tryNewThemeNotification ( ) ;
732
+ }
733
+ }
734
+ }
735
+ } , 6000 ) ;
730
736
}
731
737
732
738
private async _showYouGotMigratedNotification ( ) : Promise < void > {
733
- this . _storageService . store ( DefaultThemeUpdatedNotificationContribution . STORAGE_KEY , true , StorageScope . APPLICATION , StorageTarget . USER ) ;
734
- const newThemeSettingsId = isWeb ? ThemeSettingDefaults . COLOR_THEME_LIGHT : ThemeSettingDefaults . COLOR_THEME_DARK ;
739
+ const usingLight = this . _workbenchThemeService . getColorTheme ( ) . type === ColorScheme . LIGHT ;
740
+ const newThemeSettingsId = usingLight ? ThemeSettingDefaults . COLOR_THEME_LIGHT : ThemeSettingDefaults . COLOR_THEME_DARK ;
735
741
const newTheme = ( await this . _workbenchThemeService . getColorThemes ( ) ) . find ( theme => theme . settingsId === newThemeSettingsId ) ;
736
742
if ( newTheme ) {
737
743
const choices = [
@@ -752,7 +758,7 @@ class DefaultThemeUpdatedNotificationContribution implements IWorkbenchContribut
752
758
label : localize ( 'button.revert' , "Revert" ) ,
753
759
run : async ( ) => {
754
760
this . _writeTelemetry ( 'keepOld' ) ;
755
- const oldSettingsId = isWeb ? ThemeSettingDefaults . COLOR_THEME_LIGHT_OLD : ThemeSettingDefaults . COLOR_THEME_DARK_OLD ;
761
+ const oldSettingsId = usingLight ? ThemeSettingDefaults . COLOR_THEME_LIGHT_OLD : ThemeSettingDefaults . COLOR_THEME_DARK_OLD ;
756
762
const oldTheme = ( await this . _workbenchThemeService . getColorThemes ( ) ) . find ( theme => theme . settingsId === oldSettingsId ) ;
757
763
if ( oldTheme ) {
758
764
this . _workbenchThemeService . setColorTheme ( oldTheme , 'auto' ) ;
@@ -772,7 +778,6 @@ class DefaultThemeUpdatedNotificationContribution implements IWorkbenchContribut
772
778
}
773
779
774
780
private async _tryNewThemeNotification ( ) : Promise < void > {
775
- this . _storageService . store ( DefaultThemeUpdatedNotificationContribution . STORAGE_KEY , true , StorageScope . APPLICATION , StorageTarget . USER ) ;
776
781
const newThemeSettingsId = this . _workbenchThemeService . getColorTheme ( ) . type === ColorScheme . LIGHT ? ThemeSettingDefaults . COLOR_THEME_LIGHT : ThemeSettingDefaults . COLOR_THEME_DARK ;
777
782
const theme = ( await this . _workbenchThemeService . getColorThemes ( ) ) . find ( theme => theme . settingsId === newThemeSettingsId ) ;
778
783
if ( theme ) {
0 commit comments