mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-01 06:55:58 +00:00
First working auth by QR code.
This commit is contained in:
@@ -93,6 +93,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "export/view/export_view_top_bar.h"
|
||||
#include "export/view/export_view_panel_controller.h"
|
||||
#include "main/main_session.h"
|
||||
#include "main/main_account.h"
|
||||
#include "support/support_helper.h"
|
||||
#include "storage/storage_facade.h"
|
||||
#include "storage/storage_shared_media.h"
|
||||
@@ -430,6 +431,16 @@ MainWidget::MainWidget(
|
||||
[this] { updateControlsGeometry(); },
|
||||
lifetime());
|
||||
|
||||
session().account().mtpUpdates(
|
||||
) | rpl::start_with_next([=](const MTPUpdates &updates) {
|
||||
mtpUpdateReceived(updates);
|
||||
}, lifetime());
|
||||
|
||||
session().account().mtpNewSessionCreated(
|
||||
) | rpl::start_with_next([=] {
|
||||
mtpNewSessionCreated();
|
||||
}, lifetime());
|
||||
|
||||
// MSVC BUG + REGRESSION rpl::mappers::tuple :(
|
||||
using namespace rpl::mappers;
|
||||
_controller->activeChatValue(
|
||||
@@ -3673,35 +3684,22 @@ void MainWidget::checkIdleFinish() {
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWidget::updateReceived(const mtpPrime *from, const mtpPrime *end) {
|
||||
if (end <= from) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainWidget::mtpNewSessionCreated() {
|
||||
session().checkAutoLock();
|
||||
updSeq = 0;
|
||||
MTP_LOG(0, ("getDifference { after new_session_created }%1"
|
||||
).arg(cTestMode() ? " TESTMODE" : ""));
|
||||
getDifference();
|
||||
}
|
||||
|
||||
if (mtpTypeId(*from) == mtpc_new_session_created) {
|
||||
MTPNewSession newSession;
|
||||
if (!newSession.read(from, end)) {
|
||||
return false;
|
||||
}
|
||||
updSeq = 0;
|
||||
MTP_LOG(0, ("getDifference { after new_session_created }%1").arg(cTestMode() ? " TESTMODE" : ""));
|
||||
getDifference();
|
||||
return true;
|
||||
}
|
||||
MTPUpdates updates;
|
||||
if (!updates.read(from, end)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainWidget::mtpUpdateReceived(const MTPUpdates &updates) {
|
||||
session().checkAutoLock();
|
||||
_lastUpdateTime = crl::now();
|
||||
_noUpdatesTimer.callOnce(kNoUpdatesTimeout);
|
||||
if (!requestingDifference()
|
||||
|| HasForceLogoutNotification(updates)) {
|
||||
feedUpdates(updates);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) {
|
||||
|
Reference in New Issue
Block a user