mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Show real subscription price from the API.
This commit is contained in:
@@ -35,6 +35,14 @@ rpl::producer<TextWithEntities> Premium::statusTextValue() const {
|
||||
_statusText.value_or(TextWithEntities()));
|
||||
}
|
||||
|
||||
int64 Premium::monthlyAmount() const {
|
||||
return _monthlyAmount;
|
||||
}
|
||||
|
||||
QString Premium::monthlyCurrency() const {
|
||||
return _monthlyCurrency;
|
||||
}
|
||||
|
||||
void Premium::reload() {
|
||||
if (_statusRequestId) {
|
||||
return;
|
||||
@@ -43,6 +51,8 @@ void Premium::reload() {
|
||||
)).done([=](const MTPhelp_PremiumPromo &result) {
|
||||
_statusRequestId = 0;
|
||||
result.match([&](const MTPDhelp_premiumPromo &data) {
|
||||
_monthlyAmount = data.vmonthly_amount().v;
|
||||
_monthlyCurrency = qs(data.vcurrency());
|
||||
auto text = TextWithEntities{
|
||||
qs(data.vstatus_text()),
|
||||
EntitiesFromMTP(_session, data.vstatus_entities().v),
|
||||
|
@@ -24,6 +24,9 @@ public:
|
||||
void reload();
|
||||
[[nodiscard]] rpl::producer<TextWithEntities> statusTextValue() const;
|
||||
|
||||
[[nodiscard]] int64 monthlyAmount() const;
|
||||
[[nodiscard]] QString monthlyCurrency() const;
|
||||
|
||||
private:
|
||||
const not_null<Main::Session*> _session;
|
||||
MTP::Sender _api;
|
||||
@@ -32,6 +35,9 @@ private:
|
||||
std::optional<TextWithEntities> _statusText;
|
||||
rpl::event_stream<TextWithEntities> _statusTextUpdates;
|
||||
|
||||
int64 _monthlyAmount = 0;
|
||||
QString _monthlyCurrency;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Api
|
||||
|
Reference in New Issue
Block a user