From 5f2247a2c0db622dd472d2c8beca1b2b3ada3eed Mon Sep 17 00:00:00 2001 From: Flohack74 Date: Fri, 1 Sep 2017 00:14:34 +0200 Subject: [PATCH] - Fixing login problem: Code could not be entered if login process was interrupted by app restart - Adding contacts to content hub, trying to send vcards --- telegram/app/content-hub.json | 3 +- telegram/app/qml/telegram.qml | 63 ++++++++++++++++++----------------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/telegram/app/content-hub.json b/telegram/app/content-hub.json index 6dd2d6cd..d7eeb168 100644 --- a/telegram/app/content-hub.json +++ b/telegram/app/content-hub.json @@ -3,6 +3,7 @@ "pictures", "videos", "links", - "text" + "text", + "contacts" ] } diff --git a/telegram/app/qml/telegram.qml b/telegram/app/qml/telegram.qml index 6dbbb5b7..7827cce4 100644 --- a/telegram/app/qml/telegram.qml +++ b/telegram/app/qml/telegram.qml @@ -62,7 +62,7 @@ MainView { signal pushRegister(string token, string version) signal pushUnregister(string token) signal resumed() - + onActiveFocusChanged: { if (activeFocus) { mainView.resumed() @@ -233,6 +233,15 @@ MainView { pushClient.clearPersistent([]); } } + + onAuthPasswordNeeded: { + pageStack.setPrimaryPage(); + pageStack.addPageToCurrentColumn(pageStack.primaryPage, authPasswordPage); + } + + Component.onCompleted: { + account_list.codeRequested.connect(pageStack.pushAuthCodePage) + } } AdaptivePageLayout { @@ -275,6 +284,27 @@ MainView { pageStack.removePages(pageStack.primaryPage); } + function pushAuthCodePage(authCodePage, telegram, phoneRegistered, sendCallTimeout, resent) { + console.log("Number of profiles: " + profiles.count); + + if (profiles.count === 1) { + pageStack.setPrimaryPage(); + pageStack.addPageToCurrentColumn(pageStack.primaryPage, authCodePage, { + "phoneRegistered": telegram.authPhoneRegistered, + "timeOut": sendCallTimeout + }); + } + + // Only add the authCodePage if the code has not been resent. If the code has + // been resent then authCodePage is already on the stack + else if (!resent){ + pageStack.addPageToCurrentColumn(auth_number_page, authCodePage, { + "phoneRegistered": telegram.authPhoneRegistered, + "timeOut": sendCallTimeout + }); + } + } + IntroPage { id: introPage onStartMessaging: { @@ -315,36 +345,7 @@ MainView { Connections { target: account_list - onCodeRequested: { - auth_number_page.isBusy = false; - console.log("Number of profiles: " + profiles.count); - - if (profiles.count === 1) { - pageStack.setPrimaryPage(); - pageStack.addPageToCurrentColumn(pageStack.primaryPage, authCodePage, { - "phoneRegistered": telegram.authPhoneRegistered, - "timeOut": sendCallTimeout - }); - } - - // Only add the authCodePage if the code has not been resent. If the code has - // been resent then authCodePage is already on the stack - else if (!resent){ - pageStack.addPageToCurrentColumn(auth_number_page, authCodePage, { - "phoneRegistered": telegram.authPhoneRegistered, - "timeOut": sendCallTimeout - }); - } - -// else { -// authCodePage.timeOut = sendCallTimeout; -// authCodePage.phoneRegistered = telegram.authPhoneRegistered -// } - } - onAuthPasswordNeeded: { - pageStack.setPrimaryPage(); - pageStack.addPageToCurrentColumn(pageStack.primaryPage, authPasswordPage); - } + onCodeRequested: auth_number_page.isBusy = false } } }