The onboarding UX doesn't like me...

This commit is contained in:
Sebastian J. Wolf 2020-08-17 23:44:37 +02:00
parent 666acdf1db
commit d55aa19a72
5 changed files with 34 additions and 45 deletions

View file

@ -24,12 +24,7 @@ ApplicationWindow
{ {
id: appWindow id: appWindow
Component { initialPage: Qt.resolvedUrl("pages/OverviewPage.qml")
id: overviewPage
OverviewPage {}
}
initialPage: overviewPage
cover: Qt.resolvedUrl("pages/CoverPage.qml") cover: Qt.resolvedUrl("pages/CoverPage.qml")
allowedOrientations: defaultAllowedOrientations allowedOrientations: defaultAllowedOrientations
} }

View file

@ -72,16 +72,12 @@ CoverBackground {
Connections { Connections {
target: tdLibWrapper target: tdLibWrapper
onUnreadMessageCountUpdated: { onUnreadMessageCountUpdated: {
if (messageCountInformation.chat_list_type === "chatListMain") { coverPage.unreadMessages = messageCountInformation.unread_count;
coverPage.unreadMessages = messageCountInformation.unread_count; setUnreadInfoText();
setUnreadInfoText();
}
} }
onUnreadChatCountUpdated: { onUnreadChatCountUpdated: {
if (chatCountInformation.chat_list_type === "chatListMain") { coverPage.unreadChats = chatCountInformation.unread_count;
coverPage.unreadChats = chatCountInformation.unread_count; setUnreadInfoText();
setUnreadInfoText();
}
} }
onAuthorizationStateChanged: { onAuthorizationStateChanged: {
coverPage.authenticated = (authorizationState === TelegramAPI.AuthorizationReady); coverPage.authenticated = (authorizationState === TelegramAPI.AuthorizationReady);
@ -137,7 +133,7 @@ CoverBackground {
Row { Row {
width: parent.width width: parent.width
spacing: Theme.paddingMedium spacing: Theme.paddingMedium
visible: coverPage.authenticated && coverPage.unreadChats > 0 visible: coverPage.authenticated && coverPage.unreadMessages > 1
Text { Text {
id: inText id: inText
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall

View file

@ -23,6 +23,7 @@ import WerkWolf.Fernschreiber 1.0
Page { Page {
id: initializationPage id: initializationPage
allowedOrientations: Orientation.All allowedOrientations: Orientation.All
backNavigation: false
property bool loading: true property bool loading: true
property int authorizationState: TelegramAPI.Closed property int authorizationState: TelegramAPI.Closed
@ -50,9 +51,8 @@ Page {
enterPinColumn.visible = true; enterPinColumn.visible = true;
break; break;
case TelegramAPI.AuthorizationReady: case TelegramAPI.AuthorizationReady:
overviewPage.loading = false; initializationPage.loading = false;
pageStack.clear(); pageStack.pop();
pageStack.push(Qt.resolvedUrl("../pages/OverviewPage.qml"));
break; break;
default: default:
// Nothing ;) // Nothing ;)
@ -206,15 +206,15 @@ Page {
SilicaFlickable { SilicaFlickable {
id: welcomeFlickable id: welcomeFlickable
anchors.fill: parent
contentHeight: welcomeColumn.height contentHeight: welcomeColumn.height
Behavior on opacity { NumberAnimation {} } Behavior on opacity { NumberAnimation {} }
anchors.fill: parent
opacity: visible ? 1 : 0 opacity: visible ? 1 : 0
Column { Column {
id: welcomeColumn id: welcomeColumn
width: parent.width width: parent.width
spacing: Theme.paddingLarge spacing: Theme.paddingSmall
PageHeader { PageHeader {
title: qsTr("Welcome to Fernschreiber!") title: qsTr("Welcome to Fernschreiber!")
@ -232,6 +232,7 @@ Page {
} }
Label { Label {
id: enterPhoneNumberLabel
wrapMode: Text.Wrap wrapMode: Text.Wrap
x: Theme.horizontalPageMargin x: Theme.horizontalPageMargin
width: parent.width - ( 2 * Theme.horizontalPageMargin ) width: parent.width - ( 2 * Theme.horizontalPageMargin )
@ -252,6 +253,7 @@ Page {
} }
Button { Button {
id: continueWithPhoneNumberButton
text: qsTr("Continue") text: qsTr("Continue")
anchors { anchors {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
@ -264,18 +266,8 @@ Page {
} }
} }
Label {
id: separatorLabelPhoneNumber
x: Theme.horizontalPageMargin
width: parent.width - ( 2 * Theme.horizontalPageMargin )
font.pixelSize: Theme.fontSizeExtraSmall
anchors {
horizontalCenter: parent.horizontalCenter
}
}
} }
} }
} }

View file

@ -64,6 +64,17 @@ Page {
function updateContent() { function updateContent() {
tdLibWrapper.getChats(); tdLibWrapper.getChats();
}
function initializePage() {
overviewPage.authorizationState = tdLibWrapper.getAuthorizationState();
if (overviewPage.authorizationState === TelegramAPI.AuthorizationReady) {
overviewPage.loading = false;
overviewPage.updateContent();
}
overviewPage.connectionState = tdLibWrapper.getConnectionState();
overviewPage.setPageStatus();
} }
Connections { Connections {
@ -72,12 +83,10 @@ Page {
switch (authorizationState) { switch (authorizationState) {
case TelegramAPI.WaitPhoneNumber: case TelegramAPI.WaitPhoneNumber:
overviewPage.loading = false; overviewPage.loading = false;
pageStack.clear();
pageStack.push(Qt.resolvedUrl("../pages/InitializationPage.qml")); pageStack.push(Qt.resolvedUrl("../pages/InitializationPage.qml"));
break; break;
case TelegramAPI.WaitCode: case TelegramAPI.WaitCode:
overviewPage.loading = false; overviewPage.loading = false;
pageStack.clear();
pageStack.push(Qt.resolvedUrl("../pages/InitializationPage.qml")); pageStack.push(Qt.resolvedUrl("../pages/InitializationPage.qml"));
break; break;
case TelegramAPI.AuthorizationReady: case TelegramAPI.AuthorizationReady:
@ -97,14 +106,7 @@ Page {
} }
Component.onCompleted: { Component.onCompleted: {
overviewPage.authorizationState = tdLibWrapper.getAuthorizationState(); initializePage();
if (overviewPage.authorizationState === TelegramAPI.AuthorizationReady) {
overviewPage.loading = false;
overviewPage.updateContent();
}
overviewPage.connectionState = tdLibWrapper.getConnectionState();
overviewPage.setPageStatus();
} }
SilicaFlickable { SilicaFlickable {

View file

@ -259,14 +259,18 @@ void TDLibWrapper::handleNewChatDiscovered(const QVariantMap &chatInformation)
void TDLibWrapper::handleUnreadMessageCountUpdated(const QVariantMap &messageCountInformation) void TDLibWrapper::handleUnreadMessageCountUpdated(const QVariantMap &messageCountInformation)
{ {
this->unreadMessageInformation = messageCountInformation; if (messageCountInformation.value("chat_list_type").toString() == "chatListMain") {
emit unreadMessageCountUpdated(messageCountInformation); this->unreadMessageInformation = messageCountInformation;
emit unreadMessageCountUpdated(messageCountInformation);
}
} }
void TDLibWrapper::handleUnreadChatCountUpdated(const QVariantMap &chatCountInformation) void TDLibWrapper::handleUnreadChatCountUpdated(const QVariantMap &chatCountInformation)
{ {
this->unreadChatInformation = chatCountInformation; if (chatCountInformation.value("chat_list_type").toString() == "chatListMain") {
emit unreadChatCountUpdated(chatCountInformation); this->unreadChatInformation = chatCountInformation;
emit unreadChatCountUpdated(chatCountInformation);
}
} }
void TDLibWrapper::setInitialParameters() void TDLibWrapper::setInitialParameters()