mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Improve phrases for paid messages.
This commit is contained in:
parent
960cf7a34b
commit
4729e51e14
4 changed files with 51 additions and 13 deletions
|
@ -4826,10 +4826,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_payment_confirm_title" = "Confirm payment";
|
"lng_payment_confirm_title" = "Confirm payment";
|
||||||
"lng_payment_confirm_text#one" = "{name} charges **{count}** Star per message.";
|
"lng_payment_confirm_text#one" = "{name} charges **{count}** Star per message.";
|
||||||
"lng_payment_confirm_text#other" = "{name} charges **{count}** Stars per message.";
|
"lng_payment_confirm_text#other" = "{name} charges **{count}** Stars per message.";
|
||||||
"lng_payment_confirm_sure#one" = "Would you like to pay **{count}** Star to send one message?";
|
"lng_payment_confirm_amount#one" = "**{count}** Star";
|
||||||
"lng_payment_confirm_sure#other" = "Would you like to pay **{count}** Stars to send one message?";
|
"lng_payment_confirm_amount#other" = "**{count}** Stars";
|
||||||
|
"lng_payment_confirm_sure#one" = "Would you like to pay {amount} to send **{count}** message?";
|
||||||
|
"lng_payment_confirm_sure#other" = "Would you like to pay {amount} to send **{count}** messages?";
|
||||||
"lng_payment_confirm_dont_ask" = "Don't ask me again";
|
"lng_payment_confirm_dont_ask" = "Don't ask me again";
|
||||||
"lng_payment_confirm_button" = "Pay for 1 Message";
|
"lng_payment_confirm_button#one" = "Pay for {count} Message";
|
||||||
|
"lng_payment_confirm_button#other" = "Pay for {count} Messages";
|
||||||
"lng_payment_bar_text" = "{name} must pay {cost} for each message to you.";
|
"lng_payment_bar_text" = "{name} must pay {cost} for each message to you.";
|
||||||
"lng_payment_bar_button" = "Remove Fee";
|
"lng_payment_bar_button" = "Remove Fee";
|
||||||
"lng_payment_refund_title" = "Remove Fee";
|
"lng_payment_refund_title" = "Remove Fee";
|
||||||
|
|
|
@ -3298,7 +3298,7 @@ void ApiWrap::finishForwarding(const SendAction &action) {
|
||||||
|
|
||||||
void ApiWrap::forwardMessages(
|
void ApiWrap::forwardMessages(
|
||||||
Data::ResolvedForwardDraft &&draft,
|
Data::ResolvedForwardDraft &&draft,
|
||||||
const SendAction &action,
|
SendAction action,
|
||||||
FnMut<void()> &&successCallback) {
|
FnMut<void()> &&successCallback) {
|
||||||
Expects(!draft.items.empty());
|
Expects(!draft.items.empty());
|
||||||
|
|
||||||
|
@ -3373,9 +3373,17 @@ void ApiWrap::forwardMessages(
|
||||||
const auto requestType = Data::Histories::RequestType::Send;
|
const auto requestType = Data::Histories::RequestType::Send;
|
||||||
const auto idsCopy = localIds;
|
const auto idsCopy = localIds;
|
||||||
const auto scheduled = action.options.scheduled;
|
const auto scheduled = action.options.scheduled;
|
||||||
|
auto paidStars = std::min(
|
||||||
|
action.options.starsApproved,
|
||||||
|
int(ids.size() * peer->starsPerMessageChecked()));
|
||||||
|
auto oneFlags = sendFlags;
|
||||||
|
if (paidStars) {
|
||||||
|
action.options.starsApproved -= paidStars;
|
||||||
|
oneFlags |= SendFlag::f_allow_paid_stars;
|
||||||
|
}
|
||||||
histories.sendRequest(history, requestType, [=](Fn<void()> finish) {
|
histories.sendRequest(history, requestType, [=](Fn<void()> finish) {
|
||||||
history->sendRequestId = request(MTPmessages_ForwardMessages(
|
history->sendRequestId = request(MTPmessages_ForwardMessages(
|
||||||
MTP_flags(sendFlags),
|
MTP_flags(oneFlags),
|
||||||
forwardFrom->input,
|
forwardFrom->input,
|
||||||
MTP_vector<MTPint>(ids),
|
MTP_vector<MTPint>(ids),
|
||||||
MTP_vector<MTPlong>(randomIds),
|
MTP_vector<MTPlong>(randomIds),
|
||||||
|
@ -3385,7 +3393,7 @@ void ApiWrap::forwardMessages(
|
||||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
|
||||||
Data::ShortcutIdToMTP(_session, action.options.shortcutId),
|
Data::ShortcutIdToMTP(_session, action.options.shortcutId),
|
||||||
MTPint(), // video_timestamp
|
MTPint(), // video_timestamp
|
||||||
MTPlong() // allow_paid_stars
|
MTP_long(paidStars)
|
||||||
)).done([=](const MTPUpdates &result) {
|
)).done([=](const MTPUpdates &result) {
|
||||||
if (!scheduled) {
|
if (!scheduled) {
|
||||||
this->updates().checkForSentToScheduled(result);
|
this->updates().checkForSentToScheduled(result);
|
||||||
|
|
|
@ -306,7 +306,7 @@ public:
|
||||||
void finishForwarding(const SendAction &action);
|
void finishForwarding(const SendAction &action);
|
||||||
void forwardMessages(
|
void forwardMessages(
|
||||||
Data::ResolvedForwardDraft &&draft,
|
Data::ResolvedForwardDraft &&draft,
|
||||||
const SendAction &action,
|
SendAction action,
|
||||||
FnMut<void()> &&successCallback = nullptr);
|
FnMut<void()> &&successCallback = nullptr);
|
||||||
void shareContact(
|
void shareContact(
|
||||||
const QString &phone,
|
const QString &phone,
|
||||||
|
|
|
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
#include "settings/settings_credits_graphics.h"
|
||||||
#include "storage/storage_account.h"
|
#include "storage/storage_account.h"
|
||||||
#include "ui/boxes/confirm_box.h"
|
#include "ui/boxes/confirm_box.h"
|
||||||
#include "ui/chat/attach/attach_prepare.h"
|
#include "ui/chat/attach/attach_prepare.h"
|
||||||
|
@ -443,12 +444,30 @@ void ShowSendPaidConfirm(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Data::SendError error,
|
Data::SendError error,
|
||||||
Fn<void()> confirmed) {
|
Fn<void()> confirmed) {
|
||||||
|
const auto check = [=] {
|
||||||
|
const auto required = error.paidStars;
|
||||||
|
if (!required) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto done = [=](Settings::SmallBalanceResult result) {
|
||||||
|
if (result == Settings::SmallBalanceResult::Success
|
||||||
|
|| result == Settings::SmallBalanceResult::Already) {
|
||||||
|
confirmed();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Settings::MaybeRequestBalanceIncrease(
|
||||||
|
show,
|
||||||
|
required,
|
||||||
|
Settings::SmallBalanceForMessage{ .recipientId = peer->id },
|
||||||
|
done);
|
||||||
|
};
|
||||||
|
|
||||||
const auto session = &peer->session();
|
const auto session = &peer->session();
|
||||||
if (session->local().isPeerTrustedPayForMessage(peer->id)) {
|
if (session->local().isPeerTrustedPayForMessage(peer->id)) {
|
||||||
confirmed();
|
check();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//const auto messages = error.paidMessages;
|
const auto messages = error.paidMessages;
|
||||||
const auto stars = error.paidStars;
|
const auto stars = error.paidStars;
|
||||||
show->showBox(Box([=](not_null<Ui::GenericBox*> box) {
|
show->showBox(Box([=](not_null<Ui::GenericBox*> box) {
|
||||||
const auto trust = std::make_shared<QPointer<Ui::Checkbox>>();
|
const auto trust = std::make_shared<QPointer<Ui::Checkbox>>();
|
||||||
|
@ -456,24 +475,32 @@ void ShowSendPaidConfirm(
|
||||||
if ((*trust)->checked()) {
|
if ((*trust)->checked()) {
|
||||||
session->local().markPeerTrustedPayForMessage(peer->id);
|
session->local().markPeerTrustedPayForMessage(peer->id);
|
||||||
}
|
}
|
||||||
confirmed();
|
check();
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
Ui::ConfirmBox(box, {
|
Ui::ConfirmBox(box, {
|
||||||
.text = tr::lng_payment_confirm_text(
|
.text = tr::lng_payment_confirm_text(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_count,
|
lt_count,
|
||||||
stars,
|
stars / messages,
|
||||||
lt_name,
|
lt_name,
|
||||||
Ui::Text::Bold(peer->shortName()),
|
Ui::Text::Bold(peer->shortName()),
|
||||||
Ui::Text::RichLangValue).append(' ').append(
|
Ui::Text::RichLangValue).append(' ').append(
|
||||||
tr::lng_payment_confirm_sure(
|
tr::lng_payment_confirm_sure(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_count,
|
lt_count,
|
||||||
stars,
|
messages,
|
||||||
|
lt_amount,
|
||||||
|
tr::lng_payment_confirm_amount(
|
||||||
|
tr::now,
|
||||||
|
lt_count,
|
||||||
|
stars,
|
||||||
|
Ui::Text::RichLangValue),
|
||||||
Ui::Text::RichLangValue)),
|
Ui::Text::RichLangValue)),
|
||||||
.confirmed = proceed,
|
.confirmed = proceed,
|
||||||
.confirmText = tr::lng_payment_confirm_button(),
|
.confirmText = tr::lng_payment_confirm_button(
|
||||||
|
lt_count,
|
||||||
|
rpl::single(messages * 1.)),
|
||||||
.title = tr::lng_payment_confirm_title(),
|
.title = tr::lng_payment_confirm_title(),
|
||||||
});
|
});
|
||||||
const auto skip = st::defaultCheckbox.margin.top();
|
const auto skip = st::defaultCheckbox.margin.top();
|
||||||
|
|
Loading…
Add table
Reference in a new issue