Merge remote-tracking branch 'origin/master' into new-chat-from-contacts-7

This commit is contained in:
Sebastian Wolf 2020-11-27 19:51:56 +01:00
commit 4bcd4faca9
3 changed files with 19 additions and 6 deletions

View file

@ -68,6 +68,14 @@ Page {
} }
} }
Timer {
id: openInitializationPageTimer
interval: 0
onTriggered: {
pageStack.push(Qt.resolvedUrl("../pages/InitializationPage.qml"));
}
}
function setPageStatus() { function setPageStatus() {
switch (overviewPage.connectionState) { switch (overviewPage.connectionState) {
case TelegramAPI.WaitingForNetwork: case TelegramAPI.WaitingForNetwork:
@ -102,19 +110,23 @@ Page {
function initializePage() { function initializePage() {
overviewPage.authorizationState = tdLibWrapper.getAuthorizationState(); overviewPage.authorizationState = tdLibWrapper.getAuthorizationState();
overviewPage.handleAuthorizationState(); overviewPage.handleAuthorizationState(true);
overviewPage.connectionState = tdLibWrapper.getConnectionState(); overviewPage.connectionState = tdLibWrapper.getConnectionState();
overviewPage.setPageStatus(); overviewPage.setPageStatus();
} }
function handleAuthorizationState() { function handleAuthorizationState(isOnInitialization) {
switch (overviewPage.authorizationState) { switch (overviewPage.authorizationState) {
case TelegramAPI.WaitPhoneNumber: case TelegramAPI.WaitPhoneNumber:
case TelegramAPI.WaitCode: case TelegramAPI.WaitCode:
case TelegramAPI.WaitPassword: case TelegramAPI.WaitPassword:
case TelegramAPI.WaitRegistration: case TelegramAPI.WaitRegistration:
overviewPage.loading = false; overviewPage.loading = false;
pageStack.push(Qt.resolvedUrl("../pages/InitializationPage.qml")); if(isOnInitialization) { // pageStack isn't ready on Component.onCompleted
openInitializationPageTimer.start()
} else {
pageStack.push(Qt.resolvedUrl("../pages/InitializationPage.qml"));
}
break; break;
case TelegramAPI.AuthorizationReady: case TelegramAPI.AuthorizationReady:
overviewPage.loading = false; overviewPage.loading = false;

View file

@ -51,6 +51,7 @@ TDLibWrapper::TDLibWrapper(AppSettings *appSettings, MceInterface *mceInterface,
this->appSettings = appSettings; this->appSettings = appSettings;
this->mceInterface = mceInterface; this->mceInterface = mceInterface;
this->tdLibClient = td_json_client_create(); this->tdLibClient = td_json_client_create();
this->authorizationState = AuthorizationState::Closed;
this->tdLibReceiver = new TDLibReceiver(this->tdLibClient, this); this->tdLibReceiver = new TDLibReceiver(this->tdLibClient, this);
QString tdLibDatabaseDirectoryPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/tdlib"; QString tdLibDatabaseDirectoryPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/tdlib";

View file

@ -1252,15 +1252,15 @@
</message> </message>
<message> <message>
<source>Notification turns on the display</source> <source>Notification turns on the display</source>
<translation type="unfinished"></translation> <translation>Habilitar pantalla en notificaciones</translation>
</message> </message>
<message> <message>
<source>Storage</source> <source>Storage</source>
<translation type="unfinished"></translation> <translation>Almacenamiento</translation>
</message> </message>
<message> <message>
<source>Enable storage optimizer</source> <source>Enable storage optimizer</source>
<translation type="unfinished"></translation> <translation>Habilitar optimizador de almacenamiento</translation>
</message> </message>
</context> </context>
<context> <context>