mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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 "lang/lang_keys.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
|
#include "ayu/utils/telegram_helpers.h"
|
||||||
#include "mtproto/sender.h"
|
#include "mtproto/sender.h"
|
||||||
#include "ui/effects/ripple_animation.h"
|
#include "ui/effects/ripple_animation.h"
|
||||||
#include "ui/painter.h"
|
#include "ui/painter.h"
|
||||||
|
@ -118,8 +119,24 @@ ResolvePhoneAction::ResolvePhoneAction(
|
||||||
});
|
});
|
||||||
}).fail([=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
if (error.code() == 400) {
|
if (error.code() == 400) {
|
||||||
_peer.force_assign(nullptr);
|
bool ok = false;
|
||||||
_loaded.force_assign(true);
|
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();
|
}).send();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue