This commit is contained in:
Sandeep Somavarapu 2021-01-28 15:09:39 +01:00
parent 4d3b15fda0
commit 724888adc7
3 changed files with 16 additions and 0 deletions

View file

@ -21,6 +21,8 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IExtensionRecommendationNotificationService, RecommendationsNotificationResult, RecommendationSource } from 'vs/platform/extensionRecommendations/common/extensionRecommendations';
import { localize } from 'vs/nls';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { Event } from 'vs/base/common/event';
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
type ExeExtensionRecommendationsClassification = {
extensionId: { classification: 'PublicNonPersonalData', purpose: 'FeatureInsight' };
@ -52,6 +54,7 @@ export class ExtensionTipsService extends BaseExtensionTipsService {
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService,
@IStorageService private readonly storageService: IStorageService,
@INativeHostService private readonly nativeHostService: INativeHostService,
@IExtensionRecommendationNotificationService private readonly extensionRecommendationNotificationService: IExtensionRecommendationNotificationService,
@IFileService fileService: IFileService,
@IProductService productService: IProductService,
@ -172,6 +175,11 @@ export class ExtensionTipsService extends BaseExtensionTipsService {
case RecommendationsNotificationResult.Ignored:
this.highImportanceTipsByExe.delete(exeName);
break;
case RecommendationsNotificationResult.IncompatibleWindow:
// Recommended in incompatible window. Schedule the prompt after active window change
const onActiveWindowChange = Event.once(Event.latch(Event.any(this.nativeHostService.onDidOpenWindow, this.nativeHostService.onDidFocusWindow)));
this._register(onActiveWindowChange(() => this.promptHighImportanceExeBasedTip()));
break;
case RecommendationsNotificationResult.TooMany:
// Too many notifications. Schedule the prompt after one hour
const disposable = this._register(disposableTimeout(() => { disposable.dispose(); this.promptHighImportanceExeBasedTip(); }, 60 * 60 * 1000 /* 1 hour */));

View file

@ -23,6 +23,7 @@ export const enum RecommendationsNotificationResult {
Ignored = 'ignored',
Cancelled = 'cancelled',
TooMany = 'toomany',
IncompatibleWindow = 'incompatibleWindow',
Accepted = 'reacted',
}

View file

@ -21,6 +21,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IUserDataAutoSyncEnablementService, IUserDataSyncResourceEnablementService, SyncResource } from 'vs/platform/userDataSync/common/userDataSync';
import { SearchExtensionsAction } from 'vs/workbench/contrib/extensions/browser/extensionsActions';
import { IExtension, IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { ITASExperimentService } from 'vs/workbench/services/experiment/common/experimentService';
import { EnablementState, IWorkbenchExtensioManagementService, IWorkbenchExtensionEnablementService } from 'vs/workbench/services/extensionManagement/common/extensionManagement';
import { IExtensionIgnoredRecommendationsService } from 'vs/workbench/services/extensionRecommendations/common/extensionRecommendations';
@ -136,6 +137,7 @@ export class ExtensionRecommendationNotificationService implements IExtensionRec
@IExtensionIgnoredRecommendationsService private readonly extensionIgnoredRecommendationsService: IExtensionIgnoredRecommendationsService,
@IUserDataAutoSyncEnablementService private readonly userDataAutoSyncEnablementService: IUserDataAutoSyncEnablementService,
@IUserDataSyncResourceEnablementService private readonly userDataSyncResourceEnablementService: IUserDataSyncResourceEnablementService,
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService,
@optional(ITASExperimentService) tasExperimentService: ITASExperimentService,
) {
this.tasExperimentService = tasExperimentService;
@ -208,6 +210,11 @@ export class ExtensionRecommendationNotificationService implements IExtensionRec
return RecommendationsNotificationResult.Ignored;
}
// Do not show exe based recommendations in remote window
if (source === RecommendationSource.EXE && this.workbenchEnvironmentService.remoteAuthority) {
return RecommendationsNotificationResult.IncompatibleWindow;
}
// Ignore exe recommendation if the window
// => has shown an exe based recommendation already
// => or has shown any two recommendations already