mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-09 05:03:54 +00:00
Allowed dragging profile id as plain number.
This commit is contained in:
@@ -116,6 +116,7 @@ namespace Profile {
|
||||
namespace {
|
||||
|
||||
constexpr auto kDay = Data::WorkingInterval::kDay;
|
||||
constexpr auto kPeerIdLinkIndex = uint16(1);
|
||||
|
||||
class DraggableUrlClickHandler final : public UrlClickHandler {
|
||||
public:
|
||||
@@ -231,7 +232,7 @@ base::options::toggle ShowChannelJoinedBelowAbout({
|
||||
const auto raw = peer->id.value & PeerId::kChatTypeMask;
|
||||
value.append(Link(
|
||||
Italic(Lang::FormatCountDecimal(raw)),
|
||||
"internal:~peer_id~:copy:" + QString::number(raw)));
|
||||
kPeerIdLinkIndex));
|
||||
}
|
||||
if (ShowChannelJoinedBelowAbout.value()) {
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
@@ -261,6 +262,24 @@ base::options::toggle ShowChannelJoinedBelowAbout({
|
||||
});
|
||||
}
|
||||
|
||||
void SetupAboutPeerIdDrag(
|
||||
not_null<Ui::FlatLabel*> label,
|
||||
not_null<PeerData*> peer) {
|
||||
if (!ShowPeerIdBelowAbout.value()) {
|
||||
return;
|
||||
}
|
||||
const auto id = QString::number(peer->id.value & PeerId::kChatTypeMask);
|
||||
AboutValue(
|
||||
peer
|
||||
) | rpl::on_next([=] {
|
||||
label->setLink(
|
||||
kPeerIdLinkIndex,
|
||||
std::make_shared<DraggableUrlClickHandler>(
|
||||
u"internal:~peer_id~:copy:"_q + id,
|
||||
id));
|
||||
}, label->lifetime());
|
||||
}
|
||||
|
||||
[[nodiscard]] bool AreNonTrivialHours(const Data::WorkingHours &hours) {
|
||||
if (!hours) {
|
||||
return false;
|
||||
@@ -1634,9 +1653,11 @@ Section DetailsFiller::makeInfo() {
|
||||
auto label = user->isBot()
|
||||
? tr::lng_info_about_label()
|
||||
: tr::lng_info_bio_label();
|
||||
addTranslateToMenu(
|
||||
addInfoLine(std::move(label), AboutWithAdvancedValue(user)).text,
|
||||
const auto about = addInfoLine(
|
||||
std::move(label),
|
||||
AboutWithAdvancedValue(user));
|
||||
addTranslateToMenu(about.text, AboutWithAdvancedValue(user));
|
||||
SetupAboutPeerIdDrag(about.text, user);
|
||||
|
||||
const auto usernameLine = addInfoOneLine(
|
||||
UsernamesSubtext(_peer, tr::lng_info_username_label()),
|
||||
@@ -1801,6 +1822,7 @@ Section DetailsFiller::makeInfo() {
|
||||
: AboutWithAdvancedValue(_peer));
|
||||
if (!_topic) {
|
||||
addTranslateToMenu(about.text, AboutWithAdvancedValue(_peer));
|
||||
SetupAboutPeerIdDrag(about.text, _peer);
|
||||
}
|
||||
}
|
||||
raw->toggleOn(tracker.atLeastOneShownValue());
|
||||
|
||||
Reference in New Issue
Block a user