feat: don't read stories

feat: show message ID in tooltip
feat: update strings
fix: invert strings
This commit is contained in:
ZavaruKitsu 2023-08-01 12:45:59 +00:00
parent 486e6e681c
commit 576671e222
14 changed files with 174 additions and 101 deletions

View file

@ -3948,31 +3948,35 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_AyuPreferences" = "AyuGram Preferences"; "ayu_AyuPreferences" = "AyuGram Preferences";
"ayu_GhostEssentialsHeader" = "Ghost essentials"; "ayu_GhostEssentialsHeader" = "Ghost essentials";
"ayu_SendReadPackets" = "Send read status"; "ayu_DontReadMessages" = "Don't read messages";
"ayu_SendOnlinePackets" = "Send online status"; "ayu_DontReadStories" = "Don't read stories";
"ayu_SendUploadProgress" = "Send typing & upload status"; "ayu_DontSendOnlinePackets" = "Don't send online";
"ayu_DontSendUploadProgress" = "Don't send typing";
"ayu_SendOfflinePacketAfterOnline" = "Immediate offline after online"; "ayu_SendOfflinePacketAfterOnline" = "Immediate offline after online";
"ayu_MarkReadAfterSend" = "Send read status after reply"; "ayu_MarkReadAfterSend" = "Send read status after reply";
"ayu_UseScheduledMessages" = "Schedule messages"; "ayu_UseScheduledMessages" = "Schedule messages";
"ayu_SpyEssentialsHeader" = "Spy essentials"; "ayu_SpyEssentialsHeader" = "Spy essentials";
"ayu_SaveDeletedMessages" = "Save deleted messages"; "ayu_SaveDeletedMessages" = "Save deleted messages";
"ayu_SaveMessagesHistory" = "Save edits history"; "ayu_SaveMessagesHistory" = "Save edits history";
"ayu_MessageSavingBtn" = "Message saving Preferences"; "ayu_MessageSavingBtn" = "Message Saving Preferences";
"ayu_MessageSavingMediaHeader" = "Media"; "ayu_MessageSavingMediaHeader" = "Media";
"ayu_MessageSavingSaveMedia" = "Save media"; "ayu_MessageSavingSaveMedia" = "Save media";
"ayu_MessageSavingSaveMediaInPrivateChats" = "…in private chats"; "ayu_MessageSavingSaveMediaHint" = "Click for more";
"ayu_MessageSavingSaveMediaInPublicChannels" = "…in public channels"; "ayu_MessageSavingSaveMediaInPrivateChats" = "…in private chats";
"ayu_MessageSavingSaveMediaInPrivateChannels" = "…in private channels"; "ayu_MessageSavingSaveMediaInPublicChannels" = "…in public channels";
"ayu_MessageSavingSaveMediaInPublicGroups" = "…in public groups"; "ayu_MessageSavingSaveMediaInPrivateChannels" = "…in private channels";
"ayu_MessageSavingSaveMediaInPrivateGroups" = "…in private groups"; "ayu_MessageSavingSaveMediaInPublicGroups" = "…in public groups";
"ayu_MessageSavingSaveMediaInPrivateGroups" = "…in private groups";
"ayu_MessageSavingOtherHeader" = "Other"; "ayu_MessageSavingOtherHeader" = "Other";
"ayu_MessageSavingSaveFormatting" = "Save formatting"; "ayu_MessageSavingSaveFormatting" = "Save formatting";
"ayu_MessageSavingSaveReactions" = "Save reactions"; "ayu_MessageSavingSaveReactions" = "Save reactions";
"ayu_MessageSavingSaveForBots" = "Save in bot dialogs";
"ayu_QoLTogglesHeader" = "Useful features"; "ayu_QoLTogglesHeader" = "Useful features";
"ayu_ShowFromChannel" = "Show «channel» label"; "ayu_KeepAliveService" = "AyuGram Push Service";
"ayu_KeepAliveService" = "Keep Alive Service"; "ayu_DisableStories" = "Disable stories";
"ayu_EnableAds" = "Enable ads"; "ayu_DisableAds" = "Disable ads";
"ayu_LocalPremium" = "Local Telegram Premium"; "ayu_LocalPremium" = "Local Telegram Premium";
"ayu_CopyUsernameAsLink" = "Copy username as link";
"ayu_CustomizationHeader" = "Customization"; "ayu_CustomizationHeader" = "Customization";
"ayu_DeletedMarkText" = "Deleted mark"; "ayu_DeletedMarkText" = "Deleted mark";
"ayu_EditedMarkText" = "Edited mark"; "ayu_EditedMarkText" = "Edited mark";
@ -3982,14 +3986,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_SettingsShowID_Hide" = "Hide"; "ayu_SettingsShowID_Hide" = "Hide";
"ayu_SettingsRecentStickersCount" = "Recent stickers count"; "ayu_SettingsRecentStickersCount" = "Recent stickers count";
"ayu_SettingsCustomizationHint" = "After making changes to the \"Customization\" section, you must restart the application."; "ayu_SettingsCustomizationHint" = "After making changes to the \"Customization\" section, you must restart the application.";
"ayu_RegexFilters" = "Message filters"; "ayu_RegexFilters" = "Message Filters";
"ayu_RegexFiltersSubText" = "filters"; "ayu_RegexFiltersAmount" = "filters";
"ayu_RegexFiltersHeader" = "Filters"; "ayu_RegexFiltersHeader" = "Filters";
"ayu_RegexFiltersEnableInChats" = "Enable in chats"; "ayu_RegexFiltersEnableInChats" = "Enable in chats";
"ayu_RegexFiltersCaseInsensitive" = "Case insensitive expressions"; "ayu_RegexFiltersCaseInsensitive" = "Case insensitive expressions";
"ayu_RegexFiltersAdd" = "Add filter"; "ayu_RegexFiltersAdd" = "Add filter";
"ayu_RegexFiltersEdit" = "Edit filter"; "ayu_RegexFiltersEdit" = "Edit filter";
"ayu_RegexFiltersAddDescription_Android" = "You can use site <![CDATA[<a href=\"https://regex101.com\">regex101.com</a>]]> to fully test your regular expression.\nYou can also use plain text, but don't forget to escape brackets."; "ayu_RegexFiltersPlaceholder" = "Expression";
"ayu_RegexFiltersAddError" = "Regex syntax error"; "ayu_RegexFiltersAddError" = "Regex syntax error";
"ayu_AyuSyncHeader" = "AyuSync"; "ayu_AyuSyncHeader" = "AyuSync";
"ayu_AyuSyncStatusTitle" = "Sync status"; "ayu_AyuSyncStatusTitle" = "Sync status";
@ -3999,12 +4003,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_AyuSyncStatusErrorNoToken" = "no token"; "ayu_AyuSyncStatusErrorNoToken" = "no token";
"ayu_AyuSyncStatusErrorInvalidToken" = "invalid token"; "ayu_AyuSyncStatusErrorInvalidToken" = "invalid token";
"ayu_AyuSyncStatusErrorNoMVP" = "no MVP"; "ayu_AyuSyncStatusErrorNoMVP" = "no MVP";
"ayu_AyuSyncServerURL" = "AyuSync URL"; "ayu_AyuSyncServerURL" = "Server URL";
"ayu_AyuSyncServerToken" = "AyuSync token"; "ayu_AyuSyncServerToken" = "Access token";
"ayu_AyuSyncEnable" = "Enable synchronization"; "ayu_AyuSyncEnable" = "Enable synchronization";
"ayu_AyuSyncVisitProfile" = "Visit profile"; "ayu_AyuSyncVisitProfile" = "Visit profile";
"ayu_AyuSyncForceSync" = "Force sync clients"; "ayu_AyuSyncForceSync" = "Force sync clients";
"ayu_AyuSyncDeviceIdentifier" = "Device identifier"; "ayu_AyuSyncDeviceIdentifier" = "Device ID";
"ayu_AyuSyncLastEventSent" = "Last sent event"; "ayu_AyuSyncLastEventSent" = "Last sent event";
"ayu_AyuSyncLastEventReceived" = "Last received event"; "ayu_AyuSyncLastEventReceived" = "Last received event";
"ayu_AyuSyncLastEventNever" = "never"; "ayu_AyuSyncLastEventNever" = "never";
@ -4014,30 +4018,37 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_AyuSyncOpenPreferences" = "Open preferences"; "ayu_AyuSyncOpenPreferences" = "Open preferences";
"ayu_AyuSyncDownloadAgent" = "Download agent"; "ayu_AyuSyncDownloadAgent" = "Download agent";
"ayu_WALMode" = "Enable WAL mode"; "ayu_WALMode" = "Enable WAL mode";
"ayu_CleanDatabase" = "Clean database"; "ayu_ClearAyuDatabase" = "Clear Ayu Database";
"ayu_CleanDatabaseNotification" = "AyuGram database cleaned"; "ayu_ClearAyuDatabaseNotification" = "AyuGram database cleared";
"ayu_BetaFeatures" = "Beta features"; "ayu_EraseLocalDatabase" = "Erase Local Database";
"ayu_ConfirmationsTitle" = "Confirmations";
"ayu_StickerConfirmation" = "Confirmation when sending stickers"; "ayu_StickerConfirmation" = "Confirmation when sending stickers";
"ayu_GIFConfirmation" = "Confirmation when sending GIFs"; "ayu_GIFConfirmation" = "Confirmation when sending GIFs";
"ayu_VoiceConfirmation" = "Confirmation when sending voice messages"; "ayu_VoiceConfirmation" = "Confirmation when sending voice messages";
"ayu_EnableGhostMode" = "Enable Ghost"; "ayu_EnableGhostMode" = "Enable Ghost";
"ayu_DisableGhostMode" = "Disable Ghost"; "ayu_DisableGhostMode" = "Disable Ghost";
"ayu_KillApp" = "Kill App"; "ayu_KillApp" = "Kill App";
"ayu_DrawerGhostModeToggle" = "Ghost Mode"; "ayu_LReadMessages" = "Read on Local";
"ayu_SReadMessages" = "Read on Server";
"ayu_GhostModeToggle" = "Ghost Mode";
"ayu_GhostModeEnabled" = "Ghost mode turned on"; "ayu_GhostModeEnabled" = "Ghost mode turned on";
"ayu_GhostModeDisabled" = "Ghost mode turned off"; "ayu_GhostModeDisabled" = "Ghost mode turned off";
"ayu_EditsHistoryTitle" = "Edits history"; "ayu_EditsHistoryTitle" = "Edits history";
"ayu_EditsHistoryMenuText" = "History"; "ayu_EditsHistoryMenuText" = "History";
"ayu_ReadUntilMenuText" = "Read until"; "ayu_ReadUntilMenuText" = "Read until";
"ayu_DeleteKeepLocally" = "Keep locally";
"ayu_BoxActionReset" = "Reset"; "ayu_BoxActionReset" = "Reset";
"ayu_ReadConfirmationBoxQuestion" = "Do you want to read all messages?"; "ayu_ReadConfirmationBoxQuestion" = "Do you want to read all messages?";
"ayu_ReadConfirmationBoxActionText" = "Read"; "ayu_ReadConfirmationBoxActionText" = "Read";
"ayu_ForwardsRestrictedInfoDeleted" = "Forwarding of a deleted message is not supported."; "ayu_AyuForwardStatusForwarding" = "Forwarding messages…";
"ayu_AyuForwardStatusLoadingMedia" = "Loading media…";
"ayu_AyuForwardForwardingDescription" = "Please keep this window open while AyuGram is forwarding your messages.";
"ayu_AyuForwardLoadingMediaDescription" = "Please keep this window open while AyuGram is downloading media from your messages.";
"ayu_DeleteDateMenuText" = "Delete Date"; "ayu_DeleteDateMenuText" = "Delete Date";
"ayu_LikelyOfflineStatus" = "offline ?"; "ayu_LikelyOfflineStatus" = "offline ?";
"ayu_GhostModeShortcut" = "Enter with Ghost"; "ayu_GhostModeShortcut" = "Enter with Ghost";
"ayu_SettingsWatermark" = "AyuGram developed and maintained by Radolyn Labs.";
"ayu_SettingsShowMessageSeconds" = "Show message seconds"; "ayu_SettingsShowMessageSeconds" = "Show message seconds";
"ayu_ContextCopyID" = "Copy ID"; "ayu_ContextCopyID" = "Copy ID";
"ayu_IDCopiedToast" = "ID copied to clipboard."; "ayu_IDCopiedToast" = "ID copied to clipboard.";
"ayu_ContextHideMessage" = "Hide"; "ayu_ContextHideMessage" = "Hide";
"ayu_SettingsWatermark" = "AyuGram developed and maintained by Radolyn Labs.";

View file

@ -17,7 +17,8 @@ namespace AyuSettings
const QString filename = "tdata/ayu_settings.json"; const QString filename = "tdata/ayu_settings.json";
std::optional<AyuGramSettings> settings = std::nullopt; std::optional<AyuGramSettings> settings = std::nullopt;
rpl::variable<bool> sendReadPacketsReactive; rpl::variable<bool> sendReadMessagesReactive;
rpl::variable<bool> sendReadStoriesReactive;
rpl::variable<bool> sendOnlinePacketsReactive; rpl::variable<bool> sendOnlinePacketsReactive;
rpl::variable<bool> sendUploadProgressReactive; rpl::variable<bool> sendUploadProgressReactive;
rpl::variable<bool> sendOfflinePacketAfterOnlineReactive; rpl::variable<bool> sendOfflinePacketAfterOnlineReactive;
@ -32,10 +33,12 @@ namespace AyuSettings
bool ghostModeEnabled_util(AyuGramSettings& settingsUtil) bool ghostModeEnabled_util(AyuGramSettings& settingsUtil)
{ {
return (!settingsUtil.sendReadPackets return
!settingsUtil.sendReadMessages
&& !settingsUtil.sendReadStories
&& !settingsUtil.sendOnlinePackets && !settingsUtil.sendOnlinePackets
&& !settingsUtil.sendUploadProgress && !settingsUtil.sendUploadProgress
&& settingsUtil.sendOfflinePacketAfterOnline); && settingsUtil.sendOfflinePacketAfterOnline;
} }
void initialize() void initialize()
@ -47,13 +50,22 @@ namespace AyuSettings
settings = AyuGramSettings(); settings = AyuGramSettings();
sendReadPacketsReactive.value() | rpl::filter([=](bool val) sendReadMessagesReactive.value() | rpl::filter([=](bool val)
{ {
return (val != settings->sendReadPackets); return (val != settings->sendReadMessages);
}) | start_with_next([=](bool val) }) | start_with_next([=](bool val)
{ {
ghostModeEnabled = ghostModeEnabled_util(settings.value()); ghostModeEnabled = ghostModeEnabled_util(settings.value());
}, lifetime); }, lifetime);
// ..
sendReadStoriesReactive.value() | rpl::filter([=](bool val)
{
return (val != settings->sendReadStories);
}) | start_with_next([=](bool val)
{
ghostModeEnabled = ghostModeEnabled_util(settings.value());
}, lifetime);
// ..
sendOnlinePacketsReactive.value() | rpl::filter([=](bool val) sendOnlinePacketsReactive.value() | rpl::filter([=](bool val)
{ {
return (val != settings->sendOnlinePackets); return (val != settings->sendOnlinePackets);
@ -61,6 +73,7 @@ namespace AyuSettings
{ {
ghostModeEnabled = ghostModeEnabled_util(settings.value()); ghostModeEnabled = ghostModeEnabled_util(settings.value());
}, lifetime); }, lifetime);
// ..
sendUploadProgressReactive.value() | rpl::filter([=](bool val) sendUploadProgressReactive.value() | rpl::filter([=](bool val)
{ {
return (val != settings->sendUploadProgress); return (val != settings->sendUploadProgress);
@ -68,6 +81,7 @@ namespace AyuSettings
{ {
ghostModeEnabled = ghostModeEnabled_util(settings.value()); ghostModeEnabled = ghostModeEnabled_util(settings.value());
}, lifetime); }, lifetime);
// ..
sendOfflinePacketAfterOnlineReactive.value() | rpl::filter([=](bool val) sendOfflinePacketAfterOnlineReactive.value() | rpl::filter([=](bool val)
{ {
return (val != settings->sendOfflinePacketAfterOnline); return (val != settings->sendOfflinePacketAfterOnline);
@ -79,7 +93,7 @@ namespace AyuSettings
void postinitialize() void postinitialize()
{ {
sendReadPacketsReactive = settings->sendReadPackets; sendReadMessagesReactive = settings->sendReadMessages;
sendOnlinePacketsReactive = settings->sendOnlinePackets; sendOnlinePacketsReactive = settings->sendOnlinePackets;
deletedMarkReactive = settings->deletedMark; deletedMarkReactive = settings->deletedMark;
@ -133,10 +147,16 @@ namespace AyuSettings
postinitialize(); postinitialize();
} }
void AyuGramSettings::set_sendReadPackets(bool val) void AyuGramSettings::set_sendReadMessages(bool val)
{ {
sendReadPackets = val; sendReadMessages = val;
sendReadPacketsReactive = val; sendReadMessagesReactive = val;
}
void AyuGramSettings::set_sendReadStories(bool val)
{
sendReadStories = val;
sendReadStoriesReactive = val;
} }
void AyuGramSettings::set_sendOnlinePackets(bool val) void AyuGramSettings::set_sendOnlinePackets(bool val)
@ -157,6 +177,15 @@ namespace AyuSettings
sendOfflinePacketAfterOnlineReactive = val; sendOfflinePacketAfterOnlineReactive = val;
} }
void AyuGramSettings::set_ghostModeEnabled(bool val)
{
set_sendReadMessages(!val);
set_sendReadStories(!val);
set_sendOnlinePackets(!val);
set_sendUploadProgress(!val);
set_sendOfflinePacketAfterOnline(val);
}
void AyuGramSettings::set_markReadAfterSend(bool val) void AyuGramSettings::set_markReadAfterSend(bool val)
{ {
markReadAfterSend = val; markReadAfterSend = val;
@ -220,9 +249,9 @@ namespace AyuSettings
stickerConfirmation = val; stickerConfirmation = val;
} }
void AyuGramSettings::set_GIFConfirmation(bool val) void AyuGramSettings::set_gifConfirmation(bool val)
{ {
GIFConfirmation = val; gifConfirmation = val;
} }
void AyuGramSettings::set_voiceConfirmation(bool val) void AyuGramSettings::set_voiceConfirmation(bool val)

View file

@ -20,13 +20,13 @@ namespace AyuSettings
AyuGramSettings() AyuGramSettings()
{ {
// ~ Ghost essentials // ~ Ghost essentials
sendReadPackets = true; sendReadMessages = true;
sendReadStories = true;
sendOnlinePackets = true; sendOnlinePackets = true;
sendUploadProgress = true; sendUploadProgress = true;
sendOfflinePacketAfterOnline = false; sendOfflinePacketAfterOnline = false;
markReadAfterSend = true;
markReadAfterSend = true;
useScheduledMessages = false; useScheduledMessages = false;
// ~ Message edits & deletion history // ~ Message edits & deletion history
@ -35,6 +35,7 @@ namespace AyuSettings
// ~ QoL toggles // ~ QoL toggles
enableAds = false; enableAds = false;
disableStories = false;
copyUsernameAsLink = true; copyUsernameAsLink = true;
// ~ Customization // ~ Customization
@ -52,13 +53,14 @@ namespace AyuSettings
showMessageSeconds = false; showMessageSeconds = false;
// ~ Beta functionality // ~ Confirmations
stickerConfirmation = false; stickerConfirmation = false;
GIFConfirmation = false; gifConfirmation = false;
voiceConfirmation = false; voiceConfirmation = false;
} }
bool sendReadPackets; bool sendReadMessages;
bool sendReadStories;
bool sendOnlinePackets; bool sendOnlinePackets;
bool sendUploadProgress; bool sendUploadProgress;
bool sendOfflinePacketAfterOnline; bool sendOfflinePacketAfterOnline;
@ -67,6 +69,8 @@ namespace AyuSettings
bool saveDeletedMessages; bool saveDeletedMessages;
bool saveMessagesHistory; bool saveMessagesHistory;
bool enableAds; bool enableAds;
bool disableStories;
bool copyUsernameAsLink;
QString deletedMark; QString deletedMark;
QString editedMark; QString editedMark;
int recentStickersCount; int recentStickersCount;
@ -74,12 +78,13 @@ namespace AyuSettings
int showPeerId; int showPeerId;
bool showMessageSeconds; bool showMessageSeconds;
bool stickerConfirmation; bool stickerConfirmation;
bool GIFConfirmation; bool gifConfirmation;
bool voiceConfirmation; bool voiceConfirmation;
bool copyUsernameAsLink;
public: public:
void set_sendReadPackets(bool val); void set_sendReadMessages(bool val);
void set_sendReadStories(bool val);
void set_sendOnlinePackets(bool val); void set_sendOnlinePackets(bool val);
@ -87,6 +92,8 @@ namespace AyuSettings
void set_sendOfflinePacketAfterOnline(bool val); void set_sendOfflinePacketAfterOnline(bool val);
void set_ghostModeEnabled(bool val);
void set_markReadAfterSend(bool val); void set_markReadAfterSend(bool val);
void set_useScheduledMessages(bool val); void set_useScheduledMessages(bool val);
@ -111,7 +118,7 @@ namespace AyuSettings
void set_stickerConfirmation(bool val); void set_stickerConfirmation(bool val);
void set_GIFConfirmation(bool val); void set_gifConfirmation(bool val);
void set_voiceConfirmation(bool val); void set_voiceConfirmation(bool val);
@ -120,7 +127,8 @@ namespace AyuSettings
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE( NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
AyuGramSettings, AyuGramSettings,
sendReadPackets, sendReadMessages,
sendReadStories,
sendOnlinePackets, sendOnlinePackets,
sendUploadProgress, sendUploadProgress,
sendOfflinePacketAfterOnline, sendOfflinePacketAfterOnline,
@ -136,7 +144,7 @@ namespace AyuSettings
showPeerId, showPeerId,
showMessageSeconds, showMessageSeconds,
stickerConfirmation, stickerConfirmation,
GIFConfirmation, gifConfirmation,
voiceConfirmation, voiceConfirmation,
copyUsernameAsLink copyUsernameAsLink
); );

View file

@ -18,6 +18,6 @@ namespace AyuState
bool getAllowSendPacket() bool getAllowSendPacket()
{ {
auto settings = &AyuSettings::getInstance(); auto settings = &AyuSettings::getInstance();
return settings->sendReadPackets || processVariable(allowSendReadPacket); return settings->sendReadMessages || processVariable(allowSendReadPacket);
} }
} }

View file

@ -53,12 +53,12 @@ namespace AyuUi
void ConfirmationBox::ReadAllPeers() void ConfirmationBox::ReadAllPeers()
{ {
auto settings = &AyuSettings::getInstance(); auto settings = &AyuSettings::getInstance();
auto prev = settings->sendReadPackets; auto prev = settings->sendReadMessages;
settings->set_sendReadPackets(true); settings->set_sendReadMessages(true);
auto chats = _controller->session().data().chatsList(); auto chats = _controller->session().data().chatsList();
Window::MarkAsReadChatListHack(chats); Window::MarkAsReadChatListHack(chats);
settings->set_sendReadPackets(prev); settings->set_sendReadMessages(prev);
} }
} }

View file

@ -56,49 +56,65 @@ namespace Settings
AddButton( AddButton(
container, container,
tr::ayu_SendReadPackets(), tr::ayu_DontReadMessages(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(settings->sendReadPackets) rpl::single(!settings->sendReadMessages)
)->toggledValue( )->toggledValue(
) | rpl::filter([=](bool enabled) ) | rpl::filter([=](bool enabled)
{ {
return (enabled != settings->sendReadPackets); return (enabled == settings->sendReadMessages);
}) | start_with_next([=](bool enabled) }) | start_with_next([=](bool enabled)
{ {
settings->set_sendReadPackets(enabled); settings->set_sendReadMessages(!enabled);
AyuSettings::save(); AyuSettings::save();
}, container->lifetime()); }, container->lifetime());
AddButton( AddButton(
container, container,
tr::ayu_SendOnlinePackets(), tr::ayu_DontReadStories(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(settings->sendOnlinePackets) rpl::single(!settings->sendReadStories)
)->toggledValue( )->toggledValue(
) | rpl::filter([=](bool enabled) ) | rpl::filter([=](bool enabled)
{ {
return (enabled != settings->sendOnlinePackets); return (enabled == settings->sendReadStories);
}) | start_with_next([=](bool enabled) }) | start_with_next([=](bool enabled)
{ {
settings->set_sendOnlinePackets(enabled); settings->set_sendReadStories(!enabled);
AyuSettings::save(); AyuSettings::save();
}, container->lifetime()); }, container->lifetime());
AddButton( AddButton(
container, container,
tr::ayu_SendUploadProgress(), tr::ayu_DontSendOnlinePackets(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(settings->sendUploadProgress) rpl::single(!settings->sendOnlinePackets)
)->toggledValue( )->toggledValue(
) | rpl::filter([=](bool enabled) ) | rpl::filter([=](bool enabled)
{ {
return (enabled != settings->sendUploadProgress); return (enabled == settings->sendOnlinePackets);
}) | start_with_next([=](bool enabled) }) | start_with_next([=](bool enabled)
{ {
settings->set_sendUploadProgress(enabled); settings->set_sendOnlinePackets(!enabled);
AyuSettings::save();
}, container->lifetime());
AddButton(
container,
tr::ayu_DontSendUploadProgress(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(!settings->sendUploadProgress)
)->toggledValue(
) | rpl::filter([=](bool enabled)
{
return (enabled == settings->sendUploadProgress);
}) | start_with_next([=](bool enabled)
{
settings->set_sendUploadProgress(!enabled);
AyuSettings::save(); AyuSettings::save();
}, container->lifetime()); }, container->lifetime());
@ -198,23 +214,23 @@ namespace Settings
AddButton( AddButton(
container, container,
tr::ayu_EnableAds(), tr::ayu_DisableAds(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(settings->enableAds) rpl::single(!settings->enableAds)
)->toggledValue( )->toggledValue(
) | rpl::filter([=](bool enabled) ) | rpl::filter([=](bool enabled)
{ {
return (enabled != settings->enableAds); return (enabled == settings->enableAds);
}) | start_with_next([=](bool enabled) }) | start_with_next([=](bool enabled)
{ {
settings->set_enableAds(enabled); settings->set_enableAds(!enabled);
AyuSettings::save(); AyuSettings::save();
}, container->lifetime()); }, container->lifetime());
AddButton( AddButton(
container, container,
rpl::single(QString("Copy username as link")), tr::ayu_CopyUsernameAsLink(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(settings->copyUsernameAsLink) rpl::single(settings->copyUsernameAsLink)
@ -403,7 +419,7 @@ namespace Settings
{ {
auto settings = &AyuSettings::getInstance(); auto settings = &AyuSettings::getInstance();
AddSubsectionTitle(container, tr::ayu_BetaFeatures()); AddSubsectionTitle(container, tr::ayu_ConfirmationsTitle());
AddButton( AddButton(
container, container,
@ -426,14 +442,14 @@ namespace Settings
tr::ayu_GIFConfirmation(), tr::ayu_GIFConfirmation(),
st::settingsButtonNoIcon st::settingsButtonNoIcon
)->toggleOn( )->toggleOn(
rpl::single(settings->GIFConfirmation) rpl::single(settings->gifConfirmation)
)->toggledValue( )->toggledValue(
) | rpl::filter([=](bool enabled) ) | rpl::filter([=](bool enabled)
{ {
return (enabled != settings->GIFConfirmation); return (enabled != settings->gifConfirmation);
}) | start_with_next([=](bool enabled) }) | start_with_next([=](bool enabled)
{ {
settings->set_GIFConfirmation(enabled); settings->set_gifConfirmation(enabled);
AyuSettings::save(); AyuSettings::save();
}, container->lifetime()); }, container->lifetime());
@ -482,7 +498,7 @@ namespace Settings
AddSkip(container); AddSkip(container);
SetupSendConfirmations(container); SetupSendConfirmations(container);
AddDividerText(container, tr::ayu_SettingsWatermark()); AddDividerText(container, tr::ayu_SettingsWatermark());
} }

View file

@ -499,7 +499,7 @@ 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?")),

View file

@ -204,9 +204,9 @@ void Histories::readInboxTill(
AyuSync::getInstance().syncRead(history, tillId); AyuSync::getInstance().syncRead(history, tillId);
// AyuGram sendReadPackets // AyuGram sendReadMessages
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
auto allow = settings->sendReadPackets; auto allow = settings->sendReadMessages;
auto reallyAllow = AyuState::getAllowSendPacket(); // will return true if `allow` auto reallyAllow = AyuState::getAllowSendPacket(); // will return true if `allow`
if (!reallyAllow) if (!reallyAllow)
{ {

View file

@ -24,6 +24,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/layers/show.h" #include "ui/layers/show.h"
#include "ui/text/text_utilities.h" #include "ui/text/text_utilities.h"
// AyuGram includes
#include "ayu/ayu_settings.h"
namespace Data { namespace Data {
namespace { namespace {
@ -1127,11 +1131,21 @@ void Stories::sendMarkAsReadRequest(
checkQuitPreventFinished(); checkQuitPreventFinished();
}; };
const auto api = &_owner->session().api(); // AyuGram sendReadStories
api->request(MTPstories_ReadStories( const auto settings = &AyuSettings::getInstance();
peer->asUser()->inputUser,
MTP_int(tillId) if (settings->sendReadStories)
)).done(finish).fail(finish).send(); {
const auto api = &_owner->session().api();
api->request(MTPstories_ReadStories(
peer->asUser()->inputUser,
MTP_int(tillId)
)).done(finish).fail(finish).send();
}
else
{
finish();
}
} }
void Stories::checkQuitPreventFinished() { void Stories::checkQuitPreventFinished() {

View file

@ -3892,7 +3892,7 @@ void HistoryWidget::send(Api::SendOptions options) {
options.scheduled = current + 12; options.scheduled = current + 12;
} }
if (!settings->sendReadPackets && settings->markReadAfterSend) if (!settings->sendReadMessages && settings->markReadAfterSend)
{ {
AyuState::setAllowSendReadPacket(true); AyuState::setAllowSendReadPacket(true);
_history->session().data().histories().readInboxOnNewMessage(_history->lastMessage()); _history->session().data().histories().readInboxOnNewMessage(_history->lastMessage());

View file

@ -277,6 +277,9 @@ QString DateTooltipText(not_null<Element*> view) {
+ tr::lng_signed_author(tr::now, lt_user, msgsigned->author); + tr::lng_signed_author(tr::now, lt_user, msgsigned->author);
} }
} }
dateText += '\n';
dateText += "ID: ";
dateText += QString::number(item->id.bare);
return dateText; return dateText;
} }

View file

@ -103,13 +103,9 @@ void Tray::rebuildMenu() {
_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();
settings->set_sendReadPackets(!ghostMode); settings->set_ghostModeEnabled(!ghostMode);
settings->set_sendOnlinePackets(!ghostMode);
settings->set_sendUploadProgress(!ghostMode);
settings->set_sendOfflinePacketAfterOnline(ghostMode);
AyuSettings::save(); AyuSettings::save();
}); });

View file

@ -801,21 +801,21 @@ void MainMenu::setupMenu() {
controller->showPeerHistory(controller->session().user()); controller->showPeerHistory(controller->session().user());
}); });
addAction( addAction(
rpl::single(QString("LRead Messages")), tr::ayu_LReadMessages(),
{ &st::menuIconMarkRead } { &st::menuIconMarkRead }
)->setClickedCallback([=] )->setClickedCallback([=]
{ {
auto settings = &AyuSettings::getInstance(); auto settings = &AyuSettings::getInstance();
auto prev = settings->sendReadPackets; auto prev = settings->sendReadMessages;
settings->set_sendReadPackets(false); settings->set_sendReadMessages(false);
auto chats = controller->session().data().chatsList(); auto chats = controller->session().data().chatsList();
MarkAsReadChatListHack(chats); MarkAsReadChatListHack(chats);
settings->set_sendReadPackets(prev); settings->set_sendReadMessages(prev);
}); });
addAction( addAction(
rpl::single(QString("SRead Messages")), tr::ayu_SReadMessages(),
{ &st::menuIconMarkRead } { &st::menuIconMarkRead }
)->setClickedCallback([=] )->setClickedCallback([=]
{ {
@ -887,18 +887,14 @@ void MainMenu::setupMenu() {
if (settings->showGhostToggleInDrawer) if (settings->showGhostToggleInDrawer)
{ {
_ghostModeToggle = addAction( _ghostModeToggle = addAction(
tr::ayu_DrawerGhostModeToggle(), tr::ayu_GhostModeToggle(),
{ &st::menuIconSilent } // todo: fix `ayuGhostIcon` { &st::menuIconSilent } // todo: fix `ayuGhostIcon`
)->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_ghostModeEnabled(ghostMode);
settings->set_sendOnlinePackets(!ghostMode);
settings->set_sendUploadProgress(!ghostMode);
settings->set_sendOfflinePacketAfterOnline(ghostMode);
AyuSettings::save(); AyuSettings::save();
}, _ghostModeToggle->lifetime()); }, _ghostModeToggle->lifetime());

@ -1 +1 @@
Subproject commit 9f91b83c4c85b476a83f5da5e2b7986c68f410cf Subproject commit dbc0816644ba1caa533e69fb1cbf6ba5566f1150