mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
fix: revert share link box & copy as username
This commit is contained in:
parent
9dbc9e59e5
commit
6f754bef8c
3 changed files with 19 additions and 11 deletions
|
@ -136,13 +136,10 @@ void AddMessageDetailsAction(not_null<Ui::PopupMenu*> menu, HistoryItem *item) {
|
||||||
const auto messageDate = base::unixtime::parse(item->date());
|
const auto messageDate = base::unixtime::parse(item->date());
|
||||||
const auto messageEditDate = base::unixtime::parse(view ? view->displayedEditDate() : TimeId(0));
|
const auto messageEditDate = base::unixtime::parse(view ? view->displayedEditDate() : TimeId(0));
|
||||||
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma ide diagnostic ignored "NullDereference"
|
|
||||||
const auto messageForwardedDate =
|
const auto messageForwardedDate =
|
||||||
isForwarded
|
isForwarded && forwarded
|
||||||
? base::unixtime::parse(forwarded->originalDate)
|
? base::unixtime::parse(forwarded->originalDate)
|
||||||
: QDateTime();
|
: QDateTime();
|
||||||
#pragma clang diagnostic pop
|
|
||||||
|
|
||||||
const auto
|
const auto
|
||||||
messageViews = item->hasViews() && item->viewsCount() > 0 ? QString::number(item->viewsCount()) : QString();
|
messageViews = item->hasViews() && item->viewsCount() > 0 ? QString::number(item->viewsCount()) : QString();
|
||||||
|
|
|
@ -146,8 +146,17 @@ base::options::toggle ShowPeerIdBelowAbout({
|
||||||
+ addToLink;
|
+ addToLink;
|
||||||
}
|
}
|
||||||
if (!link.isEmpty()) {
|
if (!link.isEmpty()) {
|
||||||
if (const auto strong = weak.get()) {
|
if (addToLink.isEmpty()) {
|
||||||
FastShareLink(strong, link);
|
link = '@' + link.replace("https://t.me/", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
QGuiApplication::clipboard()->setText(link);
|
||||||
|
|
||||||
|
const auto isLink = link.startsWith(u"https://t.me/"_q);
|
||||||
|
if (const auto window = weak.get()) {
|
||||||
|
window->showToast(isLink
|
||||||
|
? tr::lng_username_copied(tr::now) // "Link copied to clipboard."
|
||||||
|
: tr::lng_text_copied(tr::now)); // "Text copied to clipboard."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -188,11 +188,13 @@ void CollectibleInfoBox(
|
||||||
Ui::Text::Link(formatted),
|
Ui::Text::Link(formatted),
|
||||||
Ui::Text::WithEntities);
|
Ui::Text::WithEntities);
|
||||||
const auto copyCallback = [box, type, formatted, text = info.copyText] {
|
const auto copyCallback = [box, type, formatted, text = info.copyText] {
|
||||||
QGuiApplication::clipboard()->setText(
|
auto toCopy = text.isEmpty() ? formatted : text;
|
||||||
text.isEmpty() ? formatted : text);
|
if (type == CollectibleType::Username) {
|
||||||
box->uiShow()->showToast((type == CollectibleType::Phone)
|
toCopy = "@" + toCopy.replace("https://t.me/", "");
|
||||||
? tr::lng_text_copied(tr::now)
|
}
|
||||||
: tr::lng_username_copied(tr::now));
|
|
||||||
|
QGuiApplication::clipboard()->setText(toCopy);
|
||||||
|
box->uiShow()->showToast(tr::lng_text_copied(tr::now));
|
||||||
};
|
};
|
||||||
box->addRow(
|
box->addRow(
|
||||||
object_ptr<Ui::FlatLabel>(
|
object_ptr<Ui::FlatLabel>(
|
||||||
|
|
Loading…
Add table
Reference in a new issue