mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
fix: tray ghost toggle
This commit is contained in:
parent
0a10adfdfd
commit
90d62514e9
5 changed files with 29 additions and 29 deletions
|
@ -164,7 +164,7 @@ namespace AyuSettings {
|
||||||
voiceConfirmation = val;
|
voiceConfirmation = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AyuGramSettings::getGhostModeValue() {
|
bool AyuGramSettings::get_ghostModeEnabled() const {
|
||||||
return (!sendReadPackets
|
return (!sendReadPackets
|
||||||
&& !sendOnlinePackets
|
&& !sendOnlinePackets
|
||||||
&& !sendUploadProgress
|
&& !sendUploadProgress
|
||||||
|
@ -179,11 +179,11 @@ namespace AyuSettings {
|
||||||
return editedMarkReactive.value();
|
return editedMarkReactive.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<int> get_showPeerId() {
|
rpl::producer<int> get_showPeerIdReactive() {
|
||||||
return showPeerIdReactive.value();
|
return showPeerIdReactive.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<bool> get_ghostModeEnabled() {
|
rpl::producer<bool> get_ghostModeEnabledReactive() {
|
||||||
return ghostModeEnabled.value();
|
return ghostModeEnabled.value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ namespace AyuSettings {
|
||||||
void set_GIFConfirmation(bool val);
|
void set_GIFConfirmation(bool val);
|
||||||
void set_voiceConfirmation(bool val);
|
void set_voiceConfirmation(bool val);
|
||||||
|
|
||||||
bool getGhostModeValue();
|
bool get_ghostModeEnabled() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
AyuGramSettings &getInstance();
|
AyuGramSettings &getInstance();
|
||||||
|
@ -133,8 +133,8 @@ namespace AyuSettings {
|
||||||
|
|
||||||
rpl::producer<QString> get_deletedMarkReactive();
|
rpl::producer<QString> get_deletedMarkReactive();
|
||||||
rpl::producer<QString> get_editedMarkReactive();
|
rpl::producer<QString> get_editedMarkReactive();
|
||||||
rpl::producer<int> get_showPeerId();
|
rpl::producer<int> get_showPeerIdReactive();
|
||||||
|
|
||||||
// computed fields
|
// computed fields
|
||||||
rpl::producer<bool> get_ghostModeEnabled();
|
rpl::producer<bool> get_ghostModeEnabledReactive();
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ namespace Settings {
|
||||||
QString("Bot API")
|
QString("Bot API")
|
||||||
};
|
};
|
||||||
|
|
||||||
auto currentVal = AyuSettings::get_showPeerId() | rpl::map([=](int val) {
|
auto currentVal = AyuSettings::get_showPeerIdReactive() | rpl::map([=](int val) {
|
||||||
return options[val];
|
return options[val];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -90,28 +90,28 @@ void Tray::rebuildMenu() {
|
||||||
[=] { toggleSoundNotifications(); });
|
[=] { toggleSoundNotifications(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
// auto turnGhostModeText = _textUpdates.events(
|
auto turnGhostModeText = _textUpdates.events(
|
||||||
// ) | rpl::map([=] {
|
) | rpl::map([=] {
|
||||||
// auto settings = AyuSettings::AyuGramSettings();
|
auto settings = &AyuSettings::getInstance();
|
||||||
// bool ghostModeEnabled = settings.getGhostModeValue();
|
bool ghostModeEnabled = settings->get_ghostModeEnabled();
|
||||||
//
|
|
||||||
// return ghostModeEnabled
|
|
||||||
// ? tr::ayu_DisableGhostMode(tr::now)
|
|
||||||
// : tr::ayu_EnableGhostMode(tr::now);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// _tray.addAction(rpl::single(QString("Toggle ghost mode")), [=] {
|
return ghostModeEnabled
|
||||||
// auto settings = &AyuSettings::getInstance();
|
? tr::ayu_DisableGhostMode(tr::now)
|
||||||
// bool ghostMode = (bool) AyuSettings::get_ghostModeEnabled();
|
: tr::ayu_EnableGhostMode(tr::now);
|
||||||
//
|
});
|
||||||
// settings->set_sendReadPackets(!ghostMode);
|
|
||||||
// settings->set_sendOnlinePackets(!ghostMode);
|
_tray.addAction(std::move(turnGhostModeText), [=] {
|
||||||
// settings->set_sendUploadProgress(!ghostMode);
|
auto settings = &AyuSettings::getInstance();
|
||||||
//
|
bool ghostMode = !settings->get_ghostModeEnabled();
|
||||||
// settings->set_sendOfflinePacketAfterOnline(ghostMode);
|
|
||||||
//
|
settings->set_sendReadPackets(!ghostMode);
|
||||||
// AyuSettings::save();
|
settings->set_sendOnlinePackets(!ghostMode);
|
||||||
// });
|
settings->set_sendUploadProgress(!ghostMode);
|
||||||
|
|
||||||
|
settings->set_sendOfflinePacketAfterOnline(ghostMode);
|
||||||
|
|
||||||
|
AyuSettings::save();
|
||||||
|
});
|
||||||
|
|
||||||
auto quitText = _textUpdates.events(
|
auto quitText = _textUpdates.events(
|
||||||
) | rpl::map([=] {
|
) | rpl::map([=] {
|
||||||
|
|
|
@ -851,7 +851,7 @@ void MainMenu::setupMenu() {
|
||||||
_ghostModeToggle = addAction(
|
_ghostModeToggle = addAction(
|
||||||
tr::ayu_DrawerGhostModeToggle(),
|
tr::ayu_DrawerGhostModeToggle(),
|
||||||
{&st::ayuGhostIcon, kIconPurple}
|
{&st::ayuGhostIcon, kIconPurple}
|
||||||
)->toggleOn(AyuSettings::get_ghostModeEnabled());
|
)->toggleOn(AyuSettings::get_ghostModeEnabledReactive());
|
||||||
|
|
||||||
_ghostModeToggle->toggledChanges(
|
_ghostModeToggle->toggledChanges(
|
||||||
) | rpl::start_with_next([=](bool ghostMode) {
|
) | rpl::start_with_next([=](bool ghostMode) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue