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
Component {
id: overviewPage
OverviewPage {}
}
initialPage: overviewPage
initialPage: Qt.resolvedUrl("pages/OverviewPage.qml")
cover: Qt.resolvedUrl("pages/CoverPage.qml")
allowedOrientations: defaultAllowedOrientations
}

View file

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

View file

@ -23,6 +23,7 @@ import WerkWolf.Fernschreiber 1.0
Page {
id: initializationPage
allowedOrientations: Orientation.All
backNavigation: false
property bool loading: true
property int authorizationState: TelegramAPI.Closed
@ -50,9 +51,8 @@ Page {
enterPinColumn.visible = true;
break;
case TelegramAPI.AuthorizationReady:
overviewPage.loading = false;
pageStack.clear();
pageStack.push(Qt.resolvedUrl("../pages/OverviewPage.qml"));
initializationPage.loading = false;
pageStack.pop();
break;
default:
// Nothing ;)
@ -206,15 +206,15 @@ Page {
SilicaFlickable {
id: welcomeFlickable
anchors.fill: parent
contentHeight: welcomeColumn.height
Behavior on opacity { NumberAnimation {} }
anchors.fill: parent
opacity: visible ? 1 : 0
Column {
id: welcomeColumn
width: parent.width
spacing: Theme.paddingLarge
spacing: Theme.paddingSmall
PageHeader {
title: qsTr("Welcome to Fernschreiber!")
@ -232,6 +232,7 @@ Page {
}
Label {
id: enterPhoneNumberLabel
wrapMode: Text.Wrap
x: Theme.horizontalPageMargin
width: parent.width - ( 2 * Theme.horizontalPageMargin )
@ -252,6 +253,7 @@ Page {
}
Button {
id: continueWithPhoneNumberButton
text: qsTr("Continue")
anchors {
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() {
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 {
@ -72,12 +83,10 @@ Page {
switch (authorizationState) {
case TelegramAPI.WaitPhoneNumber:
overviewPage.loading = false;
pageStack.clear();
pageStack.push(Qt.resolvedUrl("../pages/InitializationPage.qml"));
break;
case TelegramAPI.WaitCode:
overviewPage.loading = false;
pageStack.clear();
pageStack.push(Qt.resolvedUrl("../pages/InitializationPage.qml"));
break;
case TelegramAPI.AuthorizationReady:
@ -97,14 +106,7 @@ Page {
}
Component.onCompleted: {
overviewPage.authorizationState = tdLibWrapper.getAuthorizationState();
if (overviewPage.authorizationState === TelegramAPI.AuthorizationReady) {
overviewPage.loading = false;
overviewPage.updateContent();
}
overviewPage.connectionState = tdLibWrapper.getConnectionState();
overviewPage.setPageStatus();
initializePage();
}
SilicaFlickable {

View file

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