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
property string errorString: errorString
readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp()
QtObject {
id: d
readonly property int minWidth: 480
@ -123,6 +125,13 @@ Item {
fontSize: completeProfileBody.fontSize
fontBold: completeProfileBody.fontBold
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 });
}
}
@ -142,6 +151,12 @@ Item {
fontSize: completeProfileBody.fontSize
fontBold: completeProfileBody.fontBold
onClicked: {
if (completeProfileBody.loginDialogPoppedUp) {
var data = {
"action": "user clicked create profile"
}
UserActivityLogger.logAction("encourageLoginDialog", data);
}
loginErrorMessage.visible = false;
loginDialog.createAccountFromSteam();
}
@ -253,13 +268,29 @@ Item {
onHandleCreateCompleted: {
console.log("Create Succeeded")
loginDialog.loginThroughSteam();
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": true, "linkSteam": false });
if (completeProfileBody.withSteam) {
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: {
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 bool lostFocus: false
readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp()
QtObject {
id: d
readonly property int minWidth: 480
@ -68,6 +70,20 @@ Item {
function login() {
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 });
}
@ -294,6 +310,14 @@ Item {
topMargin: hifi.dimensions.contentSpacing.y
}
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": "" });
}
}
@ -310,7 +334,7 @@ Item {
topMargin: hifi.dimensions.contentSpacing.y
}
onClicked: {
linkAccountBody.login()
linkAccountBody.login();
}
}
TextMetrics {
@ -373,7 +397,12 @@ Item {
lightboxPopup.visible = false;
}
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 {
@ -402,6 +431,19 @@ Item {
linkAccountBody.withSteam = true;
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,
"withSteam": linkAccountBody.withSteam, "withOculus": linkAccountBody.withOculus, "linkSteam": linkAccountBody.linkSteam });
@ -470,6 +512,12 @@ Item {
linkColor: hifi.colors.blueAccent
onLinkActivated: {
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,
"errorString": "", "linkSteam": linkAccountBody.linkSteam });
}
@ -495,10 +543,9 @@ Item {
fontFamily: linkAccountBody.fontFamily
fontSize: linkAccountBody.fontSize
fontBold: linkAccountBody.fontBold
visible: loginDialog.getLoginDialogPoppedUp() && !linkAccountBody.linkSteam;
visible: linkAccountBody.loginDialogPoppedUp && !linkAccountBody.linkSteam;
onClicked: {
if (loginDialog.getLoginDialogPoppedUp()) {
console.log("[ENCOURAGELOGINDIALOG]: user dismissed login screen")
if (linkAccountBody.loginDialogPoppedUp) {
var data = {
"action": "user dismissed login screen"
};

View file

@ -30,6 +30,8 @@ Item {
property bool withOculus: withOculus
property bool linkSteam: linkSteam
readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp()
QtObject {
id: d
readonly property int minWidth: 480
@ -62,8 +64,12 @@ Item {
running: false;
repeat: false;
onTriggered: {
if (loginDialog.getLoginDialogPoppedUp()) {
if (loggingInBody.loginDialogPoppedUp) {
loginDialog.dismissLoginDialog();
var data = {
"action": "user logged in successfully";
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
root.tryDestroy();
}
@ -107,6 +113,12 @@ Item {
loggingInText.x = 0;
loggingInText.anchors.centerIn = loggingInHeader;
loggedInGlyph.visible = true;
if (loggingInBody.loginDialogPoppedUp) {
var data = {
"action": "user logged in with Steam successfully"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
} else if (loggingInBody.withOculus) {
// reset the flag.
loggingInGlyph.visible = false;
@ -115,8 +127,21 @@ Item {
loggingInText.anchors.centerIn = loggingInHeader;
loggedInGlyph.text = hifi.glyphs.oculus;
loggedInGlyph.visible = true;
if (loggingInBody.loginDialogPoppedUp) {
var data = {
"action": "user logged in with Oculus successfully"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
} else {
loggingInText.text = "You are now logged in!";
if (loggingInBody.loginDialogPoppedUp) {
var data = {
"action": "user logged in successfully"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
}
successTimer.start();
}
@ -234,11 +259,28 @@ Item {
target: loginDialog
onHandleLinkCompleted: {
console.log("Link Succeeded");
loggingInBody.linkSteam = false;
loggingInBody.loadingSuccess();
if (loggingInBody.linkSteam) {
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: {
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 });
}
@ -253,18 +295,43 @@ Item {
var errorString = "";
if (loggingInBody.linkSteam && loggingInBody.withSteam) {
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 });
} else if (loggingInBody.withSteam) {
loggingInGlyph.visible = false;
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 });
} else if (loggingInBody.withOculus) {
loggingInGlyph.visible = false;
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 });
}
else {
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 });
}
}

View file

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

View file

@ -26,6 +26,10 @@ Item {
readonly property int textFieldFontSize: 18
readonly property bool fontBold: true
readonly property bool withSteam: withSteam
readonly property bool loginDialogPoppedUp: loginDialog.getLoginDialogPoppedUp()
function create() {
mainTextContainer.visible = false
loginDialog.createAccountFromSteam(textField.text);
@ -197,18 +201,40 @@ Item {
target: loginDialog
onHandleCreateCompleted: {
console.log("Create Succeeded");
loginDialog.loginThroughSteam();
bodyLoader.setSource("LoggingInBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": true, "linkSteam": false })
if (usernameCollisionBody.withSteam) {
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: {
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.text = "\"" + textField.text + qsTr("\" is invalid or already taken.");
}
onHandleLoginCompleted: {
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();
}
root.tryDestroy();
@ -216,6 +242,13 @@ Item {
onHandleLoginFailed: {
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";
}

View file

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