mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +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 textcmdLink(1, invoice->title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tr::lng_deleted_message(tr::now);
|
return QString();// tr::lng_deleted_message(tr::now);
|
||||||
} else if (payment->msgId) {
|
} else if (payment->msgId) {
|
||||||
return tr::lng_contacts_loading(tr::now);
|
return QString();// tr::lng_contacts_loading(tr::now);
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}();
|
}();
|
||||||
|
@ -1062,7 +1062,10 @@ void HistoryService::createFromMtp(const MTPDmessageService &message) {
|
||||||
dependent->msgId = data.vreply_to_msg_id().v;
|
dependent->msgId = data.vreply_to_msg_id().v;
|
||||||
if (!updateDependent()) {
|
if (!updateDependent()) {
|
||||||
history()->session().api().requestMessageData(
|
history()->session().api().requestMessageData(
|
||||||
history()->peer->asChannel(),
|
(peerIsChannel(dependent->peerId)
|
||||||
|
? history()->owner().channel(
|
||||||
|
peerToChannel(dependent->peerId)).get()
|
||||||
|
: history()->peer->asChannel()),
|
||||||
dependent->msgId,
|
dependent->msgId,
|
||||||
HistoryDependentItemCallback(this));
|
HistoryDependentItemCallback(this));
|
||||||
}
|
}
|
||||||
|
@ -1139,11 +1142,20 @@ void HistoryService::updateText(PreparedText &&text) {
|
||||||
void HistoryService::clearDependency() {
|
void HistoryService::clearDependency() {
|
||||||
if (const auto dependent = GetDependentData()) {
|
if (const auto dependent = GetDependentData()) {
|
||||||
if (dependent->msg) {
|
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() {
|
HistoryService::~HistoryService() {
|
||||||
clearDependency();
|
clearDependency();
|
||||||
_media.reset();
|
_media.reset();
|
||||||
|
|
|
@ -103,6 +103,8 @@ public:
|
||||||
|
|
||||||
Storage::SharedMediaTypesMask sharedMediaTypes() const override;
|
Storage::SharedMediaTypesMask sharedMediaTypes() const override;
|
||||||
|
|
||||||
|
void dependencyItemRemoved(HistoryItem *dependency) override;
|
||||||
|
|
||||||
bool needCheck() const override;
|
bool needCheck() const override;
|
||||||
bool serviceMsg() const override {
|
bool serviceMsg() const override {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -155,7 +155,6 @@ void CheckoutProcess::handleFormUpdate(const FormUpdate &update) {
|
||||||
_session->api().applyUpdates(data.updates);
|
_session->api().applyUpdates(data.updates);
|
||||||
if (weak) {
|
if (weak) {
|
||||||
closeAndReactivate();
|
closeAndReactivate();
|
||||||
if (_reactivate) _reactivate();
|
|
||||||
}
|
}
|
||||||
}, [&](const Error &error) {
|
}, [&](const Error &error) {
|
||||||
handleError(error);
|
handleError(error);
|
||||||
|
|
|
@ -116,8 +116,8 @@ void Form::fillInvoiceFromMessage() {
|
||||||
if (const auto item = _session->data().message(id)) {
|
if (const auto item = _session->data().message(id)) {
|
||||||
const auto media = [&] {
|
const auto media = [&] {
|
||||||
if (const auto payment = item->Get<HistoryServicePayment>()) {
|
if (const auto payment = item->Get<HistoryServicePayment>()) {
|
||||||
if (payment->msg) {
|
if (const auto invoice = payment->msg) {
|
||||||
return payment->msg->media();
|
return invoice->media();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return item->media();
|
return item->media();
|
||||||
|
@ -346,6 +346,20 @@ void Form::processDetails(const MTPDpayments_paymentReceipt &data) {
|
||||||
.botId = data.vbot_id().v,
|
.botId = data.vbot_id().v,
|
||||||
.providerId = data.vprovider_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 (_details.botId) {
|
||||||
if (const auto bot = _session->data().userLoaded(_details.botId)) {
|
if (const auto bot = _session->data().userLoaded(_details.botId)) {
|
||||||
_invoice.cover.seller = bot->name;
|
_invoice.cover.seller = bot->name;
|
||||||
|
|
Loading…
Add table
Reference in a new issue