Skip to content

Commit

Permalink
wip Edit peer colors.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Nov 13, 2023
1 parent 631649d commit c1b1723
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ PreviewWrap::PreviewWrap(
? tr::lng_settings_color_reply(tr::now)
: tr::lng_settings_color_reply_channel(tr::now),
},
#if 0 // mtp
MTP_messageMediaEmpty(),
#endif
HistoryMessageMarkupData(),
uint64(0)))
, _replyItem(_history->addNewLocalMessage(
Expand All @@ -316,19 +318,29 @@ PreviewWrap::PreviewWrap(
? tr::lng_settings_color_text(tr::now)
: tr::lng_settings_color_text_channel(tr::now),
},
#if 0 // mtp
MTP_messageMediaWebPage(
MTP_flags(0),
MTP_webPagePending(
MTP_flags(0),
MTP_long(_webpage->id),
MTPstring(),
MTP_int(0))),
#endif
HistoryMessageMarkupData(),
uint64(0)))
#if 0 // mtp
, _element(_replyItem->createView(_delegate.get()))
#endif
, _position(0, st::msgMargin.bottom()) {
_style->apply(_theme.get());

_replyItem->setMediaExplicit(std::make_unique<Data::MediaWebPage>(
_replyItem.get(),
_webpage.get(),
MediaWebPageFlag::Manual));
_element = _replyItem->createView(_delegate.get());

_fake->setName(peer->name(), QString());
std::move(colorIndexValue) | rpl::start_with_next([=](uint8 index) {
_fake->changeColorIndex(index);
Expand Down Expand Up @@ -449,6 +461,7 @@ void Set(
? tr::lng_settings_color_changed(tr::now)
: tr::lng_settings_color_changed_channel(tr::now));
};
#if 0 // todo
const auto fail = [=](const MTP::Error &error) {
setLocal(wasIndex, wasEmojiId);
show->showToast(error.type());
Expand All @@ -474,6 +487,7 @@ void Set(
} else {
Unexpected("Invalid peer type in Set(colorIndex).");
}
#endif
}

void Apply(
Expand Down Expand Up @@ -503,6 +517,7 @@ void Apply(
Set(show, peer, colorIndex, backgroundEmojiId);
close();
} else {
#if 0 // todo
session->api().request(MTPpremium_GetBoostsStatus(
peer->input
)).done([=](const MTPpremium_BoostsStatus &result) {
Expand Down Expand Up @@ -533,6 +548,7 @@ void Apply(
show->showToast(error.type());
cancel();
}).send();
#endif
}
}

Expand Down
5 changes: 5 additions & 0 deletions Telegram/SourceFiles/history/history_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4572,6 +4572,11 @@ void HistoryItem::setMedia(const TLmessageContent &content) {
checkBuyButton();
}

void HistoryItem::setMediaExplicit(std::unique_ptr<Data::Media> media) {
_media = std::move(media);
checkBuyButton();
}

void HistoryItem::setContent(const TLmessageContent &content) {
_flags &= ~(MessageFlag::IsGroupEssential)
& ~(MessageFlag::IsContactSignUp);
Expand Down
1 change: 1 addition & 0 deletions Telegram/SourceFiles/history/history_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ class HistoryItem final : public RuntimeComposer<HistoryItem> {
void customEmojiRepaint();

void updateContent(const Tdb::TLmessageContent &content);
void setMediaExplicit(std::unique_ptr<Data::Media> media);
void updateInteractionInfo(const Tdb::TLmessageInteractionInfo *info);
void updateEditedInfo(
TimeId editDate,
Expand Down

0 comments on commit c1b1723

Please sign in to comment.