Skip to content

Commit 1c3d08b

Browse files
committed
Stop tracking emulator/device option. Start tracking sync requests.
1 parent df4daba commit 1c3d08b

File tree

8 files changed

+46
-63
lines changed

8 files changed

+46
-63
lines changed

src/debug-adapter/webKitDebugAdapter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ export class WebKitDebugAdapter implements IDebugAdapter {
116116

117117
private _attach(args: IAttachRequestArgs | ILaunchRequestArgs) {
118118
ExtensionClient.setAppRoot(utils.getAppRoot(args));
119-
ExtensionClient.getInstance().analyticsLaunchDebugger({ request: args.request, platform: args.platform, emulator: args.emulator });
119+
let analyticsRequest = (args.request == "launch" && !(args as ILaunchRequestArgs).rebuild) ? "sync" : args.request;
120+
ExtensionClient.getInstance().analyticsLaunchDebugger({ request: analyticsRequest, platform: args.platform });
120121
this.initDiagnosticLogging(args.request, args);
121122
this.appRoot = utils.getAppRoot(args);
122123
this.platform = args.platform;

src/main.ts

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -44,60 +44,46 @@ export function activate(context: vscode.ExtensionContext) {
4444
ExtensionServer.getInstance().start();
4545
performVersionsCheck(context);
4646

47-
let runCommand = (project: ns.NSProject, options: string[]) => {
47+
let runCommand = (project: ns.NSProject) => {
4848
if (vscode.workspace.rootPath === undefined) {
4949
vscode.window.showErrorMessage('No workspace opened.');
5050
return;
5151
}
5252

53-
vscode.window.showQuickPick(options)
54-
.then(target => {
55-
if(target == undefined) {
56-
return; // e.g. if the user presses escape button
57-
}
58-
59-
// Move the selected option to be the first element in order to keep the last selected option at the top of the list
60-
options.splice(options.indexOf(target), 1);
61-
options.unshift(target);
53+
// Show output channel
54+
let runChannel: vscode.OutputChannel = vscode.window.createOutputChannel(`Run on ${project.platform()}`);
55+
runChannel.clear();
56+
runChannel.show(vscode.ViewColumn.Two);
6257

63-
// Show output channel
64-
let runChannel: vscode.OutputChannel = vscode.window.createOutputChannel(`Run on ${project.platform()}`);
65-
runChannel.clear();
66-
runChannel.show(vscode.ViewColumn.Two);
58+
AnalyticsService.getInstance().runRunCommand(project.platform());
6759

68-
// Execute run command
69-
let emulator: boolean = (target === 'emulator');
70-
AnalyticsService.getInstance().runRunCommand(project.platform(), emulator);
71-
return project.run(emulator)
72-
.then(tnsProcess => {
73-
tnsProcess.on('error', err => {
74-
vscode.window.showErrorMessage('Unexpected error executing NativeScript Run command.');
75-
});
76-
tnsProcess.stderr.on('data', data => {
77-
runChannel.append(data);
78-
});
79-
tnsProcess.stdout.on('data', data => {
80-
runChannel.append(data);
81-
});
82-
tnsProcess.on('exit', exitCode => {
83-
tnsProcess.stdout.removeAllListeners('data');
84-
tnsProcess.stderr.removeAllListeners('data');
85-
});
86-
tnsProcess.on('close', exitCode => {
87-
runChannel.hide();
88-
});
60+
return project.run()
61+
.then(tnsProcess => {
62+
tnsProcess.on('error', err => {
63+
vscode.window.showErrorMessage('Unexpected error executing NativeScript Run command.');
64+
});
65+
tnsProcess.stderr.on('data', data => {
66+
runChannel.append(data);
67+
});
68+
tnsProcess.stdout.on('data', data => {
69+
runChannel.append(data);
70+
});
71+
tnsProcess.on('exit', exitCode => {
72+
tnsProcess.stdout.removeAllListeners('data');
73+
tnsProcess.stderr.removeAllListeners('data');
74+
});
75+
tnsProcess.on('close', exitCode => {
76+
runChannel.hide();
8977
});
9078
});
9179
};
9280

93-
let iosRunOptions = ['device', 'emulator'];
9481
let runIosCommand = vscode.commands.registerCommand('nativescript.runIos', () => {
95-
return runCommand(new ns.IosProject(vscode.workspace.rootPath), iosRunOptions);
82+
return runCommand(new ns.IosProject(vscode.workspace.rootPath));
9683
});
9784

98-
let androidRunOptions = ['device', 'emulator'];
9985
let runAndroidCommand = vscode.commands.registerCommand('nativescript.runAndroid', () => {
100-
return runCommand(new ns.AndroidProject(vscode.workspace.rootPath), androidRunOptions);
86+
return runCommand(new ns.AndroidProject(vscode.workspace.rootPath));
10187
});
10288

10389
context.subscriptions.push(runIosCommand);

src/services/NsCliService.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export abstract class NSProject extends EventEmitter {
8787

8888
public abstract platform(): string;
8989

90-
public abstract run(emulator: boolean): Promise<ChildProcess>;
90+
public abstract run(): Promise<ChildProcess>;
9191

9292
public abstract debug(args: IAttachRequestArgs | ILaunchRequestArgs): Promise<any>;
9393

@@ -116,7 +116,7 @@ export class IosProject extends NSProject {
116116
return 'ios';
117117
}
118118

119-
public run(emulator: boolean): Promise<ChildProcess> {
119+
public run(): Promise<ChildProcess> {
120120
if (!this.isOSX()) {
121121
return Promise.reject('iOS platform is only supported on OS X.');
122122
}
@@ -125,7 +125,6 @@ export class IosProject extends NSProject {
125125
let command = new CommandBuilder()
126126
.appendParam("run")
127127
.appendParam(this.platform())
128-
.appendParamIf("--emulator", emulator)
129128
.build();
130129

131130
let child: ChildProcess = this.spawnProcess(command.path, command.args);
@@ -212,12 +211,11 @@ export class AndroidProject extends NSProject {
212211
return 'android';
213212
}
214213

215-
public run(emulator: boolean): Promise<ChildProcess> {
214+
public run(): Promise<ChildProcess> {
216215
// build command to execute
217216
let command = new CommandBuilder()
218217
.appendParam("run")
219218
.appendParam(this.platform())
220-
.appendParamIf("--emulator", emulator)
221219
.build();
222220

223221
let child: ChildProcess = this.spawnProcess(command.path, command.args);

src/services/analytics/AnalyticsService.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,24 @@ export class AnalyticsService {
6060
}
6161
}
6262

63-
public launchDebugger(request: string, platform: string, emulator: boolean): Promise<any> {
63+
public launchDebugger(request: string, platform: string): Promise<any> {
6464
if(this._analyticsEnabled) {
6565
try {
6666
return Promise.all([
67-
this._gua.launchDebugger(request, platform, emulator),
68-
this._ta.launchDebugger(request, platform, emulator)
67+
this._gua.launchDebugger(request, platform),
68+
this._ta.launchDebugger(request, platform)
6969
]);
7070
} catch(e) {}
7171
}
7272
return Promise.resolve();
7373
}
7474

75-
public runRunCommand(platform: string, emulator: boolean): Promise<any> {
75+
public runRunCommand(platform: string): Promise<any> {
7676
if(this._analyticsEnabled) {
7777
try {
7878
return Promise.all([
79-
this._gua.runRunCommand(platform, emulator),
80-
this._ta.runRunCommand(platform, emulator)
79+
this._gua.runRunCommand(platform),
80+
this._ta.runRunCommand(platform)
8181
]);
8282
} catch(e) {}
8383
}

src/services/analytics/GUAService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ export class GUAService {
2121
};
2222
}
2323

24-
public launchDebugger(request: string, platform: string, emulator: boolean): Promise<any> {
24+
public launchDebugger(request: string, platform: string): Promise<any> {
2525
let payload = this._getBasePayload();
2626
payload.ec = 'vscode-extension-debug'; // event category
27-
payload.ea = `debug-${request}-on-${platform}-${emulator ? 'emulator' : 'device'}`; // event action
27+
payload.ea = `debug-${request}-on-${platform}`; // event action
2828
return this.sendEvent(payload);
2929
}
3030

31-
public runRunCommand(platform: string, emulator: boolean): Promise<any> {
31+
public runRunCommand(platform: string): Promise<any> {
3232
let payload = this._getBasePayload();
3333
payload.ec = 'vscode-extension-command'; // event category
34-
payload.ea = `command-run-on-${platform}-${emulator ? 'emulator' : 'device'}`; // event action
34+
payload.ea = `command-run-on-${platform}`; // event action
3535
return this.sendEvent(payload);
3636
}
3737

src/services/analytics/TelerikAnalyticsService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ export class TelerikAnalyticsService {
5959
this._eqatecMonitor.trackFeature(`ExtensionVersion.${baseInfo.extensionVersion}`);
6060
}
6161

62-
public launchDebugger(request: string, platform: string, emulator: boolean): Promise<any> {
63-
this._eqatecMonitor.trackFeature(`${capitalizeFirstLetter(request)}.${capitalizeFirstLetter(platform)}.${emulator ? 'Emulator' : 'Device'}`);
62+
public launchDebugger(request: string, platform: string): Promise<any> {
63+
this._eqatecMonitor.trackFeature(`${capitalizeFirstLetter(request)}.${capitalizeFirstLetter(platform)}`);
6464
return Promise.resolve();
6565
}
6666

67-
public runRunCommand(platform: string, emulator: boolean): Promise<any> {
68-
this._eqatecMonitor.trackFeature(`Run.${capitalizeFirstLetter(platform)}.${emulator ? 'Emulator' : 'Device'}`);
67+
public runRunCommand(platform: string): Promise<any> {
68+
this._eqatecMonitor.trackFeature(`Run.${capitalizeFirstLetter(platform)}`);
6969
return Promise.resolve();
7070
}
7171
}

src/services/ipc/ExtensionProtocol.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ export interface Response {
1212
export interface AnalyticsLaunchDebuggerArgs {
1313
request: string;
1414
platform: string;
15-
emulator: boolean;
1615
}
1716

1817
export interface AnalyticsRunRunCommandArgs {
1918
platform: string;
20-
emulator: boolean;
2119
}

src/services/ipc/ExtensionServer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ export class ExtensionServer {
6767
}
6868

6969
public analyticsLaunchDebugger(args: extProtocol.AnalyticsLaunchDebuggerArgs): Promise<any> {
70-
return AnalyticsService.getInstance().launchDebugger(args.request, args.platform, args.emulator);
70+
return AnalyticsService.getInstance().launchDebugger(args.request, args.platform);
7171
}
7272

7373
public runRunCommand(args: extProtocol.AnalyticsRunRunCommandArgs): Promise<any> {
74-
return AnalyticsService.getInstance().runRunCommand(args.platform, args.emulator);
74+
return AnalyticsService.getInstance().runRunCommand(args.platform);
7575
}
7676
}

0 commit comments

Comments
 (0)