Skip to content

Commit

Permalink
Remove dependency to vscode-commons
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Bricon <[email protected]>
  • Loading branch information
fbricon committed Jun 8, 2021
1 parent a7fb6b6 commit 9244dea
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 76 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ The following settings are supported:

With your approval, the vscode-xml extension collects anonymous [usage data](USAGE_DATA.md) and sends it to Red Hat servers to help improve our products and services.
Read our [privacy statement](https://developers.redhat.com/article/tool-data-collection) to learn more.
This extension respects the `redhat.telemetry.enabled` setting, which you can learn more about at https://github.com/redhat-developer/vscode-commons#how-to-disable-telemetry-reporting
This extension respects the `redhat.telemetry.enabled` setting, which you can learn more about at https://github.com/redhat-developer/vscode-redhat-telemetry#how-to-disable-telemetry-reporting

## LemMinX Binary

Expand Down
4 changes: 2 additions & 2 deletions USAGE_DATA.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Data collection

vscode-xml has opt-in telemetry collection, provided by [vscode-commons](https://github.com/redhat-developer/vscode-commons).
vscode-xml has opt-in telemetry collection, provided by [vscode-redhat-telemetry](https://github.com/redhat-developer/vscode-redhat-telemetry).

## What's included in the vscode-xml telemetry data

Expand All @@ -21,7 +21,7 @@ vscode-xml has opt-in telemetry collection, provided by [vscode-commons](https:/
## What's included in the general telemetry data

Please see the
[vscode-commons data collection information](https://github.com/redhat-developer/vscode-commons/blob/master/USAGE_DATA.md#other-extensions)
[vscode-redhat-telemetry data collection information](https://github.com/redhat-developer/vscode-redhat-telemetry/blob/HEAD/USAGE_DATA.md#usage-data-being-collected-by-red-hat-extensions)
for information on what data it collects.

## How to opt in or out
Expand Down
87 changes: 22 additions & 65 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@
"Formatters",
"Snippets"
],
"extensionDependencies": [
"redhat.vscode-commons"
],
"devDependencies": {
"@types/fs-extra": "^8.0.0",
"@types/node": "^10.14.16",
Expand All @@ -77,7 +74,7 @@
"webpack-cli": "^4.6.0"
},
"dependencies": {
"@redhat-developer/vscode-redhat-telemetry": "0.0.13",
"@redhat-developer/vscode-redhat-telemetry": "0.1.1",
"expand-home-dir": "^0.0.3",
"find-java-home": "1.1.0",
"fs-extra": "^8.1.0",
Expand All @@ -91,6 +88,12 @@
"type": "object",
"title": "XML",
"properties": {
"redhat.telemetry.enabled": {
"type": "boolean",
"default": null,
"markdownDescription": "Enable usage data and errors to be sent to Red Hat servers. Read our [privacy statement](https://developers.redhat.com/article/tool-data-collection).",
"scope": "window"
},
"xml.java.home": {
"type": [
"string",
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let languageClient: LanguageClient;

export async function activate(context: ExtensionContext): Promise<XMLExtensionApi> {

await Telemetry.startTelemetry();
await Telemetry.startTelemetry(context);
Telemetry.sendTelemetry(Telemetry.SETTINGS_EVT, {
preferBinary: (getXMLConfiguration()['server']['preferBinary'] as boolean)
});
Expand Down
8 changes: 5 additions & 3 deletions src/telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getTelemetryService, TelemetryService } from "@redhat-developer/vscode-redhat-telemetry/lib";
import { TelemetryService, getRedHatService } from "@redhat-developer/vscode-redhat-telemetry";
import { ExtensionContext } from "vscode";

/**
* Wrap vscode-redhat-telemetry to suit vscode-xml
Expand All @@ -23,11 +24,12 @@ export namespace Telemetry {
* @returns when the telemetry service has been started
* @throws Error if the telemetry service has already been started
*/
export async function startTelemetry(): Promise<void> {
export async function startTelemetry(context: ExtensionContext): Promise<void> {
if (!!_telemetryManager) {
throw new Error("The telemetry service for vscode-xml has already been started")
}
_telemetryManager = await getTelemetryService("redhat.vscode-xml");
const redhatService =await getRedHatService(context);
_telemetryManager = await redhatService.getTelemetryService();
return _telemetryManager.sendStartupEvent();
}

Expand Down

0 comments on commit 9244dea

Please sign in to comment.