From 37b738ff8bba90ad2784a09a1e9060f5366b555e Mon Sep 17 00:00:00 2001 From: David Kelly Date: Thu, 1 Jun 2017 16:46:31 -0700 Subject: [PATCH 1/3] initial cut at some UserActivities for the bubble --- .../src/UserActivityLoggerScriptingInterface.cpp | 10 +++++++++- .../src/UserActivityLoggerScriptingInterface.h | 2 ++ scripts/system/bubble.js | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/UserActivityLoggerScriptingInterface.cpp b/libraries/networking/src/UserActivityLoggerScriptingInterface.cpp index ff69363570..61f2071c5f 100644 --- a/libraries/networking/src/UserActivityLoggerScriptingInterface.cpp +++ b/libraries/networking/src/UserActivityLoggerScriptingInterface.cpp @@ -56,7 +56,7 @@ void UserActivityLoggerScriptingInterface::palAction(QString action, QString tar } void UserActivityLoggerScriptingInterface::palOpened(float secondsOpened) { - doLogAction("pal_opened", { + doLogAction("pal_opened", { { "seconds_opened", secondsOpened } }); } @@ -71,6 +71,14 @@ void UserActivityLoggerScriptingInterface::makeUserConnection(QString otherID, b doLogAction("makeUserConnection", payload); } +void UserActivityLoggerScriptingInterface::bubbleToggled(bool newValue) { + doLogAction(newValue ? "bubbleOn" : "bubbleOff"); +} + +void UserActivityLoggerScriptingInterface::bubbleActivated() { + doLogAction("bubbleActivated"); +} + void UserActivityLoggerScriptingInterface::logAction(QString action, QVariantMap details) { doLogAction(action, QJsonObject::fromVariantMap(details)); } diff --git a/libraries/networking/src/UserActivityLoggerScriptingInterface.h b/libraries/networking/src/UserActivityLoggerScriptingInterface.h index b141e930f2..885f637a62 100644 --- a/libraries/networking/src/UserActivityLoggerScriptingInterface.h +++ b/libraries/networking/src/UserActivityLoggerScriptingInterface.h @@ -30,6 +30,8 @@ public: Q_INVOKABLE void palAction(QString action, QString target); Q_INVOKABLE void palOpened(float secondsOpen); Q_INVOKABLE void makeUserConnection(QString otherUser, bool success, QString details = ""); + Q_INVOKABLE void bubbleToggled(bool newValue); + Q_INVOKABLE void bubbleActivated(); Q_INVOKABLE void logAction(QString action, QVariantMap details = QVariantMap{}); private: void doLogAction(QString action, QJsonObject details = {}); diff --git a/scripts/system/bubble.js b/scripts/system/bubble.js index 8d103c93de..de18bae4cd 100644 --- a/scripts/system/bubble.js +++ b/scripts/system/bubble.js @@ -10,7 +10,7 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -/* global Script, Users, Overlays, AvatarList, Controller, Camera, getControllerWorldLocation */ +/* global Script, Users, Overlays, AvatarList, Controller, Camera, getControllerWorldLocation, UserActivityLogger */ (function () { // BEGIN LOCAL_SCOPE var button; @@ -76,6 +76,7 @@ // Called from the C++ scripting interface to show the bubble overlay function enteredIgnoreRadius() { createOverlays(); + UserActivityLogger.bubbleActivated(); } // Used to set the state of the bubble HUD button @@ -142,6 +143,7 @@ function onBubbleToggled() { var bubbleActive = Users.getIgnoreRadiusEnabled(); writeButtonProperties(bubbleActive); + UserActivityLogger.bubbleToggled(bubbleActive); if (bubbleActive) { createOverlays(); } else { From 4dae77cd9d382d5d8162f1df5fb7335f4a82d888 Mon Sep 17 00:00:00 2001 From: David Kelly Date: Fri, 2 Jun 2017 08:45:02 -0700 Subject: [PATCH 2/3] make sure we dont log the initial call to onBubbleToggled --- scripts/system/bubble.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/system/bubble.js b/scripts/system/bubble.js index de18bae4cd..1bdc14368c 100644 --- a/scripts/system/bubble.js +++ b/scripts/system/bubble.js @@ -140,11 +140,12 @@ } // When the space bubble is toggled... - function onBubbleToggled() { - var bubbleActive = Users.getIgnoreRadiusEnabled(); - writeButtonProperties(bubbleActive); - UserActivityLogger.bubbleToggled(bubbleActive); - if (bubbleActive) { + function onBubbleToggled(enabled, doNotLog) { + writeButtonProperties(enabled); + if (doNotLog !== true) { + UserActivityLogger.bubbleToggled(enabled); + } + if (enabled) { createOverlays(); } else { hideOverlays(); @@ -165,7 +166,7 @@ sortOrder: 4 }); - onBubbleToggled(); + onBubbleToggled(Users.getIgnoreRadiusEnabled(), true); // pass in true so we don't log this initial one in the UserActivity table button.clicked.connect(Users.toggleIgnoreRadius); Users.ignoreRadiusEnabledChanged.connect(onBubbleToggled); From 2feea16063bd5c958e82773275bf2666e2153490 Mon Sep 17 00:00:00 2001 From: David Kelly Date: Fri, 2 Jun 2017 09:47:03 -0700 Subject: [PATCH 3/3] added comment --- scripts/system/bubble.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/system/bubble.js b/scripts/system/bubble.js index 1bdc14368c..c2a2f7af40 100644 --- a/scripts/system/bubble.js +++ b/scripts/system/bubble.js @@ -140,6 +140,8 @@ } // When the space bubble is toggled... + // NOTE: the c++ calls this with just the first param -- we added a second + // just for not logging the initial state of the bubble when we startup. function onBubbleToggled(enabled, doNotLog) { writeButtonProperties(enabled); if (doNotLog !== true) {