diff --git a/src/vs/code/browser/workbench/workbench.html b/src/vs/code/browser/workbench/workbench.html index fedadf22ee6..ff62e0a65a9 100644 --- a/src/vs/code/browser/workbench/workbench.html +++ b/src/vs/code/browser/workbench/workbench.html @@ -15,6 +15,9 @@ + + + diff --git a/src/vs/platform/product/browser/productService.ts b/src/vs/platform/product/browser/productService.ts new file mode 100644 index 00000000000..084144d009f --- /dev/null +++ b/src/vs/platform/product/browser/productService.ts @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { IProductService, IProductConfiguration } from 'vs/platform/product/common/product'; +import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; + +export class ProductService implements IProductService { + + private readonly productConfiguration: IProductConfiguration | null; + + constructor() { + const element = document.getElementById('vscode-remote-product-configuration'); + this.productConfiguration = element ? JSON.parse(element.getAttribute('data-settings')!) : null; + } + + _serviceBrand: ServiceIdentifier; + + get version(): string { return '1.35.0'; } + + get commit(): string | undefined { return undefined; } + + get nameLong(): string { return ''; } + + get urlProtocol(): string { return ''; } + + get extensionAllowedProposedApi(): string[] { return this.productConfiguration ? this.productConfiguration.extensionAllowedProposedApi : []; } + + get uiExtensions(): string[] | undefined { return this.productConfiguration ? this.productConfiguration.uiExtensions : undefined; } + + get enableTelemetry(): boolean { return false; } + + get sendASmile(): { reportIssueUrl: string, requestFeatureUrl: string } | undefined { return this.productConfiguration ? this.productConfiguration.sendASmile : undefined; } + + get extensionsGallery() { return this.productConfiguration ? this.productConfiguration.extensionsGallery : undefined; } +} \ No newline at end of file diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts index 2a35190f8ae..97f3fe3e5a4 100644 --- a/src/vs/platform/product/common/product.ts +++ b/src/vs/platform/product/common/product.ts @@ -30,4 +30,89 @@ export interface IProductService { reportIssueUrl: string; requestFeatureUrl: string; }; +} + +export interface IProductConfiguration { + nameShort: string; + nameLong: string; + applicationName: string; + win32AppId: string; + win32x64AppId: string; + win32UserAppId: string; + win32x64UserAppId: string; + win32AppUserModelId: string; + win32MutexName: string; + darwinBundleIdentifier: string; + urlProtocol: string; + dataFolderName: string; + downloadUrl: string; + updateUrl?: string; + quality?: string; + target?: string; + commit?: string; + settingsSearchBuildId?: number; + settingsSearchUrl?: string; + experimentsUrl?: string; + date: string; + extensionsGallery?: { + serviceUrl: string; + itemUrl: string; + controlUrl: string; + recommendationsUrl: string; + }; + extensionTips: { [id: string]: string; }; + extensionImportantTips: { [id: string]: { name: string; pattern: string; }; }; + exeBasedExtensionTips: { [id: string]: { friendlyName: string, windowsPath?: string, recommendations: string[] }; }; + extensionKeywords: { [extension: string]: string[]; }; + extensionAllowedBadgeProviders: string[]; + extensionAllowedProposedApi: string[]; + keymapExtensionTips: string[]; + crashReporter: { + companyName: string; + productName: string; + }; + welcomePage: string; + enableTelemetry: boolean; + aiConfig: { + asimovKey: string; + }; + sendASmile: { + reportIssueUrl: string, + requestFeatureUrl: string + }; + documentationUrl: string; + releaseNotesUrl: string; + keyboardShortcutsUrlMac: string; + keyboardShortcutsUrlLinux: string; + keyboardShortcutsUrlWin: string; + introductoryVideosUrl: string; + tipsAndTricksUrl: string; + newsletterSignupUrl: string; + twitterUrl: string; + requestFeatureUrl: string; + reportIssueUrl: string; + licenseUrl: string; + privacyStatementUrl: string; + telemetryOptOutUrl: string; + npsSurveyUrl: string; + surveys: ISurveyData[]; + checksums: { [path: string]: string; }; + checksumFailMoreInfoUrl: string; + hockeyApp: { + 'win32-ia32': string; + 'win32-x64': string; + 'linux-x64': string; + 'darwin': string; + }; + logUploaderUrl: string; + portable?: string; + uiExtensions?: string[]; +} + +export interface ISurveyData { + surveyId: string; + surveyUrl: string; + languageId: string; + editCount: number; + userProbability: number; } \ No newline at end of file diff --git a/src/vs/platform/product/node/product.ts b/src/vs/platform/product/node/product.ts index 6a5cf7880e8..08610d71a1a 100644 --- a/src/vs/platform/product/node/product.ts +++ b/src/vs/platform/product/node/product.ts @@ -5,91 +5,7 @@ import * as path from 'vs/base/common/path'; import { getPathFromAmdModule } from 'vs/base/common/amd'; - -export interface IProductConfiguration { - nameShort: string; - nameLong: string; - applicationName: string; - win32AppId: string; - win32x64AppId: string; - win32UserAppId: string; - win32x64UserAppId: string; - win32AppUserModelId: string; - win32MutexName: string; - darwinBundleIdentifier: string; - urlProtocol: string; - dataFolderName: string; - downloadUrl: string; - updateUrl?: string; - quality?: string; - target?: string; - commit?: string; - settingsSearchBuildId?: number; - settingsSearchUrl?: string; - experimentsUrl?: string; - date: string; - extensionsGallery?: { - serviceUrl: string; - itemUrl: string; - controlUrl: string; - recommendationsUrl: string; - }; - extensionTips: { [id: string]: string; }; - extensionImportantTips: { [id: string]: { name: string; pattern: string; }; }; - exeBasedExtensionTips: { [id: string]: { friendlyName: string, windowsPath?: string, recommendations: string[] }; }; - extensionKeywords: { [extension: string]: string[]; }; - extensionAllowedBadgeProviders: string[]; - extensionAllowedProposedApi: string[]; - keymapExtensionTips: string[]; - crashReporter: { - companyName: string; - productName: string; - }; - welcomePage: string; - enableTelemetry: boolean; - aiConfig: { - asimovKey: string; - }; - sendASmile: { - reportIssueUrl: string, - requestFeatureUrl: string - }; - documentationUrl: string; - releaseNotesUrl: string; - keyboardShortcutsUrlMac: string; - keyboardShortcutsUrlLinux: string; - keyboardShortcutsUrlWin: string; - introductoryVideosUrl: string; - tipsAndTricksUrl: string; - newsletterSignupUrl: string; - twitterUrl: string; - requestFeatureUrl: string; - reportIssueUrl: string; - licenseUrl: string; - privacyStatementUrl: string; - telemetryOptOutUrl: string; - npsSurveyUrl: string; - surveys: ISurveyData[]; - checksums: { [path: string]: string; }; - checksumFailMoreInfoUrl: string; - hockeyApp: { - 'win32-ia32': string; - 'win32-x64': string; - 'linux-x64': string; - 'darwin': string; - }; - logUploaderUrl: string; - portable?: string; - uiExtensions?: string[]; -} - -export interface ISurveyData { - surveyId: string; - surveyUrl: string; - languageId: string; - editCount: number; - userProbability: number; -} +import { IProductConfiguration } from 'vs/platform/product/common/product'; const rootPath = path.dirname(getPathFromAmdModule(require, '')); const productJsonPath = path.join(rootPath, 'product.json'); diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts index d728c100011..6f1954ba252 100644 --- a/src/vs/workbench/browser/web.main.ts +++ b/src/vs/workbench/browser/web.main.ts @@ -8,7 +8,7 @@ import { domContentLoaded, addDisposableListener, EventType } from 'vs/base/brow import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { ILogService } from 'vs/platform/log/common/log'; import { Disposable } from 'vs/base/common/lifecycle'; -import { SimpleLogService, SimpleProductService } from 'vs/workbench/browser/web.simpleservices'; +import { SimpleLogService } from 'vs/workbench/browser/web.simpleservices'; import { BrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService'; import { Workbench } from 'vs/workbench/browser/workbench'; import { IChannel } from 'vs/base/parts/ipc/common/ipc'; @@ -35,6 +35,7 @@ import { ISignService } from 'vs/platform/sign/common/sign'; import { SignService } from 'vs/platform/sign/browser/signService'; import { hash } from 'vs/base/common/hash'; import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api'; +import { ProductService } from 'vs/platform/product/browser/productService'; class CodeRendererMain extends Disposable { @@ -90,7 +91,7 @@ class CodeRendererMain extends Disposable { serviceCollection.set(IWorkbenchEnvironmentService, environmentService); // Product - const productService = new SimpleProductService(); + const productService = new ProductService(); serviceCollection.set(IProductService, productService); // Remote diff --git a/src/vs/workbench/browser/web.simpleservices.ts b/src/vs/workbench/browser/web.simpleservices.ts index 9298d9ce924..96d69910456 100644 --- a/src/vs/workbench/browser/web.simpleservices.ts +++ b/src/vs/workbench/browser/web.simpleservices.ts @@ -23,7 +23,6 @@ import { IURLHandler, IURLService } from 'vs/platform/url/common/url'; import { ITelemetryService, ITelemetryData, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry'; import { ConsoleLogService } from 'vs/platform/log/common/log'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; -import { IProductService } from 'vs/platform/product/common/product'; import { Disposable, IDisposable } from 'vs/base/common/lifecycle'; import { IStorageService, IWorkspaceStorageChangeEvent, StorageScope, IWillSaveStateEvent, WillSaveStateReason } from 'vs/platform/storage/common/storage'; import { IUpdateService, State } from 'vs/platform/update/common/update'; @@ -517,23 +516,6 @@ export class SimpleMultiExtensionsManagementService implements IExtensionManagem //#endregion -//#region Product - -export class SimpleProductService implements IProductService { - - _serviceBrand: any; - - version: string = '1.35.0'; - commit?: string; - nameLong: string = ''; - urlProtocol: string = ''; - extensionAllowedProposedApi: string[] = []; - uiExtensions?: string[]; - enableTelemetry: boolean = false; -} - -//#endregion - //#region Request export const IRequestService = createDecorator('requestService'); diff --git a/src/vs/workbench/contrib/surveys/electron-browser/languageSurveys.contribution.ts b/src/vs/workbench/contrib/surveys/electron-browser/languageSurveys.contribution.ts index 447a3565881..ec9ac3fb2b7 100644 --- a/src/vs/workbench/contrib/surveys/electron-browser/languageSurveys.contribution.ts +++ b/src/vs/workbench/contrib/surveys/electron-browser/languageSurveys.contribution.ts @@ -11,7 +11,8 @@ import { Registry } from 'vs/platform/registry/common/platform'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import pkg from 'vs/platform/product/node/package'; -import product, { ISurveyData } from 'vs/platform/product/node/product'; +import product from 'vs/platform/product/node/product'; +import { ISurveyData } from 'vs/platform/product/common/product'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { Severity, INotificationService } from 'vs/platform/notification/common/notification'; import { ITextFileService, StateChange } from 'vs/workbench/services/textfile/common/textfiles'; diff --git a/src/vs/workbench/services/userData/common/userDataService.ts b/src/vs/workbench/services/userData/common/userDataService.ts new file mode 100644 index 00000000000..64fb82202a3 --- /dev/null +++ b/src/vs/workbench/services/userData/common/userDataService.ts @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; +import { Event } from 'vs/base/common/event'; + +export const IUserDataService = createDecorator('userDataService'); + +export interface IUserDataService { + _serviceBrand: any; + + onDidChange: Event; + + read(key: string): Promise; + + write(key: string, value: string): Promise; +} + +export const IUserDataEditorService = createDecorator('userDataEditorService'); + +export interface IUserDataEditorService { + _serviceBrand: any; + + openInEditor(key: string): Promise; +} \ No newline at end of file diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts index 7bdf1ac3687..025e107af2a 100644 --- a/src/vs/workbench/workbench.web.main.ts +++ b/src/vs/workbench/workbench.web.main.ts @@ -157,7 +157,6 @@ registerSingleton(IContextViewService, ContextViewService, true); registerSingleton(ILifecycleService, BrowserLifecycleService); // registerSingleton(ILocalizationsService, LocalizationsService); // registerSingleton(ISharedProcessService, SharedProcessService, true); -// registerSingleton(IProductService, ProductService, true); // registerSingleton(IWindowsService, WindowsService); // registerSingleton(IUpdateService, UpdateService); // registerSingleton(IIssueService, IssueService);