mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 05:58:38 +00:00
Take rating info url from appConfig.
This commit is contained in:
parent
a81b9344cf
commit
20ce2ead75
@ -1878,7 +1878,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
"lng_stars_rating_tooltip" = "Profile level reflects the user's payment reliability.";
|
||||
"lng_stars_rating_learn_more" = "Learn More";
|
||||
"lng_stars_rating_about_url" = "https://telegram.org/";
|
||||
|
||||
"lng_manage_discussion_group" = "Discussion";
|
||||
"lng_manage_discussion_group_add" = "Add a group";
|
||||
|
@ -36,12 +36,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/basic_click_handlers.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "ui/painter.h"
|
||||
#include "base/event_filter.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "main/main_app_config.h"
|
||||
#include "main/main_session.h"
|
||||
#include "settings/settings_premium.h"
|
||||
#include "chat_helpers/stickers_lottie.h"
|
||||
@ -669,6 +671,11 @@ Cover::Cover(
|
||||
_status->widthValue() | rpl::start_with_next([=](int width) {
|
||||
rating->setMinimalAddedWidth(width);
|
||||
}, rating->lifetime());
|
||||
const auto session = &_peer->session();
|
||||
rating->learnMoreRequests() | rpl::start_with_next([=] {
|
||||
const auto &appConfig = session->appConfig();
|
||||
UrlClickHandler::Open(appConfig.starsRatingLearnMoreUrl());
|
||||
}, rating->lifetime());
|
||||
_statusShift = rating->collapsedWidthValue();
|
||||
_statusShift.changes() | rpl::start_with_next([=] {
|
||||
refreshStatusGeometry(width());
|
||||
|
@ -232,6 +232,12 @@ QString AppConfig::ageVerifyBotUsername() const {
|
||||
return get<QString>(u"verify_age_bot_username"_q, QString());
|
||||
}
|
||||
|
||||
QString AppConfig::starsRatingLearnMoreUrl() const {
|
||||
return get<QString>(
|
||||
u"stars_rating_learnmore_url"_q,
|
||||
u"https://telegram.org/blog"_q);
|
||||
}
|
||||
|
||||
void AppConfig::refresh(bool force) {
|
||||
if (_requestId || !_api) {
|
||||
if (force) {
|
||||
|
@ -109,6 +109,8 @@ public:
|
||||
[[nodiscard]] int ageVerifyMinAge() const;
|
||||
[[nodiscard]] QString ageVerifyBotUsername() const;
|
||||
|
||||
[[nodiscard]] QString starsRatingLearnMoreUrl() const;
|
||||
|
||||
void refresh(bool force = false);
|
||||
|
||||
private:
|
||||
|
@ -13,7 +13,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/tooltip.h"
|
||||
#include "ui/basic_click_handlers.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/ui_utility.h"
|
||||
@ -213,7 +212,7 @@ void StarsRating::toggleTooltips(bool shown) {
|
||||
outer.width());
|
||||
}, widget->lifetime());
|
||||
button->setClickedCallback([=] {
|
||||
UrlClickHandler::Open(tr::lng_stars_rating_about_url(tr::now));
|
||||
_learnMoreRequests.fire({});
|
||||
});
|
||||
}
|
||||
|
||||
@ -346,6 +345,10 @@ rpl::producer<int> StarsRating::collapsedWidthValue() const {
|
||||
return _collapsedWidthValue.value();
|
||||
}
|
||||
|
||||
rpl::producer<> StarsRating::learnMoreRequests() const {
|
||||
return _learnMoreRequests.events();
|
||||
}
|
||||
|
||||
rpl::lifetime &StarsRating::lifetime() {
|
||||
return _widget->lifetime();
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
void setMinimalAddedWidth(int addedWidth);
|
||||
|
||||
[[nodiscard]] rpl::producer<int> collapsedWidthValue() const;
|
||||
[[nodiscard]] rpl::producer<> learnMoreRequests() const;
|
||||
|
||||
[[nodiscard]] rpl::lifetime &lifetime();
|
||||
|
||||
@ -73,6 +74,8 @@ private:
|
||||
Ui::Animations::Simple _expandedAnimation;
|
||||
mutable int _activeWidth = 0;
|
||||
|
||||
rpl::event_stream<> _learnMoreRequests;
|
||||
|
||||
base::Timer _collapseTimer;
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user