Finally the onboarding process seems to work properly
This commit is contained in:
parent
d55aa19a72
commit
48be585561
2 changed files with 31 additions and 22 deletions
|
@ -52,6 +52,7 @@ Page {
|
|||
break;
|
||||
case TelegramAPI.AuthorizationReady:
|
||||
initializationPage.loading = false;
|
||||
pageStack.completeAnimation();
|
||||
pageStack.pop();
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -28,10 +28,18 @@ Page {
|
|||
id: overviewPage
|
||||
allowedOrientations: Orientation.All
|
||||
|
||||
property bool initializationCompleted: false;
|
||||
property bool loading: true;
|
||||
property int authorizationState: TelegramAPI.Closed
|
||||
property int connectionState: TelegramAPI.WaitingForNetwork
|
||||
|
||||
onStatusChanged: {
|
||||
console.log("[OverviewPage] Status changed: " + status + ", initialization completed: " + initializationCompleted);
|
||||
if (status === PageStatus.Active && initializationCompleted) {
|
||||
updateContent();
|
||||
}
|
||||
}
|
||||
|
||||
BusyLabel {
|
||||
text: qsTr("Loading...")
|
||||
running: overviewPage.loading
|
||||
|
@ -64,23 +72,17 @@ Page {
|
|||
|
||||
function updateContent() {
|
||||
tdLibWrapper.getChats();
|
||||
|
||||
}
|
||||
|
||||
function initializePage() {
|
||||
overviewPage.authorizationState = tdLibWrapper.getAuthorizationState();
|
||||
if (overviewPage.authorizationState === TelegramAPI.AuthorizationReady) {
|
||||
overviewPage.loading = false;
|
||||
overviewPage.updateContent();
|
||||
}
|
||||
overviewPage.handleAuthorizationState();
|
||||
overviewPage.connectionState = tdLibWrapper.getConnectionState();
|
||||
overviewPage.setPageStatus();
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: tdLibWrapper
|
||||
onAuthorizationStateChanged: {
|
||||
switch (authorizationState) {
|
||||
function handleAuthorizationState() {
|
||||
switch (overviewPage.authorizationState) {
|
||||
case TelegramAPI.WaitPhoneNumber:
|
||||
overviewPage.loading = false;
|
||||
pageStack.push(Qt.resolvedUrl("../pages/InitializationPage.qml"));
|
||||
|
@ -91,18 +93,24 @@ Page {
|
|||
break;
|
||||
case TelegramAPI.AuthorizationReady:
|
||||
overviewPage.loading = false;
|
||||
overviewPage.initializationCompleted = true;
|
||||
overviewPage.updateContent();
|
||||
break;
|
||||
default:
|
||||
// Nothing ;)
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: tdLibWrapper
|
||||
onAuthorizationStateChanged: {
|
||||
overviewPage.authorizationState = authorizationState;
|
||||
handleAuthorizationState();
|
||||
}
|
||||
onConnectionStateChanged: {
|
||||
overviewPage.connectionState = connectionState;
|
||||
setPageStatus();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
|
Loading…
Reference in a new issue