diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index e32b21f36..680ac3d5a 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -402,6 +402,8 @@ PRIVATE boxes/sessions_box.h boxes/share_box.cpp boxes/share_box.h + boxes/star_gift_box.cpp + boxes/star_gift_box.h boxes/sticker_set_box.cpp boxes/sticker_set_box.h boxes/stickers_box.cpp @@ -649,6 +651,8 @@ PRIVATE data/data_lastseen_status.h data/data_location.cpp data/data_location.h + data/data_media_preload.cpp + data/data_media_preload.h data/data_media_rotation.cpp data/data_media_rotation.h data/data_media_types.cpp @@ -684,6 +688,7 @@ PRIVATE data/data_replies_list.h data/data_reply_preview.cpp data/data_reply_preview.h + data/data_report.h data/data_saved_messages.cpp data/data_saved_messages.h data/data_saved_sublist.cpp @@ -1027,6 +1032,10 @@ PRIVATE info/media/info_media_widget.h info/members/info_members_widget.cpp info/members/info_members_widget.h + info/peer_gifts/info_peer_gifts_common.cpp + info/peer_gifts/info_peer_gifts_common.h + info/peer_gifts/info_peer_gifts_widget.cpp + info/peer_gifts/info_peer_gifts_widget.h info/polls/info_polls_results_inner_widget.cpp info/polls/info_polls_results_inner_widget.h info/polls/info_polls_results_widget.cpp diff --git a/Telegram/Resources/emoji/emoji_1.webp b/Telegram/Resources/emoji/emoji_1.webp index 4bf92eca5..4669e6022 100644 Binary files a/Telegram/Resources/emoji/emoji_1.webp and b/Telegram/Resources/emoji/emoji_1.webp differ diff --git a/Telegram/Resources/emoji/emoji_2.webp b/Telegram/Resources/emoji/emoji_2.webp index 988947793..0c0d7c295 100644 Binary files a/Telegram/Resources/emoji/emoji_2.webp and b/Telegram/Resources/emoji/emoji_2.webp differ diff --git a/Telegram/Resources/emoji/emoji_3.webp b/Telegram/Resources/emoji/emoji_3.webp index 5e2172deb..4d874b37b 100644 Binary files a/Telegram/Resources/emoji/emoji_3.webp and b/Telegram/Resources/emoji/emoji_3.webp differ diff --git a/Telegram/Resources/emoji/emoji_4.webp b/Telegram/Resources/emoji/emoji_4.webp index 4859c1337..bc4eead44 100644 Binary files a/Telegram/Resources/emoji/emoji_4.webp and b/Telegram/Resources/emoji/emoji_4.webp differ diff --git a/Telegram/Resources/emoji/emoji_5.webp b/Telegram/Resources/emoji/emoji_5.webp index 3539ebe03..9a4e9afd6 100644 Binary files a/Telegram/Resources/emoji/emoji_5.webp and b/Telegram/Resources/emoji/emoji_5.webp differ diff --git a/Telegram/Resources/emoji/emoji_6.webp b/Telegram/Resources/emoji/emoji_6.webp index 8da39a6b1..7d5842d8e 100644 Binary files a/Telegram/Resources/emoji/emoji_6.webp and b/Telegram/Resources/emoji/emoji_6.webp differ diff --git a/Telegram/Resources/emoji/emoji_7.webp b/Telegram/Resources/emoji/emoji_7.webp index 3c31b2345..b324a3e83 100644 Binary files a/Telegram/Resources/emoji/emoji_7.webp and b/Telegram/Resources/emoji/emoji_7.webp differ diff --git a/Telegram/Resources/emoji/emoji_8.webp b/Telegram/Resources/emoji/emoji_8.webp index c3e6b3b0d..5ac85a8a7 100644 Binary files a/Telegram/Resources/emoji/emoji_8.webp and b/Telegram/Resources/emoji/emoji_8.webp differ diff --git a/Telegram/Resources/export_html/css/style.css b/Telegram/Resources/export_html/css/style.css index 102f5f3a5..f9727d68a 100644 --- a/Telegram/Resources/export_html/css/style.css +++ b/Telegram/Resources/export_html/css/style.css @@ -582,3 +582,55 @@ div.toast_shown { .bot_button_column_separator { width: 2px } + +.reactions { + margin: 5px 0; +} + +.reactions .reaction { + display: inline-flex; + height: 20px; + border-radius: 15px; + background-color: #e8f5fc; + color: #168acd; + font-weight: bold; + margin-bottom: 5px; +} + +.reactions .reaction.active { + background-color: #40a6e2; + color: #fff; +} + +.reactions .reaction.paid { + background-color: #fdf6e1; + color: #c58523; +} + +.reactions .reaction.active.paid { + background-color: #ecae0a; + color: #fdf6e1; +} + +.reactions .reaction .emoji { + line-height: 20px; + margin: 0 5px; + font-size: 15px; +} + +.reactions .reaction .userpic:not(:first-child) { + margin-left: -8px; +} + +.reactions .reaction .userpic { + display: inline-block; +} + +.reactions .reaction .userpic .initials { + font-size: 8px; +} + +.reactions .reaction .count { + margin-right: 8px; + line-height: 20px; +} \ No newline at end of file diff --git a/Telegram/Resources/icons/inline_button_copy.png b/Telegram/Resources/icons/inline_button_copy.png new file mode 100644 index 000000000..50732e98f Binary files /dev/null and b/Telegram/Resources/icons/inline_button_copy.png differ diff --git a/Telegram/Resources/icons/inline_button_copy@2x.png b/Telegram/Resources/icons/inline_button_copy@2x.png new file mode 100644 index 000000000..0c843e25f Binary files /dev/null and b/Telegram/Resources/icons/inline_button_copy@2x.png differ diff --git a/Telegram/Resources/icons/inline_button_copy@3x.png b/Telegram/Resources/icons/inline_button_copy@3x.png new file mode 100644 index 000000000..f2b2fce5b Binary files /dev/null and b/Telegram/Resources/icons/inline_button_copy@3x.png differ diff --git a/Telegram/Resources/iv_html/page.css b/Telegram/Resources/iv_html/page.css index 9c0ab832f..cdbfc3108 100644 --- a/Telegram/Resources/iv_html/page.css +++ b/Telegram/Resources/iv_html/page.css @@ -12,6 +12,7 @@ body { margin: 0; background-color: var(--td-window-bg); color: var(--td-window-fg); + zoom: var(--td-zoom-percentage); } html.custom_scroll ::-webkit-scrollbar { diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index bd4508f87..e13e83477 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -453,6 +453,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_username_app_not_found" = "Bot application not found."; "lng_username_link" = "This link opens a chat with you:"; "lng_username_copied" = "Link copied to clipboard."; +"lng_username_text_copied" = "Username copied to clipboard."; "lng_usernames_edit" = "click to edit"; "lng_usernames_active" = "active"; @@ -487,6 +488,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_collectible_phone_info" = "This phone number was bought on **Fragment** on {date} for {price}"; "lng_collectible_phone_copy" = "Copy Phone Number"; "lng_collectible_learn_more" = "Learn More"; +"lng_collectible_phone_copied" = "Phone number copied to clipboard."; "lng_settings_section_info" = "Info"; @@ -508,6 +510,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_settings_alert_linux" = "Draw attention to the window"; "lng_settings_badge_title" = "Badge counter"; "lng_settings_include_muted" = "Include muted chats in unread count"; +"lng_settings_include_muted_folders" = "Include muted chats in folder counters"; "lng_settings_count_unread" = "Count unread messages"; "lng_settings_events_title" = "Events"; "lng_settings_events_joined" = "Contact joined Telegram"; @@ -1322,6 +1325,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_profile_similar_channels#other" = "{count} similar channels"; "lng_profile_saved_messages#one" = "{count} saved message"; "lng_profile_saved_messages#other" = "{count} saved messages"; +"lng_profile_peer_gifts#one" = "{count} gift"; +"lng_profile_peer_gifts#other" = "{count} gifts"; "lng_profile_participants_section" = "Members"; "lng_profile_subscribers_section" = "Subscribers"; "lng_profile_add_contact" = "Add Contact"; @@ -1376,6 +1381,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_profile_copy_fullname" = "Copy Name"; "lng_profile_photo_by_you" = "photo set by you"; "lng_profile_public_photo" = "public photo"; +"lng_profile_administrators#one" = "{count} administrator"; +"lng_profile_administrators#other" = "{count} administrators"; +"lng_profile_manage" = "Channel settings"; "lng_invite_upgrade_title" = "Upgrade to Premium"; "lng_invite_upgrade_group_invite#one" = "{users} only accepts invitations to groups from Contacts and **Premium** users."; @@ -1659,6 +1667,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_report_and_ban_button" = "Ban user"; "lng_report_details_about" = "Please enter any additional details relevant to your report."; "lng_report_details" = "Additional Details"; +"lng_report_details_optional" = "Add Comment (Optional)"; +"lng_report_details_non_optional" = "Add Comment"; +"lng_report_details_message_about" = "Please help us by telling what is wrong with the message you have selected"; "lng_report_reason_spam" = "Spam"; "lng_report_reason_fake" = "Fake Account"; "lng_report_reason_violence" = "Violence"; @@ -1852,8 +1863,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_action_proximity_distance_km#other" = "{count} km"; "lng_action_webview_data_done" = "Data from the \"{text}\" button was transferred to the bot."; "lng_action_gift_received" = "{user} sent you a gift for {cost}"; -"lng_action_gift_received_me" = "You sent to {user} a gift for {cost}"; +"lng_action_gift_sent" = "You sent a gift for {cost}"; "lng_action_gift_received_anonymous" = "Unknown user sent you a gift for {cost}"; +"lng_action_gift_for_stars#one" = "{count} Star"; +"lng_action_gift_for_stars#other" = "{count} Stars"; +"lng_action_gift_got_subtitle" = "Gift from {user}"; +"lng_action_gift_got_stars_text#one" = "Display this gift on your page or convert it to **{count}** Star."; +"lng_action_gift_got_stars_text#other" = "Display this gift on your page or convert it to **{count}** Stars."; +"lng_action_gift_sent_subtitle" = "Gift for {user}"; +"lng_action_gift_sent_text#one" = "{user} can display this gift on their page or convert it to {count} Star."; +"lng_action_gift_sent_text#other" = "{user} can display this gift on their page or convert it to {count} Stars."; +"lng_action_gift_premium_months#one" = "{count} Month Premium"; +"lng_action_gift_premium_months#other" = "{count} Months Premium"; +"lng_action_gift_premium_about" = "Subscription for exclusive Telegram features."; "lng_action_suggested_photo_me" = "You suggested this photo for {user}'s Telegram profile."; "lng_action_suggested_photo" = "{user} suggests this photo for your Telegram profile."; "lng_action_suggested_photo_button" = "View Photo"; @@ -1915,6 +1937,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_similar_channels_premium_all_link" = "Telegram Premium"; "lng_similar_channels_show_more" = "Show more channels"; +"lng_peer_gifts_title" = "Gifts"; +"lng_peer_gifts_about" = "These gifts were sent to {user} by other users."; +"lng_peer_gifts_about_mine" = "These gifts were sent to you by other users. Click on a gift to convert it to Stars or change its privacy settings."; + "lng_premium_gift_duration_months#one" = "for {count} month"; "lng_premium_gift_duration_months#other" = "for {count} months"; "lng_premium_gift_duration_years#one" = "for {count} year"; @@ -2415,6 +2441,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_credits_box_history_entry_gift_name" = "Received Gift"; "lng_credits_box_history_entry_giveaway_name" = "Received Prize"; "lng_credits_box_history_entry_gift_sent" = "Sent Gift"; +"lng_credits_box_history_entry_gift_converted" = "Converted Gift"; "lng_credits_box_history_entry_gift_out_about" = "With Stars, **{user}** will be able to unlock content and services on Telegram.\n{link}"; "lng_credits_box_history_entry_gift_in_about" = "Use Stars to unlock content and services on Telegram. {link}"; "lng_credits_box_history_entry_gift_about_link" = "See Examples {emoji}"; @@ -2461,6 +2488,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_credits_small_balance_about" = "Buy **Stars** and use them on **{bot}** and other miniapps."; "lng_credits_small_balance_reaction" = "Buy **Stars** and send them to {channel} to support their posts."; "lng_credits_small_balance_subscribe" = "Buy **Stars** and subscribe to **{channel}** and other channels."; +"lng_credits_small_balance_star_gift" = "Buy **Stars** to send gifts to {user} and other contacts."; "lng_credits_small_balance_fallback" = "Buy **Stars** to unlock content and services on Telegram."; "lng_credits_purchase_blocked" = "Sorry, you can't purchase this item with Telegram Stars."; "lng_credits_enough" = "You have enough stars at the moment. {link}"; @@ -2980,6 +3008,53 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_gift_stars_incoming" = "Use Stars to unlock content and services on Telegram."; "lng_gift_until" = "Until"; +"lng_gift_premium_or_stars" = "Gift Premium or Stars"; +"lng_gift_premium_subtitle" = "Gift Premium"; +"lng_gift_premium_about" = "Give {name} access to exclusive features with Telegram Premium. {features}"; +"lng_gift_premium_features" = "See Features >"; +"lng_gift_premium_label" = "Premium"; +"lng_gift_stars_subtitle" = "Gift Stars"; +"lng_gift_stars_about" = "Give {name} gifts that can be kept on your profile or converted to Stars. {link}"; +"lng_gift_stars_link" = "What are Stars >"; +"lng_gift_stars_limited" = "limited"; +"lng_gift_stars_sold_out" = "sold out"; +"lng_gift_stars_tabs_all" = "All Gifts"; +"lng_gift_stars_tabs_limited" = "Limited"; +"lng_gift_send_title" = "Send a Gift"; +"lng_gift_send_message" = "Enter Message"; +"lng_gift_send_anonymous" = "Hide My Name"; +"lng_gift_send_anonymous_about" = "You can hide your name and message from visitors to {user}'s profile. {recipient} will still see your name and message."; +"lng_gift_send_premium_about" = "Only {user} will see your message."; +"lng_gift_send_button" = "Send a Gift for {cost}"; +"lng_gift_sent_title" = "Gift Sent!"; +"lng_gift_sent_about#one" = "You spent **{count}** Star from your balance."; +"lng_gift_sent_about#other" = "You spent **{count}** Stars from your balance."; +"lng_gift_limited_of_one" = "unique"; +"lng_gift_limited_of_count" = "1 of {amount}"; +"lng_gift_anonymous_hint" = "Only you can see the sender's name."; +"lng_gift_hidden_hint" = "This gift is hidden. Only you can see it."; +"lng_gift_visible_hint" = "This gift is visible to visitors of your page."; +"lng_gift_availability" = "Availability"; +"lng_gift_from_hidden" = "Hidden User"; +"lng_gift_availability_left#one" = "{count} of {amount} left"; +"lng_gift_availability_left#other" = "{count} of {amount} left"; +"lng_gift_availability_none" = "None of {amount} left"; +"lng_gift_display_on_page" = "Display on my Page"; +"lng_gift_display_on_page_hide" = "Hide from my Page"; +"lng_gift_convert_to_stars#one" = "Convert to {count} Star"; +"lng_gift_convert_to_stars#other" = "Convert to {count} Stars"; +"lng_gift_convert_sure_title" = "Convert Gift to Stars"; +"lng_gift_convert_sure_text#one" = "Do you want to convert this gift from {user} to **{count} Star**?\n\nThis action cannot be undone."; +"lng_gift_convert_sure_text#other" = "Do you want to convert this gift from {user} to **{count} Stars**?\n\nThis action cannot be undone."; +"lng_gift_convert_sure" = "Convert"; +"lng_gift_display_done" = "The gift is now shown on your profile page."; +"lng_gift_display_done_hide" = "The gift is now hidden from your profile page."; +"lng_gift_got_stars#one" = "You got **{count} Star** for this gift."; +"lng_gift_got_stars#other" = "You got **{count} Stars** for this gift."; +"lng_gift_sold_out_title" = "Sold Out!"; +"lng_gift_sold_out_text#one" = "All {count} gift was already sold."; +"lng_gift_sold_out_text#other" = "All {count} gifts were already sold."; + "lng_accounts_limit_title" = "Limit Reached"; "lng_accounts_limit1#one" = "You have reached the limit of **{count}** connected account."; "lng_accounts_limit1#other" = "You have reached the limit of **{count}** connected accounts."; @@ -3222,6 +3297,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_replies_discussion_started" = "Discussion started"; "lng_replies_no_comments" = "No comments here yet..."; +"lng_verification_codes" = "Verification Codes"; + "lng_archived_name" = "Archived chats"; "lng_archived_add" = "Archive"; "lng_archived_remove" = "Unarchive"; @@ -3246,7 +3323,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_open_link" = "Open"; "lng_allow_bot_pass" = "Allow {bot_name} to pass your Telegram name and ID (not your phone number) to the web pages you open via this bot?"; "lng_allow_bot" = "Allow"; -"lng_allow_bot_webview" = "{bot_name} would like to open its web app to proceed.\n\nIt will be able to access your **IP address** and basic device info."; +"lng_allow_bot_webview_details" = "More about this bot {emoji}"; +"lng_allow_bot_webview_details_about" = "To launch this web app, you will connect to its website.\n\nIt will be able to access your **IP address** and basic device info."; "lng_url_auth_open_confirm" = "Do you want to open {link}?"; "lng_url_auth_login_option" = "Log in to {domain} as {user}"; "lng_url_auth_allow_messages" = "Allow {bot} to send me messages"; @@ -3498,6 +3576,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_context_animated_reactions_many#one" = "Reactions contain emoji from **{count} pack**."; "lng_context_animated_reactions_many#other" = "Reactions contain emoji from **{count} packs**."; +"lng_context_noforwards_info_channel" = "Copying and forwarding is not allowed in this channel."; +"lng_context_noforwards_info_group" = "Copying and forwarding is not allowed in this group."; +"lng_context_noforwards_info_bot" = "Copying and forwarding is not allowed from this bot."; + "lng_context_spoiler_effect" = "Hide with Spoiler"; "lng_context_disable_spoiler" = "Remove Spoiler"; "lng_context_make_paid" = "Make This Content Paid"; @@ -3608,6 +3690,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_reply_header_short" = "Reply"; "lng_reply_quote_selected" = "Quote Selected"; "lng_reply_from_private_chat" = "This reply is from a private chat."; +"lng_reply_quote_long_title" = "Quote too long!"; +"lng_reply_quote_long_text" = "The selected text is too long to quote."; "lng_link_options_header" = "Link Preview Settings"; "lng_link_header_short" = "Link"; "lng_link_move_up" = "Move Up"; @@ -4233,6 +4317,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_rights_restriction_for_all" = "This option is disabled for all members in Group Permissions."; "lng_rights_permission_for_all" = "This option is enabled for all members in Group Permissions."; "lng_rights_permission_unavailable" = "This permission is not available in public groups."; +"lng_rights_permission_in_discuss" = "This permission is not available in discussion groups."; "lng_rights_permission_cant_edit" = "You cannot change this permission."; "lng_rights_user_restrictions" = "User permissions"; "lng_rights_user_restrictions_header" = "What can this member do?"; @@ -5550,6 +5635,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_qr_box_quality1" = "Normal"; "lng_qr_box_quality2" = "High"; "lng_qr_box_quality3" = "Very High"; +"lng_qr_box_transparent_background" = "Transparent Background"; +"lng_qr_box_font_size" = "Font size"; // Wnd specific diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 3701e55ec..798a9e220 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -10,7 +10,7 @@ + Version="5.6.3.0" /> Telegram Desktop Telegram Messenger LLP diff --git a/Telegram/Resources/winrc/Telegram.manifest b/Telegram/Resources/winrc/Telegram.manifest index 75569a75f..014c43ed5 100644 --- a/Telegram/Resources/winrc/Telegram.manifest +++ b/Telegram/Resources/winrc/Telegram.manifest @@ -16,6 +16,8 @@ + true/pm + PerMonitor UTF-8 diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index df78b18a6..4404a4c05 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 5,5,5,0 - PRODUCTVERSION 5,5,5,0 + FILEVERSION 5,6,3,0 + PRODUCTVERSION 5,6,3,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -62,10 +62,10 @@ BEGIN BEGIN VALUE "CompanyName", "Radolyn Labs" VALUE "FileDescription", "AyuGram Desktop" - VALUE "FileVersion", "5.5.5.0" + VALUE "FileVersion", "5.6.3.0" VALUE "LegalCopyright", "Copyright (C) 2014-2024" VALUE "ProductName", "AyuGram Desktop" - VALUE "ProductVersion", "5.5.5.0" + VALUE "ProductVersion", "5.6.3.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 0b54e9425..fbe2ad09e 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 5,5,5,0 - PRODUCTVERSION 5,5,5,0 + FILEVERSION 5,6,3,0 + PRODUCTVERSION 5,6,3,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -53,10 +53,10 @@ BEGIN BEGIN VALUE "CompanyName", "Radolyn Labs" VALUE "FileDescription", "AyuGram Desktop Updater" - VALUE "FileVersion", "5.5.5.0" + VALUE "FileVersion", "5.6.3.0" VALUE "LegalCopyright", "Copyright (C) 2014-2024" VALUE "ProductName", "AyuGram Desktop" - VALUE "ProductVersion", "5.5.5.0" + VALUE "ProductVersion", "5.6.3.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/api/api_bot.cpp b/Telegram/SourceFiles/api/api_bot.cpp index dc5cfabb8..5342cbd2e 100644 --- a/Telegram/SourceFiles/api/api_bot.cpp +++ b/Telegram/SourceFiles/api/api_bot.cpp @@ -39,6 +39,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/layers/generic_box.h" #include "ui/text/text_utilities.h" +#include +#include + namespace Api { namespace { @@ -503,11 +506,19 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) { bot->session().attachWebView().open({ .bot = bot, .context = { .controller = controller }, - .button = {.text = button->text, .url = button->data }, + .button = { .text = button->text, .url = button->data }, .source = InlineBots::WebViewSourceButton{ .simple = true }, }); } } break; + + case ButtonType::CopyText: { + const auto text = QString::fromUtf8(button->data); + if (!text.isEmpty()) { + QGuiApplication::clipboard()->setText(text); + controller->showToast(tr::lng_text_copied(tr::now)); + } + } break; } } diff --git a/Telegram/SourceFiles/api/api_chat_invite.cpp b/Telegram/SourceFiles/api/api_chat_invite.cpp index dde941b33..be07e72ac 100644 --- a/Telegram/SourceFiles/api/api_chat_invite.cpp +++ b/Telegram/SourceFiles/api/api_chat_invite.cpp @@ -275,7 +275,6 @@ void ConfirmSubscriptionBox( : 0; state->api->request( MTPpayments_SendStarsForm( - MTP_flags(0), MTP_long(formId), MTP_inputInvoiceChatInviteSubscription(MTP_string(hash))) ).done([=](const MTPpayments_PaymentResult &result) { diff --git a/Telegram/SourceFiles/api/api_credits.cpp b/Telegram/SourceFiles/api/api_credits.cpp index f26a9380b..4ef4b09c8 100644 --- a/Telegram/SourceFiles/api/api_credits.cpp +++ b/Telegram/SourceFiles/api/api_credits.cpp @@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_updates.h" #include "apiwrap.h" #include "base/unixtime.h" +#include "data/components/credits.h" #include "data/data_channel.h" #include "data/data_document.h" #include "data/data_peer.h" @@ -69,10 +70,12 @@ constexpr auto kTransactionsLimit = 100; }, [](const auto &) { return PeerId(0); }).value; + const auto stargift = tl.data().vstargift(); + const auto incoming = (int64(tl.data().vstars().v) >= 0); return Data::CreditsHistoryEntry{ .id = qs(tl.data().vid()), .title = qs(tl.data().vtitle().value_or_empty()), - .description = qs(tl.data().vdescription().value_or_empty()), + .description = { qs(tl.data().vdescription().value_or_empty()) }, .date = base::unixtime::parse(tl.data().vdate().v), .photoId = photo ? photo->id : 0, .extended = std::move(extended), @@ -81,6 +84,9 @@ constexpr auto kTransactionsLimit = 100; .barePeerId = barePeerId, .bareGiveawayMsgId = uint64( tl.data().vgiveaway_post_id().value_or_empty()), + .bareGiftStickerId = (stargift + ? owner->processDocument(stargift->data().vsticker())->id + : 0), .peerType = tl.data().vpeer().match([](const HistoryPeerTL &) { return Data::CreditsHistoryEntry::PeerType::Peer; }, [](const MTPDstarsTransactionPeerPlayMarket &) { @@ -104,12 +110,16 @@ constexpr auto kTransactionsLimit = 100; ? base::unixtime::parse(tl.data().vtransaction_date()->v) : QDateTime(), .successLink = qs(tl.data().vtransaction_url().value_or_empty()), + .convertStars = int(stargift + ? stargift->data().vconvert_stars().v + : 0), + .converted = stargift && incoming, .reaction = tl.data().is_reaction(), .refunded = tl.data().is_refund(), .pending = tl.data().is_pending(), .failed = tl.data().is_failed(), - .in = (int64(tl.data().vstars().v) >= 0), - .gift = tl.data().is_gift(), + .in = incoming, + .gift = tl.data().is_gift() || stargift.has_value(), }; } @@ -239,6 +249,8 @@ void CreditsStatus::request( _peer->isSelf() ? MTP_inputPeerSelf() : _peer->input )).done([=](const TLResult &result) { _requestId = 0; + const auto balance = result.data().vbalance().v; + _peer->session().credits().apply(_peer->id, balance); if (const auto onstack = done) { onstack(StatusFromTL(result, _peer)); } diff --git a/Telegram/SourceFiles/api/api_media.cpp b/Telegram/SourceFiles/api/api_media.cpp index 46a5b7fa3..22fc37631 100644 --- a/Telegram/SourceFiles/api/api_media.cpp +++ b/Telegram/SourceFiles/api/api_media.cpp @@ -37,7 +37,8 @@ MTPVector ComposeSendingDocumentAttributes( MTP_int(dimensions.width()), MTP_int(dimensions.height()), MTPint(), // preload_prefix_size - MTPdouble())); // video_start_ts + MTPdouble(), // video_start_ts + MTPstring())); // video_codec } else { attributes.push_back(MTP_documentAttributeImageSize( MTP_int(dimensions.width()), diff --git a/Telegram/SourceFiles/api/api_premium.cpp b/Telegram/SourceFiles/api/api_premium.cpp index 0cd7a308b..84ce45783 100644 --- a/Telegram/SourceFiles/api/api_premium.cpp +++ b/Telegram/SourceFiles/api/api_premium.cpp @@ -550,6 +550,24 @@ Payments::InvoicePremiumGiftCode PremiumGiftCodeOptions::invoice( }; } +std::vector PremiumGiftCodeOptions::optionsForPeer() const { + auto result = std::vector(); + + if (!_optionsForOnePerson.currency.isEmpty()) { + const auto count = int(_optionsForOnePerson.months.size()); + result.reserve(count); + for (auto i = 0; i != count; ++i) { + Assert(i < _optionsForOnePerson.totalCosts.size()); + result.push_back({ + .cost = _optionsForOnePerson.totalCosts[i], + .currency = _optionsForOnePerson.currency, + .months = _optionsForOnePerson.months[i], + }); + } + } + return result; +} + Data::PremiumSubscriptionOptions PremiumGiftCodeOptions::options(int amount) { const auto it = _subscriptionOptions.find(amount); if (it != end(_subscriptionOptions)) { @@ -571,6 +589,41 @@ Data::PremiumSubscriptionOptions PremiumGiftCodeOptions::options(int amount) { } } +auto PremiumGiftCodeOptions::requestStarGifts() +-> rpl::producer { + return [=](auto consumer) { + auto lifetime = rpl::lifetime(); + + _api.request(MTPpayments_GetStarGifts( + MTP_int(0) + )).done([=](const MTPpayments_StarGifts &result) { + result.match([&](const MTPDpayments_starGifts &data) { + _giftsHash = data.vhash().v; + const auto &list = data.vgifts().v; + const auto session = &_peer->session(); + auto gifts = std::vector(); + gifts.reserve(list.size()); + for (const auto &gift : list) { + if (auto parsed = FromTL(session, gift)) { + gifts.push_back(std::move(*parsed)); + } + } + _gifts = std::move(gifts); + }, [&](const MTPDpayments_starGiftsNotModified &) { + }); + consumer.put_done(); + }).fail([=](const MTP::Error &error) { + consumer.put_error_copy(error.type()); + }).send(); + + return lifetime; + }; +} + +const std::vector &PremiumGiftCodeOptions::starGifts() const { + return _gifts; +} + int PremiumGiftCodeOptions::giveawayBoostsPerPremium() const { constexpr auto kFallbackCount = 4; return _peer->session().appConfig().get( @@ -705,4 +758,56 @@ rpl::producer RandomHelloStickerValue( }) | rpl::take(1) | rpl::map(random)); } +std::optional FromTL( + not_null session, + const MTPstarGift &gift) { + const auto &data = gift.data(); + const auto document = session->data().processDocument( + data.vsticker()); + const auto remaining = data.vavailability_remains(); + const auto total = data.vavailability_total(); + if (!document->sticker()) { + return {}; + } + return StarGift{ + .id = uint64(data.vid().v), + .stars = int64(data.vstars().v), + .convertStars = int64(data.vconvert_stars().v), + .document = document, + .limitedLeft = remaining.value_or_empty(), + .limitedCount = total.value_or_empty(), + }; +} + +std::optional FromTL( + not_null to, + const MTPuserStarGift &gift) { + const auto session = &to->session(); + const auto &data = gift.data(); + auto parsed = FromTL(session, data.vgift()); + if (!parsed) { + return {}; + } + return UserStarGift{ + .gift = std::move(*parsed), + .message = (data.vmessage() + ? TextWithEntities{ + .text = qs(data.vmessage()->data().vtext()), + .entities = Api::EntitiesFromMTP( + session, + data.vmessage()->data().ventities().v), + } + : TextWithEntities()), + .convertStars = int64(data.vconvert_stars().value_or_empty()), + .fromId = (data.vfrom_id() + ? peerFromUser(data.vfrom_id()->v) + : PeerId()), + .messageId = data.vmsg_id().value_or_empty(), + .date = data.vdate().v, + .anonymous = data.is_name_hidden(), + .hidden = data.is_unsaved(), + .mine = to->isSelf(), + }; +} + } // namespace Api diff --git a/Telegram/SourceFiles/api/api_premium.h b/Telegram/SourceFiles/api/api_premium.h index d78811ceb..805b68e03 100644 --- a/Telegram/SourceFiles/api/api_premium.h +++ b/Telegram/SourceFiles/api/api_premium.h @@ -67,6 +67,33 @@ struct GiveawayInfo { } }; +struct GiftOptionData { + int64 cost = 0; + QString currency; + int months = 0; +}; + +struct StarGift { + uint64 id = 0; + int64 stars = 0; + int64 convertStars = 0; + not_null document; + int limitedLeft = 0; + int limitedCount = 0; +}; + +struct UserStarGift { + StarGift gift; + TextWithEntities message; + int64 convertStars = 0; + PeerId fromId = 0; + MsgId messageId = 0; + TimeId date = 0; + bool anonymous = false; + bool hidden = false; + bool mine = false; +}; + class Premium final { public: explicit Premium(not_null api); @@ -171,6 +198,7 @@ public: PremiumGiftCodeOptions(not_null peer); [[nodiscard]] rpl::producer request(); + [[nodiscard]] std::vector optionsForPeer() const; [[nodiscard]] Data::PremiumSubscriptionOptions options(int amount); [[nodiscard]] const std::vector &availablePresets() const; [[nodiscard]] int monthsFromPreset(int monthsIndex); @@ -187,6 +215,9 @@ public: [[nodiscard]] int giveawayPeriodMax() const; [[nodiscard]] bool giveawayGiftsPurchaseAvailable() const; + [[nodiscard]] rpl::producer requestStarGifts(); + [[nodiscard]] const std::vector &starGifts() const; + private: struct Token final { int users = 0; @@ -206,7 +237,7 @@ private: base::flat_map _subscriptionOptions; struct { std::vector months; - std::vector totalCosts; + std::vector totalCosts; QString currency; } _optionsForOnePerson; @@ -214,6 +245,9 @@ private: base::flat_map _stores; + int32 _giftsHash = 0; + std::vector _gifts; + MTP::Sender _api; }; @@ -242,4 +276,11 @@ enum class RequirePremiumState { [[nodiscard]] rpl::producer RandomHelloStickerValue( not_null session); +[[nodiscard]] std::optional FromTL( + not_null session, + const MTPstarGift &gift); +[[nodiscard]] std::optional FromTL( + not_null to, + const MTPuserStarGift &gift); + } // namespace Api diff --git a/Telegram/SourceFiles/api/api_report.cpp b/Telegram/SourceFiles/api/api_report.cpp index 869152737..309e2d240 100644 --- a/Telegram/SourceFiles/api/api_report.cpp +++ b/Telegram/SourceFiles/api/api_report.cpp @@ -10,10 +10,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "apiwrap.h" #include "data/data_peer.h" #include "data/data_photo.h" +#include "data/data_report.h" #include "data/data_user.h" #include "lang/lang_keys.h" #include "main/main_session.h" -#include "ui/boxes/report_box.h" +#include "ui/boxes/report_box_graphics.h" #include "ui/layers/show.h" namespace Api { @@ -40,15 +41,11 @@ MTPreportReason ReasonToTL(const Ui::ReportReason &reason) { } // namespace void SendReport( - std::shared_ptr show, - not_null peer, - Ui::ReportReason reason, - const QString &comment, - std::variant< - v::null_t, - MessageIdsList, - not_null, - StoryId> data) { + std::shared_ptr show, + not_null peer, + Ui::ReportReason reason, + const QString &comment, + std::variant> data) { auto done = [=] { show->showToast(tr::lng_report_thanks(tr::now)); }; @@ -58,18 +55,6 @@ void SendReport( ReasonToTL(reason), MTP_string(comment) )).done(std::move(done)).send(); - }, [&](const MessageIdsList &ids) { - auto apiIds = QVector(); - apiIds.reserve(ids.size()); - for (const auto &fullId : ids) { - apiIds.push_back(MTP_int(fullId.msg)); - } - peer->session().api().request(MTPmessages_Report( - peer->input, - MTP_vector(apiIds), - ReasonToTL(reason), - MTP_string(comment) - )).done(std::move(done)).send(); }, [&](not_null photo) { peer->session().api().request(MTPaccount_ReportProfilePhoto( peer->input, @@ -77,14 +62,93 @@ void SendReport( ReasonToTL(reason), MTP_string(comment) )).done(std::move(done)).send(); - }, [&](StoryId id) { - peer->session().api().request(MTPstories_Report( - peer->input, - MTP_vector(1, MTP_int(id)), - ReasonToTL(reason), - MTP_string(comment) - )).done(std::move(done)).send(); }); } +auto CreateReportMessagesOrStoriesCallback( + std::shared_ptr show, + not_null peer) +-> Fn)> { + using TLChoose = MTPDreportResultChooseOption; + using TLAddComment = MTPDreportResultAddComment; + using TLReported = MTPDreportResultReported; + using Result = ReportResult; + + struct State final { +#ifdef _DEBUG + ~State() { + qDebug() << "Messages or Stories Report ~State()."; + } +#endif + mtpRequestId requestId = 0; + }; + const auto state = std::make_shared(); + + return [=]( + Data::ReportInput reportInput, + Fn done) { + auto apiIds = QVector(); + apiIds.reserve(reportInput.ids.size() + reportInput.stories.size()); + for (const auto &id : reportInput.ids) { + apiIds.push_back(MTP_int(id)); + } + for (const auto &story : reportInput.stories) { + apiIds.push_back(MTP_int(story)); + } + + const auto received = [=]( + const MTPReportResult &result, + mtpRequestId requestId) { + if (state->requestId != requestId) { + return; + } + state->requestId = 0; + done(result.match([&](const TLChoose &data) { + const auto t = qs(data.vtitle()); + auto list = Result::Options(); + list.reserve(data.voptions().v.size()); + for (const auto &tl : data.voptions().v) { + list.emplace_back(Result::Option{ + .id = tl.data().voption().v, + .text = qs(tl.data().vtext()), + }); + } + return Result{ .options = std::move(list), .title = t }; + }, [&](const TLAddComment &data) -> Result { + return { + .commentOption = ReportResult::CommentOption{ + .optional = data.is_optional(), + .id = data.voption().v, + } + }; + }, [&](const TLReported &data) -> Result { + return { .successful = true }; + })); + }; + + const auto fail = [=](const MTP::Error &error) { + state->requestId = 0; + done({ .error = error.type() }); + }; + + if (!reportInput.stories.empty()) { + state->requestId = peer->session().api().request( + MTPstories_Report( + peer->input, + MTP_vector(apiIds), + MTP_bytes(reportInput.optionId), + MTP_string(reportInput.comment)) + ).done(received).fail(fail).send(); + } else { + state->requestId = peer->session().api().request( + MTPmessages_Report( + peer->input, + MTP_vector(apiIds), + MTP_bytes(reportInput.optionId), + MTP_string(reportInput.comment)) + ).done(received).fail(fail).send(); + } + }; +} + } // namespace Api diff --git a/Telegram/SourceFiles/api/api_report.h b/Telegram/SourceFiles/api/api_report.h index 14e9d4ef1..f0c0320f3 100644 --- a/Telegram/SourceFiles/api/api_report.h +++ b/Telegram/SourceFiles/api/api_report.h @@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once +class HistoryItem; class PeerData; class PhotoData; @@ -15,17 +16,41 @@ class Show; enum class ReportReason; } // namespace Ui +namespace Data { +struct ReportInput; +} // namespace Data + namespace Api { +struct ReportResult final { + using Id = QByteArray; + struct Option final { + Id id = 0; + QString text; + }; + using Options = std::vector