2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Show explaining preview of forwards privacy.

This commit is contained in:
John Preston
2019-03-19 17:50:36 +04:00
parent 81862215b4
commit b972da059a
14 changed files with 327 additions and 33 deletions

View File

@@ -239,12 +239,12 @@ void EditPrivacyBox::setupContent() {
const auto group = std::make_shared<Ui::RadioenumGroup<Option>>(
_value.option);
const auto toggle = Ui::CreateChild<rpl::event_stream<>>(content);
const auto toggle = Ui::CreateChild<rpl::event_stream<Option>>(content);
group->setChangedCallback([=](Option value) {
_value.option = value;
toggle->fire({});
toggle->fire_copy(value);
});
auto optionValue = toggle->events_starting_with_copy(_value.option);
const auto addOptionRow = [&](Option option) {
return (_controller->hasOption(option) || (_value.option == option))
@@ -275,8 +275,8 @@ void EditPrivacyBox::setupContent() {
std::move(label),
st::settingsButton,
text);
button->toggleOn(toggle->events_starting_with(
rpl::empty_value()
button->toggleOn(rpl::duplicate(
optionValue
) | rpl::map([=] {
return showExceptionLink(exception);
}))->entity()->addClickHandler([=] {
@@ -285,6 +285,13 @@ void EditPrivacyBox::setupContent() {
return button;
};
auto above = _controller->setupAboveWidget(
content,
std::move(optionValue));
if (above) {
content->add(std::move(above));
}
AddSubsectionTitle(content, _controller->optionsTitleKey());
addOptionRow(Option::Everyone);
addOptionRow(Option::Contacts);