mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 05:07:10 +02:00
feat: search by ID on click
Works only if number is recognized as phone by Telegram servers
This commit is contained in:
parent
2804cc2d1e
commit
efce0f2309
1 changed files with 19 additions and 2 deletions
|
@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "lang/lang_keys.h"
|
||||
#include "main/main_session.h"
|
||||
#include "mainwidget.h"
|
||||
#include "ayu/utils/telegram_helpers.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/painter.h"
|
||||
|
@ -118,8 +119,24 @@ ResolvePhoneAction::ResolvePhoneAction(
|
|||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.code() == 400) {
|
||||
_peer.force_assign(nullptr);
|
||||
_loaded.force_assign(true);
|
||||
bool ok = false;
|
||||
const auto possibleId = formattedPhone.toLongLong(&ok);
|
||||
if (!ok) {
|
||||
_peer.force_assign(nullptr);
|
||||
_loaded.force_assign(true);
|
||||
return;
|
||||
}
|
||||
|
||||
searchById(possibleId,
|
||||
&controller->session(),
|
||||
[=](const QString &username, UserData *user)
|
||||
{
|
||||
if (user) {
|
||||
_peer = user;
|
||||
}
|
||||
|
||||
_loaded.force_assign(true);
|
||||
});
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue