Merge pull request #9621 from sethalves/tablet-ui-track-opens-and-closes

send UserActivityLogger events when tablet is opened or closed
This commit is contained in:
Chris Collins 2017-02-07 08:23:09 -08:00 committed by GitHub
commit d2feb4202b
3 changed files with 13 additions and 2 deletions

View file

@ -16,6 +16,14 @@ void UserActivityLoggerScriptingInterface::enabledEdit() {
logAction("enabled_edit"); logAction("enabled_edit");
} }
void UserActivityLoggerScriptingInterface::openedTablet() {
logAction("opened_tablet");
}
void UserActivityLoggerScriptingInterface::closedTablet() {
logAction("closed_tablet");
}
void UserActivityLoggerScriptingInterface::openedMarketplace() { void UserActivityLoggerScriptingInterface::openedMarketplace() {
logAction("opened_marketplace"); logAction("opened_marketplace");
} }

View file

@ -21,6 +21,8 @@ class UserActivityLoggerScriptingInterface : public QObject, public Dependency {
Q_OBJECT Q_OBJECT
public: public:
Q_INVOKABLE void enabledEdit(); Q_INVOKABLE void enabledEdit();
Q_INVOKABLE void openedTablet();
Q_INVOKABLE void closedTablet();
Q_INVOKABLE void openedMarketplace(); Q_INVOKABLE void openedMarketplace();
Q_INVOKABLE void toggledAway(bool isAway); Q_INVOKABLE void toggledAway(bool isAway);
Q_INVOKABLE void tutorialProgress(QString stepName, int stepNumber, float secondsToComplete, Q_INVOKABLE void tutorialProgress(QString stepName, int stepNumber, float secondsToComplete,

View file

@ -12,7 +12,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
/* global Script, HMD, WebTablet, UIWebTablet */ /* global Script, HMD, WebTablet, UIWebTablet, UserActivityLogger, Settings, Entities, Messages, Tablet, Overlays, MyAvatar */
(function() { // BEGIN LOCAL_SCOPE (function() { // BEGIN LOCAL_SCOPE
var tabletShown = false; var tabletShown = false;
@ -65,8 +65,10 @@
hideTabletUI(); hideTabletUI();
HMD.closeTablet(); HMD.closeTablet();
} else if (HMD.showTablet && !tabletShown) { } else if (HMD.showTablet && !tabletShown) {
UserActivityLogger.openedTablet();
showTabletUI(); showTabletUI();
} else if (!HMD.showTablet && tabletShown) { } else if (!HMD.showTablet && tabletShown) {
UserActivityLogger.closedTablet();
hideTabletUI(); hideTabletUI();
} }
} }
@ -86,7 +88,6 @@
var accumulatedLevel = 0.0; var accumulatedLevel = 0.0;
// Note: Might have to tweak the following two based on the rate we're getting the data // Note: Might have to tweak the following two based on the rate we're getting the data
var AVERAGING_RATIO = 0.05; var AVERAGING_RATIO = 0.05;
var MIC_LEVEL_UPDATE_INTERVAL_MS = 100;
// Calculate microphone level with the same scaling equation (log scale, exponentially averaged) in AvatarInputs and pal.js // Calculate microphone level with the same scaling equation (log scale, exponentially averaged) in AvatarInputs and pal.js
function getMicLevel() { function getMicLevel() {