From 2d5e6e8a2cc65686e40fd7f50e58b3b7a9cc0c5c Mon Sep 17 00:00:00 2001 From: Andre Dietisheim Date: Thu, 14 Dec 2023 14:54:01 +0100 Subject: [PATCH] refactor: use telemetry feedback API (#647) Signed-off-by: Andre Dietisheim --- build.gradle | 3 +- .../actions/toolwindow/FeedBackAction.java | 32 +++++++++---------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/build.gradle b/build.gradle index 6f94b61fb..e6d1b40d1 100644 --- a/build.gradle +++ b/build.gradle @@ -53,7 +53,8 @@ intellij { 'JavaScript', 'com.intellij.css', 'yaml', - 'com.redhat.devtools.intellij.telemetry:1.0.0.44', + '/Users/andredietisheim/Documents/jboss-workspaces/intellij-redhat-telemetry/build/idea-sandbox/plugins/Telemetry by Red Hat', +// 'com.redhat.devtools.intellij.telemetry:1.0.0.44', 'com.redhat.devtools.intellij.kubernetes:1.2.1.277' ] updateSinceUntilBuild = false diff --git a/src/main/java/org/jboss/tools/intellij/openshift/actions/toolwindow/FeedBackAction.java b/src/main/java/org/jboss/tools/intellij/openshift/actions/toolwindow/FeedBackAction.java index 7308afc20..f0b4a76d1 100644 --- a/src/main/java/org/jboss/tools/intellij/openshift/actions/toolwindow/FeedBackAction.java +++ b/src/main/java/org/jboss/tools/intellij/openshift/actions/toolwindow/FeedBackAction.java @@ -12,34 +12,34 @@ import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; -import org.jboss.tools.intellij.openshift.telemetry.TelemetrySender; +import com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder.FeedbackMessage; import org.jboss.tools.intellij.openshift.telemetry.TelemetryService; import org.jboss.tools.intellij.openshift.ui.feedback.FeedBackDialog; import org.jetbrains.annotations.NotNull; public class FeedBackAction extends AnAction { - protected TelemetrySender telemetrySender; - @Override public void actionPerformed(@NotNull AnActionEvent e) { - telemetrySender = new TelemetrySender("feedback"); + FeedbackMessage feedback = TelemetryService.instance().getBuilder().feedback("feedback"); FeedBackDialog dialog = new FeedBackDialog(); dialog.show(); if (dialog.isOK()) { - telemetrySender.addProperty("satisfaction", dialog.getSatisfaction()); - telemetrySender.addProperty("satisfaction_comment", dialog.getSatisfactionComment()); - telemetrySender.addProperty("recommendation", dialog.getRecommendation()); - telemetrySender.addProperty("recommendation_comment", dialog.getRecommendationComment()); - telemetrySender.addProperty("used_similar_extension", dialog.isUsedSimilarExtension()); - telemetrySender.addProperty("used_similar_extension_name", dialog.getUsedSimilarExtensionName()); - telemetrySender.addProperty("frustrating", dialog.getFrustratingFeature()); - telemetrySender.addProperty("missing", dialog.getMissingFeature()); - telemetrySender.addProperty("best", dialog.getBestFeature()); - telemetrySender.addProperty("contact", dialog.getContact()); - telemetrySender.sendTelemetryResults(TelemetryService.TelemetryResult.SUCCESS); + feedback.property("satisfaction", dialog.getSatisfaction()) + .property("satisfaction_comment", dialog.getSatisfactionComment()) + .property("recommendation", dialog.getRecommendation()) + .property("recommendation_comment", dialog.getRecommendationComment()) + .property("used_similar_extension", dialog.isUsedSimilarExtension()) + .property("used_similar_extension_name", dialog.getUsedSimilarExtensionName()) + .property("frustrating", dialog.getFrustratingFeature()) + .property("missing", dialog.getMissingFeature()) + .property("best", dialog.getBestFeature()) + .property("contact", dialog.getContact()) + .success() + .send(); } else { - telemetrySender.sendTelemetryResults(TelemetryService.TelemetryResult.ABORTED); + feedback.aborted() + .send(); } } }