diff --git a/Telegram/Resources/icons/chat/input_autodelete_30d.png b/Telegram/Resources/icons/chat/input_autodelete_30d.png new file mode 100644 index 0000000000..dc06d9a4d7 Binary files /dev/null and b/Telegram/Resources/icons/chat/input_autodelete_30d.png differ diff --git a/Telegram/Resources/icons/chat/input_autodelete_30d@2x.png b/Telegram/Resources/icons/chat/input_autodelete_30d@2x.png new file mode 100644 index 0000000000..b9f03cbbb5 Binary files /dev/null and b/Telegram/Resources/icons/chat/input_autodelete_30d@2x.png differ diff --git a/Telegram/Resources/icons/chat/input_autodelete_30d@3x.png b/Telegram/Resources/icons/chat/input_autodelete_30d@3x.png new file mode 100644 index 0000000000..69674dfdaf Binary files /dev/null and b/Telegram/Resources/icons/chat/input_autodelete_30d@3x.png differ diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index cf50921c95..5ce90423ed 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1017,8 +1017,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_manage_messages_ttl_title" = "Auto-delete messages"; "lng_manage_messages_ttl_never" = "Off"; -"lng_manage_messages_ttl_after1" = "24 hours"; -"lng_manage_messages_ttl_after2" = "7 days"; +"lng_manage_messages_ttl_after1" = "1 day"; +"lng_manage_messages_ttl_after2" = "1 week"; +"lng_manage_messages_ttl_after3" = "1 month"; "lng_ttl_edit_about" = "Automatically delete new messages after a certain period of time for you and {user}."; "lng_ttl_edit_about_group" = "Automatically delete new messages sent in this chat after a certain period of time."; @@ -1027,8 +1028,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_ttl_about_tooltip" = "New messages in this chat will be automatically deleted in {duration}."; "lng_ttl_about_tooltip_channel" = "New messages in this chat will be automatically deleted in {duration}."; "lng_ttl_about_tooltip_off" = "Auto-delete is now disabled."; -"lng_ttl_about_duration1" = "24 hours"; -"lng_ttl_about_duration2" = "7 days"; +"lng_ttl_about_duration1" = "1 day"; +"lng_ttl_about_duration2" = "1 week"; +"lng_ttl_about_duration3" = "1 month"; "lng_report_title" = "Report channel"; "lng_report_group_title" = "Report group"; diff --git a/Telegram/SourceFiles/boxes/about_box.cpp b/Telegram/SourceFiles/boxes/about_box.cpp index c43cb3afaf..f215088385 100644 --- a/Telegram/SourceFiles/boxes/about_box.cpp +++ b/Telegram/SourceFiles/boxes/about_box.cpp @@ -93,8 +93,6 @@ void AboutBox::showVersionHistory() { url += qsl("win/%1.zip"); } else if (Platform::IsWindows64Bit()) { url += qsl("win64/%1.zip"); - } else if (Platform::IsOSXBuild()) { - url += qsl("osx/%1.zip"); } else if (Platform::IsMac()) { url += qsl("mac/%1.zip"); } else if (Platform::IsLinux32Bit()) { diff --git a/Telegram/SourceFiles/core/crash_reports.cpp b/Telegram/SourceFiles/core/crash_reports.cpp index 022c6a14c9..47b6d69ccb 100644 --- a/Telegram/SourceFiles/core/crash_reports.cpp +++ b/Telegram/SourceFiles/core/crash_reports.cpp @@ -297,8 +297,6 @@ QString PlatformString() { return qsl("Windows64Bit"); } else if (Platform::IsMacStoreBuild()) { return qsl("MacAppStore"); - } else if (Platform::IsOSXBuild()) { - return qsl("OSX"); } else if (Platform::IsMac()) { return qsl("MacOS"); } else if (Platform::IsLinux32Bit()) { diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 421a2096b3..1068f1cb3d 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -2020,8 +2020,11 @@ void Session::scheduleNextTTLs() { } const auto nearest = _ttlMessages.begin()->first; const auto now = base::unixtime::now(); - const auto timeout = (std::max(now, nearest) - now) * crl::time(1000); - _ttlCheckTimer.callOnce(timeout); + + // Set timer not more than for 24 hours. + const auto maxTimeout = TimeId(86400); + const auto timeout = std::min(std::max(now, nearest) - now, maxTimeout); + _ttlCheckTimer.callOnce(timeout * crl::time(1000)); } void Session::unregisterMessageTTL( diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index 429e85c7f8..15dd167b74 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -1047,9 +1047,11 @@ void GenerateItems( const auto wrap = [](int duration) { return (duration == 5) ? u"5 seconds"_q - : (duration < 3 * 86400) + : (duration < 2 * 86400) ? tr::lng_manage_messages_ttl_after1(tr::now) - : tr::lng_manage_messages_ttl_after2(tr::now); + : (duration < 8 * 86400) + ? tr::lng_manage_messages_ttl_after2(tr::now) + : tr::lng_manage_messages_ttl_after3(tr::now); }; auto text = !was ? tr::lng_admin_log_messages_ttl_set(tr::now, lt_from, fromLinkText, lt_duration, wrap(now)) diff --git a/Telegram/SourceFiles/history/history_service.cpp b/Telegram/SourceFiles/history/history_service.cpp index ecb8ed9781..10fd3111e3 100644 --- a/Telegram/SourceFiles/history/history_service.cpp +++ b/Telegram/SourceFiles/history/history_service.cpp @@ -399,9 +399,11 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) { const auto period = action.vperiod().v; const auto duration = (period == 5) ? u"5 seconds"_q - : (period < 3 * 86400) + : (period < 2 * 86400) ? tr::lng_ttl_about_duration1(tr::now) - : tr::lng_ttl_about_duration2(tr::now); + : (period < 8 * 86400) + ? tr::lng_ttl_about_duration2(tr::now) + : tr::lng_ttl_about_duration3(tr::now); if (isPost()) { if (!period) { result.text = tr::lng_action_ttl_removed_channel(tr::now); diff --git a/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp b/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp index 1adcb2a42c..3e432e5e68 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp @@ -37,9 +37,11 @@ void ShowAutoDeleteToast(not_null peer) { const auto duration = (period == 5) ? u"5 seconds"_q - : (period < 3 * 86400) + : (period < 2 * 86400) ? tr::lng_ttl_about_duration1(tr::now) - : tr::lng_ttl_about_duration2(tr::now); + : (period < 8 * 86400) + ? tr::lng_ttl_about_duration2(tr::now) + : tr::lng_ttl_about_duration3(tr::now); const auto text = peer->isBroadcast() ? tr::lng_ttl_about_tooltip_channel(tr::now, lt_duration, duration) : tr::lng_ttl_about_tooltip(tr::now, lt_duration, duration); @@ -113,12 +115,16 @@ TTLButton::TTLButton(not_null parent, not_null peer) Data::PeerUpdate::Flag::MessagesTTL ) | rpl::start_with_next([=] { const auto ttl = peer->messagesTTL(); - if (ttl < 3 * 86400) { + if (ttl < 2 * 86400) { _button.setIconOverride(nullptr, nullptr); - } else { + } else if (ttl < 8 * 86400) { _button.setIconOverride( &st::historyMessagesTTL2Icon, &st::historyMessagesTTL2IconOver); + } else { + _button.setIconOverride( + &st::historyMessagesTTL3Icon, + &st::historyMessagesTTL3IconOver); } }, _button.lifetime()); } diff --git a/Telegram/SourceFiles/ui/boxes/auto_delete_settings.cpp b/Telegram/SourceFiles/ui/boxes/auto_delete_settings.cpp index df18993e0c..9cd9975ef2 100644 --- a/Telegram/SourceFiles/ui/boxes/auto_delete_settings.cpp +++ b/Telegram/SourceFiles/ui/boxes/auto_delete_settings.cpp @@ -204,15 +204,18 @@ void AutoDeleteSettingsBox( //u"5 seconds"_q, AssertIsDebug() tr::lng_manage_messages_ttl_after1(tr::now), tr::lng_manage_messages_ttl_after2(tr::now), + tr::lng_manage_messages_ttl_after3(tr::now), }; const auto periodToIndex = [&](TimeId period) { return !period ? 0 //: (period == 5) AssertIsDebug() //? 1 AssertIsDebug() - : (period < 3 * 86400) + : (period < 2 * 86400) ? 1 - : 2; + : (period < 8 * 86400) + ? 2 + : 3; }; const auto indexToPeriod = [&](int index) { return !index @@ -221,7 +224,9 @@ void AutoDeleteSettingsBox( //? 5 AssertIsDebug() : (index == 1) ? 86400 - : 7 * 86400; + : (index == 2) + ? 7 * 86400 + : 31 * 86400; }; const auto sliderCallback = [=](int index) { state->period = indexToPeriod(index); diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style index 0086dbd8ae..6dc263fa63 100644 --- a/Telegram/SourceFiles/ui/chat/chat.style +++ b/Telegram/SourceFiles/ui/chat/chat.style @@ -311,6 +311,8 @@ historyMessagesTTL: IconButton(historyAttach) { } historyMessagesTTL2Icon: icon {{ "chat/input_autodelete_7d", historyComposeIconFg }}; historyMessagesTTL2IconOver: icon {{ "chat/input_autodelete_7d", historyComposeIconFgOver }}; +historyMessagesTTL3Icon: icon {{ "chat/input_autodelete_30d", historyComposeIconFg }}; +historyMessagesTTL3IconOver: icon {{ "chat/input_autodelete_30d", historyComposeIconFgOver }}; historyAttachEmojiFgActive: windowActiveTextFg; historyAttachEmojiActive: icon {{ "chat/input_smile_face", historyAttachEmojiFgActive }}; historyAttachEmojiTooltipDelta: 4px;