fixing text alignment issues, adding some oculus user log

This commit is contained in:
Wayne Chen 2019-01-23 14:38:06 -08:00
parent e6426cb680
commit 049282e2b3
2 changed files with 31 additions and 5 deletions

View file

@ -77,6 +77,17 @@ Item {
} }
} }
Timer {
id: oculusSuccessTimer
interval: 500;
running: false;
repeat: false;
onTriggered: {
loginDialog.loginThroughOculus();
init();
}
}
function init() { function init() {
// For the process of logging in. // For the process of logging in.
loggingInText.wrapMode = Text.NoWrap; loggingInText.wrapMode = Text.NoWrap;
@ -287,14 +298,29 @@ Item {
onHandleCreateCompleted: { onHandleCreateCompleted: {
console.log("Create Succeeded") console.log("Create Succeeded")
if (loggingInBody.withOculus) { if (loggingInBody.withOculus) {
if (loggingInBody.loginDialogPoppedUp) {
loginDialog.dismissLoginDialog();
var data = {
"action": "user created Oculus account successfully"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
loggingInBody.createOculus = false; loggingInBody.createOculus = false;
loggingInText.text = "Account created! Logging in to Oculus"; loggingInText.text = "Account created!";
loginDialog.loginThroughOculus(); loggingInText.x = loggingInHeader.width/2 - loggingInTextMetrics.width/2 + loggingInGlyphTextMetrics.width/2;
oculusSuccessTimer.start();
} }
} }
onHandleCreateFailed: { onHandleCreateFailed: {
console.log("Create Failed: " + error); console.log("Create Failed: " + error);
if (loggingInBody.withOculus) { if (loggingInBody.withOculus) {
if (loggingInBody.loginDialogPoppedUp) {
loginDialog.dismissLoginDialog();
var data = {
"action": "user created Oculus account unsuccessfully"
};
UserActivityLogger.logAction("encourageLoginDialog", data);
}
bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": loggingInBody.withSteam, bodyLoader.setSource("CompleteProfileBody.qml", { "loginDialog": loginDialog, "root": root, "bodyLoader": bodyLoader, "withSteam": loggingInBody.withSteam,
"withOculus": loggingInBody.withOculus, "errorString": error }); "withOculus": loggingInBody.withOculus, "errorString": error });
} }

View file

@ -480,15 +480,15 @@ Item {
if (errorString !== "") { if (errorString !== "") {
loginErrorMessage.visible = true; loginErrorMessage.visible = true;
var errorLength = errorString.split(/\r\n|\r|\n/).length;
var errorStringEdited = errorString.replace(/[\n\r]+/g, "\n"); var errorStringEdited = errorString.replace(/[\n\r]+/g, "\n");
loginErrorMessage.text = errorStringEdited; loginErrorMessage.text = errorStringEdited;
loginErrorMessageTextMetrics.text = errorString; if (errorLength > 1.0) {
if (loginErrorMessageTextMetrics.width > usernameField.width) {
loginErrorMessage.width = root.bannerWidth; loginErrorMessage.width = root.bannerWidth;
loginErrorMessage.wrapMode = Text.WordWrap; loginErrorMessage.wrapMode = Text.WordWrap;
loginErrorMessage.verticalAlignment = Text.AlignLeft; loginErrorMessage.verticalAlignment = Text.AlignLeft;
loginErrorMessage.horizontalAlignment = Text.AlignLeft; loginErrorMessage.horizontalAlignment = Text.AlignLeft;
errorContainer.height = (loginErrorMessageTextMetrics.width / usernameField.width) * loginErrorMessageTextMetrics.height; errorContainer.height = errorLength * loginErrorMessageTextMetrics.height;
} }
errorContainer.anchors.bottom = usernameField.top; errorContainer.anchors.bottom = usernameField.top;
errorContainer.anchors.bottomMargin = hifi.dimensions.contentSpacing.y; errorContainer.anchors.bottomMargin = hifi.dimensions.contentSpacing.y;