diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index ebc840dd3..4b37c2697 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -3855,17 +3855,42 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "ayu_MarkReadAfterSend" = "Send read status after reply"; "ayu_UseScheduledMessages" = "Schedule messages"; "ayu_SpyEssentialsHeader" = "Spy essentials"; -"ayu_KeepDeletedMessages" = "Keep deleted messages"; -"ayu_KeepMessagesHistory" = "Keep edits history"; +"ayu_SaveDeletedMessages" = "Save deleted messages"; +"ayu_SaveMessagesHistory" = "Save edits history"; +"ayu_MessageSavingBtn" = "Message saving Preferences"; +"ayu_MessageSavingMediaHeader" = "Media"; +"ayu_MessageSavingSaveMedia" = "Save media"; +"ayu_MessageSavingSaveMediaInPrivateChats" = "…in private chats"; +"ayu_MessageSavingSaveMediaInPublicChannels" = "…in public channels"; +"ayu_MessageSavingSaveMediaInPrivateChannels" = "…in private channels"; +"ayu_MessageSavingSaveMediaInPublicGroups" = "…in public groups"; +"ayu_MessageSavingSaveMediaInPrivateGroups" = "…in private groups"; +"ayu_MessageSavingOtherHeader" = "Other"; +"ayu_MessageSavingSaveFormatting" = "Save formatting"; +"ayu_MessageSavingSaveReactions" = "Save reactions"; "ayu_QoLTogglesHeader" = "Useful features"; "ayu_ShowFromChannel" = "Show «channel» label"; "ayu_KeepAliveService" = "Keep Alive Service"; "ayu_EnableAds" = "Enable ads"; +"ayu_LocalPremium" = "Local Telegram Premium"; "ayu_CustomizationHeader" = "Customization"; "ayu_DeletedMarkText" = "Deleted mark"; "ayu_EditedMarkText" = "Edited mark"; "ayu_ShowGhostToggleInDrawer" = "Show ghost mode toggle"; "ayu_ShowKllButtonInDrawer" = "Show kill app button"; +"ayu_SettingsShowID" = "Show peer ID"; +"ayu_SettingsShowID_Hide" = "Hide"; +"ayu_SettingsRecentStickersCount" = "Recent stickers count"; +"ayu_SettingsCustomizationHint" = "After making changes to the \"Customization\" section, you must restart the application."; +"ayu_RegexFilters" = "Message filters"; +"ayu_RegexFiltersSubText" = "filters"; +"ayu_RegexFiltersHeader" = "Filters"; +"ayu_RegexFiltersEnableInChats" = "Enable in chats"; +"ayu_RegexFiltersCaseInsensitive" = "Case insensitive expressions"; +"ayu_RegexFiltersAdd" = "Add filter"; +"ayu_RegexFiltersEdit" = "Edit filter"; +"ayu_RegexFiltersAddDescription_Android" = "You can use site regex101.com]]> to fully test your regular expression.\nYou can also use plain text, but don't forget to escape brackets."; +"ayu_RegexFiltersAddError" = "Regex syntax error"; "ayu_AyuSyncHeader" = "AyuSync"; "ayu_AyuSyncStatusTitle" = "Sync status"; "ayu_AyuSyncStatusOk" = "connected"; @@ -3885,27 +3910,34 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "ayu_AyuSyncLastEventNever" = "never"; "ayu_AyuSyncUseSecureConnection" = "Use HTTPS & WSS"; "ayu_AyuSyncIdentifierCopied" = "Identifier copied to clipboard."; -"ayu_CleanDatabase" = "Clean database"; +"ayu_AyuSyncRegisterStatusCode" = "Register status code"; +"ayu_AyuSyncOpenPreferences" = "Open preferences"; +"ayu_AyuSyncDownloadAgent" = "Download agent"; "ayu_WALMode" = "Enable WAL mode"; +"ayu_CleanDatabase" = "Clean database"; "ayu_CleanDatabaseNotification" = "AyuGram database cleaned"; +"ayu_BetaFeatures" = "Beta features"; +"ayu_StickerConfirmation" = "Confirmation when sending stickers"; +"ayu_GIFConfirmation" = "Confirmation when sending GIFs"; +"ayu_VoiceConfirmation" = "Confirmation when sending voice messages"; "ayu_EnableGhostMode" = "Enable Ghost"; "ayu_DisableGhostMode" = "Disable Ghost"; "ayu_KillApp" = "Kill App"; +"ayu_DrawerGhostModeToggle" = "Ghost Mode"; "ayu_GhostModeEnabled" = "Ghost mode turned on"; "ayu_GhostModeDisabled" = "Ghost mode turned off"; "ayu_EditsHistoryTitle" = "Edits history"; "ayu_EditsHistoryMenuText" = "History"; "ayu_ReadUntilMenuText" = "Read until"; +"ayu_BoxActionReset" = "Reset"; +"ayu_ReadConfirmationBoxQuestion" = "Do you want to read all messages?"; +"ayu_ReadConfirmationBoxActionText" = "Read"; "ayu_ForwardsRestrictedInfoDeleted" = "Forwarding of a deleted message is not supported."; "ayu_DeleteDateMenuText" = "Delete Date"; "ayu_LikelyOfflineStatus" = "offline ?"; "ayu_GhostModeShortcut" = "Enter with Ghost"; "ayu_SettingsWatermark" = "AyuGram developed and maintained by Radolyn Labs."; -"ayu_SettingsCustomizationHint" = "After making changes to the \"Customization\" section, you must restart the application."; -"ayu_SettingsRecentStickersCount" = "Recent stickers count"; -"ayu_SettingsShowID" = "Show peer ID"; -"ayu_SettingsShowID_Hide" = "Hide"; "ayu_SettingsShowMessageSeconds" = "Show message seconds"; "ayu_ContextCopyID" = "Copy ID"; "ayu_IDCopiedToast" = "ID copied to clipboard."; -"ayu_DrawerGhostModeToggle" = "Ghost Mode"; +"ayu_ContextHideMessage" = "Hide"; diff --git a/Telegram/SourceFiles/ayu/ayu_settings.cpp b/Telegram/SourceFiles/ayu/ayu_settings.cpp index 3a2f60675..41df99615 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.cpp +++ b/Telegram/SourceFiles/ayu/ayu_settings.cpp @@ -108,7 +108,14 @@ namespace AyuSettings initialize(); json p = json::parse(data); - settings = p.get(); + try + { + settings = p.get(); + } + catch (...) + { + LOG(("AyuGramSettings: failed to parse settings file")); + } postinitialize(); } @@ -162,12 +169,12 @@ namespace AyuSettings void AyuGramSettings::set_keepDeletedMessages(bool val) { - keepDeletedMessages = val; + saveDeletedMessages = val; } void AyuGramSettings::set_keepMessagesHistory(bool val) { - keepMessagesHistory = val; + saveMessagesHistory = val; } void AyuGramSettings::set_enableAds(bool val) diff --git a/Telegram/SourceFiles/ayu/ayu_settings.h b/Telegram/SourceFiles/ayu/ayu_settings.h index 6e6aba0e1..d41472ea5 100644 --- a/Telegram/SourceFiles/ayu/ayu_settings.h +++ b/Telegram/SourceFiles/ayu/ayu_settings.h @@ -30,8 +30,8 @@ namespace AyuSettings useScheduledMessages = false; // ~ Message edits & deletion history - keepDeletedMessages = true; - keepMessagesHistory = true; + saveDeletedMessages = true; + saveMessagesHistory = true; // ~ QoL toggles enableAds = false; @@ -42,11 +42,6 @@ namespace AyuSettings recentStickersCount = 20; showGhostToggleInDrawer = true; - // ~ Beta functionality - stickerConfirmation = false; - GIFConfirmation = false; - voiceConfirmation = false; - /* * showPeerId = 0 means no ID shown * showPeerId = 1 means ID shown as for Telegram API devs @@ -55,6 +50,8 @@ namespace AyuSettings showPeerId = 2; showMessageSeconds = false; + + // ~ Beta functionality stickerConfirmation = false; GIFConfirmation = false; voiceConfirmation = false; @@ -66,8 +63,8 @@ namespace AyuSettings bool sendOfflinePacketAfterOnline; bool markReadAfterSend; bool useScheduledMessages; - bool keepDeletedMessages; - bool keepMessagesHistory; + bool saveDeletedMessages; + bool saveMessagesHistory; bool enableAds; QString deletedMark; QString editedMark; @@ -125,8 +122,8 @@ namespace AyuSettings sendOfflinePacketAfterOnline, markReadAfterSend, useScheduledMessages, - keepDeletedMessages, - keepMessagesHistory, + saveDeletedMessages, + saveMessagesHistory, enableAds, deletedMark, editedMark, diff --git a/Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.cpp b/Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.cpp index e8eebccf5..bbd64b1d2 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.cpp +++ b/Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.cpp @@ -26,11 +26,7 @@ namespace AyuUi void ConfirmationBox::prepare() { - // setTitle(rpl::single(QString("Confirmation for SRead"))); - auto details = TextWithEntities(); - details.text = QString("Do you want to read all messages?"); - - _text.create(this, rpl::single(std::move(details)), st::boxLabel); + _text.create(this, tr::ayu_ReadConfirmationBoxQuestion(), st::boxLabel); auto fullHeight = st::boxPadding.top() + _text->height() @@ -38,7 +34,7 @@ namespace AyuUi setDimensions(st::boxWidth, fullHeight); - addButton(rpl::single(QString("Read")), [=, this] + addButton(tr::ayu_ReadConfirmationBoxActionText(), [=, this] { ReadAllPeers(); closeBox(); diff --git a/Telegram/SourceFiles/ayu/ui/boxes/edit_deleted_mark.cpp b/Telegram/SourceFiles/ayu/ui/boxes/edit_deleted_mark.cpp index c69f50665..2b9404d11 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/edit_deleted_mark.cpp +++ b/Telegram/SourceFiles/ayu/ui/boxes/edit_deleted_mark.cpp @@ -32,7 +32,7 @@ EditDeletedMarkBox::EditDeletedMarkBox(QWidget*) : _text( this, st::defaultInputField, - rpl::single(QString("Deleted Mark")), + tr::ayu_DeletedMarkText(), AyuSettings::getInstance().deletedMark) { } @@ -42,12 +42,12 @@ void EditDeletedMarkBox::prepare() const auto defaultDeletedMark = "🧹"; auto newHeight = st::contactPadding.top() + _text->height(); - setTitle(rpl::single(QString("Edit Deleted Mark"))); + setTitle(tr::ayu_DeletedMarkText()); newHeight += st::boxPadding.bottom() + st::contactPadding.bottom(); setDimensions(st::boxWidth, newHeight); - addLeftButton(rpl::single(QString("Reset")), [=] { _text->setText(defaultDeletedMark); }); + addLeftButton(tr::ayu_BoxActionReset(), [=] { _text->setText(defaultDeletedMark); }); addButton(tr::lng_settings_save(), [=] { save(); }); addButton(tr::lng_cancel(), [=] { closeBox(); }); diff --git a/Telegram/SourceFiles/ayu/ui/boxes/edit_edited_mark.cpp b/Telegram/SourceFiles/ayu/ui/boxes/edit_edited_mark.cpp index 7a509501c..3653124c8 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/edit_edited_mark.cpp +++ b/Telegram/SourceFiles/ayu/ui/boxes/edit_edited_mark.cpp @@ -32,7 +32,7 @@ EditEditedMarkBox::EditEditedMarkBox(QWidget*) : _text( this, st::defaultInputField, - rpl::single(QString("Edited mark")), + tr::ayu_EditedMarkText(), AyuSettings::getInstance().editedMark) { } @@ -43,12 +43,12 @@ void EditEditedMarkBox::prepare() const auto defaultEditedMark = tr::lng_edited(tr::now); auto newHeight = st::contactPadding.top() + _text->height(); - setTitle(rpl::single(QString("Edit edited Mark"))); + setTitle(tr::ayu_EditedMarkText()); newHeight += st::boxPadding.bottom() + st::contactPadding.bottom(); setDimensions(st::boxWidth, newHeight); - addLeftButton(rpl::single(QString("Reset")), [=] { _text->setText(defaultEditedMark); }); + addLeftButton(tr::ayu_BoxActionReset(), [=] { _text->setText(defaultEditedMark); }); addButton(tr::lng_settings_save(), [=] { save(); }); addButton(tr::lng_cancel(), [=] { closeBox(); }); diff --git a/Telegram/SourceFiles/ayu/ui/boxes/voice_confirmation_box.cpp b/Telegram/SourceFiles/ayu/ui/boxes/voice_confirmation_box.cpp index 2711055a7..93353abf1 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/voice_confirmation_box.cpp +++ b/Telegram/SourceFiles/ayu/ui/boxes/voice_confirmation_box.cpp @@ -4,6 +4,7 @@ // but be respectful and credit the original author. // // Copyright @Radolyn, 2023 + #include "ui/boxes/confirm_box.h" #include "voice_confirmation_box.h" diff --git a/Telegram/SourceFiles/ayu/ui/boxes/voice_confirmation_box.h b/Telegram/SourceFiles/ayu/ui/boxes/voice_confirmation_box.h index 0751bcd4b..4b8b85ec9 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/voice_confirmation_box.h +++ b/Telegram/SourceFiles/ayu/ui/boxes/voice_confirmation_box.h @@ -4,6 +4,7 @@ // but be respectful and credit the original author. // // Copyright @Radolyn, 2023 + #pragma once #include "ui/boxes/confirm_box.h" diff --git a/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.cpp b/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.cpp index ff065da88..65d850e64 100644 --- a/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.cpp +++ b/Telegram/SourceFiles/ayu/ui/context_menu/context_menu.cpp @@ -39,9 +39,9 @@ namespace AyuUi { const auto settings = &AyuSettings::getInstance(); const auto history = item->history(); - _ayuSubMenu->addAction(QString("Hide"), [=]() + _ayuSubMenu->addAction(tr::ayu_ContextHideMessage(tr::now), [=]() { - const auto initKeepDeleted = settings->keepDeletedMessages; + const auto initKeepDeleted = settings->saveDeletedMessages; settings->set_keepDeletedMessages(false); history->destroyMessage(item); diff --git a/Telegram/SourceFiles/ayu/ui/context_menu/message_history_box.cpp b/Telegram/SourceFiles/ayu/ui/context_menu/message_history_box.cpp index ded4c94ce..cf11d2ae9 100644 --- a/Telegram/SourceFiles/ayu/ui/context_menu/message_history_box.cpp +++ b/Telegram/SourceFiles/ayu/ui/context_menu/message_history_box.cpp @@ -55,7 +55,6 @@ namespace AyuUi { setTitle(tr::ayu_EditsHistoryTitle()); - // setDimensionsToContent(st::boxWideWidth, _content); setDimensions(st::boxWideWidth, 900); SetupShadowsToScrollContent(this, _scroll, _contentHeight.events()); } diff --git a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp index b309edf41..9946c94e3 100644 --- a/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp +++ b/Telegram/SourceFiles/ayu/ui/settings/settings_ayu.cpp @@ -157,14 +157,14 @@ namespace Settings AddButton( container, - tr::ayu_KeepDeletedMessages(), + tr::ayu_SaveDeletedMessages(), st::settingsButtonNoIcon )->toggleOn( - rpl::single(settings->keepDeletedMessages) + rpl::single(settings->saveDeletedMessages) )->toggledValue( ) | rpl::filter([=](bool enabled) { - return (enabled != settings->keepDeletedMessages); + return (enabled != settings->saveDeletedMessages); }) | start_with_next([=](bool enabled) { settings->set_keepDeletedMessages(enabled); @@ -173,14 +173,14 @@ namespace Settings AddButton( container, - tr::ayu_KeepMessagesHistory(), + tr::ayu_SaveMessagesHistory(), st::settingsButtonNoIcon )->toggleOn( - rpl::single(settings->keepMessagesHistory) + rpl::single(settings->saveMessagesHistory) )->toggledValue( ) | rpl::filter([=](bool enabled) { - return (enabled != settings->keepMessagesHistory); + return (enabled != settings->saveMessagesHistory); }) | start_with_next([=](bool enabled) { settings->set_keepMessagesHistory(enabled); @@ -366,13 +366,13 @@ namespace Settings void Ayu::SetupAyuSync(not_null container) { - AddSubsectionTitle(container, rpl::single(QString("AyuSync"))); + AddSubsectionTitle(container, tr::ayu_AyuSyncHeader()); - auto text = AyuSync::isAgentDownloaded() ? QString("Open preferences") : QString("Download agent"); + auto text = AyuSync::isAgentDownloaded() ? tr::ayu_AyuSyncOpenPreferences() : tr::ayu_AyuSyncDownloadAgent(); AddButton( container, - rpl::single(text), + text, st::settingsButtonNoIcon )->addClickHandler([=] { @@ -385,11 +385,11 @@ namespace Settings { auto settings = &AyuSettings::getInstance(); - AddSubsectionTitle(container, rpl::single(QString("Beta functions"))); + AddSubsectionTitle(container, tr::ayu_BetaFeatures()); AddButton( container, - rpl::single(QString("Send sticker confirmation")), + tr::ayu_StickerConfirmation(), st::settingsButtonNoIcon )->toggleOn( rpl::single(settings->stickerConfirmation) @@ -405,7 +405,7 @@ namespace Settings AddButton( container, - rpl::single(QString("Send GIF confirmation")), + tr::ayu_GIFConfirmation(), st::settingsButtonNoIcon )->toggleOn( rpl::single(settings->GIFConfirmation) @@ -421,7 +421,7 @@ namespace Settings AddButton( container, - rpl::single(QString("Send voice confirmation")), + tr::ayu_VoiceConfirmation(), st::settingsButtonNoIcon )->toggleOn( rpl::single(settings->voiceConfirmation) diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 229186458..e104c0210 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -2164,7 +2164,7 @@ void Session::updateEditedMessage(const MTPMessage &data) { return; } - // AyuGram keepMessagesHistory + // AyuGram saveMessagesHistory const auto settings = &AyuSettings::getInstance(); HistoryMessageEdition edit; @@ -2173,7 +2173,7 @@ void Session::updateEditedMessage(const MTPMessage &data) { goto proceed; } edit = HistoryMessageEdition(_session, data.c_message()); - if (settings->keepMessagesHistory && !existing->isLocal() && !existing->author()->isSelf() && !edit.isEditHide) + if (settings->saveMessagesHistory && !existing->isLocal() && !existing->author()->isSelf() && !edit.isEditHide) { const auto history = existing->history(); const auto msg = existing->originalText(); diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 1800f2240..ae7727aed 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -479,9 +479,9 @@ not_null History::insertItem( void History::destroyMessage(not_null item) { Expects(item->isHistoryEntry() || !item->mainView()); - // AyuGram keepDeletedMessages + // AyuGram saveDeletedMessages const auto settings = &AyuSettings::getInstance(); - if (settings->keepDeletedMessages && item->isRegular() && !item->isGroupMigrate()) + if (settings->saveDeletedMessages && item->isRegular() && !item->isGroupMigrate()) { if (!item->isService()) { diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 4fb753e5f..63b7923c9 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -2389,7 +2389,7 @@ void HistoryItem::setForwardsCount(int count) { void HistoryItem::setPostAuthor(const QString &author) { const auto settings = &AyuSettings::getInstance(); - if (settings->keepDeletedMessages && !(_flags & MessageFlag::HasPostAuthor)) + if (settings->saveDeletedMessages && !(_flags & MessageFlag::HasPostAuthor)) { _flags |= MessageFlag::HasPostAuthor; } @@ -2413,7 +2413,7 @@ void HistoryItem::setPostAuthor(const QString &author) { msgsigned->isAnonymousRank = !isDiscussionPost() && this->author()->isMegagroup(); - if (settings->keepDeletedMessages) + if (settings->saveDeletedMessages) { history()->owner().requestItemViewRefresh(this); } diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index 7d69a7ecc..130059cd4 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -1094,7 +1094,7 @@ base::unique_qptr FillContextMenu( const auto history = item->history(); result->addAction(QString("Hide"), [=]() { - const auto initKeepDeleted = settings->keepDeletedMessages; + const auto initKeepDeleted = settings->saveDeletedMessages; settings->set_keepDeletedMessages(false); history->destroyMessage(item);