mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 22:27:20 +02:00
Use title/description from paymentReceipt.
This commit is contained in:
parent
f09a468a7c
commit
2e58993181
4 changed files with 34 additions and 7 deletions
|
@ -768,9 +768,9 @@ HistoryService::PreparedText HistoryService::preparePaymentSentText() {
|
|||
return textcmdLink(1, invoice->title);
|
||||
}
|
||||
}
|
||||
return tr::lng_deleted_message(tr::now);
|
||||
return QString();// tr::lng_deleted_message(tr::now);
|
||||
} else if (payment->msgId) {
|
||||
return tr::lng_contacts_loading(tr::now);
|
||||
return QString();// tr::lng_contacts_loading(tr::now);
|
||||
}
|
||||
return QString();
|
||||
}();
|
||||
|
@ -1062,7 +1062,10 @@ void HistoryService::createFromMtp(const MTPDmessageService &message) {
|
|||
dependent->msgId = data.vreply_to_msg_id().v;
|
||||
if (!updateDependent()) {
|
||||
history()->session().api().requestMessageData(
|
||||
history()->peer->asChannel(),
|
||||
(peerIsChannel(dependent->peerId)
|
||||
? history()->owner().channel(
|
||||
peerToChannel(dependent->peerId)).get()
|
||||
: history()->peer->asChannel()),
|
||||
dependent->msgId,
|
||||
HistoryDependentItemCallback(this));
|
||||
}
|
||||
|
@ -1139,11 +1142,20 @@ void HistoryService::updateText(PreparedText &&text) {
|
|||
void HistoryService::clearDependency() {
|
||||
if (const auto dependent = GetDependentData()) {
|
||||
if (dependent->msg) {
|
||||
history()->owner().unregisterDependentMessage(this, dependent->msg);
|
||||
history()->owner().unregisterDependentMessage(
|
||||
this,
|
||||
dependent->msg);
|
||||
dependent->msg = nullptr;
|
||||
dependent->msgId = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryService::dependencyItemRemoved(HistoryItem *dependency) {
|
||||
clearDependency();
|
||||
updateDependentText();
|
||||
}
|
||||
|
||||
HistoryService::~HistoryService() {
|
||||
clearDependency();
|
||||
_media.reset();
|
||||
|
|
|
@ -103,6 +103,8 @@ public:
|
|||
|
||||
Storage::SharedMediaTypesMask sharedMediaTypes() const override;
|
||||
|
||||
void dependencyItemRemoved(HistoryItem *dependency) override;
|
||||
|
||||
bool needCheck() const override;
|
||||
bool serviceMsg() const override {
|
||||
return true;
|
||||
|
|
|
@ -155,7 +155,6 @@ void CheckoutProcess::handleFormUpdate(const FormUpdate &update) {
|
|||
_session->api().applyUpdates(data.updates);
|
||||
if (weak) {
|
||||
closeAndReactivate();
|
||||
if (_reactivate) _reactivate();
|
||||
}
|
||||
}, [&](const Error &error) {
|
||||
handleError(error);
|
||||
|
|
|
@ -116,8 +116,8 @@ void Form::fillInvoiceFromMessage() {
|
|||
if (const auto item = _session->data().message(id)) {
|
||||
const auto media = [&] {
|
||||
if (const auto payment = item->Get<HistoryServicePayment>()) {
|
||||
if (payment->msg) {
|
||||
return payment->msg->media();
|
||||
if (const auto invoice = payment->msg) {
|
||||
return invoice->media();
|
||||
}
|
||||
}
|
||||
return item->media();
|
||||
|
@ -346,6 +346,20 @@ void Form::processDetails(const MTPDpayments_paymentReceipt &data) {
|
|||
.botId = data.vbot_id().v,
|
||||
.providerId = data.vprovider_id().v,
|
||||
};
|
||||
if (_invoice.cover.title.isEmpty()
|
||||
&& _invoice.cover.description.isEmpty()
|
||||
&& _invoice.cover.thumbnail.isNull()
|
||||
&& !_thumbnailLoadProcess) {
|
||||
_invoice.cover = Ui::Cover{
|
||||
.title = qs(data.vtitle()),
|
||||
.description = qs(data.vdescription()),
|
||||
};
|
||||
if (const auto web = data.vphoto()) {
|
||||
if (const auto photo = _session->data().photoFromWeb(*web, {})) {
|
||||
loadThumbnail(photo);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_details.botId) {
|
||||
if (const auto bot = _session->data().userLoaded(_details.botId)) {
|
||||
_invoice.cover.seller = bot->name;
|
||||
|
|
Loading…
Add table
Reference in a new issue