updating user activity logging

This commit is contained in:
Wayne Chen 2019-01-09 13:51:40 -08:00
parent 39f4af505c
commit ba8620b644
6 changed files with 221 additions and 26 deletions

View file

@ -29,6 +29,8 @@ Item {
readonly property bool withSteam: withSteam readonly property bool withSteam: withSteam
property string errorString: errorString property string errorString: errorString
readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp()
QtObject { QtObject {
id: d id: d
readonly property int minWidth: 480 readonly property int minWidth: 480
@ -123,6 +125,13 @@ Item {
fontSize: completeProfileBody.fontSize fontSize: completeProfileBody.fontSize
fontBold: completeProfileBody.fontBold fontBold: completeProfileBody.fontBold
onClicked: { onClicked: {
if (completeProfileBody.loginDialogPoppedUp) {
var data = {
"action": "user clicked cancel on the complete profile screen"
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader }); bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader });
} }
} }
@ -142,6 +151,12 @@ Item {
fontSize: completeProfileBody.fontSize fontSize: completeProfileBody.fontSize
fontBold: completeProfileBody.fontBold fontBold: completeProfileBody.fontBold
onClicked: { onClicked: {
if (completeProfileBody.loginDialogPoppedUp) {
var data = {
"action": "user clicked create profile"
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
loginErrorMessage.visible = false; loginErrorMessage.visible = false;
loginDialog.createAccountFromSteam(); loginDialog.createAccountFromSteam();
} }
@ -253,13 +268,29 @@ Item {
onHandleCreateCompleted: { onHandleCreateCompleted: {
console.log("Create Succeeded") console.log("Create Succeeded")
loginDialog.loginThroughSteam(); if (completeProfileBody.withSteam) {
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": true, "linkSteam": false }); if (completeProfileBody.loginDialogPoppedUp) {
var data = {
"action": "user created a profile with Steam successfully from the complete profile screen"
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
loginDialog.loginThroughSteam();
}
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": completeProfileBody.withSteam, "linkSteam": false });
} }
onHandleCreateFailed: { onHandleCreateFailed: {
console.log("Create Failed: " + error); console.log("Create Failed: " + error);
if (completeProfileBody.withSteam) {
if (completeProfileBody.loginDialogPoppedUp) {
var data = {
"action": "user failed to create a profile with Steam from the complete profile screen"
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
}
bodyLoader.setSource("UsernameCollisionBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader }); bodyLoader.setSource("UsernameCollisionBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": completeProfileBody.withSteam });
} }
} }

View file

@ -42,6 +42,8 @@ Item {
property string errorString: errorString property string errorString: errorString
property bool lostFocus: false property bool lostFocus: false
readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp()
QtObject { QtObject {
id: d id: d
readonly property int minWidth: 480 readonly property int minWidth: 480
@ -68,6 +70,20 @@ Item {
function login() { function login() {
loginDialog.login(emailField.text, passwordField.text); loginDialog.login(emailField.text, passwordField.text);
if (linkAccountBody.loginDialogPoppedUp) {
var data;
if (linkAccountBody.linkSteam) {
data = {
"action": "user linking hifi account with Steam"
};
} else {
data = {
"action": "user logging in"
};
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": linkAccountBody.withSteam, "withOculus": linkAccountBody.withOculus, "linkSteam": linkAccountBody.linkSteam }); bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": linkAccountBody.withSteam, "withOculus": linkAccountBody.withOculus, "linkSteam": linkAccountBody.linkSteam });
} }
@ -294,6 +310,14 @@ Item {
topMargin: hifi.dimensions.contentSpacing.y topMargin: hifi.dimensions.contentSpacing.y
} }
onClicked: { onClicked: {
if (linkAccountBody.loginDialogPoppedUp) {
var data = {
"action": "user clicked cancel at link account screen"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
loginDialog.dismissLoginDialog();
}
bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": linkAccountBody.withSteam, "errorString": "" }); bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": linkAccountBody.withSteam, "errorString": "" });
} }
} }
@ -310,7 +334,7 @@ Item {
topMargin: hifi.dimensions.contentSpacing.y topMargin: hifi.dimensions.contentSpacing.y
} }
onClicked: { onClicked: {
linkAccountBody.login() linkAccountBody.login();
} }
} }
TextMetrics { TextMetrics {
@ -373,7 +397,12 @@ Item {
lightboxPopup.visible = false; lightboxPopup.visible = false;
} }
lightboxPopup.visible = true; lightboxPopup.visible = true;
// bodyLoader.setSource("CantAccessBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader }); if (linkAccountBody.loginDialogPoppedUp) {
var data = {
"action": "user clicked can't access account"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
} }
} }
HifiControlsUit.Button { HifiControlsUit.Button {
@ -402,6 +431,19 @@ Item {
linkAccountBody.withSteam = true; linkAccountBody.withSteam = true;
loginDialog.loginThroughSteam(); loginDialog.loginThroughSteam();
} }
if (linkAccountBody.loginDialogPoppedUp) {
var data;
if (linkAccountBody.withOculus) {
data = {
"action": "user clicked login through Oculus"
};
} else if (linkAccountBody.withSteam) {
data = {
"action": "user clicked login through Steam"
};
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader,
"withSteam": linkAccountBody.withSteam, "withOculus": linkAccountBody.withOculus, "linkSteam": linkAccountBody.linkSteam }); "withSteam": linkAccountBody.withSteam, "withOculus": linkAccountBody.withOculus, "linkSteam": linkAccountBody.linkSteam });
@ -470,6 +512,12 @@ Item {
linkColor: hifi.colors.blueAccent linkColor: hifi.colors.blueAccent
onLinkActivated: { onLinkActivated: {
Tablet.playSound(TabletEnums.ButtonClick); Tablet.playSound(TabletEnums.ButtonClick);
if (linkAccountBody.loginDialogPoppedUp) {
var data = {
"action": "user clicked sign up button"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
bodyLoader.setSource("SignUpBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, bodyLoader.setSource("SignUpBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader,
"errorString": "", "linkSteam": linkAccountBody.linkSteam }); "errorString": "", "linkSteam": linkAccountBody.linkSteam });
} }
@ -495,10 +543,9 @@ Item {
fontFamily: linkAccountBody.fontFamily fontFamily: linkAccountBody.fontFamily
fontSize: linkAccountBody.fontSize fontSize: linkAccountBody.fontSize
fontBold: linkAccountBody.fontBold fontBold: linkAccountBody.fontBold
visible: loginDialog.getLoginDialogPoppedUp() && !linkAccountBody.linkSteam; visible: linkAccountBody.loginDialogPoppedUp && !linkAccountBody.linkSteam;
onClicked: { onClicked: {
if (loginDialog.getLoginDialogPoppedUp()) { if (linkAccountBody.loginDialogPoppedUp) {
console.log("[ENCOURAGELOGINDIALOG]: user dismissed login screen")
var data = { var data = {
"action": "user dismissed login screen" "action": "user dismissed login screen"
}; };

View file

@ -30,6 +30,8 @@ Item {
property bool withOculus: withOculus property bool withOculus: withOculus
property bool linkSteam: linkSteam property bool linkSteam: linkSteam
readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp()
QtObject { QtObject {
id: d id: d
readonly property int minWidth: 480 readonly property int minWidth: 480
@ -62,8 +64,12 @@ Item {
running: false; running: false;
repeat: false; repeat: false;
onTriggered: { onTriggered: {
if (loginDialog.getLoginDialogPoppedUp()) { if (loggingInBody.loginDialogPoppedUp) {
loginDialog.dismissLoginDialog(); loginDialog.dismissLoginDialog();
var data = {
"action": "user logged in successfully";
};
UserActivityLogger.logAction("encourageLoginDialog", data);
} }
root.tryDestroy(); root.tryDestroy();
} }
@ -107,6 +113,12 @@ Item {
loggingInText.x = 0; loggingInText.x = 0;
loggingInText.anchors.centerIn = loggingInHeader; loggingInText.anchors.centerIn = loggingInHeader;
loggedInGlyph.visible = true; loggedInGlyph.visible = true;
if (loggingInBody.loginDialogPoppedUp) {
var data = {
"action": "user logged in with Steam successfully"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
} else if (loggingInBody.withOculus) { } else if (loggingInBody.withOculus) {
// reset the flag. // reset the flag.
loggingInGlyph.visible = false; loggingInGlyph.visible = false;
@ -115,8 +127,21 @@ Item {
loggingInText.anchors.centerIn = loggingInHeader; loggingInText.anchors.centerIn = loggingInHeader;
loggedInGlyph.text = hifi.glyphs.oculus; loggedInGlyph.text = hifi.glyphs.oculus;
loggedInGlyph.visible = true; loggedInGlyph.visible = true;
if (loggingInBody.loginDialogPoppedUp) {
var data = {
"action": "user logged in with Oculus successfully"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
} else { } else {
loggingInText.text = "You are now logged in!"; loggingInText.text = "You are now logged in!";
if (loggingInBody.loginDialogPoppedUp) {
var data = {
"action": "user logged in successfully"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
} }
successTimer.start(); successTimer.start();
} }
@ -234,11 +259,28 @@ Item {
target: loginDialog target: loginDialog
onHandleLinkCompleted: { onHandleLinkCompleted: {
console.log("Link Succeeded"); console.log("Link Succeeded");
loggingInBody.linkSteam = false; if (loggingInBody.linkSteam) {
loggingInBody.loadingSuccess(); loggingInBody.linkSteam = false;
if (loggingInBody.loginDialogPoppedUp) {
var data = {
"action": "user linked Steam with their hifi account credentials successfully"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
loggingInBody.loadingSuccess();
}
} }
onHandleLinkFailed: { onHandleLinkFailed: {
console.log("Link Failed: " + error); console.log("Link Failed: " + error);
if (loggingInBody.linkSteam) {
if (loggingInBody.loginDialogPoppedUp) {
var data = {
"action": "user linked Steam unsuccessfully"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
}
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "linkSteam": true, "errorString": error }); bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "linkSteam": true, "errorString": error });
} }
@ -253,18 +295,43 @@ Item {
var errorString = ""; var errorString = "";
if (loggingInBody.linkSteam && loggingInBody.withSteam) { if (loggingInBody.linkSteam && loggingInBody.withSteam) {
errorString = "Username or password is incorrect."; errorString = "Username or password is incorrect.";
if (loggingInBody.loginDialogPoppedUp) {
var data = {
"action": "user failed to link Steam with their hifi account credentials"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": loggingInBody.withSteam, "linkSteam": loggingInBody.linkSteam, "errorString": errorString }); bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": loggingInBody.withSteam, "linkSteam": loggingInBody.linkSteam, "errorString": errorString });
} else if (loggingInBody.withSteam) { } else if (loggingInBody.withSteam) {
loggingInGlyph.visible = false; loggingInGlyph.visible = false;
errorString = "Your Steam authentication has failed. Please make sure you are logged into Steam and try again."; errorString = "Your Steam authentication has failed. Please make sure you are logged into Steam and try again.";
if (loggingInBody.loginDialogPoppedUp) {
var data = {
"action": "user failed to authenticate with Steam to log in"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": loggingInBody.withSteam, "errorString": errorString }); bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": loggingInBody.withSteam, "errorString": errorString });
} else if (loggingInBody.withOculus) { } else if (loggingInBody.withOculus) {
loggingInGlyph.visible = false; loggingInGlyph.visible = false;
errorString = "Your Oculus authentication has failed. Please make sure you are logged into Oculus and try again." errorString = "Your Oculus authentication has failed. Please make sure you are logged into Oculus and try again."
if (loggingInBody.loginDialogPoppedUp) {
var data = {
"action": "user failed to authenticate with Oculus to log in"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "errorString": errorString }); bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "errorString": errorString });
} }
else { else {
errorString = "Username or password is incorrect."; errorString = "Username or password is incorrect.";
if (loggingInBody.loginDialogPoppedUp) {
var data = {
"action": "user failed at logging in"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "errorString": errorString }); bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "errorString": errorString });
} }
} }

View file

@ -40,6 +40,8 @@ Item {
property bool linkSteam: linkSteam property bool linkSteam: linkSteam
property bool lostFocus: false property bool lostFocus: false
readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp()
QtObject { QtObject {
id: d id: d
readonly property int minWidth: 480 readonly property int minWidth: 480
@ -345,6 +347,12 @@ Item {
fontSize: signUpBody.fontSize fontSize: signUpBody.fontSize
fontBold: signUpBody.fontBold fontBold: signUpBody.fontBold
onClicked: { onClicked: {
if (signUpBody.loginDialogPoppedUp) {
var data = {
"action": "user clicked cancel button at sign up screen"
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "linkSteam": signUpBody.linkSteam }); bodyLoader.setSource("LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "linkSteam": signUpBody.linkSteam });
} }
} }
@ -363,23 +371,18 @@ Item {
} }
onClicked: { onClicked: {
if (signUpBody.loginDialogPoppedUp) {
var data = {
"action": "user clicked sign up button"
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
signUpBody.signup(); signUpBody.signup();
} }
} }
} }
} }
MouseArea {
z: -2
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: {
if (!usernameField.focus && !emailField.focus && !passwordField.focus) {
usernameField.focus = true;
}
}
}
Component.onCompleted: { Component.onCompleted: {
//but rise Tablet's one instead for Tablet interface //but rise Tablet's one instead for Tablet interface
root.keyboardEnabled = HMD.active; root.keyboardEnabled = HMD.active;
@ -408,12 +411,26 @@ Item {
onHandleSignupCompleted: { onHandleSignupCompleted: {
console.log("Sign Up Completed"); console.log("Sign Up Completed");
if (signUpBody.loginDialogPoppedUp) {
var data = {
"action": "user signed up successfully"
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
loginDialog.login(usernameField.text, passwordField.text); loginDialog.login(usernameField.text, passwordField.text);
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": false, "linkSteam": false }); bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": false, "linkSteam": false });
} }
onHandleSignupFailed: { onHandleSignupFailed: {
console.log("Sign Up Failed") console.log("Sign Up Failed")
if (signUpBody.loginDialogPoppedUp) {
var data = {
"action": "user signed up unsuccessfully"
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
if (errorString !== "") { if (errorString !== "") {
loginErrorMessage.visible = true; loginErrorMessage.visible = true;
var errorStringEdited = errorString.replace(/[\n\r]+/g, "\n"); var errorStringEdited = errorString.replace(/[\n\r]+/g, "\n");

View file

@ -26,6 +26,10 @@ Item {
readonly property int textFieldFontSize: 18 readonly property int textFieldFontSize: 18
readonly property bool fontBold: true readonly property bool fontBold: true
readonly property bool withSteam: withSteam
readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp()
function create() { function create() {
mainTextContainer.visible = false mainTextContainer.visible = false
loginDialog.createAccountFromSteam(textField.text); loginDialog.createAccountFromSteam(textField.text);
@ -197,18 +201,40 @@ Item {
target: loginDialog target: loginDialog
onHandleCreateCompleted: { onHandleCreateCompleted: {
console.log("Create Succeeded"); console.log("Create Succeeded");
loginDialog.loginThroughSteam(); if (usernameCollisionBody.withSteam) {
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": true, "linkSteam": false }) if (usernameCollisionBody.loginDialogPoppedUp) {
var data = {
"action": "user created a profile with Steam successfully in the username collision screen"
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
loginDialog.loginThroughSteam();
}
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": usernameCollisionBody.withSteam, "linkSteam": false })
} }
onHandleCreateFailed: { onHandleCreateFailed: {
console.log("Create Failed: " + error) console.log("Create Failed: " + error)
if (usernameCollisionBody.loginDialogPoppedUp) {
var data = {
"action": "user failed to create account from the username collision screen"
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
mainTextContainer.visible = true mainTextContainer.visible = true
mainTextContainer.text = "\"" + textField.text + qsTr("\" is invalid or already taken."); mainTextContainer.text = "\"" + textField.text + qsTr("\" is invalid or already taken.");
} }
onHandleLoginCompleted: { onHandleLoginCompleted: {
console.log("Login Succeeded"); console.log("Login Succeeded");
if (loginDialog.getLoginDialogPoppedUp()) { if (usernameCollisionBody.loginDialogPoppedUp) {
var data = {
"action": "user logged in successfully from the username collision screen"
}
UserActivityLogger.logAction("encourageLoginDialog", data);
loginDialog.dismissLoginDialog(); loginDialog.dismissLoginDialog();
} }
root.tryDestroy(); root.tryDestroy();
@ -216,6 +242,13 @@ Item {
onHandleLoginFailed: { onHandleLoginFailed: {
console.log("Login Failed") console.log("Login Failed")
if (usernameCollisionBody.loginDialogPoppedUp) {
var data = {
"action": "user failed to log in from the username collision screen"
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
mainTextContainer.text = "Login Failed"; mainTextContainer.text = "Login Failed";
} }

View file

@ -2864,7 +2864,7 @@ void Application::showLoginScreen() {
dialogsManager->showLoginDialog(); dialogsManager->showLoginDialog();
emit loginDialogFocusEnabled(); emit loginDialogFocusEnabled();
QJsonObject loginData = {}; QJsonObject loginData = {};
loginData["action"] = "login dialog shown"; loginData["action"] = "login dialog popped up";
UserActivityLogger::getInstance().logAction("encourageLoginDialog", loginData); UserActivityLogger::getInstance().logAction("encourageLoginDialog", loginData);
_window->setWindowTitle("High Fidelity Interface"); _window->setWindowTitle("High Fidelity Interface");
} else { } else {