2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Support correct saved stories / archive loading.

This commit is contained in:
John Preston
2023-06-07 19:56:38 +04:00
parent 7f8a985067
commit 5e5b252f2f
15 changed files with 382 additions and 162 deletions

View File

@@ -125,17 +125,15 @@ void AddPremiumPrivacyButton(
not_null<Window::SessionController*> controller,
not_null<Ui::VerticalLayout*> container,
rpl::producer<QString> label,
IconDescriptor &&descriptor,
Privacy::Key key,
Fn<std::unique_ptr<EditPrivacyController>()> controllerFactory) {
const auto shower = Ui::CreateChild<rpl::lifetime>(container.get());
const auto session = &controller->session();
const auto &st = st::settingsButton;
const auto &st = st::settingsButtonNoIcon;
const auto button = AddButton(
container,
rpl::duplicate(label),
st,
std::move(descriptor));
st);
struct State {
State(QWidget *parent) : widget(parent) {
widget.setAttribute(Qt::WA_TransparentForMouseEvents);
@@ -260,59 +258,50 @@ void SetupPrivacy(
using Key = Privacy::Key;
const auto add = [&](
rpl::producer<QString> label,
IconDescriptor &&descriptor,
Key key,
auto controllerFactory) {
AddPrivacyButton(
controller,
container,
std::move(label),
std::move(descriptor),
{},
key,
controllerFactory);
};
add(
tr::lng_settings_phone_number_privacy(),
{ &st::settingsIconCalls, kIconGreen },
Key::PhoneNumber,
[=] { return std::make_unique<PhoneNumberPrivacyController>(
controller); });
add(
tr::lng_settings_last_seen(),
{ &st::settingsIconOnline, kIconLightBlue },
Key::LastSeen,
[=] { return std::make_unique<LastSeenPrivacyController>(session); });
add(
tr::lng_settings_profile_photo_privacy(),
{ &st::settingsIconAccount, kIconRed },
Key::ProfilePhoto,
[] { return std::make_unique<ProfilePhotoPrivacyController>(); });
add(
tr::lng_settings_forwards_privacy(),
{ &st::settingsIconForward, kIconLightOrange },
Key::Forwards,
[=] { return std::make_unique<ForwardsPrivacyController>(
controller); });
add(
tr::lng_settings_calls(),
{ &st::settingsIconVideoCalls, kIconGreen },
Key::Calls,
[] { return std::make_unique<CallsPrivacyController>(); });
add(
tr::lng_settings_groups_invite(),
{ &st::settingsIconGroup, kIconDarkBlue },
Key::Invites,
[] { return std::make_unique<GroupsInvitePrivacyController>(); });
AddPremiumPrivacyButton(
controller,
container,
tr::lng_settings_voices_privacy(),
{ &st::settingsPremiumIconVoice, kIconRed },
Key::Voices,
[=] { return std::make_unique<VoicesPrivacyController>(session); });
add(
tr::lng_settings_bio_privacy(),
{ &st::settingsIconAccount, kIconDarkOrange },
Key::About,
[] { return std::make_unique<AboutPrivacyController>(); });
@@ -832,7 +821,7 @@ void AddPrivacyButton(
container,
std::move(label),
PrivacyString(session, key),
st::settingsButton,
st::settingsButtonNoIcon,
std::move(descriptor)
)->addClickHandler([=] {
*shower = session->api().userPrivacy().value(