Skip to content

GDPR Changes #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 17, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Your application will be launched and the VSCode debugger will attach. If you wa

### NativeScript commands

Type `NativeScript` in the Command Palette and you will see all available commands.
Type `NativeScript` in the Command Palette and you will see all available commands.

![NativeScript Commands](https://raw.githubusercontent.com/NativeScript/nativescript-vscode-extension/master/images/screenshots/nativescript-commands.png)

Expand All @@ -50,7 +50,7 @@ If your version of NativeScript is incompatible with the extension you will see
npm install
npm run build # compiles TypeScript source files to JavaScript
npm run package # produces nativescript-*.*.*.vsix in the root folder
```
```

3. To test the extension run the following commands in the root repository folder:

Expand All @@ -60,6 +60,17 @@ If your version of NativeScript is incompatible with the extension you will see
npm run launch-as-server # launches the debug adapter in server mode
# execute this in a separate terminal
npm run test-mac # run tests on ios device
```
```

4. To install the extension drag and drop the `nativescript-*.*.*.vsix` package in the VS Code.

### How to disable the analytics
Copy link

@ggarabedian ggarabedian May 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend using a list for the steps:

The anonymous usage data collected by Progress from the NativeScript extension for Visual Studio Code is used strictly to improve the product and its services, and enhance the overall user experience.

If you have previously enabled the analytics option, you can disable it by following the steps outlined below:

  1. Open the Visual Studio Code Settings
    • on Windows, select File > Preferences > Settings
    • on macOS, select Code > Preferences > Settings
  2. Add the following option (or update the existing one) to disable the analytics:
"nativescript.analytics.enabled": false

NativeScript Extension for Visual Studio Code collects usage data and sends it to Progress to help improve our products and services.
Copy link

@bundyo bundyo May 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add that it is not personally identifiable?

Is this synced with @ggarabedian?


If you don’t wish to send usage data to Progress, you can set the **nativescript.analytics.enabled** to **false**.

From **File > Preferences > Settings** (macOS: **Code > Preferences > Settings**), add the following option to disable analytics:

```
"nativescript.analytics.enabled": false
```
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"source-map": "0.6.1",
"tree-kill": "^1.2.0",
"universal-analytics": "0.4.13",
"uuid": "^3.2.1",
"vscode-chrome-debug-core": "~3.9.0",
"vscode-debugadapter": "1.26.0",
"vscode-debugprotocol": "1.26.0",
Expand Down Expand Up @@ -67,7 +68,7 @@
"properties": {
"nativescript.analytics.enabled": {
"type": "boolean",
"default": true,
"default": false,
"description": "Enables the extension tracking."
},
"nativescript.tnsPath": {
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/analyticsBaseInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export interface AnalyticsBaseInfo {
operatingSystem: OperatingSystem,
cliVersion: string,
extensionVersion: string,
userId: string
clientId: string
}
118 changes: 78 additions & 40 deletions src/analytics/analyticsService.ts
Original file line number Diff line number Diff line change
@@ -1,76 +1,114 @@
import * as os from 'os';
import { Version } from '../common/version';
import { GUAService } from './guaService';
import { TelerikAnalyticsService } from './telerikAnalyticsService';
import { AnalyticsBaseInfo, OperatingSystem } from './analyticsBaseInfo';
import { Services } from '../services/extensionHostServices';
import * as utils from '../common/utilities';
import * as vscode from 'vscode';
import * as uuid from "uuid";

export class AnalyticsService {
private static HAS_ANALYTICS_PROMPT_SHOWN_KEY = "nativescript.hasAnalyticsPromptShown";
private static CLIENT_ID_KEY = "nativescript.analyticsClientId";
private static ANALYTICS_PROMPT_MESSAGE = "Help improve NativeScript Extension by allowing Progress to collect data usage. " +
Copy link

@ggarabedian ggarabedian May 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a suggestion that I find a bit better:

Help us improve the NativeScript extension by allowing Progress to collect anonymous usage data. For more information about the gathered information and how it is used, read our privacy statement. You can disable the analytics and data collection at any given time.

Do you want to enable analytics?

"Read our [privacy statement](https://www.telerik.com/about/privacy-policy) and " +
"learn how to [disable analytics settings.](https://github.com/NativeScript/nativescript-vscode-extension/blob/master/README.md#how-to-disable-the-analytics). " +
"Do you want to enable analytics?";
private static ANALYTICS_PROMPT_ACCEPT_ACTION = "Yes";
private static ANALYTICS_PROMPT_DENY_ACTION = "No";

private _globalState: vscode.Memento;
private _baseInfo: AnalyticsBaseInfo;
private _gua: GUAService;
private _ta: TelerikAnalyticsService;
private _analyticsEnabled: boolean;

public static generateMachineId(): string {
let machineId = '';
try {
let netInterfaces = os.networkInterfaces();
Object.keys(netInterfaces).forEach(interfName => {
netInterfaces[interfName].forEach(interf => {
if (!interf.internal) {
machineId += `${interf.mac}-`;
}
});
});
} catch(e) {}
return machineId;
}
constructor(globalState: vscode.Memento) {
this._globalState = globalState;

constructor() {
this._analyticsEnabled = Services.workspaceConfigService().isAnalyticsEnabled;
let operatingSystem = OperatingSystem.Other;
switch(process.platform) {
case 'win32': { operatingSystem = OperatingSystem.Windows; break; }
case 'darwin': { operatingSystem = OperatingSystem.OSX; break; }
case 'linux':
case 'freebsd': { operatingSystem = OperatingSystem.Linux; break; }
};
vscode.workspace.onDidChangeConfiguration(() => this.updateAnalyticsEnabled());

this._baseInfo = {
cliVersion: Services.cli().version.toString(),
extensionVersion: utils.getInstalledExtensionVersion().toString(),
operatingSystem: operatingSystem,
userId: AnalyticsService.generateMachineId()
operatingSystem: AnalyticsService.getOperatingSystem(),
clientId: this.getOrGenerateClientId()
};

if(this._analyticsEnabled) {
this._gua = new GUAService('UA-111455-29', this._baseInfo);
this._ta = new TelerikAnalyticsService('b8b2e51f188f43e9b0dfb899f7b71cc6', this._baseInfo);
}
}

public launchDebugger(request: string, platform: string): Promise<any> {
if(this._analyticsEnabled) {
try {
return Promise.all([
this._gua.launchDebugger(request, platform),
this._ta.launchDebugger(request, platform)
]);
return this._gua.launchDebugger(request, platform);
} catch(e) {}
}

return Promise.resolve();
}

public runRunCommand(platform: string): Promise<any> {
if(this._analyticsEnabled) {
try {
return Promise.all([
this._gua.runRunCommand(platform),
this._ta.runRunCommand(platform)
]);
return this._gua.runRunCommand(platform);
} catch(e) { }
}

return Promise.resolve();
}

private static getOperatingSystem() : OperatingSystem {
switch(process.platform) {
case 'win32':
return OperatingSystem.Windows;
case 'darwin':
return OperatingSystem.OSX;
case 'linux':
case 'freebsd':
return OperatingSystem.Linux;
default:
return OperatingSystem.Other;
};
}

public initialize() : void {
const hasAnalyticsPromptShown = this._globalState.get<boolean>(AnalyticsService.HAS_ANALYTICS_PROMPT_SHOWN_KEY);
if(!hasAnalyticsPromptShown) {
vscode.window.showInformationMessage(AnalyticsService.ANALYTICS_PROMPT_MESSAGE,
AnalyticsService.ANALYTICS_PROMPT_ACCEPT_ACTION,
AnalyticsService.ANALYTICS_PROMPT_DENY_ACTION
)
.then(result => this.onAnalyticsMessageConfirmation(result));

return;
}

this.updateAnalyticsEnabled();
}

private getOrGenerateClientId(): string {
let clientId = this._globalState.get<string>(AnalyticsService.CLIENT_ID_KEY);

if(!clientId) {
clientId = uuid.v4();
this._globalState.update(AnalyticsService.CLIENT_ID_KEY, clientId);
}

return clientId;
}

private onAnalyticsMessageConfirmation(result: string) : void {
const shouldEnableAnalytics = result === AnalyticsService.ANALYTICS_PROMPT_ACCEPT_ACTION ? true : false;

this._globalState.update(AnalyticsService.HAS_ANALYTICS_PROMPT_SHOWN_KEY, true);

Services.workspaceConfigService().isAnalyticsEnabled = shouldEnableAnalytics;
this.updateAnalyticsEnabled();
}

private updateAnalyticsEnabled() {
this._analyticsEnabled = Services.workspaceConfigService().isAnalyticsEnabled;

if(this._analyticsEnabled && !this._gua) {
this._gua = new GUAService('UA-111455-29', this._baseInfo);
}
}
}
Loading