mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 02:53:43 +02:00
Some initial analytics for PAL usage
This commit is contained in:
parent
601223aa98
commit
d9fbf832e2
5 changed files with 34 additions and 1 deletions
|
@ -247,6 +247,7 @@ Rectangle {
|
|||
userModel.setProperty(model.userIndex, styleData.role, newValue)
|
||||
userModelData[model.userIndex][styleData.role] = newValue // Defensive programming
|
||||
Users[styleData.role](model.sessionId, newValue)
|
||||
UserActivityLogger["palAction"](newValue ? "un-" + styleData.role : styleData.role, model.sessionId)
|
||||
if (styleData.role === "ignore") {
|
||||
userModel.setProperty(model.userIndex, "personalMute", newValue)
|
||||
userModelData[model.userIndex]["personalMute"] = newValue // Defensive programming
|
||||
|
@ -273,6 +274,7 @@ Rectangle {
|
|||
height: 24
|
||||
onClicked: {
|
||||
Users[styleData.role](model.sessionId)
|
||||
UserActivityLogger["palAction"](styleData.role, model.sessionId)
|
||||
if (styleData.role === "kick") {
|
||||
// Just for now, while we cannot undo "Ban":
|
||||
userModel.remove(model.userIndex)
|
||||
|
|
|
@ -1937,6 +1937,8 @@ void Application::initializeUi() {
|
|||
rootContext->setContextProperty("AvatarList", DependencyManager::get<AvatarManager>().data());
|
||||
rootContext->setContextProperty("Users", DependencyManager::get<UsersScriptingInterface>().data());
|
||||
|
||||
rootContext->setContextProperty("UserActivityLogger", DependencyManager::get<UserActivityLoggerScriptingInterface>().data());
|
||||
|
||||
rootContext->setContextProperty("Camera", &_myCamera);
|
||||
|
||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||
|
|
|
@ -38,6 +38,21 @@ void UserActivityLoggerScriptingInterface::tutorialProgress( QString stepName, i
|
|||
|
||||
}
|
||||
|
||||
void UserActivityLoggerScriptingInterface::palAction(QString action, QString target) {
|
||||
QJsonObject payload;
|
||||
payload["action"] = action;
|
||||
if (target.length() > 0) {
|
||||
payload["target"] = target;
|
||||
}
|
||||
logAction("pal_activity", payload);
|
||||
}
|
||||
|
||||
void UserActivityLoggerScriptingInterface::palOpened(float secondsOpened) {
|
||||
logAction("pal_opened", {
|
||||
{ "seconds_opened", secondsOpened }
|
||||
});
|
||||
}
|
||||
|
||||
void UserActivityLoggerScriptingInterface::logAction(QString action, QJsonObject details) {
|
||||
QMetaObject::invokeMethod(&UserActivityLogger::getInstance(), "logAction",
|
||||
Q_ARG(QString, action),
|
||||
|
|
|
@ -25,7 +25,8 @@ public:
|
|||
Q_INVOKABLE void toggledAway(bool isAway);
|
||||
Q_INVOKABLE void tutorialProgress(QString stepName, int stepNumber, float secondsToComplete,
|
||||
float tutorialElapsedTime, QString tutorialRunID = "", int tutorialVersion = 0, QString controllerType = "");
|
||||
|
||||
Q_INVOKABLE void palAction(QString action, QString target);
|
||||
Q_INVOKABLE void palOpened(float secondsOpen);
|
||||
private:
|
||||
void logAction(QString action, QJsonObject details = {});
|
||||
};
|
||||
|
|
|
@ -208,6 +208,7 @@ pal.fromQml.connect(function (message) { // messages are {method, params}, like
|
|||
var id = overlay.key;
|
||||
var selected = ExtendedOverlay.isSelected(id);
|
||||
overlay.select(selected);
|
||||
UserActivityLogger.palAction("avatar_selected", id);
|
||||
});
|
||||
|
||||
HighlightedEntity.clearOverlays();
|
||||
|
@ -232,14 +233,17 @@ pal.fromQml.connect(function (message) { // messages are {method, params}, like
|
|||
case 'refresh':
|
||||
removeOverlays();
|
||||
populateUserList();
|
||||
UserActivityLogger.palAction("refresh");
|
||||
break;
|
||||
case 'updateGain':
|
||||
data = message.params;
|
||||
Users.setAvatarGain(data['sessionId'], data['gain']);
|
||||
UserActivityLogger.palAction("avatar_gain_changed", data['sessionId']);
|
||||
break;
|
||||
case 'displayNameUpdate':
|
||||
if (MyAvatar.displayName != message.params) {
|
||||
MyAvatar.displayName = message.params;
|
||||
UserActivityLogger.palAction("display_name_change");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -551,7 +555,10 @@ var button = toolBar.addButton({
|
|||
buttonState: 1,
|
||||
alpha: 0.9
|
||||
});
|
||||
|
||||
var isWired = false;
|
||||
var palOpenedAt;
|
||||
|
||||
function off() {
|
||||
if (isWired) { // It is not ok to disconnect these twice, hence guard.
|
||||
Script.update.disconnect(updateOverlays);
|
||||
|
@ -563,6 +570,11 @@ function off() {
|
|||
triggerPressMapping.disable(); // see above
|
||||
removeOverlays();
|
||||
Users.requestsDomainListData = false;
|
||||
if (palOpenedAt) {
|
||||
var duration = new Date().getTime() - palOpenedAt;
|
||||
UserActivityLogger.palOpened(duration / 1000.0);
|
||||
palOpenedAt = 0; // just a falsy number is good enough.
|
||||
}
|
||||
if (audioInterval) {
|
||||
Script.clearInterval(audioInterval);
|
||||
}
|
||||
|
@ -579,6 +591,7 @@ function onClicked() {
|
|||
triggerMapping.enable();
|
||||
triggerPressMapping.enable();
|
||||
createAudioInterval();
|
||||
palOpenedAt = new Date().getTime();
|
||||
} else {
|
||||
off();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue