mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-22 10:17:10 +00:00
Fix phone/card click handler generation.
This commit is contained in:
parent
7006a07dd3
commit
735bbef655
@ -254,11 +254,11 @@ std::shared_ptr<ClickHandler> UiIntegration::createLinkHandler(
|
|||||||
case EntityType::Pre:
|
case EntityType::Pre:
|
||||||
return std::make_shared<MonospaceClickHandler>(data.text, data.type);
|
return std::make_shared<MonospaceClickHandler>(data.text, data.type);
|
||||||
case EntityType::Phone:
|
case EntityType::Phone:
|
||||||
return my->session
|
return (my && my->session)
|
||||||
? std::make_shared<PhoneClickHandler>(my->session, data.text)
|
? std::make_shared<PhoneClickHandler>(my->session, data.text)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
case EntityType::BankCard:
|
case EntityType::BankCard:
|
||||||
return my->session
|
return (my && my->session)
|
||||||
? std::make_shared<BankCardClickHandler>(my->session, data.text)
|
? std::make_shared<BankCardClickHandler>(my->session, data.text)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
@ -601,6 +601,7 @@ void MonoforumSenderBar::Paint(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ServicePreMessage::init(
|
void ServicePreMessage::init(
|
||||||
|
not_null<Element*> view,
|
||||||
PreparedServiceText string,
|
PreparedServiceText string,
|
||||||
ClickHandlerPtr fullClickHandler,
|
ClickHandlerPtr fullClickHandler,
|
||||||
std::unique_ptr<Media> media) {
|
std::unique_ptr<Media> media) {
|
||||||
@ -608,7 +609,11 @@ void ServicePreMessage::init(
|
|||||||
st::serviceTextStyle,
|
st::serviceTextStyle,
|
||||||
string.text,
|
string.text,
|
||||||
kMarkupTextOptions,
|
kMarkupTextOptions,
|
||||||
st::msgMinWidth);
|
st::msgMinWidth,
|
||||||
|
Core::TextContext({
|
||||||
|
.session = &view->history()->session(),
|
||||||
|
.repaint = [=] { view->customEmojiRepaint(); },
|
||||||
|
}));
|
||||||
handler = std::move(fullClickHandler);
|
handler = std::move(fullClickHandler);
|
||||||
for (auto i = 0; i != int(string.links.size()); ++i) {
|
for (auto i = 0; i != int(string.links.size()); ++i) {
|
||||||
text.setLink(i + 1, string.links[i]);
|
text.setLink(i + 1, string.links[i]);
|
||||||
@ -1675,6 +1680,7 @@ void Element::setServicePreMessage(
|
|||||||
AddComponents(ServicePreMessage::Bit());
|
AddComponents(ServicePreMessage::Bit());
|
||||||
const auto service = Get<ServicePreMessage>();
|
const auto service = Get<ServicePreMessage>();
|
||||||
service->init(
|
service->init(
|
||||||
|
this,
|
||||||
std::move(text),
|
std::move(text),
|
||||||
std::move(fullClickHandler),
|
std::move(fullClickHandler),
|
||||||
std::move(media));
|
std::move(media));
|
||||||
|
@ -310,6 +310,7 @@ private:
|
|||||||
// displaying some text in layout of a service message above the message.
|
// displaying some text in layout of a service message above the message.
|
||||||
struct ServicePreMessage : RuntimeComponent<ServicePreMessage, Element> {
|
struct ServicePreMessage : RuntimeComponent<ServicePreMessage, Element> {
|
||||||
void init(
|
void init(
|
||||||
|
not_null<Element*> view,
|
||||||
PreparedServiceText string,
|
PreparedServiceText string,
|
||||||
ClickHandlerPtr fullClickHandler,
|
ClickHandlerPtr fullClickHandler,
|
||||||
std::unique_ptr<Media> media = nullptr);
|
std::unique_ptr<Media> media = nullptr);
|
||||||
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
|
#include "history/history_item_components.h"
|
||||||
#include "history/view/history_view_message.h"
|
#include "history/view/history_view_message.h"
|
||||||
#include "history/view/history_view_cursor_state.h"
|
#include "history/view/history_view_cursor_state.h"
|
||||||
#include "calls/calls_instance.h"
|
#include "calls/calls_instance.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user