fix: reformat with resharper

This commit is contained in:
ZavaruKitsu 2023-07-10 14:30:23 +00:00
parent ee5ade56d7
commit f72e7178f5
18 changed files with 425 additions and 366 deletions

View file

@ -117,7 +117,8 @@ void SendProgressManager::send(const Key &key, int progress) {
// AyuGram sendUploadProgress // AyuGram sendUploadProgress
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
if (!settings->sendUploadProgress) { if (!settings->sendUploadProgress)
{
DEBUG_LOG(("[AyuGram] Don't send upload progress")); DEBUG_LOG(("[AyuGram] Don't send upload progress"));
return; return;
} }

View file

@ -903,12 +903,13 @@ void Updates::updateOnline(crl::time lastNonIdleTime, bool gotOtherOffline) {
// AyuGram sendOnlinePackets // AyuGram sendOnlinePackets
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
const auto &config = _session->serverConfig(); const auto& config = _session->serverConfig();
bool isOnlineOrig = Core::App().hasActiveWindow(&session()); bool isOnlineOrig = Core::App().hasActiveWindow(&session());
bool isOnline = settings->sendOnlinePackets && isOnlineOrig; bool isOnline = settings->sendOnlinePackets && isOnlineOrig;
// AyuGram sendOfflinePacketAfterOnline // AyuGram sendOfflinePacketAfterOnline
if (settings->sendOfflinePacketAfterOnline && _lastWasOnline) { if (settings->sendOfflinePacketAfterOnline && _lastWasOnline)
{
isOnline = false; isOnline = false;
} }
@ -966,9 +967,11 @@ void Updates::updateOnline(crl::time lastNonIdleTime, bool gotOtherOffline) {
} }
// AyuGram sendOfflinePacketAfterOnline // AyuGram sendOfflinePacketAfterOnline
if (settings->sendOfflinePacketAfterOnline) { if (settings->sendOfflinePacketAfterOnline)
{
session().api().requestFullPeer(session().user()); session().api().requestFullPeer(session().user());
if (session().user()->onlineTill > base::unixtime::now()) { if (session().user()->onlineTill > base::unixtime::now())
{
DEBUG_LOG(("[AyuGram] User likely appeared online")); DEBUG_LOG(("[AyuGram] User likely appeared online"));
_onlineRequest = api().request(MTPaccount_UpdateStatus( _onlineRequest = api().request(MTPaccount_UpdateStatus(

View file

@ -3487,7 +3487,8 @@ void ApiWrap::sendUploadedPhoto(
if (const auto item = _session->data().message(localId)) { if (const auto item = _session->data().message(localId)) {
// AyuGram useScheduledMessages // AyuGram useScheduledMessages
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
if (settings->useScheduledMessages && !options.scheduled) { if (settings->useScheduledMessages && !options.scheduled)
{
DEBUG_LOG(("[AyuGram] Scheduling message")); DEBUG_LOG(("[AyuGram] Scheduling message"));
auto current = base::unixtime::now(); auto current = base::unixtime::now();
options.scheduled = current + 18; // using 18 seconds because photo can be big options.scheduled = current + 18; // using 18 seconds because photo can be big
@ -3513,7 +3514,8 @@ void ApiWrap::sendUploadedDocument(
// AyuGram useScheduledMessages // AyuGram useScheduledMessages
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
if (settings->useScheduledMessages && !options.scheduled) { if (settings->useScheduledMessages && !options.scheduled)
{
DEBUG_LOG(("[AyuGram] Scheduling message")); DEBUG_LOG(("[AyuGram] Scheduling message"));
auto current = base::unixtime::now(); auto current = base::unixtime::now();
options.scheduled = current + 60; // well, a document can be really big... options.scheduled = current + 60; // well, a document can be really big...
@ -3932,7 +3934,8 @@ void ApiWrap::sendMediaWithRandomId(
uint64 randomId) { uint64 randomId) {
// AyuGram useScheduledMessages // AyuGram useScheduledMessages
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
if (settings->useScheduledMessages && !options.scheduled) { if (settings->useScheduledMessages && !options.scheduled)
{
DEBUG_LOG(("[AyuGram] Scheduling message")); DEBUG_LOG(("[AyuGram] Scheduling message"));
auto current = base::unixtime::now(); auto current = base::unixtime::now();
options.scheduled = current + 12; options.scheduled = current + 12;
@ -4033,7 +4036,8 @@ void ApiWrap::sendAlbumIfReady(not_null<SendingAlbum*> album) {
// AyuGram useScheduledMessages // AyuGram useScheduledMessages
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
if (settings->useScheduledMessages && !album->options.scheduled) { if (settings->useScheduledMessages && !album->options.scheduled)
{
DEBUG_LOG(("[AyuGram] Scheduling message")); DEBUG_LOG(("[AyuGram] Scheduling message"));
auto current = base::unixtime::now(); auto current = base::unixtime::now();
album->options.scheduled = current + 12; album->options.scheduled = current + 12;

View file

@ -1340,7 +1340,8 @@ void SendFilesBox::send(
bool ctrlShiftEnter) { bool ctrlShiftEnter) {
// AyuGram useScheduledMessages // AyuGram useScheduledMessages
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
if (settings->useScheduledMessages && !options.scheduled) { if (settings->useScheduledMessages && !options.scheduled)
{
DEBUG_LOG(("[AyuGram] Scheduling files")); DEBUG_LOG(("[AyuGram] Scheduling files"));
auto current = base::unixtime::now(); auto current = base::unixtime::now();
options.scheduled = current + 60; // well, files can be really big... options.scheduled = current + 60; // well, files can be really big...

View file

@ -485,7 +485,8 @@ void GifsListWidget::selectInlineResult(
const auto preview = Data::VideoPreviewState(media.get()); const auto preview = Data::VideoPreviewState(media.get());
if (forceSend || (media && preview.loaded())) { if (forceSend || (media && preview.loaded())) {
auto settings = &AyuSettings::getInstance(); auto settings = &AyuSettings::getInstance();
auto sendGIFCallback = [=, this] { auto sendGIFCallback = [=, this]
{
_fileChosen.fire({ _fileChosen.fire({
.document = document, .document = document,
.options = options, .options = options,
@ -493,14 +494,16 @@ void GifsListWidget::selectInlineResult(
}); });
}; };
if (settings->GIFConfirmation) { if (settings->GIFConfirmation)
{
Ui::show(Ui::MakeConfirmBox({ Ui::show(Ui::MakeConfirmBox({
.text = rpl::single(QString("Do you want to send this GIF?")), .text = rpl::single(QString("Do you want to send this GIF?")),
.confirmed = sendGIFCallback, .confirmed = sendGIFCallback,
.confirmText = rpl::single(QString("Send")), .confirmText = rpl::single(QString("Send")),
})); }));
} }
else { else
{
sendGIFCallback(); sendGIFCallback();
} }
} else if (!preview.usingThumbnail()) { } else if (!preview.usingThumbnail()) {

View file

@ -1711,11 +1711,13 @@ void StickersListWidget::mouseReleaseEvent(QMouseEvent *e) {
showStickerSetBox(document); showStickerSetBox(document);
} else { } else {
auto settings = &AyuSettings::getInstance(); auto settings = &AyuSettings::getInstance();
if (settings->stickerConfirmation) { if (settings->stickerConfirmation)
{
// it is necessary to store it here, because section & index can be changed by cursor position (guess) // it is necessary to store it here, because section & index can be changed by cursor position (guess)
int currentSection = sticker->section; int currentSection = sticker->section;
int currentIndex = sticker->index; int currentIndex = sticker->index;
auto sendStickerCallback = [=, this] { auto sendStickerCallback = [=, this]
{
_chosen.fire({ _chosen.fire({
.document = document, .document = document,
.messageSendingFrom = messageSentAnimationInfo( .messageSendingFrom = messageSentAnimationInfo(
@ -1731,7 +1733,8 @@ void StickersListWidget::mouseReleaseEvent(QMouseEvent *e) {
.confirmText = rpl::single(QString("Send")), .confirmText = rpl::single(QString("Send")),
})); }));
} }
else { else
{
_chosen.fire({ _chosen.fire({
.document = document, .document = document,
.messageSendingFrom = messageSentAnimationInfo( .messageSendingFrom = messageSentAnimationInfo(

View file

@ -184,7 +184,8 @@ void Histories::readInboxTill(
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
auto allow = settings->sendReadPackets; auto allow = settings->sendReadPackets;
auto reallyAllow = AyuState::getAllowSendPacket(); // will return true if `allow` auto reallyAllow = AyuState::getAllowSendPacket(); // will return true if `allow`
if (!reallyAllow) { if (!reallyAllow)
{
DEBUG_LOG(("[AyuGram] Don't read messages")); DEBUG_LOG(("[AyuGram] Don't read messages"));
return; return;
} }
@ -211,7 +212,8 @@ void Histories::readInboxTill(
} }
return; return;
} else if (!needsRequest && (allow != reallyAllow && !force) } else if (!needsRequest && (allow != reallyAllow && !force)
&& (!maybeState || !maybeState->willReadTill)) { && (!maybeState || !maybeState->willReadTill))
{
return; return;
} }
const auto stillUnread = history->countStillUnreadLocal(tillId); const auto stillUnread = history->countStillUnreadLocal(tillId);

View file

@ -2168,32 +2168,40 @@ void Session::updateEditedMessage(const MTPMessage &data) {
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
HistoryMessageEdition edit; HistoryMessageEdition edit;
if (data.type() != mtpc_message) { if (data.type() != mtpc_message)
{
goto proceed; goto proceed;
} }
edit = HistoryMessageEdition(_session, data.c_message()); edit = HistoryMessageEdition(_session, data.c_message());
if (settings->keepMessagesHistory && !existing->isLocal() && !existing->author()->isSelf() && !edit.isEditHide) { if (settings->keepMessagesHistory && !existing->isLocal() && !existing->author()->isSelf() && !edit.isEditHide)
{
const auto history = existing->history(); const auto history = existing->history();
const auto msg = existing->originalText(); const auto msg = existing->originalText();
const auto media = existing->media(); const auto media = existing->media();
if (edit.textWithEntities == msg) { if (edit.textWithEntities == msg)
{
// check if media changed // check if media changed
if (!edit.mtpMedia) { if (!edit.mtpMedia)
{
goto proceed; goto proceed;
} }
if (edit.mtpMedia->type() == mtpc_messageMediaPhoto if (edit.mtpMedia->type() == mtpc_messageMediaPhoto
&& media->photo() && media->photo()
&& edit.mtpMedia->c_messageMediaPhoto().vphoto()->c_photo().vaccess_hash() == media->photo()->mtpInput().c_inputPhoto().vaccess_hash()) { && edit.mtpMedia->c_messageMediaPhoto().vphoto()->c_photo().vaccess_hash() == media->photo()->mtpInput()
.c_inputPhoto().vaccess_hash())
{
goto proceed; goto proceed;
} }
if (edit.mtpMedia->type() == mtpc_messageMediaDocument if (edit.mtpMedia->type() == mtpc_messageMediaDocument
&& media->document() && media->document()
&& edit.mtpMedia->c_messageMediaDocument().vdocument()->c_document().vaccess_hash() == media->document()->mtpInput().c_inputDocument().vaccess_hash()) { && edit.mtpMedia->c_messageMediaDocument().vdocument()->c_document().vaccess_hash() == media->document()
->mtpInput().c_inputDocument().vaccess_hash())
{
goto proceed; goto proceed;
} }
} }
@ -2202,7 +2210,8 @@ void Session::updateEditedMessage(const MTPMessage &data) {
| MessageFlag::HasReplyInfo | MessageFlag::HasReplyInfo
| MessageFlag::HasPostAuthor; | MessageFlag::HasPostAuthor;
if (existing->isPost()) { if (existing->isPost())
{
flags |= MessageFlag::Post; flags |= MessageFlag::Post;
} }
@ -2212,51 +2221,58 @@ void Session::updateEditedMessage(const MTPMessage &data) {
auto msgId = existing->id.bare; auto msgId = existing->id.bare;
bool isDocument = media && media->document(); bool isDocument = media && media->document();
AyuDatabase::addEditedMessage((long) userId, (long) dialogId, (long) msgId, msg.text, isDocument, QString(""), (long) crl::now()); AyuDatabase::addEditedMessage((long)userId, (long)dialogId, (long)msgId, msg.text, isDocument, QString(""),
(long)crl::now());
if (!media || !(media->photo() || media->document())) { if (!media || !(media->photo() || media->document()))
// history->addNewLocalMessage( {
// history->nextNonHistoryEntryId(), // history->addNewLocalMessage(
// flags, // history->nextNonHistoryEntryId(),
// UserId(), // flags,
// existing->id, // UserId(),
// base::unixtime::now(), // existing->id,
// existing->author()->id, // base::unixtime::now(),
// "AyuGram"_q, // existing->author()->id,
// msg, // "AyuGram"_q,
// MTP_messageMediaEmpty(), // msg,
// HistoryMessageMarkupData(), // MTP_messageMediaEmpty(),
// existing->groupId().empty() ? 0 : existing->groupId().value); // HistoryMessageMarkupData(),
} else { // existing->groupId().empty() ? 0 : existing->groupId().value);
if (media->photo()) { }
// history->addNewLocalMessage( else
// history->nextNonHistoryEntryId(), {
// flags, if (media->photo())
// UserId(), {
// existing->id, // history->addNewLocalMessage(
// base::unixtime::now(), // history->nextNonHistoryEntryId(),
// existing->author()->id, // flags,
// "AyuGram"_q, // UserId(),
// media->photo(), // existing->id,
// existing->originalText(), // base::unixtime::now(),
// HistoryMessageMarkupData()); // existing->author()->id,
} else if (media->document()) { // "AyuGram"_q,
// history->addNewLocalMessage( // media->photo(),
// history->nextNonHistoryEntryId(), // existing->originalText(),
// flags, // HistoryMessageMarkupData());
// UserId(), }
// existing->id, else if (media->document())
// base::unixtime::now(), {
// existing->author()->id, // history->addNewLocalMessage(
// "AyuGram"_q, // history->nextNonHistoryEntryId(),
// media->document(), // flags,
// existing->originalText(), // UserId(),
// HistoryMessageMarkupData()); // existing->id,
// base::unixtime::now(),
// existing->author()->id,
// "AyuGram"_q,
// media->document(),
// existing->originalText(),
// HistoryMessageMarkupData());
} }
} }
} }
proceed: proceed:
if (existing->isLocalUpdateMedia() && data.type() == mtpc_message) { if (existing->isLocalUpdateMedia() && data.type() == mtpc_message) {
updateExistingMessage(data.c_message()); updateExistingMessage(data.c_message());

View file

@ -481,10 +481,14 @@ void History::destroyMessage(not_null<HistoryItem*> item) {
// AyuGram keepDeletedMessages // AyuGram keepDeletedMessages
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
if (settings->keepDeletedMessages && item->isRegular() && !item->isGroupMigrate()) { if (settings->keepDeletedMessages && item->isRegular() && !item->isGroupMigrate())
if (!item->isService()) { {
if (!item->isService())
{
item->setPostAuthor(settings->deletedMark); item->setPostAuthor(settings->deletedMark);
} else { }
else
{
const auto msg = TextWithEntities{ const auto msg = TextWithEntities{
"Message deleted", "Message deleted",
{ {
@ -501,7 +505,8 @@ void History::destroyMessage(not_null<HistoryItem*> item) {
| MessageFlag::HasReplyInfo | MessageFlag::HasReplyInfo
| MessageFlag::HasPostAuthor; | MessageFlag::HasPostAuthor;
if (item->isPost()) { if (item->isPost())
{
flags |= MessageFlag::Post; flags |= MessageFlag::Post;
} }

View file

@ -2389,7 +2389,8 @@ void HistoryItem::setForwardsCount(int count) {
void HistoryItem::setPostAuthor(const QString &author) { void HistoryItem::setPostAuthor(const QString &author) {
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
if (settings->keepDeletedMessages && !(_flags & MessageFlag::HasPostAuthor)) { if (settings->keepDeletedMessages && !(_flags & MessageFlag::HasPostAuthor))
{
_flags |= MessageFlag::HasPostAuthor; _flags |= MessageFlag::HasPostAuthor;
} }
@ -2412,7 +2413,8 @@ void HistoryItem::setPostAuthor(const QString &author) {
msgsigned->isAnonymousRank = !isDiscussionPost() msgsigned->isAnonymousRank = !isDiscussionPost()
&& this->author()->isMegagroup(); && this->author()->isMegagroup();
if (settings->keepDeletedMessages) { if (settings->keepDeletedMessages)
{
history()->owner().requestItemViewRefresh(this); history()->owner().requestItemViewRefresh(this);
} }

View file

@ -3868,13 +3868,15 @@ Api::SendAction HistoryWidget::prepareSendAction(
void HistoryWidget::send(Api::SendOptions options) { void HistoryWidget::send(Api::SendOptions options) {
// AyuGram useScheduledMessages // AyuGram useScheduledMessages
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
if (settings->useScheduledMessages && !options.scheduled) { if (settings->useScheduledMessages && !options.scheduled)
{
DEBUG_LOG(("[AyuGram] Scheduling message")); DEBUG_LOG(("[AyuGram] Scheduling message"));
auto current = base::unixtime::now(); auto current = base::unixtime::now();
options.scheduled = current + 12; options.scheduled = current + 12;
} }
if (!settings->sendReadPackets && settings->markReadAfterSend) { if (!settings->sendReadPackets && settings->markReadAfterSend)
{
AyuState::setAllowSendReadPacket(true); AyuState::setAllowSendReadPacket(true);
_history->session().data().histories().readInboxOnNewMessage(_history->lastMessage()); _history->session().data().histories().readInboxOnNewMessage(_history->lastMessage());
} }

View file

@ -1431,24 +1431,27 @@ void VoiceRecordBar::stopRecording(StopType type) {
window()->raise(); window()->raise();
window()->activateWindow(); window()->activateWindow();
const auto duration = Duration(data.samples); const auto duration = Duration(data.samples);
auto settings = &AyuSettings::getInstance();
if (type == StopType::Send) { auto settings = &AyuSettings::getInstance();
auto sendVoiceCallback = [=, this] { if (type == StopType::Send)
_sendVoiceRequests.fire({ data.bytes, data.waveform, duration }); {
auto sendVoiceCallback = [=, this]
{
_sendVoiceRequests.fire({data.bytes, data.waveform, duration});
}; };
if (settings->voiceConfirmation) { if (settings->voiceConfirmation)
{
Ui::show(AyuUi::MakeConfirmBox({ Ui::show(AyuUi::MakeConfirmBox({
.text = rpl::single(QString("Do you want to send voice message?")), .text = rpl::single(QString("Do you want to send voice message?")),
.confirmed = sendVoiceCallback, .confirmed = sendVoiceCallback,
.confirmText = rpl::single(QString("Send")) .confirmText = rpl::single(QString("Send"))
})); }));
} }
else { else
{
sendVoiceCallback(); sendVoiceCallback();
} }
} else if (type == StopType::Listen) { } else if (type == StopType::Listen) {
_listen = std::make_unique<ListenWrap>( _listen = std::make_unique<ListenWrap>(
this, this,
@ -1523,7 +1526,8 @@ void VoiceRecordBar::requestToSendWithOptions(Api::SendOptions options) {
const auto data = _listen->data(); const auto data = _listen->data();
auto settings = &AyuSettings::getInstance(); auto settings = &AyuSettings::getInstance();
auto sendVoiceCallback = [=, this] { auto sendVoiceCallback = [=, this]
{
_sendVoiceRequests.fire({ _sendVoiceRequests.fire({
data->bytes, data->bytes,
data->waveform, data->waveform,
@ -1532,14 +1536,16 @@ void VoiceRecordBar::requestToSendWithOptions(Api::SendOptions options) {
}); });
}; };
if (settings->voiceConfirmation) { if (settings->voiceConfirmation)
{
Ui::show(AyuUi::MakeConfirmBox({ Ui::show(AyuUi::MakeConfirmBox({
.text = rpl::single(QString("Do you want to send voice message?")), .text = rpl::single(QString("Do you want to send voice message?")),
.confirmed = sendVoiceCallback, .confirmed = sendVoiceCallback,
.confirmText = rpl::single(QString("Send")) .confirmText = rpl::single(QString("Send"))
})); }));
} }
else { else
{
sendVoiceCallback(); sendVoiceCallback();
} }
} }

View file

@ -1079,9 +1079,12 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
} }
} }
if (item != nullptr) { if (item != nullptr)
if (AyuDatabase::editedMessagesTableExists() && !((AyuDatabase::getEditedMessages(item)).empty())) { {
result->addAction(QString("History"), [=] { if (AyuDatabase::editedMessagesTableExists() && !((AyuDatabase::getEditedMessages(item)).empty()))
{
result->addAction(QString("History"), [=]
{
auto box = Box<AyuUi::MessageHistoryBox>(item); auto box = Box<AyuUi::MessageHistoryBox>(item);
Ui::show(std::move(box)); Ui::show(std::move(box));
}, &st::menuIconInfo); }, &st::menuIconInfo);
@ -1089,7 +1092,8 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
const auto history = item->history(); const auto history = item->history();
result->addAction(QString("Hide"), [=]() { result->addAction(QString("Hide"), [=]()
{
const auto initKeepDeleted = settings->keepDeletedMessages; const auto initKeepDeleted = settings->keepDeletedMessages;
settings->set_keepDeletedMessages(false); settings->set_keepDeletedMessages(false);

View file

@ -91,7 +91,8 @@ void Tray::rebuildMenu() {
} }
auto turnGhostModeText = _textUpdates.events( auto turnGhostModeText = _textUpdates.events(
) | rpl::map([=] { ) | rpl::map([=]
{
bool ghostModeEnabled = AyuSettings::get_ghostModeEnabled(); bool ghostModeEnabled = AyuSettings::get_ghostModeEnabled();
return ghostModeEnabled return ghostModeEnabled
@ -99,7 +100,8 @@ void Tray::rebuildMenu() {
: tr::ayu_EnableGhostMode(tr::now); : tr::ayu_EnableGhostMode(tr::now);
}); });
_tray.addAction(std::move(turnGhostModeText), [=] { _tray.addAction(std::move(turnGhostModeText), [=]
{
auto settings = &AyuSettings::getInstance(); auto settings = &AyuSettings::getInstance();
bool ghostMode = !AyuSettings::get_ghostModeEnabled(); bool ghostMode = !AyuSettings::get_ghostModeEnabled();
@ -113,7 +115,8 @@ void Tray::rebuildMenu() {
}); });
auto quitText = _textUpdates.events( auto quitText = _textUpdates.events(
) | rpl::map([=] { ) | rpl::map([=]
{
return tr::lng_quit_from_tray(tr::now).replace("Telegram", "AyuGram"); return tr::lng_quit_from_tray(tr::now).replace("Telegram", "AyuGram");
}); });
_tray.addAction(std::move(quitText), [] { Core::Quit(); }); _tray.addAction(std::move(quitText), [] { Core::Quit(); });

View file

@ -767,8 +767,9 @@ void MainMenu::setupMenu() {
}); });
addAction( addAction(
rpl::single(QString("LRead Messages")), rpl::single(QString("LRead Messages")),
{ &st::settingsIconForward, kIconPurple } {&st::settingsIconForward, kIconPurple}
)->setClickedCallback([=] { )->setClickedCallback([=]
{
auto settings = &AyuSettings::getInstance(); auto settings = &AyuSettings::getInstance();
auto prev = settings->sendReadPackets; auto prev = settings->sendReadPackets;
settings->set_sendReadPackets(false); settings->set_sendReadPackets(false);
@ -780,8 +781,9 @@ void MainMenu::setupMenu() {
}); });
addAction( addAction(
rpl::single(QString("SRead Messages")), rpl::single(QString("SRead Messages")),
{ &st::settingsIconForward, kIconPurple } {&st::settingsIconForward, kIconPurple}
)->setClickedCallback([=] { )->setClickedCallback([=]
{
auto box = Box<AyuUi::ConfirmationBox>(controller); auto box = Box<AyuUi::ConfirmationBox>(controller);
Ui::show(std::move(box)); Ui::show(std::move(box));
}); });
@ -847,14 +849,16 @@ void MainMenu::setupMenu() {
}, _nightThemeToggle->lifetime()); }, _nightThemeToggle->lifetime());
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
if (settings->showGhostToggleInDrawer) { if (settings->showGhostToggleInDrawer)
{
_ghostModeToggle = addAction( _ghostModeToggle = addAction(
tr::ayu_DrawerGhostModeToggle(), tr::ayu_DrawerGhostModeToggle(),
{&st::ayuGhostIcon, kIconPurple} {&st::ayuGhostIcon, kIconPurple}
)->toggleOn(AyuSettings::get_ghostModeEnabledReactive()); )->toggleOn(AyuSettings::get_ghostModeEnabledReactive());
_ghostModeToggle->toggledChanges( _ghostModeToggle->toggledChanges(
) | rpl::start_with_next([=](bool ghostMode) { ) | rpl::start_with_next([=](bool ghostMode)
{
settings->set_sendReadPackets(!ghostMode); settings->set_sendReadPackets(!ghostMode);
settings->set_sendOnlinePackets(!ghostMode); settings->set_sendOnlinePackets(!ghostMode);
settings->set_sendUploadProgress(!ghostMode); settings->set_sendUploadProgress(!ghostMode);