mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Slightly improved invoice view in messages for credits.
This commit is contained in:
parent
3d81414c71
commit
84cde1354d
2 changed files with 17 additions and 7 deletions
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "api/api_cloud_password.h"
|
#include "api/api_cloud_password.h"
|
||||||
#include "api/api_send_progress.h"
|
#include "api/api_send_progress.h"
|
||||||
|
#include "boxes/send_credits_box.h"
|
||||||
#include "boxes/share_box.h"
|
#include "boxes/share_box.h"
|
||||||
#include "boxes/passcode_box.h"
|
#include "boxes/passcode_box.h"
|
||||||
#include "boxes/url_auth_box.h"
|
#include "boxes/url_auth_box.h"
|
||||||
|
@ -330,12 +331,16 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) {
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case ButtonType::Buy: {
|
case ButtonType::Buy: {
|
||||||
Payments::CheckoutProcess::Start(
|
if (Ui::IsCreditsInvoice(item)) {
|
||||||
item,
|
controller->uiShow()->show(Box(Ui::SendCreditsBox, item));
|
||||||
Payments::Mode::Payment,
|
} else {
|
||||||
crl::guard(controller, [=](auto) {
|
Payments::CheckoutProcess::Start(
|
||||||
controller->widget()->activate();
|
item,
|
||||||
}));
|
Payments::Mode::Payment,
|
||||||
|
crl::guard(controller, [=](auto) {
|
||||||
|
controller->widget()->activate();
|
||||||
|
}));
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case ButtonType::Url: {
|
case ButtonType::Url: {
|
||||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "history/view/media/history_view_invoice.h"
|
#include "history/view/media/history_view_invoice.h"
|
||||||
|
|
||||||
|
#include "boxes/send_credits_box.h" // IsCreditsInvoice.
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "history/view/history_view_element.h"
|
#include "history/view/history_view_element.h"
|
||||||
#include "history/view/history_view_cursor_state.h"
|
#include "history/view/history_view_cursor_state.h"
|
||||||
|
@ -34,7 +35,8 @@ Invoice::Invoice(
|
||||||
}
|
}
|
||||||
|
|
||||||
void Invoice::fillFromData(not_null<Data::Invoice*> invoice) {
|
void Invoice::fillFromData(not_null<Data::Invoice*> invoice) {
|
||||||
if (invoice->photo) {
|
const auto isCreditsCurrency = Ui::IsCreditsInvoice(_parent->data());
|
||||||
|
if (invoice->photo && !isCreditsCurrency) {
|
||||||
const auto spoiler = false;
|
const auto spoiler = false;
|
||||||
_attach = std::make_unique<Photo>(
|
_attach = std::make_unique<Photo>(
|
||||||
_parent,
|
_parent,
|
||||||
|
@ -64,6 +66,9 @@ void Invoice::fillFromData(not_null<Data::Invoice*> invoice) {
|
||||||
0,
|
0,
|
||||||
int(statusText.text.size()) });
|
int(statusText.text.size()) });
|
||||||
statusText.text += ' ' + labelText().toUpper();
|
statusText.text += ' ' + labelText().toUpper();
|
||||||
|
if (isCreditsCurrency) {
|
||||||
|
statusText = {};
|
||||||
|
}
|
||||||
_status.setMarkedText(
|
_status.setMarkedText(
|
||||||
st::defaultTextStyle,
|
st::defaultTextStyle,
|
||||||
statusText,
|
statusText,
|
||||||
|
|
Loading…
Add table
Reference in a new issue