mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
feat: add Ghost mode toggle
Co-authored-by: SharapaGorg <sharapov.savely@yandex.ru>
This commit is contained in:
parent
eaba9781a5
commit
2e9f8bfec4
2 changed files with 25 additions and 0 deletions
|
@ -843,6 +843,30 @@ void MainMenu::setupMenu() {
|
||||||
toggle);
|
toggle);
|
||||||
}, _nightThemeToggle->lifetime());
|
}, _nightThemeToggle->lifetime());
|
||||||
|
|
||||||
|
_ghostModeToggle = addAction(
|
||||||
|
rpl::single(QString("Ghost Mode")),
|
||||||
|
{ &st::menuIconFake, kIconPurple }
|
||||||
|
)->toggleOn(rpl::single((&AyuSettings::getInstance())->ghostMode));
|
||||||
|
|
||||||
|
_ghostModeToggle->toggledChanges(
|
||||||
|
) | rpl::filter([=](bool ghostMode) {
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
|
return (ghostMode != settings->ghostMode);
|
||||||
|
}) | rpl::start_with_next([=](bool ghostMode) {
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
|
settings->set_ghostMode(ghostMode);
|
||||||
|
|
||||||
|
settings->set_sendReadPackets(!ghostMode);
|
||||||
|
settings->set_sendOnlinePackets(!ghostMode);
|
||||||
|
settings->set_sendOfflinePacketAfterOnline(ghostMode);
|
||||||
|
settings->set_sendUploadProgress(!ghostMode);
|
||||||
|
settings->set_keepDeletedMessages(ghostMode);
|
||||||
|
settings->set_keepMessagesHistory(ghostMode);
|
||||||
|
|
||||||
|
AyuSettings::save();
|
||||||
|
|
||||||
|
}, _ghostModeToggle->lifetime());
|
||||||
|
|
||||||
Core::App().settings().systemDarkModeValue(
|
Core::App().settings().systemDarkModeValue(
|
||||||
) | rpl::start_with_next([=](std::optional<bool> darkMode) {
|
) | rpl::start_with_next([=](std::optional<bool> darkMode) {
|
||||||
const auto darkModeEnabled
|
const auto darkModeEnabled
|
||||||
|
|
|
@ -95,6 +95,7 @@ private:
|
||||||
not_null<Ui::FlatLabel*> _telegram;
|
not_null<Ui::FlatLabel*> _telegram;
|
||||||
not_null<Ui::FlatLabel*> _version;
|
not_null<Ui::FlatLabel*> _version;
|
||||||
QPointer<Ui::SettingsButton> _nightThemeToggle;
|
QPointer<Ui::SettingsButton> _nightThemeToggle;
|
||||||
|
QPointer<Ui::SettingsButton> _ghostModeToggle;
|
||||||
rpl::event_stream<bool> _nightThemeSwitches;
|
rpl::event_stream<bool> _nightThemeSwitches;
|
||||||
base::Timer _nightThemeSwitch;
|
base::Timer _nightThemeSwitch;
|
||||||
base::unique_qptr<Ui::PopupMenu> _contextMenu;
|
base::unique_qptr<Ui::PopupMenu> _contextMenu;
|
||||||
|
|
Loading…
Add table
Reference in a new issue