Add app name to the getting started page query string

pull/2166/head
Sofian Hnaide 2016-01-22 11:01:54 -08:00
parent 7734f4a889
commit bb6e460fcd
3 changed files with 16 additions and 6 deletions

View File

@ -3,5 +3,6 @@
"nameLong": "Code [OSS Build]",
"win32MutexName": "vscodeoss",
"licenseUrl": "https://github.com/Microsoft/vscode/blob/master/LICENSE.txt",
"darwinBundleIdentifier": "com.visualstudio.code.oss"
"darwinBundleIdentifier": "com.visualstudio.code.oss",
"welcomePage": "http://go.microsoft.com/fwlink/?LinkId=723048"
}

View File

@ -16,6 +16,7 @@ export abstract class AbstractGettingStarted implements IWorkbenchContribution {
protected static hideWelcomeSettingskey = 'workbench.hide.welcome';
protected welcomePageURL: string;
protected appName: string;
constructor(
@IStorageService private storageService: IStorageService,
@ -23,6 +24,8 @@ export abstract class AbstractGettingStarted implements IWorkbenchContribution {
@ITelemetryService private telemetryService: ITelemetryService
) {
const env = contextService.getConfiguration().env;
this.appName = env.appName;
if (env.welcomePage) {
this.welcomePageURL = env.welcomePage;
this.handleWelcome();
@ -43,7 +46,7 @@ export abstract class AbstractGettingStarted implements IWorkbenchContribution {
}
private getUrl(telemetryInfo: ITelemetryInfo): string {
return `${this.welcomePageURL}&&from=vscode&&id=${telemetryInfo.machineId}`;
return `${this.welcomePageURL}&&from=${this.appName}&&id=${telemetryInfo.machineId}`;
}
protected openExternal(url: string) {

View File

@ -23,6 +23,8 @@ suite('Workbench - GettingStarted', () => {
let instantiation: IInstantiationService = null;
let welcomePageEnvConfig: string = null;
let hideWelcomeSettingsValue: string = null;
let machineId: string = null;
let appName: string = null;
suiteSetup(() => {
instantiation = create({
@ -30,13 +32,14 @@ suite('Workbench - GettingStarted', () => {
getConfiguration: () => {
return {
env: {
welcomePage: welcomePageEnvConfig
welcomePage: welcomePageEnvConfig,
appName: appName
}
}
}
},
telemetryService: {
getTelemetryInfo: () => Promise.as({ machineId: 'machineId' })
getTelemetryInfo: () => Promise.as({ machineId: machineId })
},
storageService: {
get: () => hideWelcomeSettingsValue,
@ -52,6 +55,7 @@ suite('Workbench - GettingStarted', () => {
setup(() => {
welcomePageEnvConfig = null;
hideWelcomeSettingsValue = null;
appName = null;
});
test('disabled by default', function() {
@ -60,9 +64,11 @@ suite('Workbench - GettingStarted', () => {
});
test('base case', function() {
welcomePageEnvConfig = 'url';
welcomePageEnvConfig = 'base url';
appName = 'some app';
machineId = '123';
let gettingStarted = instantiation.createInstance(TestGettingStarted);
assert(gettingStarted.lastUrl === 'url&&from=vscode&&id=machineId', 'a page is opened when welcomePage is configured && first run');
assert(gettingStarted.lastUrl === `${welcomePageEnvConfig}&&from=${appName}&&id=${machineId}`, 'a page is opened when welcomePage is configured && first run');
assert(hideWelcomeSettingsValue !== null, 'a flag is set to hide welcome page');
});