Make links clickable in product description.
This commit is contained in:
parent
97d82e8edb
commit
e2b0c8bdc2
@ -1553,7 +1553,7 @@ paymentProviderOther url:string = PaymentProvider;
|
||||
//@product_title Product title
|
||||
//@product_description Product description
|
||||
//@product_photo Product photo; may be null
|
||||
paymentForm id:int64 invoice:invoice seller_bot_user_id:int53 payment_provider_user_id:int53 payment_provider:PaymentProvider saved_order_info:orderInfo saved_credentials:savedCredentials can_save_credentials:Bool need_password:Bool product_title:string product_description:string product_photo:photo = PaymentForm;
|
||||
paymentForm id:int64 invoice:invoice seller_bot_user_id:int53 payment_provider_user_id:int53 payment_provider:PaymentProvider saved_order_info:orderInfo saved_credentials:savedCredentials can_save_credentials:Bool need_password:Bool product_title:string product_description:formattedText product_photo:photo = PaymentForm;
|
||||
|
||||
//@description Contains a temporary identifier of validated order information, which is stored for one hour. Also contains the available shipping options @order_info_id Temporary identifier of the order information @shipping_options Available shipping options
|
||||
validatedOrderInfo order_info_id:string shipping_options:vector<shippingOption> = ValidatedOrderInfo;
|
||||
@ -1573,7 +1573,7 @@ paymentResult success:Bool verification_url:string = PaymentResult;
|
||||
//@shipping_option Chosen shipping option; may be null
|
||||
//@credentials_title Title of the saved credentials chosen by the buyer
|
||||
//@tip_amount The amount of tip chosen by the buyer in the smallest units of the currency
|
||||
paymentReceipt title:string description:string photo:photo date:int32 seller_bot_user_id:int53 payment_provider_user_id:int53 invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string tip_amount:int53 = PaymentReceipt;
|
||||
paymentReceipt title:string description:formattedText photo:photo date:int32 seller_bot_user_id:int53 payment_provider_user_id:int53 invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string tip_amount:int53 = PaymentReceipt;
|
||||
|
||||
|
||||
//@class InputInvoice @description Describe an invoice to process
|
||||
@ -1902,7 +1902,7 @@ messagePoll poll:poll = MessageContent;
|
||||
//@description A message with an invoice from a bot @title Product title @param_description Product description @photo Product photo; may be null @currency Currency for the product price @total_amount Product total price in the smallest units of the currency
|
||||
//@start_parameter Unique invoice bot start_parameter. To share an invoice use the URL https://t.me/{bot_username}?start={start_parameter} @is_test True, if the invoice is a test invoice
|
||||
//@need_shipping_address True, if the shipping address must be specified @receipt_message_id The identifier of the message with the receipt, after the product has been purchased
|
||||
messageInvoice title:string description:string photo:photo currency:string total_amount:int53 start_parameter:string is_test:Bool need_shipping_address:Bool receipt_message_id:int53 = MessageContent;
|
||||
messageInvoice title:string description:formattedText photo:photo currency:string total_amount:int53 start_parameter:string is_test:Bool need_shipping_address:Bool receipt_message_id:int53 = MessageContent;
|
||||
|
||||
//@description A message with information about an ended call @is_video True, if the call was a video call @discard_reason Reason why the call was discarded @duration Call duration, in seconds
|
||||
messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "td/telegram/files/FileManager.h"
|
||||
#include "td/telegram/files/FileType.h"
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/MessageEntity.h"
|
||||
#include "td/telegram/MessagesManager.h"
|
||||
#include "td/telegram/misc.h"
|
||||
#include "td/telegram/PasswordManager.h"
|
||||
@ -36,6 +37,13 @@ namespace td {
|
||||
|
||||
namespace {
|
||||
|
||||
static tl_object_ptr<td_api::formattedText> get_product_description_object(const string &description) {
|
||||
FormattedText result;
|
||||
result.text = description;
|
||||
result.entities = find_entities(result.text, true, true);
|
||||
return get_formatted_text_object(result, true, 0);
|
||||
}
|
||||
|
||||
struct InputInvoiceInfo {
|
||||
DialogId dialog_id_;
|
||||
telegram_api::object_ptr<telegram_api::InputInvoice> input_invoice_;
|
||||
@ -386,7 +394,8 @@ class GetPaymentFormQuery final : public Td::ResultHandler {
|
||||
td_->contacts_manager_->get_user_id_object(payments_provider_user_id, "paymentForm provider"),
|
||||
std::move(payment_provider), convert_order_info(std::move(payment_form->saved_info_)),
|
||||
convert_saved_credentials(std::move(payment_form->saved_credentials_)), can_save_credentials, need_password,
|
||||
payment_form->title_, payment_form->description_, get_photo_object(td_->file_manager_.get(), photo)));
|
||||
payment_form->title_, get_product_description_object(payment_form->description_),
|
||||
get_photo_object(td_->file_manager_.get(), photo)));
|
||||
}
|
||||
|
||||
void on_error(Status status) final {
|
||||
@ -549,8 +558,9 @@ class GetPaymentReceiptQuery final : public Td::ResultHandler {
|
||||
auto photo = get_web_document_photo(td_->file_manager_.get(), std::move(payment_receipt->photo_), dialog_id_);
|
||||
|
||||
promise_.set_value(make_tl_object<td_api::paymentReceipt>(
|
||||
payment_receipt->title_, payment_receipt->description_, get_photo_object(td_->file_manager_.get(), photo),
|
||||
payment_receipt->date_, td_->contacts_manager_->get_user_id_object(seller_bot_user_id, "paymentReceipt seller"),
|
||||
payment_receipt->title_, get_product_description_object(payment_receipt->description_),
|
||||
get_photo_object(td_->file_manager_.get(), photo), payment_receipt->date_,
|
||||
td_->contacts_manager_->get_user_id_object(seller_bot_user_id, "paymentReceipt seller"),
|
||||
td_->contacts_manager_->get_user_id_object(payments_provider_user_id, "paymentReceipt provider"),
|
||||
convert_invoice(std::move(payment_receipt->invoice_)), convert_order_info(std::move(payment_receipt->info_)),
|
||||
convert_shipping_option(std::move(payment_receipt->shipping_)), std::move(payment_receipt->credentials_title_),
|
||||
@ -906,10 +916,10 @@ Result<InputInvoice> process_input_message_invoice(
|
||||
|
||||
tl_object_ptr<td_api::messageInvoice> get_message_invoice_object(const InputInvoice &input_invoice, Td *td) {
|
||||
return make_tl_object<td_api::messageInvoice>(
|
||||
input_invoice.title, input_invoice.description, get_photo_object(td->file_manager_.get(), input_invoice.photo),
|
||||
input_invoice.invoice.currency, input_invoice.total_amount, input_invoice.start_parameter,
|
||||
input_invoice.invoice.is_test, input_invoice.invoice.need_shipping_address,
|
||||
input_invoice.receipt_message_id.get());
|
||||
input_invoice.title, get_product_description_object(input_invoice.description),
|
||||
get_photo_object(td->file_manager_.get(), input_invoice.photo), input_invoice.invoice.currency,
|
||||
input_invoice.total_amount, input_invoice.start_parameter, input_invoice.invoice.is_test,
|
||||
input_invoice.invoice.need_shipping_address, input_invoice.receipt_message_id.get());
|
||||
}
|
||||
|
||||
static tl_object_ptr<telegram_api::invoice> get_input_invoice(const Invoice &invoice) {
|
||||
|
@ -410,6 +410,8 @@ class CliClient final : public Actor {
|
||||
parameters->system_language_code_ = "en";
|
||||
parameters->device_model_ = "Desktop";
|
||||
parameters->application_version_ = "1.0";
|
||||
send_request(
|
||||
td_api::make_object<td_api::setOption>("use_pfs", td_api::make_object<td_api::optionValueBoolean>(true)));
|
||||
send_request(td_api::make_object<td_api::setTdlibParameters>(std::move(parameters)));
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user