2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Improved FAQ buttons with opening link in instant view.

This commit is contained in:
23rd
2024-04-03 19:28:00 +03:00
committed by John Preston
parent d675e31a51
commit 2a388ae4b2
9 changed files with 109 additions and 31 deletions

View File

@@ -26,13 +26,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/basic_click_handlers.h"
#include "ui/boxes/confirm_box.h"
#include "ui/controls/userpic_button.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/wrap/slide_wrap.h"
#include "ui/wrap/padding_wrap.h"
#include "ui/widgets/menu/menu_add_action_callback.h"
#include "ui/widgets/labels.h"
#include "ui/widgets/continuous_sliders.h"
#include "ui/widgets/buttons.h"
#include "ui/text/text_utilities.h"
#include "ui/toast/toast.h"
#include "ui/new_badges.h"
@@ -43,9 +39,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "data/data_cloud_themes.h"
#include "data/data_chat_filters.h"
#include "data/data_peer_values.h" // Data::AmPremiumValue
#include "lang/lang_cloud_manager.h"
#include "lang/lang_keys.h"
#include "lang/lang_instance.h"
#include "storage/localstorage.h"
#include "main/main_session.h"
@@ -62,13 +56,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "info/profile/info_profile_values.h"
#include "window/window_controller.h"
#include "window/window_session_controller.h"
#include "core/file_utilities.h"
#include "core/application.h"
#include "base/call_delayed.h"
#include "base/unixtime.h"
#include "base/platform/base_platform_info.h"
#include "styles/style_settings.h"
#include "styles/style_boxes.h"
#include "styles/style_info.h"
#include "styles/style_menu_icons.h"
@@ -611,26 +601,20 @@ void SetupInterfaceScale(
}
}
void OpenFaq() {
File::OpenUrl(telegramFaqLink());
}
void SetupFaq(not_null<Ui::VerticalLayout*> container, bool icon) {
AddButtonWithIcon(
container,
tr::lng_settings_faq(),
icon ? st::settingsButton : st::settingsButtonNoIcon,
{ icon ? &st::menuIconFaq : nullptr }
)->addClickHandler(OpenFaq);
}
void SetupHelp(
not_null<Window::SessionController*> controller,
not_null<Ui::VerticalLayout*> container) {
Ui::AddDivider(container);
Ui::AddSkip(container);
SetupFaq(container);
AddButtonWithIcon(
container,
tr::lng_settings_faq(),
st::settingsButton,
{ &st::menuIconFaq }
)->addClickHandler([=] {
controller->session().data().faq().open(controller->uiShow());
});
AddButtonWithIcon(
container,
@@ -674,7 +658,10 @@ void SetupHelp(
auto box = Ui::MakeConfirmBox({
.text = tr::lng_settings_ask_sure(),
.confirmed = sure,
.cancelled = OpenFaq,
.cancelled = [=](Fn<void()> close) {
controller->session().data().faq().open(controller->uiShow());
close();
},
.confirmText = tr::lng_settings_ask_ok(),
.cancelText = tr::lng_settings_faq_button(),
.strictCancel = true,