diff --git a/.github/workflows/mac_packaged.yml b/.github/workflows/mac_packaged.yml index 5147f6cbe..631ff2a70 100644 --- a/.github/workflows/mac_packaged.yml +++ b/.github/workflows/mac_packaged.yml @@ -40,7 +40,7 @@ jobs: macos: name: MacOS - runs-on: macos-latest + runs-on: macos-13 strategy: matrix: @@ -67,6 +67,8 @@ jobs: - name: First set up. run: | + brew update + brew upgrade || true brew install autoconf automake boost cmake ffmpeg openal-soft openssl opus ninja pkg-config python qt yasm xz sudo xcode-select -s /Applications/Xcode.app/Contents/Developer diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index f924fe7a5..53b517939 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -1,7 +1,6 @@ name: Windows. on: - workflow_dispatch: push: paths-ignore: - 'docs/**' @@ -47,10 +46,11 @@ jobs: strategy: matrix: - arch: [Win32] + arch: [Win32, x64] + generator: ["", "Ninja Multi-Config"] env: - UPLOAD_ARTIFACT: "true" + UPLOAD_ARTIFACT: "false" ONLY_CACHE: "false" PREPARE_PATH: "Telegram/build/prepare/prepare.py" @@ -110,19 +110,42 @@ jobs: cd %TBUILD% %REPO_NAME%\Telegram\build\prepare\win.bat skip-release silent - - name: Read defines. + - name: Read configuration matrix. shell: bash run: | + ARTIFACT_NAME="Telegram" + + ARCH="" + if [ -n "${{ matrix.arch }}" ]; then + case "${{ matrix.arch }}" in + Win32) ARCH="x86";; + *) ARCH="${{ matrix.arch }}";; + esac + echo "Architecture from matrix: $ARCH" + ARTIFACT_NAME="${ARTIFACT_NAME}_${{ matrix.arch }}" + fi + + GENERATOR="" + if [ -n "${{ matrix.generator }}" ]; then + GENERATOR="-G \"${{ matrix.generator }}\"" + echo "Generator from matrix: $GENERATOR" + ARTIFACT_NAME="${ARTIFACT_NAME}_${{ matrix.generator }}" + fi + echo "TDESKTOP_BUILD_GENERATOR=$GENERATOR" >> $GITHUB_ENV + + [ -n "$GENERATOR" ] && ARCH="" + echo "TDESKTOP_BUILD_ARCH=$ARCH" >> $GITHUB_ENV + DEFINE="" if [ -n "${{ matrix.defines }}" ]; then DEFINE="-D ${{ matrix.defines }}=ON" echo "Define from matrix: $DEFINE" - echo "ARTIFACT_NAME=Telegram_${{ matrix.arch }}_${{ matrix.defines }}" >> $GITHUB_ENV - else - echo "ARTIFACT_NAME=Telegram_${{ matrix.arch }}" >> $GITHUB_ENV + ARTIFACT_NAME="${ARTIFACT_NAME}_${{ matrix.defines }}" fi echo "TDESKTOP_BUILD_DEFINE=$DEFINE" >> $GITHUB_ENV + echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV + API="-D TDESKTOP_API_TEST=ON" if [ $GITHUB_REF == 'refs/heads/nightly' ]; then echo "Use the open credentials." @@ -143,50 +166,23 @@ jobs: cd %TBUILD%\%REPO_NAME%\Telegram call configure.bat ^ - ${{ matrix.arch }} ^ + %TDESKTOP_BUILD_GENERATOR% ^ + %TDESKTOP_BUILD_ARCH% ^ %TDESKTOP_BUILD_API% ^ -D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF ^ -D DESKTOP_APP_NO_PDB=ON ^ - %TDESKTOP_BUILD_DEFINE% ^ - -DCMAKE_SYSTEM_VERSION=%SDK% + %TDESKTOP_BUILD_DEFINE% - cd ..\out - msbuild -m Telegram.sln /p:Configuration=Debug,Platform=${{ matrix.arch }},DebugSymbols=false,DebugType=none + cmake --build ..\out --config Debug --parallel - name: Move artifact. - if: (env.UPLOAD_ARTIFACT == 'true') || ${{ github.ref == 'refs/heads/nightly' }} + if: (env.UPLOAD_ARTIFACT == 'true') || (github.ref == 'refs/heads/nightly') run: | mkdir artifact - move %TBUILD%\%REPO_NAME%\out\Debug\AyuGram.exe artifact/ + move %TBUILD%\%REPO_NAME%\out\Debug\Telegram.exe artifact/ - uses: actions/upload-artifact@master name: Upload artifact. - if: (env.UPLOAD_ARTIFACT == 'true') || ${{ github.ref == 'refs/heads/nightly' }} + if: (env.UPLOAD_ARTIFACT == 'true') || (github.ref == 'refs/heads/nightly') with: name: ${{ env.ARTIFACT_NAME }} path: artifact\ - - release: - name: Release - needs: [windows] - runs-on: ubuntu-latest - strategy: - fail-fast: true - steps: - - uses: actions/checkout@v2 - - - name: Merge Releases - uses: actions/download-artifact@v2 - with: - name: Telegram_Win32 - path: artifact - - - name: Upload release - uses: Hs1r1us/Release-AIO@v1.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - # The name of the tag - tag_name: prelease-${{ github.run_number }} - prerelease: true - release_name: Ayugram CI - asset_files: './artifact' diff --git a/.gitmodules b/.gitmodules index 7972f7ae3..9cbb4a41a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -76,9 +76,6 @@ [submodule "Telegram/lib_webview"] path = Telegram/lib_webview url = https://github.com/desktop-app/lib_webview.git -[submodule "Telegram/ThirdParty/jemalloc"] - path = Telegram/ThirdParty/jemalloc - url = https://github.com/jemalloc/jemalloc [submodule "Telegram/ThirdParty/dispatch"] path = Telegram/ThirdParty/dispatch url = https://github.com/apple/swift-corelibs-libdispatch diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d82efbfe..fbcd97777 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,9 @@ if (APPLE) else() cmake_minimum_required(VERSION 3.16) endif() -cmake_policy(SET CMP0076 NEW) -cmake_policy(SET CMP0091 NEW) +if (POLICY CMP0149) + cmake_policy(SET CMP0149 NEW) +endif() set_property(GLOBAL PROPERTY USE_FOLDERS ON) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 6a71c866d..355d831c8 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -197,6 +197,8 @@ PRIVATE api/api_messages_search.h api/api_messages_search_merged.cpp api/api_messages_search_merged.h + api/api_peer_colors.cpp + api/api_peer_colors.h api/api_peer_photo.cpp api/api_peer_photo.h api/api_polls.cpp @@ -447,16 +449,18 @@ PRIVATE chat_helpers/gifs_list_widget.h chat_helpers/message_field.cpp chat_helpers/message_field.h + chat_helpers/share_message_phrase_factory.cpp + chat_helpers/share_message_phrase_factory.h chat_helpers/spellchecker_common.cpp chat_helpers/spellchecker_common.h + chat_helpers/stickers_dice_pack.cpp + chat_helpers/stickers_dice_pack.h chat_helpers/stickers_emoji_image_loader.cpp chat_helpers/stickers_emoji_image_loader.h chat_helpers/stickers_emoji_pack.cpp chat_helpers/stickers_emoji_pack.h chat_helpers/stickers_gift_box_pack.cpp chat_helpers/stickers_gift_box_pack.h - chat_helpers/stickers_dice_pack.cpp - chat_helpers/stickers_dice_pack.h chat_helpers/stickers_list_footer.cpp chat_helpers/stickers_list_footer.h chat_helpers/stickers_list_widget.cpp @@ -778,6 +782,8 @@ PRIVATE history/view/media/history_view_premium_gift.h history/view/media/history_view_service_box.cpp history/view/media/history_view_service_box.h + history/view/media/history_view_similar_channels.cpp + history/view/media/history_view_similar_channels.h history/view/media/history_view_slot_machine.cpp history/view/media/history_view_slot_machine.h history/view/media/history_view_sticker.cpp @@ -853,6 +859,8 @@ PRIVATE history/view/history_view_service_message.h history/view/history_view_spoiler_click_handler.cpp history/view/history_view_spoiler_click_handler.h + history/view/history_view_sponsored_click_handler.cpp + history/view/history_view_sponsored_click_handler.h history/view/history_view_sticker_toast.cpp history/view/history_view_sticker_toast.h history/view/history_view_transcribe_button.cpp @@ -958,6 +966,8 @@ PRIVATE info/profile/info_profile_widget.h info/settings/info_settings_widget.cpp info/settings/info_settings_widget.h + info/similar_channels/info_similar_channels_widget.cpp + info/similar_channels/info_similar_channels_widget.h info/statistics/info_statistics_common.h info/statistics/info_statistics_inner_widget.cpp info/statistics/info_statistics_inner_widget.h @@ -1095,6 +1105,8 @@ PRIVATE media/stories/media_stories_recent_views.h media/stories/media_stories_reply.cpp media/stories/media_stories_reply.h + media/stories/media_stories_repost_view.cpp + media/stories/media_stories_repost_view.h media/stories/media_stories_share.cpp media/stories/media_stories_share.h media/stories/media_stories_sibling.cpp @@ -1345,8 +1357,8 @@ PRIVATE settings/settings_calls.h settings/settings_codes.cpp settings/settings_codes.h - settings/settings_common.cpp - settings/settings_common.h + settings/settings_common_session.cpp + settings/settings_common_session.h settings/settings_experimental.cpp settings/settings_experimental.h settings/settings_folders.cpp @@ -1506,6 +1518,7 @@ PRIVATE window/window_section_common.h window/window_session_controller.cpp window/window_session_controller.h + window/window_session_controller_link_info.h window/window_slide_animation.cpp window/window_slide_animation.h window/window_top_bar_wrap.h @@ -1798,6 +1811,10 @@ endif() set_target_properties(Telegram PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder}) if (WIN32) + target_link_libraries(Telegram + PRIVATE + delayimp + ) target_link_options(Telegram PRIVATE /DELAYLOAD:secur32.dll @@ -1854,6 +1871,10 @@ if (NOT DESKTOP_APP_DISABLE_AUTOUPDATE AND NOT build_macstore AND NOT build_wins ) target_include_directories(Updater PRIVATE ${lib_base_loc}) if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + target_link_libraries(Updater + PRIVATE + delayimp + ) target_link_options(Updater PRIVATE /DELAYLOAD:user32.dll diff --git a/Telegram/Resources/icons/chat/input_edit.png b/Telegram/Resources/icons/chat/input_edit.png index 28639bab2..432825313 100644 Binary files a/Telegram/Resources/icons/chat/input_edit.png and b/Telegram/Resources/icons/chat/input_edit.png differ diff --git a/Telegram/Resources/icons/chat/input_edit@2x.png b/Telegram/Resources/icons/chat/input_edit@2x.png index 8e7bbf2ed..70c031a4a 100644 Binary files a/Telegram/Resources/icons/chat/input_edit@2x.png and b/Telegram/Resources/icons/chat/input_edit@2x.png differ diff --git a/Telegram/Resources/icons/chat/input_edit@3x.png b/Telegram/Resources/icons/chat/input_edit@3x.png index 7da15659a..fa6be01a5 100644 Binary files a/Telegram/Resources/icons/chat/input_edit@3x.png and b/Telegram/Resources/icons/chat/input_edit@3x.png differ diff --git a/Telegram/Resources/icons/chat/mini_lock.png b/Telegram/Resources/icons/chat/mini_lock.png new file mode 100644 index 000000000..a81e9beb5 Binary files /dev/null and b/Telegram/Resources/icons/chat/mini_lock.png differ diff --git a/Telegram/Resources/icons/chat/mini_lock@2x.png b/Telegram/Resources/icons/chat/mini_lock@2x.png new file mode 100644 index 000000000..e4936715f Binary files /dev/null and b/Telegram/Resources/icons/chat/mini_lock@2x.png differ diff --git a/Telegram/Resources/icons/chat/mini_lock@3x.png b/Telegram/Resources/icons/chat/mini_lock@3x.png new file mode 100644 index 000000000..2fd8ee86a Binary files /dev/null and b/Telegram/Resources/icons/chat/mini_lock@3x.png differ diff --git a/Telegram/Resources/icons/chat/mini_subscribers.png b/Telegram/Resources/icons/chat/mini_subscribers.png new file mode 100644 index 000000000..d9cac3f63 Binary files /dev/null and b/Telegram/Resources/icons/chat/mini_subscribers.png differ diff --git a/Telegram/Resources/icons/chat/mini_subscribers@2x.png b/Telegram/Resources/icons/chat/mini_subscribers@2x.png new file mode 100644 index 000000000..1e6a9f054 Binary files /dev/null and b/Telegram/Resources/icons/chat/mini_subscribers@2x.png differ diff --git a/Telegram/Resources/icons/chat/mini_subscribers@3x.png b/Telegram/Resources/icons/chat/mini_subscribers@3x.png new file mode 100644 index 000000000..1e4a68bc7 Binary files /dev/null and b/Telegram/Resources/icons/chat/mini_subscribers@3x.png differ diff --git a/Telegram/Resources/icons/info/edit/stickers_add.png b/Telegram/Resources/icons/info/edit/stickers_add.png new file mode 100644 index 000000000..d4c77a202 Binary files /dev/null and b/Telegram/Resources/icons/info/edit/stickers_add.png differ diff --git a/Telegram/Resources/icons/info/edit/stickers_add@2x.png b/Telegram/Resources/icons/info/edit/stickers_add@2x.png new file mode 100644 index 000000000..f188f440d Binary files /dev/null and b/Telegram/Resources/icons/info/edit/stickers_add@2x.png differ diff --git a/Telegram/Resources/icons/info/edit/stickers_add@3x.png b/Telegram/Resources/icons/info/edit/stickers_add@3x.png new file mode 100644 index 000000000..48de8115e Binary files /dev/null and b/Telegram/Resources/icons/info/edit/stickers_add@3x.png differ diff --git a/Telegram/Resources/icons/mediaview/mini_repost.png b/Telegram/Resources/icons/mediaview/mini_repost.png new file mode 100644 index 000000000..95e0e71eb Binary files /dev/null and b/Telegram/Resources/icons/mediaview/mini_repost.png differ diff --git a/Telegram/Resources/icons/mediaview/mini_repost@2x.png b/Telegram/Resources/icons/mediaview/mini_repost@2x.png new file mode 100644 index 000000000..47e5fd6af Binary files /dev/null and b/Telegram/Resources/icons/mediaview/mini_repost@2x.png differ diff --git a/Telegram/Resources/icons/mediaview/mini_repost@3x.png b/Telegram/Resources/icons/mediaview/mini_repost@3x.png new file mode 100644 index 000000000..3b73fe2d3 Binary files /dev/null and b/Telegram/Resources/icons/mediaview/mini_repost@3x.png differ diff --git a/Telegram/Resources/icons/menu/mode_messages.png b/Telegram/Resources/icons/menu/mode_messages.png new file mode 100644 index 000000000..a1a15eea2 Binary files /dev/null and b/Telegram/Resources/icons/menu/mode_messages.png differ diff --git a/Telegram/Resources/icons/menu/mode_messages@2x.png b/Telegram/Resources/icons/menu/mode_messages@2x.png new file mode 100644 index 000000000..0218c696f Binary files /dev/null and b/Telegram/Resources/icons/menu/mode_messages@2x.png differ diff --git a/Telegram/Resources/icons/menu/mode_messages@3x.png b/Telegram/Resources/icons/menu/mode_messages@3x.png new file mode 100644 index 000000000..faffe713b Binary files /dev/null and b/Telegram/Resources/icons/menu/mode_messages@3x.png differ diff --git a/Telegram/Resources/icons/menu/mode_topics.png b/Telegram/Resources/icons/menu/mode_topics.png new file mode 100644 index 000000000..e64c31734 Binary files /dev/null and b/Telegram/Resources/icons/menu/mode_topics.png differ diff --git a/Telegram/Resources/icons/menu/mode_topics@2x.png b/Telegram/Resources/icons/menu/mode_topics@2x.png new file mode 100644 index 000000000..11eccab70 Binary files /dev/null and b/Telegram/Resources/icons/menu/mode_topics@2x.png differ diff --git a/Telegram/Resources/icons/menu/mode_topics@3x.png b/Telegram/Resources/icons/menu/mode_topics@3x.png new file mode 100644 index 000000000..e0b678367 Binary files /dev/null and b/Telegram/Resources/icons/menu/mode_topics@3x.png differ diff --git a/Telegram/Resources/icons/statistics/mini_stats_like.png b/Telegram/Resources/icons/statistics/mini_stats_like.png new file mode 100644 index 000000000..0f21e7213 Binary files /dev/null and b/Telegram/Resources/icons/statistics/mini_stats_like.png differ diff --git a/Telegram/Resources/icons/statistics/mini_stats_like@2x.png b/Telegram/Resources/icons/statistics/mini_stats_like@2x.png new file mode 100644 index 000000000..1c72c0131 Binary files /dev/null and b/Telegram/Resources/icons/statistics/mini_stats_like@2x.png differ diff --git a/Telegram/Resources/icons/statistics/mini_stats_like@3x.png b/Telegram/Resources/icons/statistics/mini_stats_like@3x.png new file mode 100644 index 000000000..5a02e90e0 Binary files /dev/null and b/Telegram/Resources/icons/statistics/mini_stats_like@3x.png differ diff --git a/Telegram/Resources/icons/statistics/mini_stats_share.png b/Telegram/Resources/icons/statistics/mini_stats_share.png new file mode 100644 index 000000000..17772dc34 Binary files /dev/null and b/Telegram/Resources/icons/statistics/mini_stats_share.png differ diff --git a/Telegram/Resources/icons/statistics/mini_stats_share@2x.png b/Telegram/Resources/icons/statistics/mini_stats_share@2x.png new file mode 100644 index 000000000..d5785b282 Binary files /dev/null and b/Telegram/Resources/icons/statistics/mini_stats_share@2x.png differ diff --git a/Telegram/Resources/icons/statistics/mini_stats_share@3x.png b/Telegram/Resources/icons/statistics/mini_stats_share@3x.png new file mode 100644 index 000000000..8a0e1a72d Binary files /dev/null and b/Telegram/Resources/icons/statistics/mini_stats_share@3x.png differ diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 3f6b89211..41d36cbf4 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -839,6 +839,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_background_dimming" = "Background dimming"; "lng_background_sure_reset_default" = "Are you sure you want to reset the wallpaper?"; "lng_background_reset_default" = "Reset"; +"lng_background_apply_me" = "Apply for me"; +"lng_background_apply_both" = "Apply for me and {user}"; "lng_download_path_ask" = "Ask download path for each file"; "lng_download_path" = "Download path"; @@ -1175,6 +1177,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_profile_bot_privacy" = "Bot Privacy Policy"; "lng_profile_common_groups#one" = "{count} group in common"; "lng_profile_common_groups#other" = "{count} groups in common"; +"lng_profile_similar_channels#one" = "{count} similar channel"; +"lng_profile_similar_channels#other" = "{count} similar channels"; "lng_profile_participants_section" = "Members"; "lng_profile_subscribers_section" = "Subscribers"; "lng_profile_add_contact" = "Add Contact"; @@ -1347,6 +1351,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_manage_peer_reactions_none_about" = "Members of the group can't add any reactions to messages."; "lng_manage_peer_reactions_some_title" = "Only allow these reactions"; "lng_manage_peer_reactions_available" = "Available reactions"; +"lng_manage_peer_reactions_own" = "You can also {link} emoji packs and use them as reactions."; +"lng_manage_peer_reactions_own_link" = "create your own"; +"lng_manage_peer_reactions_level#one" = "Your channel needs to reach level **{count}** to use **{same_count}** custom reaction."; +"lng_manage_peer_reactions_level#other" = "Your channel needs to reach level **{count}** to use **{same_count}** custom reactions."; +"lng_manage_peer_reactions_boost" = "Boost your channel {link}."; +"lng_manage_peer_reactions_boost_link" = "here"; +"lng_manage_peer_reactions_limit" = "Channels can't have more custom reactions."; "lng_manage_peer_antispam" = "Aggressive Anti-Spam"; "lng_manage_peer_antispam_about" = "Telegram will filter more spam but may occasionally affect ordinary messages. You can report False Positives in Recent Actions."; @@ -1641,11 +1652,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_action_suggested_video_button" = "View Video"; "lng_action_attach_menu_bot_allowed" = "You allowed this bot to message you when you added it in the attachment menu."; "lng_action_webapp_bot_allowed" = "You allowed this bot to message you in his web-app."; -"lng_action_set_wallpaper_me" = "You set a new wallpaper for this chat"; -"lng_action_set_wallpaper" = "{user} set a new wallpaper for this chat"; +"lng_action_set_wallpaper_me" = "You set a new wallpaper for this chat."; +"lng_action_set_wallpaper" = "{user} set a new wallpaper for this chat."; +"lng_action_set_wallpaper_both_me" = "You set a new wallpaper for {user} and you."; "lng_action_set_wallpaper_button" = "View Wallpaper"; -"lng_action_set_same_wallpaper_me" = "You set the same wallpaper for this chat"; -"lng_action_set_same_wallpaper" = "{user} set the same wallpaper for this chat"; +"lng_action_set_wallpaper_remove" = "Remove"; +"lng_action_set_same_wallpaper_me" = "You set the same wallpaper for this chat."; +"lng_action_set_same_wallpaper" = "{user} set the same wallpaper for this chat."; "lng_action_topic_created_inside" = "Topic created"; "lng_action_topic_closed_inside" = "Topic closed"; "lng_action_topic_reopened_inside" = "Topic reopened"; @@ -1667,6 +1680,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_action_story_mention_me_unavailable" = "The story where you mentioned {user} is no longer available."; "lng_action_story_mention_unavailable" = "The story where {user} mentioned you is no longer available."; "lng_action_giveaway_started" = "{from} just started a giveaway of Telegram Premium subscriptions to its followers."; +"lng_action_giveaway_results#one" = "{count} winner of the giveaway was randomly selected by Telegram and received private messages with giftcodes."; +"lng_action_giveaway_results#other" = "{count} winners of the giveaway were randomly selected by Telegram and received private messages with giftcodes."; +"lng_action_giveaway_results_some" = "Some winners of the giveaway was randomly selected by Telegram and received private messages with giftcodes."; +"lng_action_giveaway_results_none" = "No winners of the giveaway could be selected."; + +"lng_similar_channels_title" = "Similar channels"; +"lng_similar_channels_view_all" = "View all"; +"lng_similar_channels_more" = "More Channels"; +"lng_similar_channels_premium_all#one" = "Subscribe to {link} to unlock up to **{count}** similar channel."; +"lng_similar_channels_premium_all#other" = "Subscribe to {link} to unlock up to **{count}** similar channels."; +"lng_similar_channels_premium_all_link" = "Telegram Premium"; +"lng_similar_channels_show_more" = "Show more channels"; "lng_premium_gift_duration_months#one" = "for {count} month"; "lng_premium_gift_duration_months#other" = "for {count} months"; @@ -1808,8 +1833,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_forwarded_hidden" = "The account was hidden by the user."; "lng_forwarded_imported" = "This message was imported from another app. It may not be real."; "lng_signed_author" = "Author: {user}"; -"lng_sponsored" = "sponsored"; -"lng_recommended" = "recommended"; +"lng_sponsored_message_title" = "Sponsored"; +"lng_recommended_message_title" = "Recommended"; "lng_edited" = "edited"; "lng_edited_date" = "Edited: {date}"; "lng_sent_date" = "Sent: {date}"; @@ -1921,6 +1946,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_premium_summary_subtitle_gift#other" = "{user} has gifted you a {count}-months subscription for Telegram Premium."; "lng_premium_summary_subtitle_gift_me#one" = "You gifted {user} a {count}-month subscription for Telegram Premium."; "lng_premium_summary_subtitle_gift_me#other" = "You gifted {user} a {count}-months subscription for Telegram Premium."; +"lng_premium_summary_subtitle_wallpapers" = "Wallpapers for Both Sides"; +"lng_premium_summary_about_wallpapers" = "Set custom wallpapers for you and your chat partner."; "lng_premium_summary_subtitle_stories" = "Upgraded Stories"; "lng_premium_summary_about_stories" = "Priority order, stealth mode, permanent views history and more."; "lng_premium_summary_subtitle_double_limits" = "Doubled Limits"; @@ -2083,6 +2110,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_boost_channel_title_color" = "Enable colors"; "lng_boost_channel_needs_level_color#one" = "Your channel needs to reach **Level {count}** to change channel color."; "lng_boost_channel_needs_level_color#other" = "Your channel needs to reach **Level {count}** to change channel color."; + +"lng_boost_channel_title_reactions" = "Custom reactions"; +"lng_boost_channel_needs_level_reactions#one" = "Your channel needs to reach **Level {count}** to add **{same_count}** custom emoji as a reaction."; +"lng_boost_channel_needs_level_reactions#other" = "Your channel needs to reach **Level {count}** to add **{same_count}** custom emoji as reactions."; + "lng_boost_channel_ask" = "Ask your **Premium** subscribers to boost your channel with this link:"; "lng_boost_channel_ask_button" = "Copy Link"; "lng_boost_channel_or" = "or"; @@ -2746,6 +2778,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_share_wrong_user" = "This game was opened from a different user."; "lng_share_game_link_copied" = "Game link copied to clipboard."; "lng_share_done" = "Done!"; +"lng_share_message_to_saved_messages" = "Message forwarded to **Saved Messages**."; +"lng_share_messages_to_saved_messages" = "Messages forwarded to **Saved Messages**."; +"lng_share_message_to_chat" = "Message forwarded to **{chat}**."; +"lng_share_messages_to_chat" = "Messages forwarded to **{chat}**."; +"lng_share_message_to_two_chats" = "Message forwarded to **{user}** and **{chat}**."; +"lng_share_messages_to_two_chats" = "Messages forwarded to **{user}** and **{chat}**."; +"lng_share_message_to_many_chats#one" = "Message forwarded to **{count} chat**."; +"lng_share_message_to_many_chats#other" = "Message forwarded to **{count} chats**."; +"lng_share_messages_to_many_chats#one" = "Messages forwarded to **{count} chat**."; +"lng_share_messages_to_many_chats#other" = "Messages forwarded to **{count} chats**."; "lng_contact_phone" = "Phone Number"; "lng_enter_contact_data" = "New Contact"; @@ -3294,6 +3336,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_audio_player_reverse" = "Reverse order"; "lng_audio_player_shuffle" = "Shuffle"; "lng_audio_transcribe_long" = "This voice message is too long."; +"lng_audio_transcribe_trials_left#one" = "You have {count} free transcription left until {date}."; +"lng_audio_transcribe_trials_left#other" = "You have {count} free transcriptions left until {date}."; +"lng_audio_transcribe_trials_over" = "You have used all your free transcriptions this week. Wait until {date} to use it again or subscribe to {link} now."; "lng_rights_edit_admin" = "Manage permissions"; "lng_rights_edit_admin_header" = "What can this admin do?"; @@ -4096,6 +4141,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_view_button_request_join" = "Request to Join"; "lng_view_button_external_link" = "Open link"; "lng_view_button_boost" = "Boost"; +"lng_view_button_giftcode" = "Open"; "lng_sponsored_hide_ads" = "Hide"; "lng_sponsored_title" = "What are sponsored messages?"; @@ -4141,10 +4187,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_forum_topics_no_discussion" = "Topics can't be enabled in discussion groups at the moment."; "lng_forum_choose_title_and_icon" = "Choose title and icon for your topic"; "lng_forum_replies_only" = "You can reply to messages in topics."; +"lng_forum_message_in" = "Message in {topic}"; +"lng_forum_reply_in" = "Reply in {topic}"; "lng_forum_no_topics" = "No topics currently created in this forum."; "lng_forum_create_topic" = "Create topic"; "lng_forum_discard_sure" = "Are you sure you want to discard this topic?"; "lng_forum_view_as_messages" = "View as Messages"; +"lng_forum_view_as_topics" = "View as Topics"; "lng_forum_no_messages" = "No messages"; "lng_forum_messages#one" = "{count} message"; "lng_forum_messages#other" = "{count} messages"; @@ -4286,12 +4335,22 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_stats_title" = "Statistics"; "lng_stats_message_title" = "Message Statistic"; +"lng_stats_story_title" = "Story Statistic"; "lng_stats_zoom_out" = "Zoom Out"; +"lng_stats_day_month_year" = "{days_count} {month} {year}"; +"lng_stats_day_month" = "{days_count} {month}"; +"lng_stats_weekday_day_month_year" = "{day}, {days_count} {month} {year}"; +"lng_stats_weekday_day_month_time" = "{day}, {days_count} {month} {time}"; + "lng_stats_overview_title" = "Overview"; "lng_stats_overview_member_count" = "Followers"; "lng_stats_overview_mean_view_count" = "Views Per Post"; "lng_stats_overview_mean_share_count" = "Shared Per Post"; +"lng_stats_overview_mean_reactions_count" = "Reactions Per Post"; +"lng_stats_overview_mean_story_view_count" = "Views Per Story"; +"lng_stats_overview_mean_story_share_count" = "Shared Per Story"; +"lng_stats_overview_mean_story_reactions_count" = "Reactions Per Story"; "lng_stats_overview_enabled_notifications" = "Enabled Notifications"; "lng_stats_overview_messages" = "Messages"; "lng_stats_overview_group_mean_view_count" = "Viewing Members"; @@ -4321,8 +4380,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_stats_recent_messages_title" = "Recent posts"; "lng_stats_recent_messages_views#one" = "{count} view"; "lng_stats_recent_messages_views#other" = "{count} views"; -"lng_stats_recent_messages_shares#one" = "{count} share"; -"lng_stats_recent_messages_shares#other" = "{count} shares"; "lng_stats_loading" = "Loading stats..."; "lng_stats_loading_subtext" = "Please wait a few moments while we generate your stats."; @@ -4336,6 +4393,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_chart_title_language" = "Languages"; "lng_chart_title_message_interaction" = "Interactions"; "lng_chart_title_instant_view_interaction" = "IV Interactions"; +"lng_chart_title_reactions_by_emotion" = "Reactions"; +"lng_chart_title_story_interactions" = "Story Interactions"; +"lng_chart_title_story_reactions_by_emotion" = "Story reactions"; "lng_chart_title_group_join" = "Group members"; "lng_chart_title_group_join_by_source" = "New members by source"; diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index b206163a2..f983e8585 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -10,7 +10,7 @@ + Version="4.12.2.0" /> Telegram Desktop Telegram Messenger LLP diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 0bbf19b2f..6df1b56ca 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,11,7,0 - PRODUCTVERSION 4,11,7,0 + FILEVERSION 4,12,2,0 + PRODUCTVERSION 4,12,2,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -62,10 +62,10 @@ BEGIN BEGIN VALUE "CompanyName", "Radolyn Labs" VALUE "FileDescription", "AyuGram Desktop" - VALUE "FileVersion", "4.11.7.0" + VALUE "FileVersion", "4.12.2.0" VALUE "LegalCopyright", "Copyright (C) 2014-2023" VALUE "ProductName", "AyuGram Desktop" - VALUE "ProductVersion", "4.11.7.0" + VALUE "ProductVersion", "4.12.2.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index f9e4d3cfd..8db1805f8 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 4,11,7,0 - PRODUCTVERSION 4,11,7,0 + FILEVERSION 4,12,2,0 + PRODUCTVERSION 4,12,2,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -53,10 +53,10 @@ BEGIN BEGIN VALUE "CompanyName", "Radolyn Labs" VALUE "FileDescription", "AyuGram Desktop Updater" - VALUE "FileVersion", "4.11.7.0" + VALUE "FileVersion", "4.12.2.0" VALUE "LegalCopyright", "Copyright (C) 2014-2023" VALUE "ProductName", "AyuGram Desktop" - VALUE "ProductVersion", "4.11.7.0" + VALUE "ProductVersion", "4.12.2.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/api/api_chat_filters.cpp b/Telegram/SourceFiles/api/api_chat_filters.cpp index c045263ae..7287b56e3 100644 --- a/Telegram/SourceFiles/api/api_chat_filters.cpp +++ b/Telegram/SourceFiles/api/api_chat_filters.cpp @@ -20,12 +20,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history.h" #include "lang/lang_keys.h" #include "main/main_session.h" -#include "settings/settings_common.h" #include "ui/boxes/confirm_box.h" #include "ui/controls/filter_link_header.h" #include "ui/text/text_utilities.h" #include "ui/widgets/buttons.h" #include "ui/filter_icons.h" +#include "ui/vertical_list.h" #include "window/window_session_controller.h" #include "styles/style_filter_icons.h" #include "styles/style_layers.h" @@ -341,7 +341,7 @@ void ToggleChatsController::setupAboveWidget() { _addedTopWidget = container->add(object_ptr(container)); const auto realAbove = container->add( object_ptr(container)); - AddDivider(realAbove); + Ui::AddDivider(realAbove); const auto totalCount = [&] { if (_chats.empty()) { return _additional.size(); @@ -422,7 +422,7 @@ void ToggleChatsController::setupBelowWidget() { auto widget = object_ptr( (QWidget*)nullptr, std::move(layout), - st::settingsDividerLabelPadding); + st::defaultBoxDividerLabelPadding); raw->add(object_ptr( raw, (_action == ToggleAction::Removing diff --git a/Telegram/SourceFiles/api/api_chat_participants.cpp b/Telegram/SourceFiles/api/api_chat_participants.cpp index 0ee748f2b..1714d9e2b 100644 --- a/Telegram/SourceFiles/api/api_chat_participants.cpp +++ b/Telegram/SourceFiles/api/api_chat_participants.cpp @@ -211,6 +211,29 @@ void ApplyBotsList( Data::PeerUpdate::Flag::FullInfo); } +[[nodiscard]] ChatParticipants::Channels ParseSimilar( + not_null channel, + const MTPmessages_Chats &chats) { + auto result = ChatParticipants::Channels(); + std::vector>(); + chats.match([&](const auto &data) { + const auto &list = data.vchats().v; + result.list.reserve(list.size()); + for (const auto &chat : list) { + const auto peer = channel->owner().processChat(chat); + if (const auto channel = peer->asChannel()) { + result.list.push_back(channel); + } + } + if constexpr (MTPDmessages_chatsSlice::Is()) { + if (channel->session().premiumPossible()) { + result.more = data.vcount().v - data.vchats().v.size(); + } + } + }); + return result; +} + } // namespace ChatParticipant::ChatParticipant( @@ -685,4 +708,50 @@ void ChatParticipants::unblock( _kickRequests.emplace(kick, requestId); } +void ChatParticipants::loadSimilarChannels(not_null channel) { + if (!channel->isBroadcast()) { + return; + } else if (const auto i = _similar.find(channel); i != end(_similar)) { + if (i->second.requestId + || !i->second.channels.more + || !channel->session().premium()) { + return; + } + } + _similar[channel].requestId = _api.request( + MTPchannels_GetChannelRecommendations(channel->inputChannel) + ).done([=](const MTPmessages_Chats &result) { + auto &similar = _similar[channel]; + similar.requestId = 0; + auto parsed = ParseSimilar(channel, result); + if (similar.channels == parsed) { + return; + } + similar.channels = std::move(parsed); + if (const auto history = channel->owner().historyLoaded(channel)) { + if (const auto item = history->joinedMessageInstance()) { + history->owner().requestItemResize(item); + } + } + _similarLoaded.fire_copy(channel); + }).send(); +} + +auto ChatParticipants::similar(not_null channel) +-> const Channels & { + const auto i = channel->isBroadcast() + ? _similar.find(channel) + : end(_similar); + if (i != end(_similar)) { + return i->second.channels; + } + static const auto empty = Channels(); + return empty; +} + +auto ChatParticipants::similarLoaded() const +-> rpl::producer> { + return _similarLoaded.events(); +} + } // namespace Api diff --git a/Telegram/SourceFiles/api/api_chat_participants.h b/Telegram/SourceFiles/api/api_chat_participants.h index 41eda6fe6..816cc6526 100644 --- a/Telegram/SourceFiles/api/api_chat_participants.h +++ b/Telegram/SourceFiles/api/api_chat_participants.h @@ -120,7 +120,26 @@ public: not_null channel, not_null participant); + void loadSimilarChannels(not_null channel); + + struct Channels { + std::vector> list; + int more = 0; + + friend inline bool operator==( + const Channels &, + const Channels &) = default; + }; + [[nodiscard]] const Channels &similar(not_null channel); + [[nodiscard]] auto similarLoaded() const + -> rpl::producer>; + private: + struct SimilarChannels { + Channels channels; + mtpRequestId requestId = 0; + }; + MTP::Sender _api; using PeerRequests = base::flat_map; @@ -143,6 +162,9 @@ private: not_null>; base::flat_map _kickRequests; + base::flat_map, SimilarChannels> _similar; + rpl::event_stream> _similarLoaded; + }; } // namespace Api diff --git a/Telegram/SourceFiles/api/api_peer_colors.cpp b/Telegram/SourceFiles/api/api_peer_colors.cpp new file mode 100644 index 000000000..85d60d814 --- /dev/null +++ b/Telegram/SourceFiles/api/api_peer_colors.cpp @@ -0,0 +1,126 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#include "api/api_peer_colors.h" + +#include "apiwrap.h" +#include "ui/chat/chat_style.h" + +namespace Api { +namespace { + +constexpr auto kRequestEach = 3600 * crl::time(1000); + +} // namespace + +PeerColors::PeerColors(not_null api) +: _api(&api->instance()) +, _timer([=] { request(); }) { + request(); + _timer.callEach(kRequestEach); +} + +PeerColors::~PeerColors() = default; + +void PeerColors::request() { + if (_requestId) { + return; + } + _requestId = _api.request(MTPhelp_GetPeerColors( + MTP_int(_hash) + )).done([=](const MTPhelp_PeerColors &result) { + _requestId = 0; + result.match([&](const MTPDhelp_peerColors &data) { + _hash = data.vhash().v; + apply(data); + }, [](const MTPDhelp_peerColorsNotModified &) { + }); + }).fail([=] { + _requestId = 0; + }).send(); +} + +std::vector PeerColors::suggested() const { + return _suggested.current(); +} + +rpl::producer> PeerColors::suggestedValue() const { + return _suggested.value(); +} + +auto PeerColors::indicesValue() const +-> rpl::producer { + return rpl::single(_colorIndicesCurrent + ? *_colorIndicesCurrent + : Ui::ColorIndicesCompressed() + ) | rpl::then(_colorIndicesChanged.events() | rpl::map([=] { + return *_colorIndicesCurrent; + })); +} + +void PeerColors::apply(const MTPDhelp_peerColors &data) { + auto suggested = std::vector(); + auto colors = std::make_shared< + std::array>(); + + using ParsedColor = std::array; + const auto parseColors = [](const MTPhelp_PeerColorSet &set) { + return set.match([&](const MTPDhelp_peerColorSet &data) { + auto result = ParsedColor(); + const auto &list = data.vcolors().v; + if (list.empty() || list.size() > Ui::kColorPatternsCount) { + LOG(("API Error: Bad count for PeerColorSet.colors: %1" + ).arg(list.size())); + return ParsedColor(); + } + auto fill = result.data(); + for (const auto &color : list) { + *fill++ = (uint32(1) << 24) | uint32(color.v); + } + return result; + }, [](const MTPDhelp_peerColorProfileSet &) { + LOG(("API Error: peerColorProfileSet in colors result!")); + return ParsedColor(); + }); + }; + + const auto &list = data.vcolors().v; + suggested.reserve(list.size()); + for (const auto &color : list) { + const auto &data = color.data(); + const auto colorIndexBare = data.vcolor_id().v; + if (colorIndexBare < 0 || colorIndexBare >= Ui::kColorIndexCount) { + LOG(("API Error: Bad color index: %1").arg(colorIndexBare)); + continue; + } + const auto colorIndex = uint8(colorIndexBare); + if (!data.is_hidden()) { + suggested.push_back(colorIndex); + } + if (const auto light = data.vcolors()) { + auto &fields = (*colors)[colorIndex]; + fields.light = parseColors(*light); + if (const auto dark = data.vdark_colors()) { + fields.dark = parseColors(*dark); + } else { + fields.dark = fields.light; + } + } + } + + if (!_colorIndicesCurrent) { + _colorIndicesCurrent = std::make_unique( + Ui::ColorIndicesCompressed{ std::move(colors) }); + _colorIndicesChanged.fire({}); + } else if (*_colorIndicesCurrent->colors != *colors) { + _colorIndicesCurrent->colors = std::move(colors); + _colorIndicesChanged.fire({}); + } + _suggested = std::move(suggested); +} + +} // namespace Api diff --git a/Telegram/SourceFiles/api/api_peer_colors.h b/Telegram/SourceFiles/api/api_peer_colors.h new file mode 100644 index 000000000..de06d4221 --- /dev/null +++ b/Telegram/SourceFiles/api/api_peer_colors.h @@ -0,0 +1,46 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#pragma once + +#include "base/timer.h" +#include "mtproto/sender.h" + +class ApiWrap; + +namespace Ui { +struct ColorIndicesCompressed; +} // namespace Ui + +namespace Api { + +class PeerColors final { +public: + explicit PeerColors(not_null api); + ~PeerColors(); + + [[nodiscard]] std::vector suggested() const; + [[nodiscard]] rpl::producer> suggestedValue() const; + [[nodiscard]] auto indicesValue() const + -> rpl::producer; + +private: + void request(); + void apply(const MTPDhelp_peerColors &data); + + MTP::Sender _api; + int32 _hash = 0; + + mtpRequestId _requestId = 0; + base::Timer _timer; + rpl::variable> _suggested; + rpl::event_stream<> _colorIndicesChanged; + std::unique_ptr _colorIndicesCurrent; + +}; + +} // namespace Api diff --git a/Telegram/SourceFiles/api/api_statistics.cpp b/Telegram/SourceFiles/api/api_statistics.cpp index 1f5c093a6..6655c618e 100644 --- a/Telegram/SourceFiles/api/api_statistics.cpp +++ b/Telegram/SourceFiles/api/api_statistics.cpp @@ -9,7 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "apiwrap.h" #include "data/data_channel.h" -#include "data/data_peer.h" #include "data/data_session.h" #include "history/history.h" #include "main/main_session.h" @@ -62,15 +61,25 @@ constexpr auto kCheckRequestsTimer = 10 * crl::time(1000); tlUnmuted.vpart().v / tlUnmuted.vtotal().v * 100., 0., 100.); - using Recent = MTPMessageInteractionCounters; + using Recent = MTPPostInteractionCounters; auto recentMessages = ranges::views::all( - data.vrecent_message_interactions().v + data.vrecent_posts_interactions().v ) | ranges::views::transform([&](const Recent &tl) { - return Data::StatisticsMessageInteractionInfo{ - .messageId = tl.data().vmsg_id().v, - .viewsCount = tl.data().vviews().v, - .forwardsCount = tl.data().vforwards().v, - }; + return tl.match([&](const MTPDpostInteractionCountersStory &data) { + return Data::StatisticsMessageInteractionInfo{ + .storyId = data.vstory_id().v, + .viewsCount = data.vviews().v, + .forwardsCount = data.vforwards().v, + .reactionsCount = data.vreactions().v, + }; + }, [&](const MTPDpostInteractionCountersMessage &data) { + return Data::StatisticsMessageInteractionInfo{ + .messageId = data.vmsg_id().v, + .viewsCount = data.vviews().v, + .forwardsCount = data.vforwards().v, + .reactionsCount = data.vreactions().v, + }; + }); }) | ranges::to_vector; return { @@ -80,6 +89,15 @@ constexpr auto kCheckRequestsTimer = 10 * crl::time(1000); .memberCount = StatisticalValueFromTL(data.vfollowers()), .meanViewCount = StatisticalValueFromTL(data.vviews_per_post()), .meanShareCount = StatisticalValueFromTL(data.vshares_per_post()), + .meanReactionCount = StatisticalValueFromTL( + data.vreactions_per_post()), + + .meanStoryViewCount = StatisticalValueFromTL( + data.vviews_per_story()), + .meanStoryShareCount = StatisticalValueFromTL( + data.vshares_per_story()), + .meanStoryReactionCount = StatisticalValueFromTL( + data.vreactions_per_story()), .enabledNotificationsPercentage = unmuted, @@ -110,6 +128,15 @@ constexpr auto kCheckRequestsTimer = 10 * crl::time(1000); .instantViewInteractionGraph = StatisticalGraphFromTL( data.viv_interactions_graph()), + .reactionsByEmotionGraph = StatisticalGraphFromTL( + data.vreactions_by_emotion_graph()), + + .storyInteractionsGraph = StatisticalGraphFromTL( + data.vstory_interactions_graph()), + + .storyReactionsByEmotionGraph = StatisticalGraphFromTL( + data.vstory_reactions_by_emotion_graph()), + .recentMessageInteractions = std::move(recentMessages), }; } @@ -324,7 +351,7 @@ Data::SupergroupStatistics Statistics::supergroupStats() const { PublicForwards::PublicForwards( not_null channel, - FullMsgId fullId) + Data::RecentPostId fullId) : StatisticsRequestSender(channel) , _fullId(fullId) { } @@ -332,9 +359,20 @@ PublicForwards::PublicForwards( void PublicForwards::request( const Data::PublicForwardsSlice::OffsetToken &token, Fn done) { - if (_requestId) { - return; + if (!_requestId) { + if (_fullId.messageId) { + requestMessage(token, std::move(done)); + } else if (_fullId.storyId) { + requestStory(token, std::move(done)); + } } +} + +void PublicForwards::requestMessage( + const Data::PublicForwardsSlice::OffsetToken &token, + Fn done) { + Expects(_fullId.messageId); + const auto offsetPeer = channel()->owner().peer(token.fullId.peer); const auto tlOffsetPeer = offsetPeer ? offsetPeer->input @@ -342,13 +380,13 @@ void PublicForwards::request( constexpr auto kLimit = tl::make_int(100); _requestId = makeRequest(MTPstats_GetMessagePublicForwards( channel()->inputChannel, - MTP_int(_fullId.msg), + MTP_int(_fullId.messageId.msg), MTP_int(token.rate), tlOffsetPeer, MTP_int(token.fullId.msg), kLimit )).done([=, channel = channel()](const MTPmessages_Messages &result) { - using Messages = QVector; + using Messages = QVector; _requestId = 0; auto nextToken = Data::PublicForwardsSlice::OffsetToken(); @@ -365,7 +403,7 @@ void PublicForwards::request( MessageFlags(), NewMessageType::Existing); nextToken.fullId = { peerId, msgId }; - result.push_back(nextToken.fullId); + result.push_back({ .messageId = nextToken.fullId }); } } } @@ -420,14 +458,90 @@ void PublicForwards::request( }).send(); } +void PublicForwards::requestStory( + const Data::PublicForwardsSlice::OffsetToken &token, + Fn done) { + Expects(_fullId.storyId); + + constexpr auto kLimit = tl::make_int(100); + _requestId = makeRequest(MTPstats_GetStoryPublicForwards( + channel()->input, + MTP_int(_fullId.storyId.story), + MTP_string(token.storyOffset), + kLimit + )).done([=, channel = channel()]( + const MTPstats_PublicForwards &tlForwards) { + using Messages = QVector; + _requestId = 0; + + const auto &data = tlForwards.data(); + + channel->owner().processUsers(data.vusers()); + channel->owner().processChats(data.vchats()); + + const auto nextToken = Data::PublicForwardsSlice::OffsetToken({ + .storyOffset = data.vnext_offset().value_or_empty(), + }); + + const auto allLoaded = nextToken.storyOffset.isEmpty() + || (nextToken.storyOffset == token.storyOffset); + const auto fullCount = data.vcount().v; + + auto recentList = Messages(); + for (const auto &tlForward : data.vforwards().v) { + tlForward.match([&](const MTPDpublicForwardMessage &data) { + const auto &message = data.vmessage(); + const auto msgId = IdFromMessage(message); + const auto peerId = PeerFromMessage(message); + const auto lastDate = DateFromMessage(message); + if (const auto peer = channel->owner().peerLoaded(peerId)) { + if (!lastDate) { + return; + } + channel->owner().addNewMessage( + message, + MessageFlags(), + NewMessageType::Existing); + recentList.push_back({ .messageId = { peerId, msgId } }); + } + }, [&](const MTPDpublicForwardStory &data) { + data.vstory().match([&](const MTPDstoryItem &d) { + recentList.push_back({ + .storyId = { peerFromMTP(data.vpeer()), d.vid().v } + }); + }, [](const auto &) { + }); + }); + } + + _lastTotal = std::max(_lastTotal, fullCount); + done({ + .list = std::move(recentList), + .total = _lastTotal, + .allLoaded = allLoaded, + .token = nextToken, + }); + }).fail([=] { + _requestId = 0; + }).send(); +} + MessageStatistics::MessageStatistics( not_null channel, FullMsgId fullId) : StatisticsRequestSender(channel) -, _publicForwards(channel, fullId) +, _publicForwards(channel, { .messageId = fullId }) , _fullId(fullId) { } +MessageStatistics::MessageStatistics( + not_null channel, + FullStoryId storyId) +: StatisticsRequestSender(channel) +, _publicForwards(channel, { .storyId = storyId }) +, _storyId(storyId) { +} + Data::PublicForwardsSlice MessageStatistics::firstSlice() const { return _firstSlice; } @@ -438,21 +552,26 @@ void MessageStatistics::request(Fn done) { } const auto requestFirstPublicForwards = [=]( const Data::StatisticalGraph &messageGraph, + const Data::StatisticalGraph &reactionsGraph, const Data::StatisticsMessageInteractionInfo &info) { - _publicForwards.request({}, [=](Data::PublicForwardsSlice slice) { + const auto callback = [=](Data::PublicForwardsSlice slice) { const auto total = slice.total; _firstSlice = std::move(slice); done({ .messageInteractionGraph = messageGraph, + .reactionsByEmotionGraph = reactionsGraph, .publicForwards = total, .privateForwards = info.forwardsCount - total, .views = info.viewsCount, + .reactions = info.reactionsCount, }); - }); + }; + _publicForwards.request({}, callback); }; const auto requestPrivateForwards = [=]( - const Data::StatisticalGraph &messageGraph) { + const Data::StatisticalGraph &messageGraph, + const Data::StatisticalGraph &reactionsGraph) { api().request(MTPchannels_GetMessages( channel()->inputChannel, MTP_vector( @@ -462,6 +581,13 @@ void MessageStatistics::request(Fn done) { const auto process = [&](const MTPVector &messages) { const auto &message = messages.v.front(); return message.match([&](const MTPDmessage &data) { + auto reactionsCount = 0; + if (const auto tlReactions = data.vreactions()) { + const auto &tlCounts = tlReactions->data().vresults(); + for (const auto &tlCount : tlCounts.v) { + reactionsCount += tlCount.data().vcount().v; + } + } return Data::StatisticsMessageInteractionInfo{ .messageId = IdFromMessage(message), .viewsCount = data.vviews() @@ -470,6 +596,7 @@ void MessageStatistics::request(Fn done) { .forwardsCount = data.vforwards() ? data.vforwards()->v : 0, + .reactionsCount = reactionsCount, }; }, [](const MTPDmessageEmpty &) { return Data::StatisticsMessageInteractionInfo(); @@ -488,22 +615,74 @@ void MessageStatistics::request(Fn done) { return Data::StatisticsMessageInteractionInfo(); }); - requestFirstPublicForwards(messageGraph, std::move(info)); + requestFirstPublicForwards( + messageGraph, + reactionsGraph, + std::move(info)); }).fail([=](const MTP::Error &error) { - requestFirstPublicForwards(messageGraph, {}); + requestFirstPublicForwards(messageGraph, reactionsGraph, {}); }).send(); }; - makeRequest(MTPstats_GetMessageStats( - MTP_flags(MTPstats_GetMessageStats::Flags(0)), - channel()->inputChannel, - MTP_int(_fullId.msg.bare) - )).done([=](const MTPstats_MessageStats &result) { - requestPrivateForwards( - StatisticalGraphFromTL(result.data().vviews_graph())); - }).fail([=](const MTP::Error &error) { - requestPrivateForwards({}); - }).send(); + const auto requestStoryPrivateForwards = [=]( + const Data::StatisticalGraph &messageGraph, + const Data::StatisticalGraph &reactionsGraph) { + api().request(MTPstories_GetStoriesByID( + channel()->input, + MTP_vector(1, MTP_int(_storyId.story))) + ).done([=](const MTPstories_Stories &result) { + const auto &storyItem = result.data().vstories().v.front(); + auto info = storyItem.match([&](const MTPDstoryItem &data) { + if (!data.vviews()) { + return Data::StatisticsMessageInteractionInfo(); + } + const auto &tlViews = data.vviews()->data(); + return Data::StatisticsMessageInteractionInfo{ + .storyId = data.vid().v, + .viewsCount = tlViews.vviews_count().v, + .forwardsCount = tlViews.vforwards_count().value_or(0), + .reactionsCount = tlViews.vreactions_count().value_or(0), + }; + }, [](const auto &) { + return Data::StatisticsMessageInteractionInfo(); + }); + + requestFirstPublicForwards( + messageGraph, + reactionsGraph, + std::move(info)); + }).fail([=](const MTP::Error &error) { + requestFirstPublicForwards(messageGraph, reactionsGraph, {}); + }).send(); + }; + + if (_storyId) { + makeRequest(MTPstats_GetStoryStats( + MTP_flags(MTPstats_GetStoryStats::Flags(0)), + channel()->input, + MTP_int(_storyId.story) + )).done([=](const MTPstats_StoryStats &result) { + const auto &data = result.data(); + requestStoryPrivateForwards( + StatisticalGraphFromTL(data.vviews_graph()), + StatisticalGraphFromTL(data.vreactions_by_emotion_graph())); + }).fail([=](const MTP::Error &error) { + requestStoryPrivateForwards({}, {}); + }).send(); + } else { + makeRequest(MTPstats_GetMessageStats( + MTP_flags(MTPstats_GetMessageStats::Flags(0)), + channel()->inputChannel, + MTP_int(_fullId.msg.bare) + )).done([=](const MTPstats_MessageStats &result) { + const auto &data = result.data(); + requestPrivateForwards( + StatisticalGraphFromTL(data.vviews_graph()), + StatisticalGraphFromTL(data.vreactions_by_emotion_graph())); + }).fail([=](const MTP::Error &error) { + requestPrivateForwards({}, {}); + }).send(); + } } Boosts::Boosts(not_null peer) diff --git a/Telegram/SourceFiles/api/api_statistics.h b/Telegram/SourceFiles/api/api_statistics.h index dddf3654c..d1b5b6624 100644 --- a/Telegram/SourceFiles/api/api_statistics.h +++ b/Telegram/SourceFiles/api/api_statistics.h @@ -68,14 +68,23 @@ private: class PublicForwards final : public StatisticsRequestSender { public: - PublicForwards(not_null channel, FullMsgId fullId); + PublicForwards( + not_null channel, + Data::RecentPostId fullId); void request( const Data::PublicForwardsSlice::OffsetToken &token, Fn done); private: - const FullMsgId _fullId; + void requestMessage( + const Data::PublicForwardsSlice::OffsetToken &token, + Fn done); + void requestStory( + const Data::PublicForwardsSlice::OffsetToken &token, + Fn done); + + const Data::RecentPostId _fullId; mtpRequestId _requestId = 0; int _lastTotal = 0; @@ -86,6 +95,9 @@ public: explicit MessageStatistics( not_null channel, FullMsgId fullId); + explicit MessageStatistics( + not_null channel, + FullStoryId storyId); void request(Fn done); @@ -94,6 +106,7 @@ public: private: PublicForwards _publicForwards; const FullMsgId _fullId; + const FullStoryId _storyId; Data::PublicForwardsSlice _firstSlice; diff --git a/Telegram/SourceFiles/api/api_transcribes.cpp b/Telegram/SourceFiles/api/api_transcribes.cpp index 6a69b53d6..ac792883b 100644 --- a/Telegram/SourceFiles/api/api_transcribes.cpp +++ b/Telegram/SourceFiles/api/api_transcribes.cpp @@ -7,13 +7,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "api/api_transcribes.h" -#include "history/history_item.h" -#include "history/history.h" -#include "main/main_session.h" -#include "data/data_document.h" -#include "data/data_session.h" -#include "data/data_peer.h" #include "apiwrap.h" +#include "data/data_document.h" +#include "data/data_peer.h" +#include "data/data_session.h" +#include "history/history.h" +#include "history/history_item.h" +#include "history/history_item_helpers.h" +#include "main/main_account.h" +#include "main/main_app_config.h" +#include "main/main_session.h" namespace Api { @@ -22,6 +25,44 @@ Transcribes::Transcribes(not_null api) , _api(&api->instance()) { } +bool Transcribes::trialsSupport() { + if (!_trialsSupport) { + const auto count = _session->account().appConfig().get( + u"transcribe_audio_trial_weekly_number"_q, + 0); + const auto until = _session->account().appConfig().get( + u"transcribe_audio_trial_cooldown_until"_q, + 0); + _trialsSupport = (count > 0) || (until > 0); + } + return *_trialsSupport; +} + +TimeId Transcribes::trialsRefreshAt() { + if (_trialsRefreshAt < 0) { + _trialsRefreshAt = _session->account().appConfig().get( + u"transcribe_audio_trial_cooldown_until"_q, + 0); + } + return _trialsRefreshAt; +} + +int Transcribes::trialsCount() { + if (_trialsCount < 0) { + _trialsCount = _session->account().appConfig().get( + u"transcribe_audio_trial_weekly_number"_q, + -1); + return std::max(_trialsCount, 0); + } + return _trialsCount; +} + +crl::time Transcribes::trialsMaxLengthMs() const { + return 1000 * _session->account().appConfig().get( + u"transcribe_audio_trial_duration_max"_q, + 300); +} + void Transcribes::toggle(not_null item) { const auto id = item->fullId(); auto i = _map.find(id); @@ -86,6 +127,23 @@ void Transcribes::load(not_null item) { MTP_int(item->id) )).done([=](const MTPmessages_TranscribedAudio &result) { const auto &data = result.data(); + + { + const auto trialsCountChanged = data.vtrial_remains_num() + && (_trialsCount != data.vtrial_remains_num()->v); + if (trialsCountChanged) { + _trialsCount = data.vtrial_remains_num()->v; + } + const auto refreshAtChanged = data.vtrial_remains_until_date() + && (_trialsRefreshAt != data.vtrial_remains_until_date()->v); + if (refreshAtChanged) { + _trialsRefreshAt = data.vtrial_remains_until_date()->v; + } + if (trialsCountChanged) { + ShowTrialTranscribesToast(_trialsCount, _trialsRefreshAt); + } + } + auto &entry = _map[id]; entry.requestId = 0; entry.pending = data.is_pending(); diff --git a/Telegram/SourceFiles/api/api_transcribes.h b/Telegram/SourceFiles/api/api_transcribes.h index 2f8bb2234..a5c5923ec 100644 --- a/Telegram/SourceFiles/api/api_transcribes.h +++ b/Telegram/SourceFiles/api/api_transcribes.h @@ -36,12 +36,21 @@ public: void apply(const MTPDupdateTranscribedAudio &update); + [[nodiscard]] bool trialsSupport(); + [[nodiscard]] TimeId trialsRefreshAt(); + [[nodiscard]] int trialsCount(); + [[nodiscard]] crl::time trialsMaxLengthMs() const; + private: void load(not_null item); const not_null _session; MTP::Sender _api; + int _trialsCount = -1; + std::optional _trialsSupport; + TimeId _trialsRefreshAt = -1; + base::flat_map _map; base::flat_map _ids; diff --git a/Telegram/SourceFiles/api/api_updates.cpp b/Telegram/SourceFiles/api/api_updates.cpp index 0303700ad..0f4cbd894 100644 --- a/Telegram/SourceFiles/api/api_updates.cpp +++ b/Telegram/SourceFiles/api/api_updates.cpp @@ -2023,6 +2023,19 @@ void Updates::feedUpdate(const MTPUpdate &update) { } } break; + case mtpc_updatePeerWallpaper: { + const auto &d = update.c_updatePeerWallpaper(); + if (const auto peer = session().data().peerLoaded(peerFromMTP(d.vpeer()))) { + if (const auto paper = d.vwallpaper()) { + peer->setWallPaper( + Data::WallPaper::Create(&session(), *paper), + d.is_wallpaper_overridden()); + } else { + peer->setWallPaper({}); + } + } + } break; + case mtpc_updateBotCommands: { const auto &d = update.c_updateBotCommands(); if (const auto peer = session().data().peerLoaded(peerFromMTP(d.vpeer()))) { @@ -2358,6 +2371,14 @@ void Updates::feedUpdate(const MTPUpdate &update) { } } break; + case mtpc_updateChannelViewForumAsMessages: { + const auto &d = update.c_updateChannelViewForumAsMessages(); + const auto id = ChannelId(d.vchannel_id()); + if (const auto channel = session().data().channelLoaded(id)) { + channel->setViewAsMessagesFlag(mtpIsTrue(d.venabled())); + } + } break; + // Pinned message. case mtpc_updatePinnedMessages: { const auto &d = update.c_updatePinnedMessages(); diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 2270743c2..2cabaf052 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_hash.h" #include "api/api_invite_links.h" #include "api/api_media.h" +#include "api/api_peer_colors.h" #include "api/api_peer_photo.h" #include "api/api_polls.h" #include "api/api_sending.h" @@ -33,50 +34,35 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_user_names.h" #include "api/api_websites.h" #include "data/notify/data_notify_settings.h" -#include "data/stickers/data_stickers.h" -#include "data/data_drafts.h" #include "data/data_changes.h" -#include "data/data_photo.h" #include "data/data_web_page.h" #include "data/data_folder.h" #include "data/data_forum_topic.h" #include "data/data_forum.h" -#include "data/data_media_types.h" -#include "data/data_sparse_ids.h" #include "data/data_search_controller.h" #include "data/data_scheduled_messages.h" -#include "data/data_channel_admins.h" #include "data/data_session.h" -#include "data/data_stories.h" #include "data/data_channel.h" #include "data/data_chat.h" #include "data/data_user.h" -#include "data/data_cloud_themes.h" #include "data/data_chat_filters.h" #include "data/data_histories.h" -#include "data/data_wall_paper.h" -#include "data/stickers/data_stickers.h" -#include "dialogs/dialogs_key.h" #include "core/core_cloud_password.h" #include "core/application.h" #include "base/unixtime.h" #include "base/random.h" -#include "base/qt/qt_common_adapters.h" #include "base/call_delayed.h" #include "lang/lang_keys.h" -#include "mainwindow.h" #include "mainwidget.h" #include "boxes/add_contact_box.h" #include "mtproto/mtproto_config.h" #include "history/history.h" -#include "history/history_item.h" #include "history/history_item_components.h" #include "history/history_item_helpers.h" #include "main/main_session.h" #include "main/main_session_settings.h" #include "main/main_account.h" #include "ui/boxes/confirm_box.h" -#include "boxes/stickers_box.h" #include "boxes/sticker_set_box.h" #include "boxes/premium_limits_box.h" #include "window/notifications_manager.h" @@ -87,7 +73,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "chat_helpers/message_field.h" #include "ui/item_text_options.h" #include "ui/text/text_utilities.h" -#include "ui/emoji_config.h" #include "ui/chat/attach/attach_prepare.h" #include "ui/toast/toast.h" #include "support/support_helper.h" @@ -95,9 +80,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/localimageloader.h" #include "storage/download_manager_mtproto.h" #include "storage/file_upload.h" -#include "storage/storage_facade.h" -#include "storage/storage_shared_media.h" -#include "storage/storage_media_prepare.h" #include "storage/storage_account.h" // AyuGram includes @@ -151,6 +133,15 @@ void ShowChannelsLimitBox(not_null peer) { } } +[[nodiscard]] FileLoadTo FileLoadTaskOptions(const Api::SendAction &action) { + const auto peer = action.history->peer; + return FileLoadTo( + peer->id, + action.options, + action.replyTo, + action.replaceMediaOf); +} + } // namespace ApiWrap::ApiWrap(not_null session) @@ -184,7 +175,8 @@ ApiWrap::ApiWrap(not_null session) , _transcribes(std::make_unique(this)) , _premium(std::make_unique(this)) , _usernames(std::make_unique(this)) -, _websites(std::make_unique(this)) { +, _websites(std::make_unique(this)) +, _peerColors(std::make_unique(this)) { crl::on_main(session, [=] { // You can't use _session->lifetime() in the constructor, // only queued, because it is not constructed yet. @@ -1754,6 +1746,10 @@ void ApiWrap::joinChannel(not_null channel) { }).send(); _channelAmInRequests.emplace(channel, requestId); + + using Flag = ChannelDataFlag; + chatParticipants().loadSimilarChannels(channel); + channel->setFlags(channel->flags() | Flag::SimilarExpanded); } } @@ -2070,13 +2066,13 @@ void ApiWrap::deleteHistory( void ApiWrap::applyUpdates( const MTPUpdates &updates, - uint64 sentMessageRandomId) { + uint64 sentMessageRandomId) const { this->updates().applyUpdates(updates, sentMessageRandomId); } int ApiWrap::applyAffectedHistory( PeerData *peer, - const MTPmessages_AffectedHistory &result) { + const MTPmessages_AffectedHistory &result) const { const auto &data = result.c_messages_affectedHistory(); if (const auto channel = peer ? peer->asChannel() : nullptr) { channel->ptsUpdateAndApply(data.vpts().v, data.vpts_count().v); @@ -2098,7 +2094,7 @@ void ApiWrap::applyAffectedMessages( } void ApiWrap::applyAffectedMessages( - const MTPmessages_AffectedMessages &result) { + const MTPmessages_AffectedMessages &result) const { const auto &data = result.c_messages_affectedMessages(); updates().updateAndApply(data.vpts().v, data.vpts_count().v); } @@ -2557,8 +2553,8 @@ void ApiWrap::refreshFileReference( request(MTPhelp_GetPremiumPromo()); }, [&](Data::FileOriginStory data) { request(MTPstories_GetStoriesByID( - _session->data().peer(data.peerId)->input, - MTP_vector(1, MTP_int(data.storyId)))); + _session->data().peer(data.peer)->input, + MTP_vector(1, MTP_int(data.story)))); }, [&](v::null_t) { fail(); }); @@ -3444,7 +3440,7 @@ void ApiWrap::sendVoiceMessage( crl::time duration, const SendAction &action) { const auto caption = TextWithTags(); - const auto to = fileLoadTaskOptions(action); + const auto to = FileLoadTaskOptions(action); _fileLoader->addTask(std::make_unique( &session(), result, @@ -3462,7 +3458,7 @@ void ApiWrap::editMedia( if (list.files.empty()) return; auto &file = list.files.front(); - const auto to = fileLoadTaskOptions(action); + const auto to = FileLoadTaskOptions(action); _fileLoader->addTask(std::make_unique( &session(), file.path, @@ -3491,7 +3487,7 @@ void ApiWrap::sendFiles( sendMessage(std::move(message)); } - const auto to = fileLoadTaskOptions(action); + const auto to = FileLoadTaskOptions(action); if (album) { album->options = to.options; } @@ -3530,7 +3526,7 @@ void ApiWrap::sendFile( const QByteArray &fileContent, SendMediaType type, const SendAction &action) { - const auto to = fileLoadTaskOptions(action); + const auto to = FileLoadTaskOptions(action); auto caption = TextWithTags(); const auto spoiler = false; const auto information = nullptr; @@ -4227,15 +4223,6 @@ void ApiWrap::sendAlbumIfReady(not_null album) { }); } -FileLoadTo ApiWrap::fileLoadTaskOptions(const SendAction &action) const { - const auto peer = action.history->peer; - return FileLoadTo( - peer->id, - action.options, - action.replyTo, - action.replaceMediaOf); -} - void ApiWrap::reloadContactSignupSilent() { if (_contactSignupSilentRequestId) { return; @@ -4451,3 +4438,7 @@ Api::Usernames &ApiWrap::usernames() { Api::Websites &ApiWrap::websites() { return *_websites; } + +Api::PeerColors &ApiWrap::peerColors() { + return *_peerColors; +} diff --git a/Telegram/SourceFiles/apiwrap.h b/Telegram/SourceFiles/apiwrap.h index ecb0f968a..70ed1affa 100644 --- a/Telegram/SourceFiles/apiwrap.h +++ b/Telegram/SourceFiles/apiwrap.h @@ -9,8 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_common.h" #include "base/timer.h" -#include "base/flat_map.h" -#include "base/flat_set.h" #include "mtproto/sender.h" #include "data/stickers/data_stickers_set.h" #include "data/data_messages.h" @@ -73,6 +71,7 @@ class InviteLinks; class ViewsManager; class ConfirmPhone; class PeerPhoto; +class PeerColors; class Polls; class ChatParticipants; class UnreadThings; @@ -141,10 +140,10 @@ public: void applyUpdates( const MTPUpdates &updates, - uint64 sentMessageRandomId = 0); + uint64 sentMessageRandomId = 0) const; int applyAffectedHistory( PeerData *peer, // May be nullptr, like for deletePhoneCallHistory. - const MTPmessages_AffectedHistory &result); + const MTPmessages_AffectedHistory &result) const; void registerModifyRequest(const QString &key, mtpRequestId requestId); void clearModifyRequest(const QString &key); @@ -392,6 +391,7 @@ public: [[nodiscard]] Api::Premium &premium(); [[nodiscard]] Api::Usernames &usernames(); [[nodiscard]] Api::Websites &websites(); + [[nodiscard]] Api::PeerColors &peerColors(); void updatePrivacyLastSeens(); @@ -503,7 +503,7 @@ private: not_null peer, bool justClear, bool revoke); - void applyAffectedMessages(const MTPmessages_AffectedMessages &result); + void applyAffectedMessages(const MTPmessages_AffectedMessages &result) const; void deleteAllFromParticipantSend( not_null channel, @@ -532,7 +532,6 @@ private: Api::SendOptions options, uint64 randomId, Fn done = nullptr); - FileLoadTo fileLoadTaskOptions(const SendAction &action) const; void getTopPromotionDelayed(TimeId now, TimeId next); void topPromotionDone(const MTPhelp_PromoData &proxy); @@ -711,6 +710,7 @@ private: const std::unique_ptr _premium; const std::unique_ptr _usernames; const std::unique_ptr _websites; + const std::unique_ptr _peerColors; mtpRequestId _wallPaperRequestId = 0; QString _wallPaperSlug; diff --git a/Telegram/SourceFiles/boxes/about_box.h b/Telegram/SourceFiles/boxes/about_box.h index 3ec637de2..e03b9970e 100644 --- a/Telegram/SourceFiles/boxes/about_box.h +++ b/Telegram/SourceFiles/boxes/about_box.h @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "boxes/abstract_box.h" +#include "ui/layers/box_content.h" namespace Ui { class LinkButton; diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp index aab01656d..8fd1f5c2b 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp @@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/call_delayed.h" #include "base/random.h" #include "ui/boxes/confirm_box.h" +#include "boxes/abstract_box.h" #include "boxes/peer_list_controllers.h" #include "boxes/premium_limits_box.h" #include "boxes/peers/add_participants_box.h" diff --git a/Telegram/SourceFiles/boxes/add_contact_box.h b/Telegram/SourceFiles/boxes/add_contact_box.h index 5e62331aa..ef70f7c3b 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.h +++ b/Telegram/SourceFiles/boxes/add_contact_box.h @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "boxes/abstract_box.h" +#include "ui/layers/box_content.h" #include "base/timer.h" #include "mtproto/sender.h" diff --git a/Telegram/SourceFiles/boxes/auto_download_box.cpp b/Telegram/SourceFiles/boxes/auto_download_box.cpp index b77cf4a4f..ae42f3cc8 100644 --- a/Telegram/SourceFiles/boxes/auto_download_box.cpp +++ b/Telegram/SourceFiles/boxes/auto_download_box.cpp @@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_session_settings.h" #include "data/data_session.h" #include "data/data_auto_download.h" +#include "ui/vertical_list.h" #include "ui/widgets/continuous_sliders.h" #include "ui/widgets/buttons.h" #include "ui/wrap/vertical_layout.h" @@ -35,7 +36,6 @@ not_null AddSizeLimitSlider( not_null container, const base::flat_map &values, int64 defaultValue) { - using namespace Settings; using Pair = base::flat_map::value_type; const auto limits = Ui::CreateChild>( @@ -46,7 +46,7 @@ not_null AddSizeLimitSlider( [](Pair pair) { return pair.second; })->second; const auto startLimit = currentLimit ? currentLimit : defaultValue; const auto result = Ui::CreateChild(container.get(), startLimit); - AddButtonWithLabel( + Settings::AddButtonWithLabel( container, tr::lng_media_size_limit(), limits->events_starting_with_copy( @@ -109,11 +109,11 @@ void AutoDownloadBox::setupContent() { Type type, rpl::producer label) { const auto value = settings->bytesLimit(_source, type); - AddButton( + content->add(object_ptr( content, std::move(label), st::settingsButtonNoIcon - )->toggleOn( + ))->toggleOn( rpl::single(value > 0) )->toggledChanges( ) | rpl::start_with_next([=](bool enabled) { diff --git a/Telegram/SourceFiles/boxes/auto_download_box.h b/Telegram/SourceFiles/boxes/auto_download_box.h index 617a4e203..d48b0da85 100644 --- a/Telegram/SourceFiles/boxes/auto_download_box.h +++ b/Telegram/SourceFiles/boxes/auto_download_box.h @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "boxes/abstract_box.h" +#include "ui/layers/box_content.h" namespace Main { class Session; diff --git a/Telegram/SourceFiles/boxes/auto_lock_box.h b/Telegram/SourceFiles/boxes/auto_lock_box.h index b20cbfa2b..9243e802f 100644 --- a/Telegram/SourceFiles/boxes/auto_lock_box.h +++ b/Telegram/SourceFiles/boxes/auto_lock_box.h @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "boxes/abstract_box.h" +#include "ui/layers/box_content.h" namespace Ui { class Radiobutton; diff --git a/Telegram/SourceFiles/boxes/background_box.cpp b/Telegram/SourceFiles/boxes/background_box.cpp index a7b92aa32..0ae3023e0 100644 --- a/Telegram/SourceFiles/boxes/background_box.cpp +++ b/Telegram/SourceFiles/boxes/background_box.cpp @@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/chat/attach/attach_extensions.h" #include "ui/chat/chat_theme.h" #include "ui/ui_utility.h" +#include "ui/vertical_list.h" #include "main/main_session.h" #include "apiwrap.h" #include "mtproto/sender.h" @@ -24,7 +25,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_document_media.h" #include "boxes/background_preview_box.h" #include "info/profile/info_profile_icon.h" -#include "settings/settings_common.h" #include "ui/boxes/confirm_box.h" #include "ui/widgets/buttons.h" #include "window/window_session_controller.h" @@ -165,9 +165,9 @@ void BackgroundBox::prepare() { auto wrap = object_ptr(this); const auto container = wrap.data(); - Settings::AddSkip(container); + Ui::AddSkip(container); - const auto button = container->add(Settings::CreateButton( + const auto button = container->add(object_ptr( container, tr::lng_settings_bg_from_file(), st::infoProfileButton)); @@ -180,8 +180,8 @@ void BackgroundBox::prepare() { chooseFromFile(); }); - Settings::AddSkip(container); - Settings::AddDivider(container); + Ui::AddSkip(container); + Ui::AddDivider(container); _inner = container->add( object_ptr(this, &_controller->session(), _forPeer)); @@ -310,7 +310,7 @@ void BackgroundBox::resetForPeer() { }).send(); const auto weak = Ui::MakeWeak(this); - _forPeer->setWallPaper(std::nullopt); + _forPeer->setWallPaper({}); if (weak) { _controller->finishChatThemeEdit(_forPeer); } diff --git a/Telegram/SourceFiles/boxes/background_box.h b/Telegram/SourceFiles/boxes/background_box.h index 4e0bc3727..3fe16d602 100644 --- a/Telegram/SourceFiles/boxes/background_box.h +++ b/Telegram/SourceFiles/boxes/background_box.h @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "boxes/abstract_box.h" +#include "ui/layers/box_content.h" class PeerData; diff --git a/Telegram/SourceFiles/boxes/background_preview_box.cpp b/Telegram/SourceFiles/boxes/background_preview_box.cpp index a920aa76a..c54f581ce 100644 --- a/Telegram/SourceFiles/boxes/background_preview_box.cpp +++ b/Telegram/SourceFiles/boxes/background_preview_box.cpp @@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "boxes/background_preview_box.h" +#include "base/unixtime.h" +#include "boxes/premium_preview_box.h" #include "lang/lang_keys.h" #include "mainwidget.h" #include "window/themes/window_theme.h" @@ -18,8 +20,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/image/image.h" #include "ui/widgets/checkbox.h" #include "ui/widgets/continuous_sliders.h" +#include "ui/wrap/fade_wrap.h" #include "ui/wrap/slide_wrap.h" #include "ui/painter.h" +#include "ui/vertical_list.h" #include "ui/ui_utility.h" #include "history/history.h" #include "history/history_item.h" @@ -33,17 +37,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_document_media.h" #include "data/data_document_resolver.h" #include "data/data_file_origin.h" -#include "base/unixtime.h" -#include "boxes/background_preview_box.h" -#include "window/window_session_controller.h" -#include "window/themes/window_themes_embedded.h" -#include "settings/settings_common.h" +#include "data/data_peer_values.h" +#include "settings/settings_premium.h" #include "storage/file_upload.h" #include "storage/localimageloader.h" +#include "window/window_session_controller.h" +#include "window/themes/window_themes_embedded.h" #include "styles/style_chat.h" #include "styles/style_layers.h" #include "styles/style_boxes.h" -#include "styles/style_settings.h" #include #include @@ -293,10 +295,10 @@ void BackgroundPreviewBox::createDimmingSlider(bool dark) { const auto equals = (dark == Window::Theme::IsNightMode()); const auto inner = Ui::CreateChild(_dimmingContent); inner->show(); - Settings::AddSubsectionTitle( + Ui::AddSubsectionTitle( inner, tr::lng_background_dimming(), - style::margins(0, st::settingsSectionSkip, 0, 0), + style::margins(0, st::defaultVerticalListSkip, 0, 0), equals ? nullptr : dark ? &_dark->subtitle : &_light->subtitle); _dimmingSlider = inner->add( object_ptr( @@ -378,7 +380,7 @@ auto BackgroundPreviewBox::prepareOverridenStyle(bool dark) .box = st::defaultBox, .toggle = toggle, .slider = st::defaultContinuousSlider, - .subtitle = st::settingsSubsectionTitle, + .subtitle = st::defaultSubsectionTitle, }; result.box.button.textFg = p->lightButtonFg(); result.box.button.textFgOver = p->lightButtonFgOver(); @@ -510,6 +512,10 @@ void BackgroundPreviewBox::recreateBlurCheckbox() { }, _blur->lifetime()); _blur->setDisabled(_paper.document() && _full.isNull()); + + if (_forBothOverlay) { + _forBothOverlay->raise(); + } } void BackgroundPreviewBox::apply() { @@ -520,7 +526,7 @@ void BackgroundPreviewBox::apply() { } } -void BackgroundPreviewBox::uploadForPeer() { +void BackgroundPreviewBox::uploadForPeer(bool both) { Expects(_forPeer != nullptr); if (_uploadId) { @@ -579,7 +585,7 @@ void BackgroundPreviewBox::uploadForPeer() { "Got wallPaperNoFile after account.UploadWallPaper.")); }); if (const auto paper = Data::WallPaper::Create(session, result)) { - setExistingForPeer(*paper); + setExistingForPeer(*paper, both); } }).send(); }, _uploadLifetime); @@ -588,7 +594,9 @@ void BackgroundPreviewBox::uploadForPeer() { _radial.start(_uploadProgress); } -void BackgroundPreviewBox::setExistingForPeer(const Data::WallPaper &paper) { +void BackgroundPreviewBox::setExistingForPeer( + const Data::WallPaper &paper, + bool both) { Expects(_forPeer != nullptr); if (const auto already = _forPeer->wallPaper()) { @@ -602,6 +610,7 @@ void BackgroundPreviewBox::setExistingForPeer(const Data::WallPaper &paper) { api->request(MTPmessages_SetChatWallPaper( MTP_flags((_fromMessageId ? Flag::f_id : Flag()) | (_fromMessageId ? Flag() : Flag::f_wallpaper) + | (both ? Flag::f_for_both : Flag()) | Flag::f_settings), _forPeer->input, paper.mtpInput(&_controller->session()), @@ -618,10 +627,117 @@ void BackgroundPreviewBox::setExistingForPeer(const Data::WallPaper &paper) { void BackgroundPreviewBox::applyForPeer() { Expects(_forPeer != nullptr); - if (Data::IsCustomWallPaper(_paper)) { - uploadForPeer(); + if (!Data::IsCustomWallPaper(_paper)) { + if (const auto already = _forPeer->wallPaper()) { + if (already->equals(_paper)) { + _controller->finishChatThemeEdit(_forPeer); + return; + } + } + } + + if (!_fromMessageId && _forPeer->session().premiumPossible()) { + if (_forBothOverlay) { + return; + } + const auto size = this->size() * style::DevicePixelRatio(); + const auto bg = Images::DitherImage( + Images::BlurLargeImage( + Ui::GrabWidgetToImage(this).scaled( + size / style::ConvertScale(4), + Qt::IgnoreAspectRatio, + Qt::SmoothTransformation), + 24).scaled( + size, + Qt::IgnoreAspectRatio, + Qt::SmoothTransformation)); + + _forBothOverlay = std::make_unique>( + this, + object_ptr(this)); + const auto overlay = _forBothOverlay->entity(); + + sizeValue() | rpl::start_with_next([=](QSize size) { + _forBothOverlay->setGeometry({ QPoint(), size }); + overlay->setGeometry({ QPoint(), size }); + }, _forBothOverlay->lifetime()); + + overlay->paintRequest( + ) | rpl::start_with_next([=](QRect clip) { + auto p = QPainter(overlay); + p.drawImage(0, 0, bg); + p.fillRect(clip, QColor(0, 0, 0, 64)); + }, overlay->lifetime()); + + using namespace Ui; + const auto forMe = CreateChild( + overlay, + tr::lng_background_apply_me(), + st::backgroundConfirm); + forMe->setClickedCallback([=] { + applyForPeer(false); + }); + using namespace rpl::mappers; + const auto forBoth = ::Settings::CreateLockedButton( + overlay, + tr::lng_background_apply_both( + lt_user, + rpl::single(_forPeer->shortName())), + st::backgroundConfirm, + Data::AmPremiumValue(&_forPeer->session()) | rpl::map(!_1)); + forBoth->setClickedCallback([=] { + if (_forPeer->session().premium()) { + applyForPeer(true); + } else { + ShowPremiumPreviewBox( + _controller->uiShow(), + PremiumPreview::Wallpapers); + } + }); + const auto cancel = CreateChild( + overlay, + tr::lng_cancel(), + st::backgroundConfirmCancel); + cancel->setClickedCallback([=] { + const auto raw = _forBothOverlay.release(); + raw->shownValue() | rpl::filter( + !rpl::mappers::_1 + ) | rpl::take(1) | rpl::start_with_next(crl::guard(raw, [=] { + delete raw; + }), raw->lifetime()); + raw->toggle(false, anim::type::normal); + }); + forMe->setTextTransform(RoundButton::TextTransform::NoTransform); + forBoth->setTextTransform(RoundButton::TextTransform::NoTransform); + cancel->setTextTransform(RoundButton::TextTransform::NoTransform); + + overlay->sizeValue( + ) | rpl::start_with_next([=](QSize size) { + const auto padding = st::backgroundConfirmPadding; + const auto width = size.width() + - padding.left() + - padding.right(); + const auto height = cancel->height(); + auto top = size.height() - padding.bottom() - height; + cancel->setGeometry(padding.left(), top, width, height); + top -= height + padding.top(); + forBoth->setGeometry(padding.left(), top, width, height); + top -= height + padding.top(); + forMe->setGeometry(padding.left(), top, width, height); + }, _forBothOverlay->lifetime()); + + _forBothOverlay->hide(anim::type::instant); + _forBothOverlay->show(anim::type::normal); } else { - setExistingForPeer(_paper); + applyForPeer(false); + } +} + +void BackgroundPreviewBox::applyForPeer(bool both) { + if (Data::IsCustomWallPaper(_paper)) { + uploadForPeer(both); + } else { + setExistingForPeer(_paper, both); } } diff --git a/Telegram/SourceFiles/boxes/background_preview_box.h b/Telegram/SourceFiles/boxes/background_preview_box.h index dc44f9509..8c1bd4346 100644 --- a/Telegram/SourceFiles/boxes/background_preview_box.h +++ b/Telegram/SourceFiles/boxes/background_preview_box.h @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "boxes/abstract_box.h" +#include "ui/layers/box_content.h" #include "base/binary_guard.h" #include "history/admin_log/history_admin_log_item.h" #include "history/view/history_view_element.h" @@ -29,6 +29,8 @@ class ChatStyle; class MediaSlider; template class SlideWrap; +template +class FadeWrap; } // namespace Ui struct BackgroundPreviewArgs { @@ -66,9 +68,10 @@ private: void apply(); void applyForPeer(); + void applyForPeer(bool both); void applyForEveryone(); - void uploadForPeer(); - void setExistingForPeer(const Data::WallPaper &paper); + void uploadForPeer(bool both); + void setExistingForPeer(const Data::WallPaper &paper, bool both); void share(); void radialAnimationCallback(crl::time now); QRect radialRect() const; @@ -131,6 +134,8 @@ private: float64 _uploadProgress = 0.; rpl::lifetime _uploadLifetime; + std::unique_ptr> _forBothOverlay; + rpl::variable _paletteServiceBg; rpl::lifetime _serviceBgLifetime; diff --git a/Telegram/SourceFiles/boxes/boxes.style b/Telegram/SourceFiles/boxes/boxes.style index b00a76986..dbba29270 100644 --- a/Telegram/SourceFiles/boxes/boxes.style +++ b/Telegram/SourceFiles/boxes/boxes.style @@ -753,7 +753,28 @@ backgroundCheck: ServiceCheck { color: msgServiceFg; duration: 200; } +backgroundConfirmPadding: margins(24px, 16px, 24px, 16px); +backgroundConfirm: RoundButton(defaultActiveButton) { + height: 44px; + textTop: 12px; + font: font(13px semibold); +} +backgroundConfirmCancel: RoundButton(backgroundConfirm) { + textFg: mediaviewSaveMsgFg; + textFgOver: mediaviewSaveMsgFg; + numbersTextFg: mediaviewSaveMsgFg; + numbersTextFgOver: mediaviewSaveMsgFg; + textBg: shadowFg; + textBgOver: shadowFg; + height: 44px; + textTop: 12px; + font: font(13px semibold); + + ripple: RippleAnimation(defaultRippleAnimation) { + color: shadowFg; + } +} urlAuthCheckbox: Checkbox(defaultBoxCheckbox) { width: 240px; } @@ -906,6 +927,14 @@ sponsoredUrlButton: RoundButton(defaultActiveButton) { } } +requestPeerRestriction: FlatLabel(defaultFlatLabel) { + minWidth: 240px; + textFg: membersAboutLimitFg; + style: TextStyle(boxTextStyle) { + lineHeight: 22px; + } +} + requestsBoxItem: PeerListItem(peerListBoxItem) { height: 99px; button: OutlineButton(defaultPeerListButton) { diff --git a/Telegram/SourceFiles/boxes/connection_box.h b/Telegram/SourceFiles/boxes/connection_box.h index d16d5cd11..8c78ebf34 100644 --- a/Telegram/SourceFiles/boxes/connection_box.h +++ b/Telegram/SourceFiles/boxes/connection_box.h @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/timer.h" #include "base/object_ptr.h" -#include "core/core_settings.h" +#include "core/core_settings_proxy.h" #include "mtproto/connection_abstract.h" #include "mtproto/mtproto_proxy_data.h" diff --git a/Telegram/SourceFiles/boxes/create_poll_box.cpp b/Telegram/SourceFiles/boxes/create_poll_box.cpp index ef53b2d62..373899be4 100644 --- a/Telegram/SourceFiles/boxes/create_poll_box.cpp +++ b/Telegram/SourceFiles/boxes/create_poll_box.cpp @@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/buttons.h" #include "ui/widgets/checkbox.h" #include "ui/text/text_utilities.h" +#include "ui/vertical_list.h" #include "main/main_session.h" #include "core/application.h" #include "core/core_settings.h" @@ -26,7 +27,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "chat_helpers/message_field.h" #include "menu/menu_send.h" #include "history/view/history_view_schedule_box.h" -#include "settings/settings_common.h" #include "base/unique_qptr.h" #include "base/event_filter.h" #include "base/call_delayed.h" @@ -34,7 +34,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_session_controller.h" #include "styles/style_layers.h" #include "styles/style_boxes.h" -#include "styles/style_settings.h" namespace { @@ -790,7 +789,7 @@ not_null CreatePollBox::setupQuestion( using namespace Settings; const auto session = &_controller->session(); - AddSubsectionTitle(container, tr::lng_polls_create_question()); + Ui::AddSubsectionTitle(container, tr::lng_polls_create_question()); const auto question = container->add( object_ptr( container, @@ -818,9 +817,9 @@ not_null CreatePollBox::setupQuestion( - st::createPollWarningPosition.x()), (geometry.y() - st::createPollFieldPadding.top() - - st::settingsSubsectionTitlePadding.bottom() - - st::settingsSubsectionTitle.style.font->height - + st::settingsSubsectionTitle.style.font->ascent + - st::defaultSubsectionTitlePadding.bottom() + - st::defaultSubsectionTitle.style.font->height + + st::defaultSubsectionTitle.style.font->ascent - st::createPollWarning.style.font->ascent), geometry.width()); }, warning->lifetime()); @@ -841,8 +840,8 @@ not_null CreatePollBox::setupSolution( const auto inner = outer->entity(); const auto session = &_controller->session(); - AddSkip(inner); - AddSubsectionTitle(inner, tr::lng_polls_solution_title()); + Ui::AddSkip(inner); + Ui::AddSubsectionTitle(inner, tr::lng_polls_solution_title()); const auto solution = inner->add( object_ptr( inner, @@ -875,9 +874,9 @@ not_null CreatePollBox::setupSolution( - st::createPollWarningPosition.x()), (geometry.y() - st::createPollFieldPadding.top() - - st::settingsSubsectionTitlePadding.bottom() - - st::settingsSubsectionTitle.style.font->height - + st::settingsSubsectionTitle.style.font->ascent + - st::defaultSubsectionTitlePadding.bottom() + - st::defaultSubsectionTitle.style.font->height + + st::defaultSubsectionTitle.style.font->ascent - st::createPollWarning.style.font->ascent), geometry.width()); }, warning->lifetime()); @@ -902,13 +901,13 @@ object_ptr CreatePollBox::setupContent() { const auto container = result.data(); const auto question = setupQuestion(container); - AddDivider(container); - AddSkip(container); + Ui::AddDivider(container); + Ui::AddSkip(container); container->add( object_ptr( container, tr::lng_polls_create_options(), - st::settingsSubsectionTitle), + st::defaultSubsectionTitle), st::createPollFieldTitlePadding); const auto options = lifetime().make_state( getDelegate()->outerContainer(), @@ -939,8 +938,8 @@ object_ptr CreatePollBox::setupContent() { options->focusFirst(); }, question->lifetime()); - AddSkip(container); - AddSubsectionTitle(container, tr::lng_polls_create_settings()); + Ui::AddSkip(container); + Ui::AddSubsectionTitle(container, tr::lng_polls_create_settings()); const auto anonymous = (!(_disabled & PollData::Flag::PublicVotes)) ? container->add( diff --git a/Telegram/SourceFiles/boxes/create_poll_box.h b/Telegram/SourceFiles/boxes/create_poll_box.h index 362213987..2147c2e32 100644 --- a/Telegram/SourceFiles/boxes/create_poll_box.h +++ b/Telegram/SourceFiles/boxes/create_poll_box.h @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "boxes/abstract_box.h" +#include "ui/layers/box_content.h" #include "api/api_common.h" #include "data/data_poll.h" #include "base/flags.h" diff --git a/Telegram/SourceFiles/boxes/dictionaries_manager.h b/Telegram/SourceFiles/boxes/dictionaries_manager.h index 0dd391410..f91fb1741 100644 --- a/Telegram/SourceFiles/boxes/dictionaries_manager.h +++ b/Telegram/SourceFiles/boxes/dictionaries_manager.h @@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #ifndef TDESKTOP_DISABLE_SPELLCHECK -#include "boxes/abstract_box.h" +#include "ui/layers/box_content.h" namespace Main { class Session; diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.h b/Telegram/SourceFiles/boxes/edit_caption_box.h index 80a7b0a82..110c0e588 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.h +++ b/Telegram/SourceFiles/boxes/edit_caption_box.h @@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "boxes/abstract_box.h" +#include "ui/layers/box_content.h" #include "ui/chat/attach/attach_prepare.h" namespace ChatHelpers { diff --git a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp index e5c601881..899c8be02 100644 --- a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp @@ -13,9 +13,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/text/text_utilities.h" #include "ui/wrap/slide_wrap.h" #include "ui/wrap/vertical_layout.h" +#include "ui/vertical_list.h" #include "history/history.h" #include "boxes/peer_list_controllers.h" -#include "settings/settings_common.h" #include "settings/settings_privacy_security.h" #include "calls/calls_instance.h" #include "base/binary_guard.h" @@ -233,7 +233,7 @@ Ui::FlatLabel *EditPrivacyBox::addLabel( object_ptr( container, std::move(label), - st::settingsDividerLabelPadding), + st::defaultBoxDividerLabelPadding), { 0, topSkip, 0, 0 }); return result; } @@ -294,7 +294,7 @@ void EditPrivacyBox::setupContent() { const auto button = content->add( object_ptr>( content, - CreateButton( + object_ptr