mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 07:07:08 +02:00
Removed unused code of hidden sender userpics for sponsored messages.
This commit is contained in:
parent
fc86bb7a5f
commit
3f19dc0486
6 changed files with 1 additions and 115 deletions
Telegram/SourceFiles
|
@ -326,13 +326,6 @@ void PaintRow(
|
|||
context.st->padding.top(),
|
||||
context.width,
|
||||
context.st->photoSize);
|
||||
} else if (!from && hiddenSenderInfo) {
|
||||
hiddenSenderInfo->emptyUserpic.paintCircle(
|
||||
p,
|
||||
context.st->padding.left(),
|
||||
context.st->padding.top(),
|
||||
context.width,
|
||||
context.st->photoSize);
|
||||
} else if (!(flags & Flag::AllowUserOnline)) {
|
||||
PaintUserpic(
|
||||
p,
|
||||
|
|
|
@ -1273,27 +1273,6 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
|
|||
width(),
|
||||
st::msgPhotoSize,
|
||||
context.paused);
|
||||
} else if (const auto info = item->hiddenSenderInfo()) {
|
||||
if (info->customUserpic.empty()) {
|
||||
info->emptyUserpic.paintCircle(
|
||||
p,
|
||||
st::historyPhotoLeft,
|
||||
userpicTop,
|
||||
width(),
|
||||
st::msgPhotoSize);
|
||||
} else {
|
||||
auto &userpic = _hiddenSenderUserpics[item->id];
|
||||
const auto valid = info->paintCustomUserpic(
|
||||
p,
|
||||
userpic,
|
||||
st::historyPhotoLeft,
|
||||
userpicTop,
|
||||
width(),
|
||||
st::msgPhotoSize);
|
||||
if (!valid) {
|
||||
info->customUserpic.load(&session(), item->fullId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Unexpected("Corrupt forwarded information in message.");
|
||||
}
|
||||
|
|
|
@ -116,12 +116,7 @@ HiddenSenderInfo::HiddenSenderInfo(
|
|||
std::optional<uint8> colorIndex)
|
||||
: name(name)
|
||||
, colorIndex(colorIndex.value_or(
|
||||
Data::DecideColorIndex(Data::FakePeerIdForJustName(name))))
|
||||
, emptyUserpic(
|
||||
Ui::EmptyUserpic::UserpicColor(this->colorIndex),
|
||||
(external
|
||||
? Ui::EmptyUserpic::ExternalName()
|
||||
: name)) {
|
||||
Data::DecideColorIndex(Data::FakePeerIdForJustName(name)))) {
|
||||
Expects(!name.isEmpty());
|
||||
|
||||
const auto parts = name.trimmed().split(' ', Qt::SkipEmptyParts);
|
||||
|
@ -153,35 +148,6 @@ ClickHandlerPtr HiddenSenderInfo::ForwardClickHandler() {
|
|||
return hidden;
|
||||
}
|
||||
|
||||
bool HiddenSenderInfo::paintCustomUserpic(
|
||||
Painter &p,
|
||||
Ui::PeerUserpicView &view,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
int size) const {
|
||||
Expects(!customUserpic.empty());
|
||||
|
||||
auto valid = true;
|
||||
if (!customUserpic.isCurrentView(view.cloud)) {
|
||||
view.cloud = customUserpic.createView();
|
||||
valid = false;
|
||||
}
|
||||
const auto image = *view.cloud;
|
||||
if (image.isNull()) {
|
||||
emptyUserpic.paintCircle(p, x, y, outerWidth, size);
|
||||
return valid;
|
||||
}
|
||||
Ui::ValidateUserpicCache(
|
||||
view,
|
||||
image.isNull() ? nullptr : &image,
|
||||
image.isNull() ? &emptyUserpic : nullptr,
|
||||
size * style::DevicePixelRatio(),
|
||||
false);
|
||||
p.drawImage(QRect(x, y, size, size), view.cached);
|
||||
return valid;
|
||||
}
|
||||
|
||||
void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
|
||||
auto phrase = TextWithEntities();
|
||||
const auto fromChannel = originalSender
|
||||
|
|
|
@ -97,19 +97,10 @@ public:
|
|||
QString firstName;
|
||||
QString lastName;
|
||||
uint8 colorIndex = 0;
|
||||
Ui::EmptyUserpic emptyUserpic;
|
||||
mutable Data::CloudImage customUserpic;
|
||||
|
||||
[[nodiscard]] static ClickHandlerPtr ForwardClickHandler();
|
||||
|
||||
[[nodiscard]] const Ui::Text::String &nameText() const;
|
||||
[[nodiscard]] bool paintCustomUserpic(
|
||||
Painter &p,
|
||||
Ui::PeerUserpicView &view,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
int size) const;
|
||||
|
||||
inline bool operator==(const HiddenSenderInfo &other) const {
|
||||
return name == other.name;
|
||||
|
|
|
@ -376,28 +376,6 @@ void PreviewWrap::paintEvent(QPaintEvent *e) {
|
|||
userpicTop,
|
||||
width(),
|
||||
st::msgPhotoSize);
|
||||
} else if (const auto info = item->hiddenSenderInfo()) {
|
||||
if (info->customUserpic.empty()) {
|
||||
info->emptyUserpic.paintCircle(
|
||||
p,
|
||||
st::historyPhotoLeft,
|
||||
userpicTop,
|
||||
width(),
|
||||
st::msgPhotoSize);
|
||||
} else {
|
||||
const auto valid = info->paintCustomUserpic(
|
||||
p,
|
||||
_userpic,
|
||||
st::historyPhotoLeft,
|
||||
userpicTop,
|
||||
width(),
|
||||
st::msgPhotoSize);
|
||||
if (!valid) {
|
||||
info->customUserpic.load(
|
||||
&item->history()->session(),
|
||||
item->fullId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Unexpected("Corrupt forwarded information in message.");
|
||||
}
|
||||
|
|
|
@ -2181,27 +2181,6 @@ void ListWidget::paintEvent(QPaintEvent *e) {
|
|||
userpicTop,
|
||||
view->width(),
|
||||
st::msgPhotoSize);
|
||||
} else if (const auto info = item->hiddenSenderInfo()) {
|
||||
if (info->customUserpic.empty()) {
|
||||
info->emptyUserpic.paintCircle(
|
||||
p,
|
||||
st::historyPhotoLeft,
|
||||
userpicTop,
|
||||
view->width(),
|
||||
st::msgPhotoSize);
|
||||
} else {
|
||||
auto &userpic = _hiddenSenderUserpics[item->id];
|
||||
const auto valid = info->paintCustomUserpic(
|
||||
p,
|
||||
userpic,
|
||||
st::historyPhotoLeft,
|
||||
userpicTop,
|
||||
view->width(),
|
||||
st::msgPhotoSize);
|
||||
if (!valid) {
|
||||
info->customUserpic.load(session, item->fullId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Unexpected("Corrupt forwarded information in message.");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue