Compare commits

..

313 Commits

Author SHA1 Message Date
John Preston
1350fa64f3 Version 4.2.4.
- Fix crash in emoji statuses clearing.
2022-09-30 16:30:58 +04:00
John Preston
70ba28bbd5 Fix crash in emoji statuses clearing. 2022-09-30 16:30:58 +04:00
Ilya Fedin
16649a9661 Fix snap build 2022-09-30 07:44:18 +04:00
Ilya Fedin
8eb6d2e36b Update Qt and libjxl to release versions on Linux 2022-09-30 00:24:32 +04:00
23rd
8b580de47e Version 4.2.3: Fixed Github CI Windows and macOS builds. 2022-09-29 21:22:06 +04:00
23rd
5b1a9fb3e1 Migrated gyp for breakpad to upstream in prepare script on macOS. 2022-09-29 21:22:06 +04:00
Ilya Fedin
2a6e2fa353 Bundle kcoreaddons 2022-09-28 23:59:59 +04:00
Ilya Fedin
16669402cf Decrease the amount of clipboard data retrievation 2022-09-28 23:59:59 +04:00
John Preston
073c1a4d0f Version 4.2.3: Fix possible crash in premium section. 2022-09-28 15:58:25 +04:00
John Preston
4c276e2357 Version 4.2.3: Fix clearing of user emoji status. 2022-09-28 15:49:34 +04:00
John Preston
889529718f Fix possible stack overflow crash on Windows.
Fixes #25129.
2022-09-28 15:49:34 +04:00
23rd
acb092f9f2 Fixed stuck of history-down button after sending message. 2022-09-28 12:31:16 +03:00
23rd
9cd194e60e Removed ability to copy links in channels with restricted content. 2022-09-28 12:31:16 +03:00
23rd
9c3173e4bb Fixed updating of emoji status from TopBar in Premium Settings for user.
Regression was introduced in 47b32898f5.
2022-09-28 08:46:35 +03:00
John Preston
62b624c390 Version 4.2.3.
- Improve scaling / cropping for photos / video files.
- Improve touch support in channel comments.
- Nice animation for spoilers.
2022-09-28 09:34:31 +04:00
John Preston
1ee9122660 Fix text selection in recent actions. 2022-09-25 18:22:01 +04:00
John Preston
6cb01998cc Fix crash in recent actions with spoilers. 2022-09-25 18:21:59 +04:00
John Preston
0e6c899cee Fix crash after spoiler reveal in comments. 2022-09-25 18:21:58 +04:00
John Preston
09a6df1fdc Set some layers crash annotations. 2022-09-25 18:21:56 +04:00
John Preston
43bdfbf170 Beta version 4.2.2.
- Fix crash in spoiler revealing in media captions.
- Fix spoiler revealing in media viewer captions.
- Fix crash in folder editing on Linux.
2022-09-23 23:50:37 +04:00
John Preston
bcfe4ac4a3 Allow revealing spoilers in media viewer captions. 2022-09-23 23:50:21 +04:00
John Preston
c67c53bcdf Fix build with GCC. 2022-09-23 23:32:54 +04:00
John Preston
330c6a31a2 Fix crash in empty text state resolving. 2022-09-23 23:32:22 +04:00
John Preston
aa674a0ea5 Fix UB in closing chat across all windows. 2022-09-23 23:32:21 +04:00
John Preston
e01910ac68 Fix a crash in folders editing, happens in Qt 6.4.
Fixes #25074.
2022-09-23 23:32:19 +04:00
John Preston
eac13b31f1 Fix crash in subscribe button. 2022-09-23 23:32:18 +04:00
John Preston
d4a2c4a151 Fix crash in caption spoiler opening. 2022-09-23 23:22:08 +04:00
John Preston
8fc35e45e4 Beta version 4.2.1: Fix build with GCC. 2022-09-22 22:44:28 +04:00
John Preston
2931e754c3 Beta version 4.2.1.
- Improve scaling / cropping for photos / video files.
- Improve touch support in channel comments.
- Nice animation for spoilers.
2022-09-22 20:15:55 +04:00
John Preston
4e7a5eeffb Use Python 3.10 and GYP supporting it. 2022-09-22 15:31:46 +04:00
John Preston
6fcafeff5b Don't repeat premium stickers in fake-pack. 2022-09-22 14:58:40 +04:00
Ilya Fedin
3165ef9f0b Implement target_compile_options_if_exists, target_link_options_if_exists 2022-09-22 12:58:07 +04:00
John Preston
ec992ae552 Fix reactions menu on Retina screens. 2022-09-22 12:33:48 +04:00
John Preston
f0a36d6460 Show only first row of colored default statuses. 2022-09-22 12:27:46 +04:00
John Preston
ffb024a5f7 Move Ui::Text::String to HistoryView::Element. 2022-09-22 11:07:48 +04:00
Ilya Fedin
140dcb033b Fix snap building on snapcraft 2022-09-20 10:20:07 +04:00
Ilya Fedin
06d9d04787 Remove explicit setting of paths for cmake in snapcraft.yaml
This is reported as fixed in snapcraft, thus these paths should be set automatically
2022-09-19 19:12:16 +04:00
John Preston
a7c29991db Hide toggle silent send in channels on msg edit. 2022-09-19 18:49:46 +04:00
John Preston
e3d79d46f7 Fix new format of direct post links in channels. 2022-09-19 18:28:53 +04:00
John Preston
476a864be2 Improve cropping for videos a bit.
Partially fixes #25061 for videos as well.
2022-09-19 18:05:03 +04:00
John Preston
fc3810fd7f Improve scaling / expanding for photos.
Fixes #25061.
2022-09-19 17:44:59 +04:00
John Preston
f5bff22bb8 Improve touch support in popup menus. 2022-09-19 17:29:28 +04:00
Ilya Fedin
157b4c43ee Update lib_ui 2022-09-19 14:23:27 +04:00
Ilya Fedin
f2d2826fc7 Make InstallLauncher accessible on any platform 2022-09-19 14:23:27 +04:00
Ilya Fedin
cfa12fb0cc Move AppRuntimeDirectory to private namespace 2022-09-19 14:23:27 +04:00
Ilya Fedin
d9318c9935 Move icon name getter to cross-platform header 2022-09-19 14:23:27 +04:00
Ilya Fedin
5132fd5010 Use KSandbox to check flatpak/snap environment 2022-09-19 14:23:27 +04:00
Ilya Fedin
89879e355d Replace EscapeShell with KShell::joinArgs 2022-09-19 14:20:02 +04:00
Ilya Fedin
278ab5ebaf Add support for AVIF, HEIF and JPEG XL (only on Linux yet) 2022-09-19 11:20:50 +04:00
John Preston
39294a7fe1 Use touch handling from HistoryInner in ListWidget.
Fixes #24880.
2022-09-19 11:16:09 +04:00
John Preston
7727cdff92 Fix build with Xcode. 2022-09-18 17:12:16 +04:00
John Preston
8bd0ff7925 Opimize spoiler revealing. 2022-09-18 16:52:31 +04:00
John Preston
4f948699c0 Correct spoiler selections. 2022-09-18 16:52:31 +04:00
John Preston
cd00d41cca Correct spoiler colors in fully selected messages. 2022-09-18 16:52:31 +04:00
John Preston
749fb52113 Implement animated spoilers. 2022-09-18 16:52:30 +04:00
Ilya Fedin
4975254cc1 Avoid building qttools
Removing po folder from kcoreaddons allows that
2022-09-18 15:55:56 +04:00
Ilya Fedin
b36063e086 Update kcoreaddons to 5.98.0
And patch to cache portal result
2022-09-17 06:23:05 +04:00
John Preston
645ae69220 Version 4.2.
- A new expandable reaction menu was added in private chats and groups.
- All users get access to dozens of new reactions,
including reactions previously reserved for Premium users.
- The reactions you use most frequently
will always be displayed at the top.
- Premium users can react to messages with thousands of custom emoji
and add up to 3 reactions to each message.
- Group admins can control whether
custom reactions are allowed in their groups.
- Premium users can add an animated emoji status next to their name
to display their current activity.
- To set a status, tap your Premium badge in the main menu or Settings.
- Popular suggestions for working, sleeping,
traveling and more will be shown at the top.
- To set a status for a specific duration like 1 hour or 2 days,
right click the emoji.
- A new format was supported for username links,
in addition to "t.me/username." You can now open Telegram accounts,
groups or channels using links like "username.t.me"
or "https://username.t.me."
- Improved support for long media captions.
2022-09-17 00:47:22 +04:00
John Preston
782c5c28a8 Support custom quick reaction in settings. 2022-09-16 11:16:59 +04:00
John Preston
fba683be8e Fix custom status remove on chat reopen. 2022-09-16 10:42:25 +04:00
Ilya Fedin
552d96df71 Update Qt to 6.4.0 rc1 2022-09-16 09:46:36 +04:00
John Preston
1043467eec Fix lib_ui build. 2022-09-15 22:00:20 +04:00
John Preston
9923cc9b31 Beta version 4.1.2: Fix build with Xcode. 2022-09-14 23:15:00 +04:00
23rd
47b32898f5 Fixed padding of TopBar in Premium Settings for user. 2022-09-14 23:10:31 +04:00
23rd
557a2e400e Fixed muting of peer forever. 2022-09-14 23:10:30 +04:00
23rd
84400f5912 Added strictly typed field to export JSON for text entities. 2022-09-14 23:10:28 +04:00
John Preston
b28140c4b0 Beta version 4.1.2.
- New reaction selector above the right click menu.
- Premium: Set any custom emoji reactions in private chats.
- Premium: Set any custom emoji as your profile status.
- Insert or copy custom emoji from pack preview.
2022-09-14 23:06:00 +04:00
John Preston
08321b8d8b Fix sending custom emoji based on Dice-type game emoji. 2022-09-14 20:41:24 +04:00
John Preston
bc340d75c4 Insert / Copy emoji from pack preview. 2022-09-14 14:45:23 +04:00
John Preston
cae18b3320 Use "Change Emoji Status" phrase. 2022-09-14 12:27:06 +04:00
John Preston
d81b2fbb69 Activate the chosen default folder on Escape. 2022-09-14 09:13:28 +04:00
John Preston
02daa2a04b Add new reaction menu to channel comments. 2022-09-13 07:53:20 +04:00
John Preston
1363faddbf Add "Reaction button in messages" setting. 2022-09-13 07:44:22 +04:00
John Preston
20a5950f99 Fix premium star / status in accounts list. 2022-09-12 18:56:03 +04:00
John Preston
40bdcd7ebc Short poll extended media. 2022-09-12 18:18:31 +04:00
John Preston
379736a7d1 Show extended preview inline keyboard button. 2022-09-12 16:40:19 +04:00
John Preston
d2234d88b6 Update extended media, hide inline keyboard. 2022-09-12 16:10:56 +04:00
John Preston
c2fd4ccd59 Skip custom reactions if premium isn't possible. 2022-09-12 10:07:07 +04:00
John Preston
26c79939e0 Fix custom status duration edit from Settings. 2022-09-12 09:51:55 +04:00
John Preston
ffaeb239f0 Don't show emoji tooltip in reactions / statuses. 2022-09-12 09:46:23 +04:00
John Preston
7c8d3452b5 Fix reaction icons in Who Reacted. 2022-09-12 09:38:18 +04:00
John Preston
e2bca0a7ff Fix media with caption in a narrow window. 2022-09-12 09:35:28 +04:00
John Preston
2e8a03dfd1 Correctly round spoiler animation in ExtendedMedia. 2022-09-12 09:06:26 +04:00
John Preston
a919978a37 Use spoiler animation for ExtendedMedia. 2022-09-12 09:06:26 +04:00
John Preston
20b5138e00 Initial implementation of ExtendedMedia. 2022-09-12 09:06:26 +04:00
John Preston
2523d6e8d8 Update API scheme to layer 146. 2022-09-12 09:06:26 +04:00
John Preston
03e90840de Closed alpha version 4.1.1.1: Fix build with GCC. 2022-09-10 11:07:08 +04:00
John Preston
4ab34e3727 Suggest only like and dislike reactions in groups by default. 2022-09-10 09:36:08 +04:00
John Preston
3129d9f0df Add a distinct "N seconds" key for the slowmode phrase. 2022-09-10 08:19:37 +04:00
John Preston
2b6b1d7611 Closed alpha version 4.1.1.1. 2022-09-10 08:12:35 +04:00
John Preston
6e9493c725 Ignore premium gradient keys when colorizing theme. 2022-09-10 08:11:58 +04:00
John Preston
746141a363 Update lib_ui to fix a crash on Linux. 2022-09-10 08:08:46 +04:00
John Preston
4942154a9c Make loading emoji set icons look nicer. 2022-09-10 07:23:20 +04:00
John Preston
d511f2bb90 Fix via @bot after name for premium users. 2022-09-09 09:35:36 +04:00
John Preston
460b4b2de5 Move around some sources in CMakeLists. 2022-09-08 13:16:39 +04:00
John Preston
ab25cf214c Fix FFmpeg frame generator ending. 2022-09-08 09:50:11 +04:00
John Preston
b0203af398 Fix no-bubble comments button resize. 2022-09-08 09:38:52 +04:00
John Preston
c00f2f96ec Replace phone number with "Set Emoji Status". 2022-09-07 20:39:57 +04:00
John Preston
2215500c9a Add emoji status icon to premium promo. 2022-09-07 20:36:06 +04:00
John Preston
5cc6275fc3 Fly + effects when choosing an emoji status. 2022-09-07 12:52:34 +04:00
John Preston
d4810713cb Fly-animate reactions from the new context menu. 2022-09-06 17:08:20 +04:00
John Preston
1877786707 Special phrase for a colored emoji status. 2022-09-06 12:32:33 +04:00
John Preston
06ec574543 Fix single-frame 60 fps lotties. 2022-09-06 12:07:09 +04:00
John Preston
f0955f2021 Add emoji-status disclaimer for unknown peers. 2022-09-06 11:20:55 +04:00
John Preston
400d4b793a Fix initial visibility of Who can send messages.
Fixes #25030.
2022-09-06 08:09:29 +04:00
John Preston
d6ba092697 Make GIFs and videos with captions larger. 2022-09-05 19:03:52 +04:00
John Preston
9ef2f370ac Handle only username subdomains for t.me domain. 2022-09-05 12:22:43 +04:00
Ilya Fedin
234c74a439 Update patches commit in Dockerfile 2022-09-05 11:57:46 +04:00
Ilya Fedin
88f1f8ff22 Move QGuiApplication::setDesktopFileName call to Platform::start
It depends on Core::UpdaterDisabled that is not initialized in Launcher::initHook yet
2022-09-05 08:24:48 +04:00
John Preston
00ee31ce2d Make photos with captions wider. 2022-09-04 08:18:50 +04:00
Alexander Kernozhitsky
a5bd4ef6f7 Fix code style 2022-09-04 08:04:02 +04:00
Alexander Kernozhitsky
c6c2a44e9d Patch the remaining uses or FFmpeg APIs 2022-09-04 08:04:02 +04:00
Alexander Kernozhitsky
21b0454461 Remove duplicate line
Co-authored-by: darkkeks <darkkeks@rambler.ru>
2022-09-04 08:04:02 +04:00
Alexander Kernozhitsky
ca4b5edf21 Correct FFmpeg API usage
FFmpeg docs say that you must return AVERROR_EOF from the read callback, not zero. Still, Telegram just propagates the return value from IODevice::read() call, which returns zero in case of EOF.

I don't know whether this commit has any effect on the upstream build, but it fixes a bug in Debian build of Telegram, which is using FFmpeg 5.1 instead of 4.4. Still, it's also useful in the upstream, as it makes work with FFmpeg more correct.
2022-09-04 08:04:02 +04:00
Ilya Fedin
9ac739c423 Update poetry installer URL 2022-09-04 08:02:43 +04:00
Ilya Fedin
bd7a880468 Increase operation limit of stale action to 1000 for it to operate normally 2022-09-04 08:01:51 +04:00
Ilya Fedin
807e63d9f2 Disable PR processing in stale bot explicitly
According to the documentation, it shouldn't procces them until stale-pr-message is set, but that doesn't seem to be true
2022-09-04 08:01:51 +04:00
Ilya Fedin
4cedf89e51 Migrate from stale app to stale action
It doesn't seem to work for multiple months
2022-09-03 09:30:20 +04:00
John Preston
a736ddb24e One more fix for GCC build. 2022-09-03 09:08:13 +04:00
Ilya Fedin
b48674d302 Avoid unneccesary QPA, again 2022-09-03 08:47:02 +04:00
GitHub Action
a6a9b16358 Update User-Agent for DNS to Chrome 104.0.5112.101. 2022-09-03 08:42:51 +04:00
Ilya Fedin
dfb40dd216 Handle PiP aspect ratio on Wayland synchronously
During testing with Qt 6.4 I now remember why I made a way complicated logic (yes, because the trivial one bugs with Qt 6.4)
This restores it, but uses event filters rather than hardware integration override
2022-09-03 08:41:49 +04:00
John Preston
85acf051c1 Try to fix build with GCC. 2022-09-03 06:51:02 +04:00
Ilya Fedin
86059f2b5e Update Qt to 6.4.0 beta4 on Linux 2022-09-02 21:27:41 +04:00
Ilya Fedin
4f261ced8e Ceil device pixel ratio
Qt 6.4 provides QT_WIDGETS_HIGHDPI_DOWNSCALE that allows widgets to draw at integer device pixel ratio by using the next integer. Ceiling this value makes tdesktop in sync with technique and provides sharp content.

Without QT_WIDGETS_HIGHDPI_DOWNSCALE, this doesn't makes the content sharp, but the quality is still better as Qt attempts to downscale those graphic rather than upscale.
2022-09-02 21:27:41 +04:00
Ilya Fedin
feb6107ce6 Qt 6.4 supports window activation with tray on Wayland 2022-09-02 21:27:41 +04:00
Ilya Fedin
eab41d272b Fix various spaces on end of lines 2022-09-02 21:27:41 +04:00
Ilya Fedin
38da0e086d Get rid of lib_waylandshells 2022-09-02 21:27:41 +04:00
Ilya Fedin
f874876b00 Update wayland to 1.21.0 2022-09-02 21:27:41 +04:00
Ilya Fedin
2065616592 Let Qt use Vulkan headers for Vulkan support 2022-09-02 21:27:41 +04:00
John Preston
898edad09b Show status duration menu only in status panel. 2022-09-02 21:14:34 +04:00
23rd
49773dde72 Attempted to fix rare non-elided text in bar of pinned bot messages. 2022-09-02 21:14:34 +04:00
23rd
fa6b4f9b52 Slightly improved style of Premium Settings. 2022-09-02 21:14:34 +04:00
23rd
fa4801ac94 Added ability to set emoji status for certain period of time. 2022-09-02 21:14:34 +04:00
John Preston
9bb2bb09b9 Update API scheme on layer 145.
Restrict send from channels to premium in line with API restrictions.
2022-09-02 21:14:34 +04:00
John Preston
e32031963b Colorize status in premium promo and pack preview. 2022-09-02 21:14:34 +04:00
John Preston
c13221a984 Menu reactions selector without enabled compositing. 2022-09-02 21:14:34 +04:00
John Preston
688cd70c91 Prepend colored default statuses in selector. 2022-09-02 21:14:34 +04:00
John Preston
a256eb4bc8 Add mini-copies animation for custom reactions. 2022-09-02 21:14:34 +04:00
John Preston
7d77e8a203 Play generic animations for custom reactions. 2022-09-02 21:14:34 +04:00
John Preston
47709884dd Allow 50% interface scale from command line. 2022-09-02 21:14:33 +04:00
John Preston
7658d1da3c Fix unsetting reaction in private chats. 2022-09-02 21:14:33 +04:00
John Preston
0a3077b9a5 Update API scheme on layer 145. 2022-09-02 21:14:33 +04:00
John Preston
e0513f7b7c Return old allowed reactions edit for channels. 2022-09-02 21:14:33 +04:00
23rd
7e7562fdad Fixed crash in RecoverBox from PasscodeBox with custom check callback. 2022-09-02 21:14:33 +04:00
23rd
15aefddab4 Added support of Webm custom emoji to Premium Settings. 2022-09-02 21:14:33 +04:00
23rd
e34b61d56b Moved out HistoryView::StickerPlayer implementations to separate file. 2022-09-02 21:14:33 +04:00
John Preston
010b5e3949 Support username.t.me links. 2022-09-02 21:14:33 +04:00
John Preston
5530df8f2d Play emoji status only twice in main menu. 2022-09-02 21:14:33 +04:00
John Preston
742b819c7e Always show reaction userpics in private chats. 2022-09-02 21:14:33 +04:00
John Preston
2618ee3d75 Paint two-loops of custom emoji statuses. 2022-09-02 21:14:33 +04:00
John Preston
da281c4d3d Fix build with Xcode. 2022-09-02 21:14:33 +04:00
John Preston
2d07539892 Support colored emoji statuses. 2022-09-02 21:14:33 +04:00
John Preston
923e725e18 Request default and recent emoji statuses. 2022-09-02 21:14:33 +04:00
23rd
b2d72e2541 Removed subscription options from Settings when there is only one. 2022-09-02 21:14:33 +04:00
23rd
7ed10eaacc Added gradient colors to radiobutton views in Premium Settings. 2022-09-02 21:14:33 +04:00
23rd
5505a566be Replaced gradient header in Premium Settings for dark themes. 2022-09-02 21:14:32 +04:00
23rd
35c59ad35a Moved out util function for contrast calculation between 2 colors. 2022-09-02 21:14:32 +04:00
John Preston
5e81c65ea6 Implement improved allowed reactions editing. 2022-09-02 21:14:32 +04:00
John Preston
021e275336 Update API scheme on layer 145. 2022-09-02 21:14:32 +04:00
John Preston
e540b8cbdc Read correct reactions limit from config. 2022-09-02 21:14:32 +04:00
John Preston
ebf6cea2f5 Correctly show premium promo for custom reactions. 2022-09-02 21:14:32 +04:00
John Preston
a3c110dafa Correctly show flying custom reactions. 2022-09-02 21:14:32 +04:00
John Preston
ad0c9ebb79 Fly-animate custom reactions. 2022-09-02 21:14:32 +04:00
John Preston
d5008fe7ac Sync custom emoji from strip to recent in the panel. 2022-09-02 21:14:32 +04:00
John Preston
7c3814cdcd Fix recent userpics display in reactions. 2022-09-02 21:14:32 +04:00
John Preston
ed3f246510 Use FrameGenerator-based AnimatedIcon for reactions. 2022-09-02 21:14:32 +04:00
John Preston
d9a6d5f508 Update API scheme on layer 145. 2022-09-02 21:14:32 +04:00
23rd
da6d580348 Fixed style of box for premium doubled limits. 2022-09-02 21:14:32 +04:00
23rd
0ffa88d0f3 Added shadow to small TopBar in Premium Settings for user. 2022-09-02 21:14:32 +04:00
23rd
149d92d224 Added ability to choose subscription option for Premium in Settings. 2022-09-02 21:14:32 +04:00
23rd
6f3d19914d Unified parsing of MTP gift and subscription options in separate file. 2022-09-02 21:14:32 +04:00
23rd
fc759ac688 Renamed GiftOption to SubscriptionOption. 2022-09-02 21:14:31 +04:00
23rd
e03eaaaa98 Fixed switching between sections of Premium Settings. 2022-09-02 21:14:31 +04:00
23rd
857f56d5b4 Added animation pause in TopBar in Premium Settings for user. 2022-09-02 21:14:31 +04:00
23rd
638cf237c4 Slightly improved design of Premium Settings. 2022-09-02 21:14:31 +04:00
23rd
01b50a8460 Added initial implementation of TopBar in Premium Settings for user. 2022-09-02 21:14:31 +04:00
23rd
b519b6bf4c Reduced minimum and maximum sizes of ministars. 2022-09-02 21:14:31 +04:00
23rd
b10bf0e12c Replaced svg file for premium star. 2022-09-02 21:14:31 +04:00
23rd
4d43830c3b Replaced ripple colors for top buttons in Premium Settings. 2022-09-02 21:14:31 +04:00
23rd
65ad8e6ac1 Moved out class for colored ministars to separate file. 2022-09-02 21:14:31 +04:00
23rd
56cbde93da Divided TopBar in Premium Settings into abstract and main classes. 2022-09-02 21:14:31 +04:00
23rd
90ef0e4969 Reformated serializing and parsing of ref data for Premium Settings. 2022-09-02 21:14:31 +04:00
John Preston
668a3308be Support custom emoji reactions in WhoReacted. 2022-09-02 21:14:31 +04:00
John Preston
ba83836922 Display custom emoji reactions under messages. 2022-09-02 21:14:31 +04:00
John Preston
14f937cb02 Show only some reactions in the bottom info.
Only in private chats with no premium users.
Only if nobody sent more than one reaction while was premium.
Only if nobody sent a custom emoji reaction while was premium.
2022-09-02 21:14:31 +04:00
John Preston
733cad798b Load emoji for reactions panel. 2022-09-02 21:14:31 +04:00
John Preston
8a6b3027f5 Support multiple reactions from one user. 2022-09-02 21:14:31 +04:00
John Preston
31db1804c8 Request top and recent reactions. 2022-09-02 21:14:31 +04:00
John Preston
f8c962712b Update API scheme on layer 145. 2022-09-02 21:14:31 +04:00
John Preston
a202174d12 Disable expand button in the inline reactions selector for now. 2022-09-02 21:14:31 +04:00
John Preston
3399397a76 Allow 1 year for session termination delay. 2022-09-02 21:14:30 +04:00
John Preston
c655f78780 Fix build with Xcode. 2022-09-02 21:14:30 +04:00
John Preston
73d8530c13 Fix jumping to premium promo from reactions panel. 2022-09-02 21:14:30 +04:00
John Preston
610c46e26f Make a nice selector for only-recent set. 2022-09-02 21:14:30 +04:00
John Preston
96805b62b2 Seamless switch from strip icons to custom emoji. 2022-09-02 21:14:30 +04:00
John Preston
4762c7a4fd Fix layout with a single available reaction. 2022-09-02 21:14:30 +04:00
John Preston
0277d765bb Nice reactions panel expanding. 2022-09-02 21:14:30 +04:00
John Preston
20d4d00634 Implement expanding of list / categories. 2022-09-02 21:14:30 +04:00
John Preston
c5fa4aae62 Support reaction dropdown based on EmojiListWidget. 2022-09-02 21:14:30 +04:00
John Preston
f72092a261 Update API scheme on layer 145. 2022-09-02 21:14:30 +04:00
John Preston
33b266175d Allow creating EmojiListWidget without SessionController. 2022-09-02 21:14:30 +04:00
John Preston
c9a98ae723 Expand reaction selection panel. 2022-09-02 21:14:30 +04:00
John Preston
bd42c23999 Implement reactions selector above the menu. 2022-09-02 21:14:30 +04:00
John Preston
f658cb7e99 Update API scheme on layer 145. 2022-09-02 21:14:30 +04:00
John Preston
fa26afaf9a Rename several HistoryView::Reactions modules. 2022-09-02 21:14:30 +04:00
John Preston
b648387e96 Fixed emoji packs menu item. 2022-09-02 21:14:29 +04:00
John Preston
8d2ebdbb99 Animate reactions strip appearance. 2022-09-02 21:14:29 +04:00
John Preston
a0d5456a4d PoC content outside of PopupMenu. 2022-09-02 21:14:29 +04:00
23rd
c20ed7c7a8 Enabled utf-8 mode for python while breakpad is building. 2022-09-02 21:14:29 +04:00
23rd
ef543d040e Replaced separate click handlers for each spoiler entry with single one. 2022-09-02 21:14:29 +04:00
John Preston
27063167ae Don't cut name / status unnecessary. 2022-09-02 21:14:29 +04:00
John Preston
8a1118d9bb Show how much message limit is exceeded when editing. 2022-09-02 21:14:29 +04:00
John Preston
1e2e007d38 Show custom emoji in private chat reactions. 2022-09-02 21:14:29 +04:00
John Preston
09124f6424 Implement PoC custom reaction selection. 2022-09-02 21:14:29 +04:00
John Preston
cece9cf09b Show in chats list EntityType::Pre like EntityType::Code. 2022-09-02 21:14:29 +04:00
John Preston
60cc232884 Update API scheme on layer 145. 2022-09-02 21:14:29 +04:00
John Preston
ba8673af5e Fix build with Xcode. 2022-09-02 21:14:29 +04:00
John Preston
77772caabb Update API scheme on layer 145. 2022-09-02 21:14:29 +04:00
John Preston
e22bb40dd1 Improve premium / emoji status badge styles. 2022-09-02 21:14:29 +04:00
John Preston
bd089f20a8 Emoji status selector in MainMenu/Settings. 2022-09-02 21:14:28 +04:00
John Preston
64bd4f0926 Make nice emoji status selector in profile. 2022-09-02 21:14:28 +04:00
John Preston
165d3143de Allow emoji status edit from self profile. 2022-09-02 21:14:28 +04:00
John Preston
21fd381778 Show emoji status in chats list / top bar. 2022-09-02 21:14:28 +04:00
John Preston
285ce81b7b Update API scheme to layer 145. 2022-09-02 21:14:28 +04:00
Ilya Fedin
e7f85f7255 Add missing include to settings_advanced 2022-09-02 18:46:31 +04:00
Ilya Fedin
12d8d193a1 Create QSystemTrayIcon even when tray is not supported
QSystemTrayIcon provides no public API to know when tray icon support appears, but can subscribe to native events internally

This should help for environments where a race condition between applications autostart and tray service autostart present in case Qt is subscribed internally
2022-09-02 17:29:57 +04:00
Ilya Fedin
c18313614b Use Core::Tray::has in settings_advanced 2022-09-02 17:29:57 +04:00
Ilya Fedin
f1092753fc Remove version from the .desktop file
Some desktop environments hide the launcher if they don't know the version
2022-09-01 13:53:53 +04:00
Ilya Fedin
5fc7caeec9 Provide old version to Platform::NewVersionLaunched 2022-09-01 13:53:53 +04:00
Ilya Fedin
e20840b4d4 Use KUrlMimeData for clipboard xdg-desktop-portal integration 2022-08-30 20:25:10 +04:00
Ilya Fedin
5f53dfda0e Move Qt version from configure.py to CMakeLists.txt 2022-08-30 20:25:10 +04:00
Joe Kappus
630e73fa23 Fix build with GCC 12. 2022-08-30 12:42:26 +04:00
John Preston
92a9ba2ba0 Use exact jom url instead of mirrored. 2022-08-29 09:12:09 +04:00
Ilya Fedin
4d4d75addf Install nuget and jom with prepare.py 2022-08-28 08:38:37 +04:00
Ilya Fedin
42fe80b5e2 Use perl, nasm, yasm and ninja from msys64 2022-08-28 08:38:37 +04:00
Ilya Fedin
96793179a3 Find nuget in the recommended directory automatically 2022-08-28 00:35:45 +04:00
Ilya Fedin
fc19ce5a9b Install msys64 with prepare.py 2022-08-28 00:35:45 +04:00
Ilya Fedin
31fa6d24f4 Use zlib built with cmake on Windows 2022-08-28 00:35:45 +04:00
John Preston
7b005c64e0 Workaround MSVC 17.3.2 ICE. 2022-08-26 09:47:03 +04:00
Yue Wu
82d68f5b98 Fix JSON output when exporting custom emojis
Fixes #24961
2022-08-23 12:21:58 +04:00
Ilya Fedin
2259f747f1 Add missing network-status permission
This should make webview working as well as auto-reconnection when system network changed
2022-08-22 17:23:02 +04:00
John Preston
c793537d96 Version 4.1.1.
- Fix editing media captions with animated emoji.
- Fix viewing animated emoji sets used in a message.
- Fix premium sticker tooltip auto-show in channel comments.
- Fix main window position and size restoring after relaunch.
- Other bug fixes and minor improvements.
2022-08-16 09:38:19 +03:00
23rd
e568f7ab01 Added ability to restrict voice messages in conversations for everyone. 2022-08-16 09:38:19 +03:00
John Preston
11b711c43f Fix realtime "Large emoji" applying to only-custom-emoji. 2022-08-16 09:29:02 +03:00
John Preston
d1a81a83b4 Fix crash in editing media captions. 2022-08-16 09:21:12 +03:00
John Preston
42ca06d33c Request up to 32 file parts at once for video downloads. 2022-08-16 08:57:36 +03:00
John Preston
184ebc865c Fix downloading videos of size > INT_MAX to disk. 2022-08-16 08:56:30 +03:00
John Preston
c8c3f43853 Fix editing media captions with custom emoji. 2022-08-16 08:27:55 +03:00
John Preston
9105677325 Add "View Profile" even with third column info. 2022-08-16 07:41:32 +03:00
John Preston
7c2d3a8855 Fix custom emoji in initial send files caption. 2022-08-15 19:10:38 +03:00
John Preston
888306c017 Fix custom emoji in reply bar in comments / scheduled. 2022-08-15 19:01:40 +03:00
John Preston
6ff30c643a Fix user links in Recent Actions. 2022-08-15 18:54:08 +03:00
John Preston
5f8fca0355 Don't allow custom emoji pseudo-links in EditLink. 2022-08-15 18:41:37 +03:00
John Preston
4933fbb74a Show out message timestamp always for > 3 custom emoji. 2022-08-15 17:54:45 +03:00
John Preston
51010e864c Fix premium sticker tooltip auto-show in comments. 2022-08-15 16:39:56 +03:00
John Preston
24ee944689 Improve reply info layout in narrow mode.
Fixes #24935.
2022-08-15 16:21:08 +03:00
John Preston
2c0a38d356 Don't unload emoji sets.
Fixes #24933.
2022-08-15 15:52:27 +03:00
John Preston
e05f570e1a Fix custom emoji copy from TextWithEntities to clipboard. 2022-08-15 15:13:46 +03:00
John Preston
2846b2f7a5 Fix stickers list footer last icon. 2022-08-15 14:23:07 +03:00
John Preston
c126a1e56e Simplify CustomEmojiId. 2022-08-15 13:17:24 +03:00
John Preston
f0f7318978 Better saved credentials processing. 2022-08-15 12:20:17 +03:00
John Preston
fede1ff173 Simplify stickers inner API. 2022-08-15 11:34:22 +03:00
John Preston
94e4a8981f Specify gift box sticker explicitly. 2022-08-15 10:42:06 +03:00
Ilya Fedin
1e7117dd67 Revert "Fix enlargening the window by shadow margin when resotring position"
This reverts commit e0ddaf9da1.
2022-08-14 11:51:13 +04:00
Ilya Fedin
65ddbec794 Set Qt version in configure.py 2022-08-14 11:51:13 +04:00
Ilya Fedin
8adec5fcfd Update lib_webview 2022-08-13 14:32:11 +04:00
Joe Kappus
f82089cbfe Fix build with GCC 12. 2022-08-13 14:18:13 +04:00
Ilya Fedin
23d9ca896e Update cmake_helpers 2022-08-13 12:10:07 +04:00
Ilya Fedin
5f3c957b1d Use COPY --link to consume less space when building Docker image 2022-08-13 12:10:07 +04:00
Ilya Fedin
b9181db407 Don't use QWindowSystemInterface in the PiP
It provides no difference, there was a mistake while testing the behavior
2022-08-12 19:51:04 +03:00
Ilya Fedin
be8d91055a Remove unused prepare.sh in centos_env 2022-08-12 19:47:03 +03:00
John Preston
df45294855 Version 4.1: Fix build with GCC. 2022-08-12 19:01:41 +03:00
John Preston
ef6d2b2c0b Version 4.1.
- Include animated emoji in messages and captions.
- Premium users unlock over 500 new emoji,
including custom packs with unique characters.
- All users can view any emoji,
and try them out in the Saved Messages chat.
- Control who can send you voice
and video messages with Telegram Premium.
- Send a Premium subscription to any user from their profile.
- Choose 3, 6, or 12 months - at a discount.
2022-08-12 16:46:57 +03:00
John Preston
60839bb8ac Update cmake_helpers. 2022-08-12 16:23:05 +03:00
John Preston
228a48c8bf Fix possible crash in main window destructor.
In platform window destructor it can send window state change signal.
2022-08-12 16:21:52 +03:00
John Preston
76a482317d Fix main menu name label refreshing. 2022-08-11 20:58:30 +03:00
John Preston
01f28b4d52 Use CustomEmoji instances for categories in the panel. 2022-08-11 20:56:33 +03:00
John Preston
655194c841 Return ApiWrap::requestPeerSettings method. 2022-08-11 09:59:18 +03:00
Ilya Fedin
8fe48f3ca2 Use cmake_dependent_option to better declare variables that relate on other variables 2022-08-11 09:07:15 +03:00
John Preston
54f467eb47 Don't rely on MTP* when sending photos. 2022-08-11 09:06:56 +03:00
John Preston
3698396677 Remove MTP from Polls::create interface. 2022-08-11 09:06:43 +03:00
John Preston
d2e1517e7a Correctly cancel username check request. 2022-08-11 09:06:30 +03:00
John Preston
7733e3350d Remove unused private fields in ApiWrap. 2022-08-11 09:06:16 +03:00
John Preston
566128c3eb Remove MTP from requestDeepLinkInfo interface. 2022-08-11 09:05:37 +03:00
John Preston
ab3d3a449b Remove MTP from requestWallPaper interface. 2022-08-11 09:05:23 +03:00
John Preston
e9fd249c5a Remove some unused ApiWrap methods. 2022-08-11 09:04:25 +03:00
John Preston
e7a3c5367a Make MTP* optional in ConfirmInviteBox. 2022-08-11 09:02:41 +03:00
John Preston
8bc807dc40 Set name / phone texts on-demand. 2022-08-09 14:12:19 +03:00
Ilya Fedin
ceb7d5f238 Use version-less Qt targets and functions whenever possible 2022-08-09 10:42:24 +04:00
John Preston
84b3260f38 Don't open group info on migration update. 2022-08-08 20:21:30 +03:00
Sergey A. Osokin
7a3452a18a Fix warnings by removing unused const variables
Telegram/SourceFiles/ui/text/custom_emoji_instance.cpp:23:16: warning: unused variable 'kMaxFrameDuration' [-Wunused-const-variable]
Telegram/SourceFiles/boxes/reactions_settings_box.cpp:46:16: warning: unused variable 'kVisibleButtonsCount' [-Wunused-const-variable]
Telegram/SourceFiles/boxes/premium_preview_box.cpp:53:16: warning: unused variable 'kShiftDuration' [-Wunused-const-variable]
Telegram/SourceFiles/settings/settings_premium.cpp:55:16: warning: unused variable 'kTitleAnimationPart' [-Wunused-const-variable]

Found by:	clang
2022-08-08 21:21:13 +04:00
John Preston
05edf00d40 Fix unwrapped media top skip. 2022-08-08 19:12:18 +03:00
John Preston
b67bfd0a8a Improve device model detection on macOS. 2022-08-08 19:12:08 +03:00
John Preston
90d2021f4d Jump to keyboard top on FullMsgId change. 2022-08-08 18:28:36 +03:00
John Preston
72ed3bfab9 Show leave confirmation when starting an RTMP stream. 2022-08-08 18:19:04 +03:00
John Preston
d8743ec0e6 Fix opening channel with active livestream in a new window. 2022-08-08 18:18:44 +03:00
John Preston
3a3341fef8 Fix RTMP livestream starting while in another call.
Fixes #24862.
2022-08-08 16:39:44 +03:00
John Preston
068eb3fcd1 Fix a click on "via @bot" of a sticker.
Fixes #24888.
2022-08-08 16:02:09 +03:00
John Preston
75ee74ff1f Fix paddings in unwrapped emoji messages. 2022-08-08 15:41:33 +03:00
John Preston
dfb3346096 Better replace many same emoji at once. 2022-08-08 15:34:04 +03:00
John Preston
a098abefd7 Replace many same emoji at once. 2022-08-08 15:24:11 +03:00
John Preston
f63984c9e3 Don't select first result on animated emoji suggestion. 2022-08-08 14:57:33 +03:00
John Preston
9509c88ef9 Fix possible crash in pinned messages destruction. 2022-08-08 14:32:16 +03:00
John Preston
819925fc72 Don't show premium effects on message previews. 2022-08-08 13:37:31 +03:00
John Preston
cf4b869c27 Don't always show timestamps on large custom-emoji-only messages. 2022-08-08 13:37:15 +03:00
John Preston
5c43a541d7 Show emoji promo only on Premium Emoji toast. 2022-08-08 13:25:22 +03:00
Ilya Fedin
68e0d155f9 Update submodules 2022-08-08 11:05:52 +04:00
Ilya Fedin
8c1bef929e A better way of PiP aspect ratio handling on Wayland 2022-08-08 11:05:52 +04:00
23rd
cde5e89e42 Fixed recording of voice messages in Saved Messages. 2022-08-08 09:34:55 +03:00
Ilya Fedin
e0ddaf9da1 Fix enlargening the window by shadow margin when resotring position 2022-08-08 08:54:14 +04:00
Vedant
aa208fb7d0 Update winget.yml 2022-08-05 18:49:28 +04:00
John Preston
b7cc2e9894 Don't pass redundant MTPUpdates arguments. 2022-08-05 13:37:41 +03:00
646 changed files with 18428 additions and 8573 deletions

21
.github/stale.yml vendored
View File

@@ -1,21 +0,0 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 180
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 30
# Issues with these labels will never be considered stale
exemptLabels: [ "enhancement" ]
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: |
Hey there!
This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.
Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.
Thanks!
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
# Process only issues
only: issues

View File

@@ -25,16 +25,14 @@ jobs:
submodules: recursive
- name: First set up.
run: |
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
echo $HOME/.poetry/bin >> $GITHUB_PATH
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Docker image build.
run: |
cd Telegram/build/docker/centos_env
poetry install
DEBUG= poetry run gen_dockerfile | docker build -t $IMAGE_TAG -
DEBUG= poetry run gen_dockerfile | docker buildx build -t $IMAGE_TAG -
- name: Push the Docker image.
if: ${{ github.ref_name == github.event.repository.default_branch }}
run: |

View File

@@ -97,7 +97,6 @@ jobs:
-D CMAKE_CXX_FLAGS="-Werror" \
-D CMAKE_EXE_LINKER_FLAGS="-s" \
-D TDESKTOP_API_TEST=ON \
-D DESKTOP_APP_USE_PACKAGED=OFF \
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF \
$DEFINE

View File

@@ -40,7 +40,7 @@ jobs:
macos:
name: MacOS
runs-on: macos-latest
runs-on: macos-12
strategy:
matrix:
@@ -114,7 +114,6 @@ jobs:
-D CMAKE_C_FLAGS="-Werror" \
-D CMAKE_CXX_FLAGS="-Werror" \
-D TDESKTOP_API_TEST=ON \
-D DESKTOP_APP_USE_PACKAGED=OFF \
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF \
$DEFINE

25
.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v5
with:
stale-issue-message: |
Hey there!
This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.
Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.
Thanks!
stale-issue-label: 'stale'
exempt-issue-labels: 'enhancement'
days-before-stale: 180
days-before-close: 30
days-before-pr-stale: -1
operations-per-run: 1000

View File

@@ -79,23 +79,12 @@ jobs:
submodules: recursive
path: ${{ env.TBUILD }}\${{ env.REPO_NAME }}
- name: Choco installs.
run: |
choco install --no-progress -y nasm strawberryperl yasm jom ninja
py -m pip install pywin32
- name: Install msys64.
run: |
mkdir %TBUILD%\ThirdParty
xcopy /E /I C:\msys64 %TBUILD%\ThirdParty\msys64
- name: Python installs.
run: pip3 install --upgrade pywin32 six
- name: Set up environment paths.
shell: bash
run: |
echo "C:\\Strawberry\\perl\\bin\\" >> $GITHUB_PATH
echo "C:\\Program Files\\NASM\\" >> $GITHUB_PATH
echo "C:\\ProgramData\\chocolatey\\lib\\ninja\\tools\\" >> $GITHUB_PATH
echo "CACHE_KEY=$(sha256sum $TBUILD/$REPO_NAME/$PREPARE_PATH | awk '{ print $1 }')" >> $GITHUB_ENV
echo "Configurate git for cherry-picks."
@@ -149,7 +138,6 @@ jobs:
call configure.bat ^
${{ matrix.arch }} ^
-D TDESKTOP_API_TEST=ON ^
-D DESKTOP_APP_USE_PACKAGED=OFF ^
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF ^
-D DESKTOP_APP_NO_PDB=ON ^
%TDESKTOP_BUILD_DEFINE% ^

View File

@@ -7,12 +7,12 @@ jobs:
runs-on: windows-latest # action can only be run on windows
steps:
- if: github.event.action == 'released'
uses: telegramdesktop/winget-releaser@latest
uses: telegramdesktop/winget-releaser@main
with:
identifier: Telegram.TelegramDesktop
token: ${{ secrets.WINGET_TOKEN }}
- if: github.event.action == 'prereleased'
uses: telegramdesktop/winget-releaser@latest
uses: telegramdesktop/winget-releaser@main
with:
identifier: Telegram.TelegramDesktop.Beta
token: ${{ secrets.WINGET_TOKEN }}

9
.gitmodules vendored
View File

@@ -79,9 +79,6 @@
[submodule "Telegram/lib_webview"]
path = Telegram/lib_webview
url = https://github.com/desktop-app/lib_webview.git
[submodule "Telegram/lib_waylandshells"]
path = Telegram/lib_waylandshells
url = https://github.com/desktop-app/lib_waylandshells.git
[submodule "Telegram/ThirdParty/jemalloc"]
path = Telegram/ThirdParty/jemalloc
url = https://github.com/jemalloc/jemalloc
@@ -94,3 +91,9 @@
[submodule "Telegram/ThirdParty/wayland-protocols"]
path = Telegram/ThirdParty/wayland-protocols
url = https://github.com/gitlab-freedesktop-mirrors/wayland-protocols.git
[submodule "Telegram/ThirdParty/kimageformats"]
path = Telegram/ThirdParty/kimageformats
url = https://github.com/KDE/kimageformats.git
[submodule "Telegram/ThirdParty/kcoreaddons"]
path = Telegram/ThirdParty/kcoreaddons
url = https://github.com/KDE/kcoreaddons.git

View File

@@ -38,6 +38,8 @@ get_filename_component(cmake_helpers_loc "cmake" REALPATH)
include(cmake/variables.cmake)
include(cmake/nice_target_sources.cmake)
include(cmake/target_compile_options_if_exists.cmake)
include(cmake/target_link_options_if_exists.cmake)
include(cmake/target_link_static_libraries.cmake)
include(cmake/target_link_frameworks.cmake)
include(cmake/init_target.cmake)
@@ -48,6 +50,15 @@ include(cmake/target_prepare_qrc.cmake)
include(cmake/options.cmake)
if (NOT DESKTOP_APP_USE_PACKAGED)
if (WIN32)
set(qt_version 5.15.4)
elseif (APPLE)
set(qt_version 6.3.1)
else()
set(qt_version 6.4.0)
endif()
endif()
include(cmake/external/qt/package.cmake)
set(desktop_app_skip_libs

View File

@@ -18,9 +18,6 @@ endif()
add_subdirectory(lib_storage)
add_subdirectory(lib_lottie)
add_subdirectory(lib_qr)
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
add_subdirectory(lib_waylandshells)
endif()
add_subdirectory(lib_webrtc)
add_subdirectory(lib_webview)
add_subdirectory(codegen)
@@ -82,9 +79,9 @@ PRIVATE
desktop-app::lib_webview
desktop-app::lib_ffmpeg
desktop-app::lib_stripe
desktop-app::external_lz4
desktop-app::external_rlottie
desktop-app::external_zlib
desktop-app::external_kcoreaddons
desktop-app::external_qt_static_plugins
desktop-app::external_qt
desktop-app::external_qr_code_generator
@@ -139,6 +136,8 @@ PRIVATE
api/api_polls.h
api/api_premium.cpp
api/api_premium.h
api/api_premium_option.cpp
api/api_premium_option.h
api/api_report.cpp
api/api_report.h
api/api_ringtones.cpp
@@ -464,6 +463,8 @@ PRIVATE
data/data_download_manager.h
data/data_drafts.cpp
data/data_drafts.h
data/data_emoji_statuses.cpp
data/data_emoji_statuses.h
data/data_folder.cpp
data/data_folder.h
data/data_file_click_handler.cpp
@@ -487,6 +488,8 @@ PRIVATE
data/data_media_types.h
# data/data_messages.cpp
# data/data_messages.h
data/data_message_reaction_id.cpp
data/data_message_reaction_id.h
data/data_message_reactions.cpp
data/data_message_reactions.h
data/data_msg_id.h
@@ -614,54 +617,69 @@ PRIVATE
history/view/controls/history_view_voice_record_bar.h
history/view/controls/history_view_voice_record_button.cpp
history/view/controls/history_view_voice_record_button.h
history/view/media/history_view_call.h
history/view/media/history_view_call.cpp
history/view/media/history_view_contact.h
history/view/media/history_view_call.h
history/view/media/history_view_contact.cpp
history/view/media/history_view_custom_emoji.h
history/view/media/history_view_contact.h
history/view/media/history_view_custom_emoji.cpp
history/view/media/history_view_dice.h
history/view/media/history_view_custom_emoji.h
history/view/media/history_view_dice.cpp
history/view/media/history_view_document.h
history/view/media/history_view_dice.h
history/view/media/history_view_document.cpp
history/view/media/history_view_file.h
history/view/media/history_view_document.h
history/view/media/history_view_extended_preview.cpp
history/view/media/history_view_extended_preview.h
history/view/media/history_view_file.cpp
history/view/media/history_view_game.h
history/view/media/history_view_file.h
history/view/media/history_view_game.cpp
history/view/media/history_view_gif.h
history/view/media/history_view_game.h
history/view/media/history_view_gif.cpp
history/view/media/history_view_invoice.h
history/view/media/history_view_gif.h
history/view/media/history_view_invoice.cpp
history/view/media/history_view_large_emoji.h
history/view/media/history_view_invoice.h
history/view/media/history_view_large_emoji.cpp
history/view/media/history_view_location.h
history/view/media/history_view_large_emoji.h
history/view/media/history_view_location.cpp
history/view/media/history_view_media.h
history/view/media/history_view_location.h
history/view/media/history_view_media.cpp
history/view/media/history_view_media_common.h
history/view/media/history_view_media.h
history/view/media/history_view_media_common.cpp
history/view/media/history_view_media_grouped.h
history/view/media/history_view_media_common.h
history/view/media/history_view_media_grouped.cpp
history/view/media/history_view_media_unwrapped.h
history/view/media/history_view_media_grouped.h
history/view/media/history_view_media_unwrapped.cpp
history/view/media/history_view_photo.h
history/view/media/history_view_media_unwrapped.h
history/view/media/history_view_photo.cpp
history/view/media/history_view_poll.h
history/view/media/history_view_photo.h
history/view/media/history_view_poll.cpp
history/view/media/history_view_service_media_gift.h
history/view/media/history_view_poll.h
history/view/media/history_view_service_media_gift.cpp
history/view/media/history_view_slot_machine.h
history/view/media/history_view_service_media_gift.h
history/view/media/history_view_slot_machine.cpp
history/view/media/history_view_sticker.h
history/view/media/history_view_slot_machine.h
history/view/media/history_view_sticker.cpp
history/view/media/history_view_theme_document.h
history/view/media/history_view_sticker.h
history/view/media/history_view_sticker_player.cpp
history/view/media/history_view_sticker_player.h
history/view/media/history_view_sticker_player_abstract.h
history/view/media/history_view_theme_document.cpp
history/view/media/history_view_web_page.h
history/view/media/history_view_theme_document.h
history/view/media/history_view_web_page.cpp
history/view/reactions/message_reactions_list.cpp
history/view/reactions/message_reactions_list.h
history/view/reactions/message_reactions_selector.cpp
history/view/reactions/message_reactions_selector.h
history/view/media/history_view_web_page.h
history/view/reactions/history_view_reactions.cpp
history/view/reactions/history_view_reactions.h
history/view/reactions/history_view_reactions_animation.cpp
history/view/reactions/history_view_reactions_animation.h
history/view/reactions/history_view_reactions_button.cpp
history/view/reactions/history_view_reactions_button.h
history/view/reactions/history_view_reactions_list.cpp
history/view/reactions/history_view_reactions_list.h
history/view/reactions/history_view_reactions_selector.cpp
history/view/reactions/history_view_reactions_selector.h
history/view/reactions/history_view_reactions_strip.cpp
history/view/reactions/history_view_reactions_strip.h
history/view/reactions/history_view_reactions_tabs.cpp
history/view/reactions/history_view_reactions_tabs.h
history/view/history_view_bottom_info.cpp
history/view/history_view_bottom_info.h
history/view/history_view_contact_status.cpp
@@ -692,12 +710,6 @@ PRIVATE
history/view/history_view_pinned_tracker.h
history/view/history_view_quick_action.cpp
history/view/history_view_quick_action.h
history/view/history_view_react_animation.cpp
history/view/history_view_react_animation.h
history/view/history_view_react_button.cpp
history/view/history_view_react_button.h
history/view/history_view_reactions.cpp
history/view/history_view_reactions.h
history/view/history_view_replies_section.cpp
history/view/history_view_replies_section.h
history/view/history_view_requests_bar.cpp
@@ -797,8 +809,12 @@ PRIVATE
info/polls/info_polls_results_widget.h
info/profile/info_profile_actions.cpp
info/profile/info_profile_actions.h
info/profile/info_profile_badge.cpp
info/profile/info_profile_badge.h
info/profile/info_profile_cover.cpp
info/profile/info_profile_cover.h
info/profile/info_profile_emoji_status_panel.cpp
info/profile/info_profile_emoji_status_panel.h
info/profile/info_profile_icon.cpp
info/profile/info_profile_icon.h
info/profile/info_profile_inner_widget.cpp
@@ -1452,18 +1468,13 @@ else()
endif()
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
if (DESKTOP_APP_QT6)
qt6_generate_wayland_protocol_client_sources(Telegram
FILES
${third_party_loc}/plasma-wayland-protocols/src/protocols/plasma-shell.xml
)
else()
message(FATAL_ERROR "This piece of cmake code is not ported to Qt 5")
endif()
qt_generate_wayland_protocol_client_sources(Telegram
FILES
${third_party_loc}/plasma-wayland-protocols/src/protocols/plasma-shell.xml
)
target_link_libraries(Telegram
PRIVATE
desktop-app::lib_waylandshells
desktop-app::external_wayland_client
)
endif()

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,9 +1 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" viewBox="0 0 76 73" xmlns="http://www.w3.org/2000/svg">
<title>Star</title>
<g fill="none" fill-rule="evenodd">
<g transform="translate(-5 -5)" fill="#fff">
<path d="m40.806 66.037-17.389 10.627c-1.5943 0.97436-3.6766 0.4718-4.651-1.1225-0.47558-0.77817-0.61685-1.7154-0.39178-2.5992l2.8114-11.039c0.91458-3.5913 3.3384-6.6111 6.6467-8.281l15.265-7.7056c0.84279-0.42542 1.1811-1.4535 0.7557-2.2963-0.3335-0.66067-1.0543-1.0317-1.7857-0.91925l-17.288 2.6578c-4.0448 0.62183-8.1617-0.52596-11.301-3.1508l-7.112-5.9459c-1.4335-1.1985-1.624-3.3321-0.42557-4.7656 0.58391-0.69842 1.4246-1.1321 2.3322-1.2029l20.357-1.5894c1.3848-0.10811 2.5919-0.98375 3.1246-2.2665l7.8535-18.913c0.71656-1.7256 2.6963-2.5436 4.4219-1.8271 0.82676 0.34331 1.4838 1.0003 1.8271 1.8271l7.8535 18.913c0.53267 1.2828 1.7398 2.1584 3.1246 2.2665l20.456 1.5971c1.8628 0.14544 3.255 1.7734 3.1096 3.6363-0.070088 0.89771-0.49515 1.7304-1.1811 2.3138l-15.589 13.259c-1.0616 0.90287-1.5248 2.3263-1.1979 3.681l4.7945 19.87c0.43827 1.8163-0.67888 3.6441-2.4952 4.0824-0.87218 0.21045-1.7922 0.065833-2.5578-0.40204l-17.515-10.704c-1.1827-0.72283-2.6706-0.72283-3.8533 0z"/>
</g>
</g>
</svg>
<svg width="84" height="81" viewBox="0 0 84 81" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(-190.000000, -73.000000)" fill="#fff"><defs>gradientPlaceholder</defs><path d="M217.584175 95.7198452l10.102137-20.1302773C228.851735 73.2672578 231.669488 72.3342655 233.979937 73.5056713 234.886993 73.9655512 235.620771 74.7092927 236.070698 75.6248193l9.540513 19.41335C246.390574 96.6240434 247.914247 97.7068442 249.661599 97.9165844L269.640156 100.314675C272.352386 100.640233 274.288515 103.114133 273.96462 105.840286 273.831224 106.963049 273.321003 108.006556 272.518147 108.798619l-15.7911 15.578821C256.089452 125.006464 255.780497 125.898568 255.89167 126.789576L258.515919 147.821772C258.891602 150.832711 256.767771 153.579675 253.772209 153.957287 252.636962 154.100393 251.485656 153.881854 250.480518 153.332463L233.796907 144.21349C232.589892 143.553757 231.136827 143.534799 229.913183 144.162822l-17.2854 8.871545C210.195073 154.282929 207.215982 153.312865 205.973797 150.867667 205.509027 149.952785 205.337643 148.915649 205.483212 147.898872L206.864713 138.249309C207.540411 133.529666 210.458736 129.435705 214.68762 127.274973L233.885915 117.465678C234.398537 117.203755 234.602854 116.57373 234.342269 116.058476 234.140381 115.659283 233.708181 115.433429 233.267119 115.496635l-23.479483 3.364749C206.198378 119.375746 202.558336 118.361996 199.744254 116.064306L191.92377 109.678904C189.692048 107.856709 189.352516 104.561073 191.165405 102.317895 192.008458 101.274743 193.218498 100.597614 194.544752 100.426837L214.594132 97.8451554C215.880032 97.679575 217.000319 96.8832795 217.584175 95.7198452z"/></g></g></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -17,6 +17,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_menu_night_mode" = "Night Mode";
"lng_menu_add_account" = "Add Account";
"lng_menu_activate" = "Activate";
"lng_menu_set_status" = "Set Emoji Status";
"lng_menu_change_status" = "Change Emoji Status";
"lng_disable_notifications_from_tray" = "Disable notifications";
"lng_enable_notifications_from_tray" = "Enable notifications";
@@ -267,7 +269,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_proxy_unsupported" = "Your Telegram Desktop version doesn't support this proxy type or the proxy link is invalid. Please update Telegram Desktop to the latest version.";
"lng_edit_deleted" = "This message was deleted";
"lng_edit_too_long" = "Your message text is too long";
"lng_edit_limit_reached#one" = "You've reached the message text limit. Please make the text shorter by {count} character.";
"lng_edit_limit_reached#other" = "You've reached the message text limit. Please make the text shorter by {count} characters.";
"lng_edit_message" = "Edit message";
"lng_edit_message_text" = "New message text...";
"lng_deleted" = "Deleted Account";
@@ -511,6 +514,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_settings_send_cmdenter" = "Send by Cmd+Enter";
"lng_settings_chat_quick_action_reply" = "Reply with double click";
"lng_settings_chat_quick_action_react" = "Send reaction with double click";
"lng_settings_chat_corner_reaction" = "Reaction button on messages";
"lng_settings_chat_reactions_title" = "Quick Reaction";
"lng_settings_chat_reactions_subtitle" = "Choose your favorite reaction";
@@ -1194,13 +1198,20 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_manage_peer_permissions" = "Permissions";
"lng_manage_peer_invite_links" = "Invite links";
"lng_manage_peer_reactions" = "Reactions";
"lng_manage_peer_reactions_on" = "All";
"lng_manage_peer_reactions_off" = "Off";
"lng_manage_peer_requests" = "Member Requests";
"lng_manage_peer_requests_channel" = "Subscriber Requests";
"lng_manage_peer_reactions_enable" = "Enable Reactions";
"lng_manage_peer_reactions_about" = "Allow members to react to group messages.";
"lng_manage_peer_reactions_about_channel" = "Allow subscribers to react to channel posts.";
"lng_manage_peer_reactions_all" = "All reactions";
"lng_manage_peer_reactions_all_about" = "Members of the group can use any emoji as reactions to messages.";
"lng_manage_peer_reactions_some" = "Some reactions";
"lng_manage_peer_reactions_some_about" = "You can select emoji that will allow members of your group to react to messages.";
"lng_manage_peer_reactions_none" = "No reactions";
"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_group_type" = "Group type";
@@ -1700,6 +1711,22 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_premium_unlock_reactions" = "Unlock Premium Reactions";
"lng_premium_unlock_stickers" = "Unlock Premium Stickers";
"lng_premium_unlock_emoji" = "Unlock Animated Emoji";
"lng_premium_unlock_status" = "Unlock Emoji Status";
"lng_premium_subscribe_months_12" = "Annual";
"lng_premium_subscribe_months_6" = "Semiannual";
"lng_premium_subscribe_months_1" = "Monthly";
"lng_premium_subscribe_total" = "{cost} per year";
"lng_premium_subscribe_button" = "Subscribe for {cost} per month";
"lng_premium_emoji_status_title" = "{user} set this emoji from {link} as their current status.";
"lng_premium_emoji_status_title_colored" = "{user} set this emoji as their current status.";
"lng_premium_emoji_status_about" = "Emoji status is a premium feature. Other features included in **Telegram Premium**:";
"lng_premium_emoji_status_button" = "Unlock Emoji Status";
"lng_premium_summary_user_title" = "{user} is a subscriber of Telegram Premium.";
"lng_premium_summary_user_about" = "Owners of Telegram Premium accounts have exclusive access to multiple additional features.";
"lng_premium_summary_user_button" = "Learn More";
"lng_premium_summary_title" = "Telegram Premium";
"lng_premium_summary_top_about" = "Go **beyond the limits**, get **exclusive features** and support us by subscribing to **Telegram Premium**.";
@@ -1718,8 +1745,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_premium_summary_about_voice_to_text" = "Ability to read the transcript of any incoming voice message.";
"lng_premium_summary_subtitle_no_ads" = "No Ads";
"lng_premium_summary_about_no_ads" = "No more ads in public channels where Telegram sometimes shows ads.";
"lng_premium_summary_subtitle_unique_reactions" = "Unique Reactions";
"lng_premium_summary_about_unique_reactions" = "Additional animated reactions on messages available only to the Premium subscribers.";
"lng_premium_summary_subtitle_emoji_status" = "Emoji Status";
"lng_premium_summary_about_emoji_status" = "Add any of thousands emoji next to your name to display current activity.";
"lng_premium_summary_subtitle_infinite_reactions" = "Infinite Reactions";
"lng_premium_summary_about_infinite_reactions" = "React with thousands of emoji — with multiple reactions per message.";
"lng_premium_summary_subtitle_premium_stickers" = "Premium Stickers";
"lng_premium_summary_about_premium_stickers" = "Exclusive enlarged stickers featuring additional effects, updated monthly.";
"lng_premium_summary_subtitle_animated_emoji" = "Animated Emoji";
@@ -1789,6 +1818,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_accounts_limit1#other" = "You have reached the limit of **{count}** connected accounts.";
"lng_accounts_limit2" = "You can free one space by subscribing to **Telegram Premium** with one of these connected accounts:";
"lng_emoji_status_for_title" = "Set Status for...";
"lng_emoji_status_for_submit" = "Set Status";
"lng_emoji_status_menu_duration_any" = "Set Status for {duration}";
"lng_group_about_header" = "You have created a group.";
"lng_group_about_text" = "Groups can have:";
"lng_group_about1" = "Up to 100,000 members";
@@ -1884,6 +1917,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_new_contact_unarchive" = "Unarchive";
"lng_new_contact_from_request_channel" = "{user} is an admin of {name}, a channel you requested to join.";
"lng_new_contact_from_request_group" = "{user} is an admin of {name}, a group you requested to join.";
"lng_new_contact_about_status" = "This account uses {emoji} as a custom status next to its\nname. Such emoji statuses are available to all\nsubscribers of {link}.";
"lng_new_contact_about_status_link" = "Telegram Premium";
"lng_from_request_title_channel" = "Chat with channel's admin";
"lng_from_request_title_group" = "Chat with group's admin";
"lng_from_request_body" = "You received this message because you requested to join {name} on {date}.";
@@ -1913,6 +1948,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_send_anonymous_ph" = "Send anonymously...";
"lng_send_as_title" = "Send message as...";
"lng_send_as_anonymous_admin" = "Anonymous admin";
"lng_send_as_premium_required" = "Subscribe to {link} to be able to comment on behalf of your channels in group chats.";
"lng_send_as_premium_required_link" = "Telegram Premium";
"lng_record_cancel" = "Release outside this field to cancel";
"lng_record_lock_cancel_sure" = "Are you sure you want to stop recording and discard your voice message?";
"lng_record_listen_cancel_sure" = "Are you sure you want to discard your recorded voice message?";
@@ -2168,6 +2205,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_context_animated_emoji" = "This message contains emoji from **{name} pack**.";
"lng_context_animated_emoji_many#one" = "This message contains emoji from **{count} pack**.";
"lng_context_animated_emoji_many#other" = "This message contains emoji from **{count} packs**.";
"lng_context_animated_reaction" = "This reaction is from **{name} pack**.";
"lng_context_animated_reactions" = "Reactions contain emoji from **{name} pack**.";
"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_downloads_section" = "Downloads";
"lng_downloads_view_in_chat" = "View in chat";
@@ -2783,6 +2824,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_slowmode_enabled"= "Slow mode is enabled. You can send your next message in {left}.";
"lng_slowmode_no_many" = "Slow mode is enabled. You can't send more than one message at a time.";
"lng_slowmode_too_long" = "Sorry, this text is too long to send as one message.\n\nSlow mode is enabled. You can't send more than one message at a time.";
"lng_slowmode_seconds#one" = "{count} second";
"lng_slowmode_seconds#other" = "{count} seconds";
"lng_rights_gigagroup_title" = "Broadcast group";
"lng_rights_gigagroup_convert" = "Convert to Broadcast Group";
@@ -2991,6 +3034,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_admin_log_messages_ttl_removed" = "{from} disabled messages auto-deletion after {duration}";
"lng_admin_log_reactions_disabled" = "{from} disabled reactions";
"lng_admin_log_reactions_updated" = "{from} updated the list of allowed reactions to: {emoji}";
"lng_admin_log_reactions_allowed_all" = "{from} allowed all reactions";
"lng_admin_log_reactions_allowed_official" = "{from} allowed all official reactions";
"lng_admin_log_edited_invite_link" = "edited invite link {link}";
"lng_admin_log_invite_link_expire_date" = "Expire date: {previous} -> {limit}";
"lng_admin_log_invite_link_usage_limit" = "Usage limit: {previous} -> {limit}";

View File

@@ -68,7 +68,7 @@ inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string pro
inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia;
inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia;
inputMediaGame#d33f43f3 id:InputGame = InputMedia;
inputMediaInvoice#d9799874 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:flags.1?string = InputMedia;
inputMediaInvoice#8eb5a6d5 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:flags.1?string extended_media:flags.2?InputMedia = InputMedia;
inputMediaGeoLive#971fa843 flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:flags.2?int period:flags.1?int proximity_notification_radius:flags.3?int = InputMedia;
inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> = InputMedia;
inputMediaDice#e66fbf7b emoticon:string = InputMedia;
@@ -110,7 +110,7 @@ storage.fileMp4#b3cea0e4 = storage.FileType;
storage.fileWebp#1081464c = storage.FileType;
userEmpty#d3bc4b7a id:long = User;
user#3ff6ecb0 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
user#5d99adee flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus = User;
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
userProfilePhoto#82d1f706 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;
@@ -128,8 +128,8 @@ chatForbidden#6592a1a7 id:long title:string = Chat;
channel#8261ac61 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat;
chatFull#d18ee226 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector<long> available_reactions:flags.18?Vector<string> = ChatFull;
channelFull#ea68a619 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?Vector<string> = ChatFull;
chatFull#c9d31138 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector<long> available_reactions:flags.18?ChatReactions = ChatFull;
channelFull#f2355507 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions = ChatFull;
chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant;
chatParticipantCreator#e46bcee4 user_id:long = ChatParticipant;
@@ -154,7 +154,7 @@ messageMediaDocument#9cb070d7 flags:# nopremium:flags.3?true document:flags.0?Do
messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia;
messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia;
messageMediaGame#fdb19008 game:Game = MessageMedia;
messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia;
messageMediaInvoice#f6a548d3 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string extended_media:flags.4?MessageExtendedMedia = MessageMedia;
messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int proximity_notification_radius:flags.1?int = MessageMedia;
messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;
messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia;
@@ -324,7 +324,7 @@ updateChannelMessageViews#f226ac08 channel_id:long id:int views:int = Update;
updateChatParticipantAdmin#d7ca61a2 chat_id:long user_id:long is_admin:Bool version:int = Update;
updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update;
updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true emojis:flags.1?true order:Vector<long> = Update;
updateStickerSets#43ae3dec = Update;
updateStickerSets#31c24808 flags:# masks:flags.0?true emojis:flags.1?true = Update;
updateSavedGifs#9375341e = Update;
updateBotInlineQuery#496f379c flags:# query_id:long user_id:long query:string geo:flags.0?GeoPoint peer_type:flags.1?InlineQueryPeerType offset:string = Update;
updateBotInlineSend#12f12a07 flags:# user_id:long query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update;
@@ -393,6 +393,11 @@ updateBotMenuButton#14b85813 bot_id:long button:BotMenuButton = Update;
updateSavedRingtones#74d8be99 = Update;
updateTranscribedAudio#84cd5a flags:# pending:flags.0?true peer:Peer msg_id:int transcription_id:long text:string = Update;
updateReadFeaturedEmojiStickers#fb4c496c = Update;
updateUserEmojiStatus#28373599 user_id:long emoji_status:EmojiStatus = Update;
updateRecentEmojiStatuses#30f443db = Update;
updateRecentReactions#6f7863f4 = Update;
updateMoveStickerSetToTop#86fccf85 flags:# masks:flags.0?true emojis:flags.1?true stickerset:long = Update;
updateMessageExtendedMedia#5a73a98c peer:Peer msg_id:int extended_media:MessageExtendedMedia = Update;
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
@@ -419,7 +424,7 @@ upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes
dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true this_port_only:flags.5?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption;
config#330b4067 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true force_try_ipv6:flags.14?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config;
config#232566ac flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true force_try_ipv6:flags.14?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int reactions_default:flags.15?Reaction = Config;
nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
@@ -557,7 +562,7 @@ authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true pa
account.authorizations#4bff8ea0 authorization_ttl_days:int authorizations:Vector<Authorization> = account.Authorizations;
account.password#185b184f flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes pending_reset_date:flags.5?int = account.Password;
account.password#957b50fb flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes pending_reset_date:flags.5?int login_email_pattern:flags.6?string = account.Password;
account.passwordSettings#9a5c33e5 flags:# email:flags.0?string secure_settings:flags.1?SecureSecretSettings = account.PasswordSettings;
@@ -581,6 +586,8 @@ inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;
inputStickerSetDice#e67f520e emoticon:string = InputStickerSet;
inputStickerSetAnimatedEmojiAnimations#cde3739 = InputStickerSet;
inputStickerSetPremiumGifts#c88b3b02 = InputStickerSet;
inputStickerSetEmojiGenericAnimations#4c4d4ce = InputStickerSet;
inputStickerSetEmojiDefaultStatuses#29d0f5ee = InputStickerSet;
stickerSet#2dd14edc flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true videos:flags.6?true emojis:flags.7?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector<PhotoSize> thumb_dc_id:flags.4?int thumb_version:flags.4?int thumb_document_id:flags.8?long count:int hash:int = StickerSet;
@@ -716,6 +723,8 @@ auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType;
auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType;
auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType;
auth.sentCodeTypeMissedCall#82006484 prefix:string length:int = auth.SentCodeType;
auth.sentCodeTypeEmailCode#5a159841 flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true email_pattern:string length:int next_phone_login_date:flags.2?int = auth.SentCodeType;
auth.sentCodeTypeSetUpEmailRequired#a5491dea flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true = auth.SentCodeType;
messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer;
@@ -942,7 +951,7 @@ channelAdminLogEventActionChangeHistoryTTL#6e941a38 prev_value:int new_value:int
channelAdminLogEventActionParticipantJoinByRequest#afb6144a invite:ExportedChatInvite approved_by:long = ChannelAdminLogEventAction;
channelAdminLogEventActionToggleNoForwards#cb2ac766 new_value:Bool = ChannelAdminLogEventAction;
channelAdminLogEventActionSendMessage#278f2868 message:Message = ChannelAdminLogEventAction;
channelAdminLogEventActionChangeAvailableReactions#9cf7f76a prev_value:Vector<string> new_value:Vector<string> = ChannelAdminLogEventAction;
channelAdminLogEventActionChangeAvailableReactions#be4e0ef8 prev_value:ChatReactions new_value:ChatReactions = ChannelAdminLogEventAction;
channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent;
@@ -1319,7 +1328,7 @@ searchResultPosition#7f648b67 msg_id:int date:int offset:int = SearchResultsPosi
messages.searchResultsPositions#53b22baf count:int positions:Vector<SearchResultsPosition> = messages.SearchResultsPositions;
channels.sendAsPeers#8356cda9 peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = channels.SendAsPeers;
channels.sendAsPeers#f496b0c6 peers:Vector<SendAsPeer> chats:Vector<Chat> users:Vector<User> = channels.SendAsPeers;
users.userFull#3b6d152e full_user:UserFull chats:Vector<Chat> users:Vector<User> = users.UserFull;
@@ -1327,7 +1336,7 @@ messages.peerSettings#6880b94d settings:PeerSettings chats:Vector<Chat> users:Ve
auth.loggedOut#c3a2835f flags:# future_auth_token:flags.0?bytes = auth.LoggedOut;
reactionCount#6fb250d1 flags:# chosen:flags.0?true reaction:string count:int = ReactionCount;
reactionCount#a3d1cb80 flags:# chosen_order:flags.0?int reaction:Reaction count:int = ReactionCount;
messageReactions#4f2b9479 flags:# min:flags.0?true can_see_list:flags.2?true results:Vector<ReactionCount> recent_reactions:flags.1?Vector<MessagePeerReaction> = MessageReactions;
@@ -1341,7 +1350,7 @@ messages.availableReactions#768e3aad hash:int reactions:Vector<AvailableReaction
messages.translateNoResult#67ca4737 = messages.TranslatedText;
messages.translateResultText#a214f7d0 text:string = messages.TranslatedText;
messagePeerReaction#51b67eff flags:# big:flags.0?true unread:flags.1?true peer_id:Peer reaction:string = MessagePeerReaction;
messagePeerReaction#b156fe9c flags:# big:flags.0?true unread:flags.1?true peer_id:Peer reaction:Reaction = MessagePeerReaction;
groupCallStreamChannel#80eb48af channel:int scale:int last_timestamp_ms:long = GroupCallStreamChannel;
@@ -1394,7 +1403,7 @@ payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice;
messages.transcribedAudio#93752c52 flags:# pending:flags.0?true transcription_id:long text:string = messages.TranscribedAudio;
help.premiumPromo#8a4f3c29 status_text:string status_entities:Vector<MessageEntity> video_sections:Vector<string> videos:Vector<Document> currency:string monthly_amount:long users:Vector<User> = help.PremiumPromo;
help.premiumPromo#5334759c status_text:string status_entities:Vector<MessageEntity> video_sections:Vector<string> videos:Vector<Document> period_options:Vector<PremiumSubscriptionOption> users:Vector<User> = help.PremiumPromo;
inputStorePaymentPremiumSubscription#a6751e66 flags:# restore:flags.0?true = InputStorePaymentPurpose;
inputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:long = InputStorePaymentPurpose;
@@ -1403,6 +1412,42 @@ premiumGiftOption#74c34319 flags:# months:int currency:string amount:long bot_ur
paymentFormMethod#88f8f21b url:string title:string = PaymentFormMethod;
emojiStatusEmpty#2de11aae = EmojiStatus;
emojiStatus#929b619d document_id:long = EmojiStatus;
emojiStatusUntil#fa30a8c7 document_id:long until:int = EmojiStatus;
account.emojiStatusesNotModified#d08ce645 = account.EmojiStatuses;
account.emojiStatuses#90c467d1 hash:long statuses:Vector<EmojiStatus> = account.EmojiStatuses;
reactionEmpty#79f5d419 = Reaction;
reactionEmoji#1b2286b8 emoticon:string = Reaction;
reactionCustomEmoji#8935fc73 document_id:long = Reaction;
chatReactionsNone#eafc32bc = ChatReactions;
chatReactionsAll#52928bca flags:# allow_custom:flags.0?true = ChatReactions;
chatReactionsSome#661d4037 reactions:Vector<Reaction> = ChatReactions;
messages.reactionsNotModified#b06fdbdf = messages.Reactions;
messages.reactions#eafdf716 hash:long reactions:Vector<Reaction> = messages.Reactions;
emailVerifyPurposeLoginSetup#4345be73 phone_number:string phone_code_hash:string = EmailVerifyPurpose;
emailVerifyPurposeLoginChange#527d22eb = EmailVerifyPurpose;
emailVerifyPurposePassport#bbf51685 = EmailVerifyPurpose;
emailVerificationCode#922e55a9 code:string = EmailVerification;
emailVerificationGoogle#db909ec2 token:string = EmailVerification;
emailVerificationApple#96d074fd token:string = EmailVerification;
account.emailVerified#2b96cd1b email:string = account.EmailVerified;
account.emailVerifiedLogin#e1bb0d61 email:string sent_code:auth.SentCode = account.EmailVerified;
premiumSubscriptionOption#b6f11ebe flags:# current:flags.1?true can_purchase_upgrade:flags.2?true months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumSubscriptionOption;
sendAsPeer#b81c7034 flags:# premium_required:flags.0?true peer:Peer = SendAsPeer;
messageExtendedMediaPreview#ad628cc8 flags:# w:flags.0?int h:flags.0?int thumb:flags.1?PhotoSize video_duration:flags.2?int = MessageExtendedMedia;
messageExtendedMedia#ee479c64 media:MessageMedia = MessageExtendedMedia;
---functions---
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
@@ -1415,7 +1460,7 @@ invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X;
auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;
auth.signUp#80eee427 phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization;
auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization;
auth.signIn#8d52a951 flags:# phone_number:string phone_code_hash:string phone_code:flags.0?string email_verification:flags.1?EmailVerification = auth.Authorization;
auth.logOut#3e72ba19 = auth.LoggedOut;
auth.resetAuthorizations#9fab0d1a = Bool;
auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization;
@@ -1471,8 +1516,8 @@ account.getAuthorizationForm#a929597a bot_id:long scope:string public_key:string
account.acceptAuthorization#f3ed4c73 bot_id:long scope:string public_key:string value_hashes:Vector<SecureValueHash> credentials:SecureCredentialsEncrypted = Bool;
account.sendVerifyPhoneCode#a5a356f9 phone_number:string settings:CodeSettings = auth.SentCode;
account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool;
account.sendVerifyEmailCode#7011509f email:string = account.SentEmailCode;
account.verifyEmail#ecba39db email:string code:string = Bool;
account.sendVerifyEmailCode#98e037bb purpose:EmailVerifyPurpose email:string = account.SentEmailCode;
account.verifyEmail#32da4cf purpose:EmailVerifyPurpose verification:EmailVerification = account.EmailVerified;
account.initTakeoutSession#8ef3eab0 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?long = account.Takeout;
account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool;
account.confirmPasswordEmail#8fdf1920 code:string = Bool;
@@ -1509,6 +1554,10 @@ account.changeAuthorizationSettings#40f48462 flags:# hash:long encrypted_request
account.getSavedRingtones#e1902288 hash:long = account.SavedRingtones;
account.saveRingtone#3dea5b03 id:InputDocument unsave:Bool = account.SavedRingtone;
account.uploadRingtone#831a83a2 file:InputFile file_name:string mime_type:string = Document;
account.updateEmojiStatus#fbd3de6b emoji_status:EmojiStatus = Bool;
account.getDefaultEmojiStatuses#d6753386 hash:long = account.EmojiStatuses;
account.getRecentEmojiStatuses#f578105 hash:long = account.EmojiStatuses;
account.clearRecentEmojiStatuses#18201aae = Bool;
users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
users.getFullUser#b60f5918 id:InputUser = users.UserFull;
@@ -1545,8 +1594,8 @@ messages.deleteHistory#b08f922a flags:# just_clear:flags.0?true revoke:flags.1?t
messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;
messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool;
messages.sendMessage#d9d75a4 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
messages.sendMedia#e25ff8e0 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
messages.sendMessage#d9d75a4 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
messages.sendMedia#e25ff8e0 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
messages.forwardMessages#cc30290b flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
messages.reportSpam#cf1592db peer:InputPeer = Bool;
messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings;
@@ -1626,7 +1675,7 @@ messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool;
messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory;
messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages;
messages.sendMultiMedia#f803138f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
messages.sendMultiMedia#f803138f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile;
messages.searchStickerSets#35705b8a flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets;
messages.getSplitRanges#1cff7e08 = Vector<MessageRange>;
@@ -1685,12 +1734,12 @@ messages.hideChatJoinRequest#7fe7e815 flags:# approved:flags.0?true peer:InputPe
messages.hideAllChatJoinRequests#e085f4ea flags:# approved:flags.0?true peer:InputPeer link:flags.1?string = Updates;
messages.toggleNoForwards#b11eafa2 peer:InputPeer enabled:Bool = Updates;
messages.saveDefaultSendAs#ccfddf96 peer:InputPeer send_as:InputPeer = Bool;
messages.sendReaction#25690ce4 flags:# big:flags.1?true peer:InputPeer msg_id:int reaction:flags.0?string = Updates;
messages.sendReaction#d30d78d4 flags:# big:flags.1?true add_to_recent:flags.2?true peer:InputPeer msg_id:int reaction:flags.0?Vector<Reaction> = Updates;
messages.getMessagesReactions#8bba90e6 peer:InputPeer id:Vector<int> = Updates;
messages.getMessageReactionsList#e0ee6b77 flags:# peer:InputPeer id:int reaction:flags.0?string offset:flags.1?string limit:int = messages.MessageReactionsList;
messages.setChatAvailableReactions#14050ea6 peer:InputPeer available_reactions:Vector<string> = Updates;
messages.getMessageReactionsList#461b3f48 flags:# peer:InputPeer id:int reaction:flags.0?Reaction offset:flags.1?string limit:int = messages.MessageReactionsList;
messages.setChatAvailableReactions#feb16771 peer:InputPeer available_reactions:ChatReactions = Updates;
messages.getAvailableReactions#18dea0ac hash:int = messages.AvailableReactions;
messages.setDefaultReaction#d960c4d4 reaction:string = Bool;
messages.setDefaultReaction#4f47a016 reaction:Reaction = Bool;
messages.translateText#24ce6dee flags:# peer:flags.0?InputPeer msg_id:flags.0?int text:flags.1?string from_lang:flags.2?string to_lang:string = messages.TranslatedText;
messages.getUnreadReactions#e85bae1a peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
messages.readReactions#82e251d7 peer:InputPeer = messages.AffectedHistory;
@@ -1698,9 +1747,9 @@ messages.searchSentMedia#107e31a0 q:string filter:MessagesFilter limit:int = mes
messages.getAttachMenuBots#16fcc2cb hash:long = AttachMenuBots;
messages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot;
messages.toggleBotInAttachMenu#1aee33af bot:InputUser enabled:Bool = Bool;
messages.requestWebView#91b15831 flags:# from_bot_menu:flags.4?true silent:flags.5?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON reply_to_msg_id:flags.0?int send_as:flags.13?InputPeer = WebViewResult;
messages.requestWebView#fc87a53c flags:# from_bot_menu:flags.4?true silent:flags.5?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to_msg_id:flags.0?int send_as:flags.13?InputPeer = WebViewResult;
messages.prolongWebView#ea5fbcce flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to_msg_id:flags.0?int send_as:flags.13?InputPeer = Bool;
messages.requestSimpleWebView#6abb2f73 flags:# bot:InputUser url:string theme_params:flags.0?DataJSON = SimpleWebViewResult;
messages.requestSimpleWebView#299bec8e flags:# bot:InputUser url:string theme_params:flags.0?DataJSON platform:string = SimpleWebViewResult;
messages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent;
messages.sendWebViewData#dc0242c8 bot:InputUser random_id:long button_text:string data:string = Updates;
messages.transcribeAudio#269e9a49 peer:InputPeer msg_id:int = messages.TranscribedAudio;
@@ -1708,6 +1757,11 @@ messages.rateTranscribedAudio#7f1d072f peer:InputPeer msg_id:int transcription_i
messages.getCustomEmojiDocuments#d9ab0f54 document_id:Vector<long> = Vector<Document>;
messages.getEmojiStickers#fbfca18f hash:long = messages.AllStickers;
messages.getFeaturedEmojiStickers#ecf6736 hash:long = messages.FeaturedStickers;
messages.reportReaction#3f64c076 peer:InputPeer id:int reaction_peer:InputPeer = Bool;
messages.getTopReactions#bb8125ba limit:int hash:long = messages.Reactions;
messages.getRecentReactions#39461db2 limit:int hash:long = messages.Reactions;
messages.clearRecentReactions#9dfeefb4 = Bool;
messages.getExtendedMedia#84f80814 peer:InputPeer id:Vector<int> = Updates;
updates.getState#edd4882a = updates.State;
updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
@@ -1814,7 +1868,6 @@ payments.exportInvoice#f91b065 invoice_media:InputMedia = payments.ExportedInvoi
payments.assignAppStoreTransaction#80ed747d receipt:bytes purpose:InputStorePaymentPurpose = Updates;
payments.assignPlayMarketTransaction#dffd50d3 receipt:DataJSON purpose:InputStorePaymentPurpose = Updates;
payments.canPurchasePremium#9fc19eb6 purpose:InputStorePaymentPurpose = Bool;
payments.requestRecurringPayment#146e958d user_id:InputUser recurring_init_charge:string invoice_media:InputMedia = Updates;
stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true animated:flags.1?true videos:flags.4?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector<InputStickerSetItem> software:flags.3?string = messages.StickerSet;
stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet;
@@ -1871,4 +1924,4 @@ stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel
stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats;
// LAYER 144
// LAYER 146

View File

@@ -10,7 +10,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="4.0.4.0" />
Version="4.2.4.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>

View File

@@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,0,4,0
PRODUCTVERSION 4,0,4,0
FILEVERSION 4,2,4,0
PRODUCTVERSION 4,2,4,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "4.0.4.0"
VALUE "FileVersion", "4.2.4.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "4.0.4.0"
VALUE "ProductVersion", "4.2.4.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,0,4,0
PRODUCTVERSION 4,0,4,0
FILEVERSION 4,2,4,0
PRODUCTVERSION 4,2,4,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "4.0.4.0"
VALUE "FileVersion", "4.2.4.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "4.0.4.0"
VALUE "ProductVersion", "4.2.4.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -41,7 +41,7 @@ void AttachedStickers::request(
return;
} else if (result.v.size() > 1) {
strongController->show(
Box<StickersBox>(strongController, result));
Box<StickersBox>(strongController, result.v));
return;
}
// Single attached sticker pack.

View File

@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "main/main_session.h"
#include "ui/empty_userpic.h"
#include "ui/painter.h"
#include "core/application.h"
#include "data/data_session.h"
#include "data/data_photo.h"
@@ -175,17 +176,28 @@ ConfirmInviteBox::ConfirmInviteBox(
const MTPDchatInvite &data,
ChannelData *invitePeekChannel,
Fn<void()> submit)
: ConfirmInviteBox(
session,
Parse(session, data),
invitePeekChannel,
std::move(submit)) {
}
ConfirmInviteBox::ConfirmInviteBox(
not_null<Main::Session*> session,
ChatInvite &&invite,
ChannelData *invitePeekChannel,
Fn<void()> submit)
: _session(session)
, _submit(std::move(submit))
, _title(this, st::confirmInviteTitle)
, _status(this, st::confirmInviteStatus)
, _about(this, st::confirmInviteAbout)
, _aboutRequests(this, st::confirmInviteStatus)
, _participants(GetParticipants(_session, data))
, _isChannel(data.is_channel() && !data.is_megagroup())
, _requestApprove(data.is_request_needed()) {
const auto title = qs(data.vtitle());
const auto count = data.vparticipants_count().v;
, _participants(std::move(invite.participants))
, _isChannel(invite.isChannel && !invite.isMegagroup)
, _requestApprove(invite.isRequestNeeded) {
const auto count = invite.participantsCount;
const auto status = [&] {
return invitePeekChannel
? tr::lng_channel_invite_private(tr::now)
@@ -202,10 +214,10 @@ ConfirmInviteBox::ConfirmInviteBox(
? tr::lng_channel_status(tr::now)
: tr::lng_group_status(tr::now);
}();
_title->setText(title);
_title->setText(invite.title);
_status->setText(status);
if (const auto v = qs(data.vabout().value_or_empty()); !v.isEmpty()) {
_about->setText(v);
if (!invite.about.isEmpty()) {
_about->setText(invite.about);
} else {
_about.destroy();
}
@@ -217,9 +229,8 @@ ConfirmInviteBox::ConfirmInviteBox(
_aboutRequests.destroy();
}
const auto photo = _session->data().processPhoto(data.vphoto());
if (!photo->isNull()) {
_photo = photo->createMediaView();
if (invite.photo) {
_photo = invite.photo->createMediaView();
_photo->wanted(Data::PhotoSize::Small, Data::FileOrigin());
if (!_photo->image(Data::PhotoSize::Small)) {
_session->downloaderTaskFinished(
@@ -230,29 +241,37 @@ ConfirmInviteBox::ConfirmInviteBox(
} else {
_photoEmpty = std::make_unique<Ui::EmptyUserpic>(
Data::PeerUserpicColor(0),
title);
invite.title);
}
}
ConfirmInviteBox::~ConfirmInviteBox() = default;
auto ConfirmInviteBox::GetParticipants(
not_null<Main::Session*> session,
const MTPDchatInvite &data)
-> std::vector<Participant> {
const auto participants = data.vparticipants();
if (!participants) {
return {};
}
const auto &v = participants->v;
auto result = std::vector<Participant>();
result.reserve(v.size());
for (const auto &participant : v) {
if (const auto user = session->data().processUser(participant)) {
result.push_back(Participant{ user });
ConfirmInviteBox::ChatInvite ConfirmInviteBox::Parse(
not_null<Main::Session*> session,
const MTPDchatInvite &data) {
auto participants = std::vector<Participant>();
if (const auto list = data.vparticipants()) {
participants.reserve(list->v.size());
for (const auto &participant : list->v) {
if (const auto user = session->data().processUser(participant)) {
participants.push_back(Participant{ user });
}
}
}
return result;
const auto photo = session->data().processPhoto(data.vphoto());
return {
.title = qs(data.vtitle()),
.about = data.vabout().value_or_empty(),
.photo = (photo->isNull() ? nullptr : photo.get()),
.participantsCount = data.vparticipants_count().v,
.participants = std::move(participants),
.isPublic = data.is_public(),
.isChannel = data.is_channel(),
.isMegagroup = data.is_megagroup(),
.isBroadcast = data.is_broadcast(),
.isRequestNeeded = data.is_request_needed(),
};
}
void ConfirmInviteBox::prepare() {
@@ -280,7 +299,7 @@ void ConfirmInviteBox::prepare() {
auto name = new Ui::FlatLabel(this, st::confirmInviteUserName);
name->resizeToWidth(st::confirmInviteUserPhotoSize + padding);
name->setText(participant.user->firstName.isEmpty()
? participant.user->name
? participant.user->name()
: participant.user->firstName);
name->moveToLeft(left + (padding / 2), st::confirmInviteUserNameTop);
left += _userWidth;

View File

@@ -59,10 +59,28 @@ private:
not_null<UserData*> user;
std::shared_ptr<Data::CloudImageView> userpic;
};
static std::vector<Participant> GetParticipants(
struct ChatInvite {
QString title;
QString about;
PhotoData *photo = nullptr;
int participantsCount = 0;
std::vector<Participant> participants;
bool isPublic = false;
bool isChannel = false;
bool isMegagroup = false;
bool isBroadcast = false;
bool isRequestNeeded = false;
};
[[nodiscard]] static ChatInvite Parse(
not_null<Main::Session*> session,
const MTPDchatInvite &data);
ConfirmInviteBox(
not_null<Main::Session*> session,
ChatInvite &&invite,
ChannelData *invitePeekChannel,
Fn<void()> submit);
const not_null<Main::Session*> _session;
Fn<void()> _submit;

View File

@@ -35,6 +35,10 @@ void ConfirmPhone::resolve(
_sendRequestId = 0;
result.match([&](const MTPDauth_sentCode &data) {
const auto bad = [](const char *type) {
LOG(("API Error: Should not be '%1'.").arg(type));
return 0;
};
const auto sentCodeLength = data.vtype().match([&](
const MTPDauth_sentCodeTypeApp &data) {
LOG(("Error: should not be in-app code!"));
@@ -43,12 +47,14 @@ void ConfirmPhone::resolve(
return data.vlength().v;
}, [&](const MTPDauth_sentCodeTypeCall &data) {
return data.vlength().v;
}, [&](const MTPDauth_sentCodeTypeFlashCall &data) {
LOG(("Error: should not be flashcall!"));
return 0;
}, [&](const MTPDauth_sentCodeTypeMissedCall &data) {
LOG(("Error: should not be missedcall!"));
return 0;
}, [&](const MTPDauth_sentCodeTypeFlashCall &) {
return bad("FlashCall");
}, [&](const MTPDauth_sentCodeTypeMissedCall &) {
return bad("MissedCall");
}, [&](const MTPDauth_sentCodeTypeEmailCode &) {
return bad("EmailCode");
}, [&](const MTPDauth_sentCodeTypeSetUpEmailRequired &) {
return bad("SetUpEmailRequired");
});
const auto phoneHash = qs(data.vphone_code_hash());
const auto timeout = [&]() -> std::optional<int> {

View File

@@ -27,13 +27,19 @@ using namespace rpl::details;
template <typename T>
constexpr auto WithId =
is_callable_plain_v<T, const MTPUpdates &, Fn<void()>, mtpRequestId>;
is_callable_plain_v<T, Fn<void()>, mtpRequestId>;
template <typename T>
constexpr auto WithoutId =
is_callable_plain_v<T, const MTPUpdates &, Fn<void()>>;
is_callable_plain_v<T, Fn<void()>>;
template <typename T>
constexpr auto WithoutCallback =
is_callable_plain_v<T, const MTPUpdates &>;
is_callable_plain_v<T>;
template <typename T>
constexpr auto ErrorWithId =
is_callable_plain_v<T, QString, mtpRequestId>;
template <typename T>
constexpr auto ErrorWithoutId =
is_callable_plain_v<T, QString>;
template <typename DoneCallback, typename FailCallback>
mtpRequestId EditMessage(
@@ -93,22 +99,30 @@ mtpRequestId EditMessage(
const auto apply = [=] { api->applyUpdates(result); };
if constexpr (WithId<DoneCallback>) {
done(result, apply, requestId);
done(apply, requestId);
} else if constexpr (WithoutId<DoneCallback>) {
done(result, apply);
done(apply);
} else if constexpr (WithoutCallback<DoneCallback>) {
done(result);
done();
apply();
} else {
apply();
t_bad_callback(done);
}
if (updateRecentStickers) {
api->requestRecentStickersForce(true);
}
}).fail(
fail
).send();
}).fail([=](const MTP::Error &error, mtpRequestId requestId) {
if constexpr (ErrorWithId<FailCallback>) {
fail(error.type(), requestId);
} else if constexpr (ErrorWithoutId<FailCallback>) {
fail(error.type());
} else if constexpr (WithoutCallback<FailCallback>) {
fail();
} else {
t_bad_callback(fail);
}
}).send();
}
template <typename DoneCallback, typename FailCallback>
@@ -132,7 +146,7 @@ void EditMessageWithUploadedMedia(
not_null<HistoryItem*> item,
SendOptions options,
MTPInputMedia media) {
const auto done = [=](const auto &result, Fn<void()> applyUpdates) {
const auto done = [=](Fn<void()> applyUpdates) {
if (item) {
item->clearSavedMedia();
item->setIsLocalUpdateMedia(true);
@@ -140,11 +154,10 @@ void EditMessageWithUploadedMedia(
item->setIsLocalUpdateMedia(false);
}
};
const auto fail = [=](const MTP::Error &error) {
const auto err = error.type();
const auto fail = [=](const QString &error) {
const auto session = &item->history()->session();
const auto notModified = (err == u"MESSAGE_NOT_MODIFIED"_q);
const auto mediaInvalid = (err == u"MEDIA_NEW_INVALID"_q);
const auto notModified = (error == u"MESSAGE_NOT_MODIFIED"_q);
const auto mediaInvalid = (error == u"MEDIA_NEW_INVALID"_q);
if (notModified || mediaInvalid) {
item->returnSavedMedia();
session->data().sendHistoryChangeNotifications();
@@ -200,8 +213,8 @@ mtpRequestId EditCaption(
not_null<HistoryItem*> item,
const TextWithEntities &caption,
SendOptions options,
Fn<void(const MTPUpdates &)> done,
Fn<void(const MTP::Error &)> fail) {
Fn<void()> done,
Fn<void(const QString &)> fail) {
return EditMessage(item, caption, options, done, fail);
}
@@ -209,17 +222,13 @@ mtpRequestId EditTextMessage(
not_null<HistoryItem*> item,
const TextWithEntities &caption,
SendOptions options,
Fn<void(const MTPUpdates &, mtpRequestId requestId)> done,
Fn<void(const MTP::Error &, mtpRequestId requestId)> fail) {
const auto callback = [=](
const auto &result,
Fn<void()> applyUpdates,
auto id) {
Fn<void(mtpRequestId requestId)> done,
Fn<void(const QString &, mtpRequestId requestId)> fail) {
const auto callback = [=](Fn<void()> applyUpdates, mtpRequestId id) {
applyUpdates();
done(result, id);
done(id);
};
return EditMessage(item, caption, options, callback, fail);
}
} // namespace Api

View File

@@ -42,14 +42,14 @@ mtpRequestId EditCaption(
not_null<HistoryItem*> item,
const TextWithEntities &caption,
SendOptions options,
Fn<void(const MTPUpdates &)> done,
Fn<void(const MTP::Error &)> fail);
Fn<void()> done,
Fn<void(const QString &)> fail);
mtpRequestId EditTextMessage(
not_null<HistoryItem*> item,
const TextWithEntities &caption,
SendOptions options,
Fn<void(const MTPUpdates &, mtpRequestId requestId)> done,
Fn<void(const MTP::Error &, mtpRequestId requestId)> fail);
Fn<void(mtpRequestId requestId)> done,
Fn<void(const QString &error, mtpRequestId requestId)> fail);
} // namespace Api

View File

@@ -37,7 +37,7 @@ void Polls::create(
const PollData &data,
const SendAction &action,
Fn<void()> done,
Fn<void(const MTP::Error &error)> fail) {
Fn<void()> fail) {
_session->api().sendAction(action);
const auto history = action.history;
@@ -101,7 +101,7 @@ void Polls::create(
history->finishSavingCloudDraft(
UnixtimeFromMsgId(response.outerMsgId));
}
fail(error);
fail();
finish();
}).afterRequest(history->sendRequestId
).send();

View File

@@ -29,7 +29,7 @@ public:
const PollData &data,
const SendAction &action,
Fn<void()> done,
Fn<void(const MTP::Error &error)> fail);
Fn<void()> fail);
void sendVotes(
FullMsgId itemId,
const std::vector<QByteArray> &options);

View File

@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "api/api_premium.h"
#include "api/api_premium_option.h"
#include "api/api_text_entities.h"
#include "main/main_session.h"
#include "data/data_peer_values.h"
@@ -86,37 +87,43 @@ void Premium::reloadPromo() {
_promoRequestId = _api.request(MTPhelp_GetPremiumPromo(
)).done([=](const MTPhelp_PremiumPromo &result) {
_promoRequestId = 0;
result.match([&](const MTPDhelp_premiumPromo &data) {
_session->data().processUsers(data.vusers());
_monthlyAmount = data.vmonthly_amount().v;
_monthlyCurrency = qs(data.vcurrency());
auto text = TextWithEntities{
qs(data.vstatus_text()),
EntitiesFromMTP(_session, data.vstatus_entities().v),
};
_statusText = text;
_statusTextUpdates.fire(std::move(text));
auto videos = base::flat_map<QString, not_null<DocumentData*>>();
const auto count = int(std::min(
data.vvideo_sections().v.size(),
data.vvideos().v.size()));
videos.reserve(count);
for (auto i = 0; i != count; ++i) {
const auto document = _session->data().processDocument(
data.vvideos().v[i]);
if ((!document->isVideoFile() && !document->isGifv())
|| !document->supportsStreaming()) {
document->forceIsStreamedAnimation();
}
videos.emplace(
qs(data.vvideo_sections().v[i]),
document);
const auto &data = result.data();
_session->data().processUsers(data.vusers());
_subscriptionOptions = SubscriptionOptionsFromTL(
data.vperiod_options().v);
for (const auto &option : data.vperiod_options().v) {
if (option.data().vmonths().v == 1) {
_monthlyAmount = option.data().vamount().v;
_monthlyCurrency = qs(option.data().vcurrency());
}
if (_videos != videos) {
_videos = std::move(videos);
_videosUpdated.fire({});
}
auto text = TextWithEntities{
qs(data.vstatus_text()),
EntitiesFromMTP(_session, data.vstatus_entities().v),
};
_statusText = text;
_statusTextUpdates.fire(std::move(text));
auto videos = base::flat_map<QString, not_null<DocumentData*>>();
const auto count = int(std::min(
data.vvideo_sections().v.size(),
data.vvideos().v.size()));
videos.reserve(count);
for (auto i = 0; i != count; ++i) {
const auto document = _session->data().processDocument(
data.vvideos().v[i]);
if ((!document->isVideoFile() && !document->isGifv())
|| !document->supportsStreaming()) {
document->forceIsStreamedAnimation();
}
});
videos.emplace(
qs(data.vvideo_sections().v[i]),
document);
}
if (_videos != videos) {
_videos = std::move(videos);
_videosUpdated.fire({});
}
}).fail([=] {
_promoRequestId = 0;
}).send();
@@ -176,4 +183,8 @@ void Premium::reloadCloudSet() {
}).send();
}
const Data::SubscriptionOptions &Premium::subscriptionOptions() const {
return _subscriptionOptions;
}
} // namespace Api

View File

@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "data/data_subscription_option.h"
#include "mtproto/sender.h"
class ApiWrap;
@@ -39,6 +40,9 @@ public:
[[nodiscard]] int64 monthlyAmount() const;
[[nodiscard]] QString monthlyCurrency() const;
[[nodiscard]] auto subscriptionOptions() const
-> const Data::SubscriptionOptions &;
private:
void reloadPromo();
void reloadStickers();
@@ -67,6 +71,8 @@ private:
int64 _monthlyAmount = 0;
QString _monthlyCurrency;
Data::SubscriptionOptions _subscriptionOptions;
};
} // namespace Api

View File

@@ -0,0 +1,40 @@
/*
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_premium_option.h"
#include "ui/text/format_values.h"
namespace Api {
constexpr auto kDiscountDivider = 5.;
Data::SubscriptionOption CreateSubscriptionOption(
int months,
int monthlyAmount,
int64 amount,
const QString &currency,
const QString &botUrl) {
const auto discount = [&] {
const auto percent = monthlyAmount * months / float64(amount) - 1.;
return std::round(percent * 100. / kDiscountDivider)
* kDiscountDivider;
}();
return {
.duration = Ui::FormatTTL(months * 86400 * 31),
.discount = discount
? QString::fromUtf8("\xe2\x88\x92%1%").arg(discount)
: QString(),
.costPerMonth = Ui::FillAmountAndCurrency(
amount / float64(months),
currency),
.costTotal = Ui::FillAmountAndCurrency(amount, currency),
.botUrl = botUrl,
};
}
} // namespace Api

View File

@@ -0,0 +1,50 @@
/*
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 "data/data_subscription_option.h"
namespace Api {
[[nodiscard]] Data::SubscriptionOption CreateSubscriptionOption(
int months,
int monthlyAmount,
int64 amount,
const QString &currency,
const QString &botUrl);
template<typename Option>
[[nodiscard]] Data::SubscriptionOptions SubscriptionOptionsFromTL(
const QVector<Option> &tlOptions) {
auto result = Data::SubscriptionOptions();
const auto monthlyAmount = [&] {
const auto &min = ranges::min_element(
tlOptions,
ranges::less(),
[](const Option &o) { return o.data().vamount().v; }
)->data();
return min.vamount().v / float64(min.vmonths().v);
}();
result.reserve(tlOptions.size());
for (const auto &tlOption : tlOptions) {
const auto &option = tlOption.data();
const auto botUrl = qs(option.vbot_url());
const auto months = option.vmonths().v;
const auto amount = option.vamount().v;
const auto currency = qs(option.vcurrency());
result.push_back(CreateSubscriptionOption(
months,
monthlyAmount,
amount,
currency,
botUrl));
}
return result;
}
} // namespace Api

View File

@@ -103,7 +103,7 @@ void SendExistingMedia(
sendFlags |= MTPmessages_SendMedia::Flag::f_send_as;
}
const auto messagePostAuthor = peer->isBroadcast()
? session->user()->name
? session->user()->name()
: QString();
auto caption = TextWithEntities{
@@ -231,7 +231,8 @@ bool SendDice(MessageToSend &message) {
const auto full = QStringView(message.textWithTags.text).trimmed();
auto length = 0;
if (!Ui::Emoji::Find(full.data(), full.data() + full.size(), &length)
|| length != full.size()) {
|| length != full.size()
|| !message.textWithTags.tags.isEmpty()) {
return false;
}
auto &account = message.action.history->session().account();
@@ -290,7 +291,7 @@ bool SendDice(MessageToSend &message) {
sendFlags |= MTPmessages_SendMedia::Flag::f_send_as;
}
const auto messagePostAuthor = peer->isBroadcast()
? session->user()->name
? session->user()->name()
: QString();
const auto replyTo = message.action.replyTo;
@@ -423,7 +424,7 @@ void SendConfirmedFile(
? PeerId()
: session->userPeerId();
const auto messagePostAuthor = peer->isBroadcast()
? session->user()->name
? session->user()->name()
: QString();
const auto media = MTPMessageMedia([&] {

View File

@@ -20,31 +20,24 @@ namespace {
using namespace TextUtilities;
[[nodiscard]] QString CustomEmojiEntityData(
not_null<Main::Session*> session,
const MTPDmessageEntityCustomEmoji &data) {
return Data::SerializeCustomEmojiId({
.selfId = session->userId().bare,
.id = data.vdocument_id().v,
});
}
[[nodiscard]] std::optional<MTPMessageEntity> CustomEmojiEntity(
not_null<Main::Session*> session,
MTPint offset,
MTPint length,
const QString &data) {
const auto parsed = Data::ParseCustomEmojiData(data);
if (!parsed.id || parsed.selfId != session->userId().bare) {
return {};
}
const auto document = session->data().document(parsed.id);
if (!document->sticker()) {
if (!parsed.id) {
return {};
}
return MTP_messageEntityCustomEmoji(
offset,
length,
MTP_long(document->id));
MTP_long(parsed.id));
}
[[nodiscard]] std::optional<MTPMessageEntity> MentionNameEntity(
@@ -125,9 +118,9 @@ EntitiesInText EntitiesFromMTP(
case mtpc_messageEntityPre: { auto &d = entity.c_messageEntityPre(); result.push_back({ EntityType::Pre, d.voffset().v, d.vlength().v, qs(d.vlanguage()) }); } break;
case mtpc_messageEntityBankCard: break; // Skipping cards. // #TODO entities
case mtpc_messageEntitySpoiler: { auto &d = entity.c_messageEntitySpoiler(); result.push_back({ EntityType::Spoiler, d.voffset().v, d.vlength().v }); } break;
case mtpc_messageEntityCustomEmoji: if (session) {
case mtpc_messageEntityCustomEmoji: {
const auto &d = entity.c_messageEntityCustomEmoji();
result.push_back({ EntityType::CustomEmoji, d.voffset().v, d.vlength().v, CustomEmojiEntityData(session, d) });
result.push_back({ EntityType::CustomEmoji, d.voffset().v, d.vlength().v, CustomEmojiEntityData(d) });
} break;
}
}
@@ -181,7 +174,7 @@ MTPVector<MTPMessageEntity> EntitiesToMTP(
case EntityType::Pre: v.push_back(MTP_messageEntityPre(offset, length, MTP_string(entity.data()))); break;
case EntityType::Spoiler: v.push_back(MTP_messageEntitySpoiler(offset, length)); break;
case EntityType::CustomEmoji: {
if (const auto valid = CustomEmojiEntity(session, offset, length, entity.data())) {
if (const auto valid = CustomEmojiEntity(offset, length, entity.data())) {
v.push_back(*valid);
}
} break;

View File

@@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_channel.h"
#include "data/data_chat_filters.h"
#include "data/data_cloud_themes.h"
#include "data/data_emoji_statuses.h"
#include "data/data_group_call.h"
#include "data/data_drafts.h"
#include "data/data_histories.h"
@@ -1649,6 +1650,15 @@ void Updates::feedUpdate(const MTPUpdate &update) {
}
} break;
case mtpc_updateMessageExtendedMedia: {
const auto &d = update.c_updateMessageExtendedMedia();
const auto peerId = peerFromMTP(d.vpeer());
const auto msgId = d.vmsg_id().v;
if (const auto item = session().data().message(peerId, msgId)) {
item->applyEdition(d.vextended_media());
}
} break;
// Messages being read.
case mtpc_updateReadHistoryInbox: {
auto &d = update.c_updateReadHistoryInbox();
@@ -2344,12 +2354,48 @@ void Updates::feedUpdate(const MTPUpdate &update) {
}
} break;
case mtpc_updateMoveStickerSetToTop: {
const auto &d = update.c_updateMoveStickerSetToTop();
auto &stickers = session().data().stickers();
const auto isEmoji = d.is_emojis();
const auto setId = d.vstickerset().v;
auto &order = isEmoji
? stickers.emojiSetsOrderRef()
: stickers.setsOrderRef();
const auto i = ranges::find(order, setId);
if (i == order.end()) {
if (isEmoji) {
stickers.setLastEmojiUpdate(0);
session().api().updateCustomEmoji();
} else {
stickers.setLastUpdate(0);
session().api().updateStickers();
}
} else if (i != order.begin()) {
std::rotate(order.begin(), i, i + 1);
if (isEmoji) {
session().local().writeInstalledCustomEmoji();
} else {
session().local().writeInstalledStickers();
}
stickers.notifyUpdated(isEmoji
? Data::StickersType::Emoji
: Data::StickersType::Stickers);
}
} break;
case mtpc_updateStickerSets: {
// Can't determine is it masks or stickers, so update both.
session().data().stickers().setLastUpdate(0);
session().api().updateStickers();
session().data().stickers().setLastMasksUpdate(0);
session().api().updateMasks();
const auto &d = update.c_updateStickerSets();
if (d.is_emojis()) {
session().data().stickers().setLastEmojiUpdate(0);
session().api().updateCustomEmoji();
} else if (d.is_masks()) {
session().data().stickers().setLastMasksUpdate(0);
session().api().updateMasks();
} else {
session().data().stickers().setLastUpdate(0);
session().api().updateStickers();
}
} break;
case mtpc_updateRecentStickers: {
@@ -2370,6 +2416,25 @@ void Updates::feedUpdate(const MTPUpdate &update) {
session().api().updateStickers();
} break;
case mtpc_updateReadFeaturedEmojiStickers: {
// We don't track read status of them for now.
} break;
case mtpc_updateUserEmojiStatus: {
const auto &d = update.c_updateUserEmojiStatus();
if (const auto user = session().data().userLoaded(d.vuser_id())) {
user->setEmojiStatus(d.vemoji_status());
}
} break;
case mtpc_updateRecentEmojiStatuses: {
session().data().emojiStatuses().refreshRecentDelayed();
} break;
case mtpc_updateRecentReactions: {
session().data().reactions().refreshRecentDelayed();
} break;
////// Cloud saved GIFs
case mtpc_updateSavedGifs: {
session().data().stickers().setLastSavedGifsUpdate(0);

View File

@@ -20,13 +20,16 @@ namespace {
// Send channel views each second.
constexpr auto kSendViewsTimeout = crl::time(1000);
constexpr auto kPollExtendedMediaPeriod = 30 * crl::time(1000);
constexpr auto kMaxPollPerRequest = 100;
} // namespace
ViewsManager::ViewsManager(not_null<ApiWrap*> api)
: _session(&api->session())
, _api(&api->instance())
, _incrementTimer([=] { viewsIncrement(); }) {
, _incrementTimer([=] { viewsIncrement(); })
, _pollTimer([=] { sendPollRequests(); }) {
}
void ViewsManager::scheduleIncrement(not_null<HistoryItem*> item) {
@@ -52,6 +55,25 @@ void ViewsManager::removeIncremented(not_null<PeerData*> peer) {
_incremented.remove(peer);
}
void ViewsManager::pollExtendedMedia(not_null<HistoryItem*> item) {
if (!item->isRegular()) {
return;
}
const auto id = item->id;
const auto peer = item->history()->peer;
auto &request = _pollRequests[peer];
if (request.ids.contains(id) || request.sent.contains(id)) {
return;
}
request.ids.emplace(id);
if (!request.id && !request.when) {
request.when = crl::now() + kPollExtendedMediaPeriod;
}
if (!_pollTimer.isActive()) {
_pollTimer.callOnce(kPollExtendedMediaPeriod);
}
}
void ViewsManager::viewsIncrement() {
for (auto i = _toIncrement.begin(); i != _toIncrement.cend();) {
if (_incrementRequests.contains(i->first)) {
@@ -81,6 +103,88 @@ void ViewsManager::viewsIncrement() {
}
}
void ViewsManager::sendPollRequests() {
const auto now = crl::now();
auto toRequest = base::flat_map<not_null<PeerData*>, QVector<MTPint>>();
auto nearest = crl::time();
for (auto &[peer, request] : _pollRequests) {
if (request.id) {
continue;
} else if (request.when <= now) {
Assert(request.sent.empty());
auto &list = toRequest[peer];
const auto count = int(request.ids.size());
if (count < kMaxPollPerRequest) {
request.sent = base::take(request.ids);
} else {
const auto from = begin(request.ids);
const auto end = from + kMaxPollPerRequest;
request.sent = { from, end };
request.ids.erase(from, end);
}
list.reserve(request.sent.size());
for (const auto &id : request.sent) {
list.push_back(MTP_int(id.bare));
}
if (!request.ids.empty()) {
nearest = now;
}
} else if (!nearest || nearest > request.when) {
nearest = request.when;
}
}
sendPollRequests(toRequest);
if (nearest) {
_pollTimer.callOnce(std::max(nearest - now, crl::time(1)));
}
}
void ViewsManager::sendPollRequests(
const base::flat_map<
not_null<PeerData*>,
QVector<MTPint>> &batched) {
for (auto &[peer, list] : batched) {
const auto finish = [=, list = list](mtpRequestId id) {
const auto now = crl::now();
const auto owner = &_session->data();
for (auto i = begin(_pollRequests); i != end(_pollRequests);) {
if (i->second.id == id) {
const auto peer = i->first->id;
for (const auto &itemId : i->second.sent) {
if (const auto item = owner->message(peer, itemId)) {
owner->requestItemRepaint(item);
}
}
i->second.sent.clear();
i->second.id = 0;
if (i->second.ids.empty()) {
i = _pollRequests.erase(i);
} else {
i->second.when = now + kPollExtendedMediaPeriod;
if (!_pollTimer.isActive()) {
_pollTimer.callOnce(kPollExtendedMediaPeriod);
}
++i;
}
} else {
++i;
}
}
};
const auto requestId = _api.request(MTPmessages_GetExtendedMedia(
peer->input,
MTP_vector<MTPint>(list)
)).done([=](const MTPUpdates &result, mtpRequestId id) {
_session->api().applyUpdates(result);
finish(id);
}).fail([=](const MTP::Error &error, mtpRequestId id) {
finish(id);
}).send();
_pollRequests[peer].id = requestId;
}
}
void ViewsManager::done(
QVector<MTPint> ids,
const MTPmessages_MessageViews &result,

View File

@@ -26,8 +26,22 @@ public:
void scheduleIncrement(not_null<HistoryItem*> item);
void removeIncremented(not_null<PeerData*> peer);
void pollExtendedMedia(not_null<HistoryItem*> item);
private:
struct PollExtendedMediaRequest {
crl::time when = 0;
mtpRequestId id = 0;
base::flat_set<MsgId> ids;
base::flat_set<MsgId> sent;
};
void viewsIncrement();
void sendPollRequests();
void sendPollRequests(
const base::flat_map<
not_null<PeerData*>,
QVector<MTPint>> &prepared);
void done(
QVector<MTPint> ids,
@@ -44,6 +58,11 @@ private:
base::flat_map<mtpRequestId, not_null<PeerData*>> _incrementByRequest;
base::Timer _incrementTimer;
base::flat_map<
not_null<PeerData*>,
PollExtendedMediaRequest> _pollRequests;
base::Timer _pollTimer;
};
} // namespace Api

View File

@@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history_item.h"
#include "history/history.h"
#include "data/stickers/data_custom_emoji.h"
#include "data/data_peer.h"
#include "data/data_chat.h"
#include "data/data_channel.h"
@@ -17,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_changes.h"
#include "data/data_session.h"
#include "data/data_media_types.h"
#include "data/data_message_reaction_id.h"
#include "main/main_app_config.h"
#include "main/main_session.h"
#include "main/main_account.h"
@@ -31,6 +33,8 @@ namespace {
constexpr auto kContextReactionsLimit = 50;
using Data::ReactionId;
struct Peers {
std::vector<PeerId> list;
bool unknown = false;
@@ -41,7 +45,7 @@ inline bool operator==(const Peers &a, const Peers &b) noexcept {
struct PeerWithReaction {
PeerId peer = 0;
QString reaction;
ReactionId reaction;
};
inline bool operator==(
const PeerWithReaction &a,
@@ -84,7 +88,7 @@ struct Context {
base::flat_map<not_null<HistoryItem*>, CachedRead> cachedRead;
base::flat_map<
not_null<HistoryItem*>,
base::flat_map<QString, CachedReacted>> cachedReacted;
base::flat_map<ReactionId, CachedReacted>> cachedReacted;
base::flat_map<not_null<Main::Session*>, rpl::lifetime> subscriptions;
[[nodiscard]] CachedRead &cacheRead(not_null<HistoryItem*> item) {
@@ -97,7 +101,7 @@ struct Context {
[[nodiscard]] CachedReacted &cacheReacted(
not_null<HistoryItem*> item,
const QString &reaction) {
const ReactionId &reaction) {
auto &map = cachedReacted[item];
const auto i = map.find(reaction);
if (i != end(map)) {
@@ -109,7 +113,7 @@ struct Context {
struct Userpic {
not_null<PeerData*> peer;
QString reaction;
QString customEntityData;
mutable std::shared_ptr<Data::CloudImageView> view;
mutable InMemoryKey uniqueKey;
};
@@ -249,7 +253,7 @@ struct State {
Peers &&peers) {
auto result = PeersWithReactions{
.list = peers.list | ranges::views::transform([](PeerId peer) {
return PeerWithReaction{.peer = peer };
return PeerWithReaction{ .peer = peer };
}) | ranges::to_vector,
.unknown = peers.unknown,
};
@@ -259,7 +263,7 @@ struct State {
[[nodiscard]] rpl::producer<PeersWithReactions> WhoReactedIds(
not_null<HistoryItem*> item,
const QString &reaction,
const ReactionId &reaction,
not_null<QWidget*> context) {
auto weak = QPointer<QWidget>(context.get());
const auto session = &item->history()->session();
@@ -273,12 +277,12 @@ struct State {
using Flag = MTPmessages_GetMessageReactionsList::Flag;
entry.requestId = session->api().request(
MTPmessages_GetMessageReactionsList(
MTP_flags(reaction.isEmpty()
MTP_flags(reaction.empty()
? Flag(0)
: Flag::f_reaction),
item->history()->peer->input,
MTP_int(item->id),
MTP_string(reaction),
ReactionToMTP(reaction),
MTPstring(), // offset
MTP_int(kContextReactionsLimit)
)
@@ -299,7 +303,8 @@ struct State {
vote.match([&](const auto &data) {
parsed.list.push_back(PeerWithReaction{
.peer = peerFromMTP(data.vpeer_id()),
.reaction = qs(data.vreaction()),
.reaction = Data::ReactionFromMTP(
data.vreaction()),
});
});
}
@@ -322,7 +327,7 @@ struct State {
not_null<QWidget*> context)
-> rpl::producer<PeersWithReactions> {
return rpl::combine(
WhoReactedIds(item, QString(), context),
WhoReactedIds(item, {}, context),
WhoReadIds(item, context)
) | rpl::map([=](PeersWithReactions &&reacted, Peers &&read) {
if (reacted.unknown || read.unknown) {
@@ -347,7 +352,7 @@ bool UpdateUserpics(
struct ResolvedPeer {
PeerData *peer = nullptr;
QString reaction;
ReactionId reaction;
};
const auto peers = ranges::views::all(
ids
@@ -373,17 +378,16 @@ bool UpdateUserpics(
auto now = std::vector<Userpic>();
for (const auto &resolved : peers) {
const auto peer = not_null{ resolved.peer };
if (ranges::contains(now, peer, &Userpic::peer)) {
continue;
}
const auto &data = ReactionEntityData(resolved.reaction);
const auto i = ranges::find(was, peer, &Userpic::peer);
if (i != end(was)) {
if (i != end(was) && i->view) {
now.push_back(std::move(*i));
now.back().customEntityData = data;
continue;
}
now.push_back(Userpic{
.peer = peer,
.reaction = resolved.reaction,
.customEntityData = data,
});
auto &userpic = now.back();
userpic.uniqueKey = peer->userpicUniqueKey(userpic.view);
@@ -426,13 +430,13 @@ void RegenerateParticipants(not_null<State*> state, int small, int large) {
const auto id = peer->id.value;
const auto was = ranges::find(old, id, &Ui::WhoReadParticipant::id);
if (was != end(old)) {
was->name = peer->name;
was->name = peer->name();
now.push_back(std::move(*was));
continue;
}
now.push_back({
.name = peer->name,
.reaction = userpic.reaction,
.name = peer->name(),
.customEntityData = userpic.customEntityData,
.userpicLarge = GenerateUserpic(userpic, large),
.userpicKey = userpic.uniqueKey,
.id = id,
@@ -446,7 +450,7 @@ void RegenerateParticipants(not_null<State*> state, int small, int large) {
rpl::producer<Ui::WhoReadContent> WhoReacted(
not_null<HistoryItem*> item,
const QString &reaction,
const ReactionId &reaction,
not_null<QWidget*> context,
const style::WhoRead &st,
std::shared_ptr<WhoReadList> whoReadIds) {
@@ -455,7 +459,7 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
return [=](auto consumer) {
auto lifetime = rpl::lifetime();
const auto resolveWhoRead = reaction.isEmpty()
const auto resolveWhoRead = reaction.empty()
&& WhoReadExists(item);
const auto state = lifetime.make_state<State>();
@@ -463,7 +467,7 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
consumer.put_next_copy(state->current);
};
const auto resolveWhoReacted = !reaction.isEmpty()
const auto resolveWhoReacted = !reaction.empty()
|| item->canViewReactions();
auto idsWithReactions = (resolveWhoRead && resolveWhoReacted)
? WhoReadOrReactedIds(item, context)
@@ -475,22 +479,26 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
: Ui::WhoReadType::Reacted;
if (resolveWhoReacted) {
const auto &list = item->reactions();
state->current.fullReactionsCount = reaction.isEmpty()
? ranges::accumulate(
state->current.fullReactionsCount = [&] {
if (reaction.empty()) {
return ranges::accumulate(
list,
0,
ranges::plus{},
&Data::MessageReaction::count);
}
const auto i = ranges::find(
list,
0,
ranges::plus{},
[](const auto &pair) { return pair.second; })
: list.contains(reaction)
? list.find(reaction)->second
: 0;
// #TODO reactions
state->current.singleReaction = !reaction.isEmpty()
reaction,
&Data::MessageReaction::id);
return (i != end(list)) ? i->count : 0;
}();
state->current.singleCustomEntityData = ReactionEntityData(
!reaction.empty()
? reaction
: (list.size() == 1)
? list.front().first
: QString();
? list.front().id
: ReactionId());
}
std::move(
idsWithReactions
@@ -510,7 +518,7 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
if (whoReadIds) {
const auto reacted = peers.list.size() - ranges::count(
peers.list,
QString(),
ReactionId(),
&PeerWithReaction::reaction);
whoReadIds->list = (peers.read.size() > reacted)
? std::move(peers.read)
@@ -583,8 +591,13 @@ bool WhoReadExists(not_null<HistoryItem*> item) {
return true;
}
bool WhoReactedExists(not_null<HistoryItem*> item) {
return item->canViewReactions() || WhoReadExists(item);
bool WhoReactedExists(
not_null<HistoryItem*> item,
WhoReactedList list) {
if (item->canViewReactions() || WhoReadExists(item)) {
return true;
}
return (list == WhoReactedList::One) && item->history()->peer->isUser();
}
rpl::producer<Ui::WhoReadContent> WhoReacted(
@@ -592,12 +605,12 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
not_null<QWidget*> context,
const style::WhoRead &st,
std::shared_ptr<WhoReadList> whoReadIds) {
return WhoReacted(item, QString(), context, st, std::move(whoReadIds));
return WhoReacted(item, {}, context, st, std::move(whoReadIds));
}
rpl::producer<Ui::WhoReadContent> WhoReacted(
not_null<HistoryItem*> item,
const QString &reaction,
const Data::ReactionId &reaction,
not_null<QWidget*> context,
const style::WhoRead &st) {
return WhoReacted(item, reaction, context, st, nullptr);

View File

@@ -18,10 +18,21 @@ struct WhoReadContent;
enum class WhoReadType;
} // namespace Ui
namespace Data {
struct ReactionId;
} // namespace Data
namespace Api {
enum class WhoReactedList {
All,
One,
};
[[nodiscard]] bool WhoReadExists(not_null<HistoryItem*> item);
[[nodiscard]] bool WhoReactedExists(not_null<HistoryItem*> item);
[[nodiscard]] bool WhoReactedExists(
not_null<HistoryItem*> item,
WhoReactedList list);
struct WhoReadList {
std::vector<PeerId> list;
@@ -36,7 +47,7 @@ struct WhoReadList {
std::shared_ptr<WhoReadList> whoReadIds = nullptr);
[[nodiscard]] rpl::producer<Ui::WhoReadContent> WhoReacted(
not_null<HistoryItem*> item,
const QString &reaction,
const Data::ReactionId &reaction,
not_null<QWidget*> context, // Cache results for this lifetime.
const style::WhoRead &st);

View File

@@ -293,14 +293,20 @@ void ApiWrap::topPromotionDone(const MTPhelp_PromoData &proxy) {
void ApiWrap::requestDeepLinkInfo(
const QString &path,
Fn<void(const MTPDhelp_deepLinkInfo &result)> callback) {
Fn<void(TextWithEntities message, bool updateRequired)> callback) {
request(_deepLinkInfoRequestId).cancel();
_deepLinkInfoRequestId = request(MTPhelp_GetDeepLinkInfo(
MTP_string(path)
)).done([=](const MTPhelp_DeepLinkInfo &result) {
_deepLinkInfoRequestId = 0;
if (result.type() == mtpc_help_deepLinkInfo) {
callback(result.c_help_deepLinkInfo());
const auto &data = result.c_help_deepLinkInfo();
callback(TextWithEntities{
qs(data.vmessage()),
Api::EntitiesFromMTP(
_session,
data.ventities().value_or_empty())
}, data.is_update_app());
}
}).fail([=] {
_deepLinkInfoRequestId = 0;
@@ -438,14 +444,22 @@ void ApiWrap::sendMessageFail(
not_null<PeerData*> peer,
uint64 randomId,
FullMsgId itemId) {
sendMessageFail(error.type(), peer, randomId, itemId);
}
void ApiWrap::sendMessageFail(
const QString &error,
not_null<PeerData*> peer,
uint64 randomId,
FullMsgId itemId) {
const auto show = ShowForPeer(peer);
if (error.type() == qstr("PEER_FLOOD")) {
if (error == qstr("PEER_FLOOD")) {
show->showBox(
Ui::MakeInformBox(
PeerFloodErrorText(&session(), PeerFloodType::Send)),
Ui::LayerOption::CloseOther);
} else if (error.type() == qstr("USER_BANNED_IN_CHANNEL")) {
} else if (error == qstr("USER_BANNED_IN_CHANNEL")) {
const auto link = Ui::Text::Link(
tr::lng_cant_more_info(tr::now),
session().createInternalLinkFull(qsl("spambot")));
@@ -457,9 +471,9 @@ void ApiWrap::sendMessageFail(
link,
Ui::Text::WithEntities)),
Ui::LayerOption::CloseOther);
} else if (error.type().startsWith(qstr("SLOWMODE_WAIT_"))) {
} else if (error.startsWith(qstr("SLOWMODE_WAIT_"))) {
const auto chop = qstr("SLOWMODE_WAIT_").size();
const auto left = base::StringViewMid(error.type(), chop).toInt();
const auto left = base::StringViewMid(error, chop).toInt();
if (const auto channel = peer->asChannel()) {
const auto seconds = channel->slowmodeSeconds();
if (seconds >= left) {
@@ -469,7 +483,7 @@ void ApiWrap::sendMessageFail(
requestFullPeer(peer);
}
}
} else if (error.type() == qstr("SCHEDULE_STATUS_PRIVATE")) {
} else if (error == qstr("SCHEDULE_STATUS_PRIVATE")) {
auto &scheduled = _session->data().scheduledMessages();
Assert(peer->isUser());
if (const auto item = scheduled.lookupItem(peer->id, itemId.msg)) {
@@ -478,7 +492,7 @@ void ApiWrap::sendMessageFail(
Ui::MakeInformBox(tr::lng_cant_do_this()),
Ui::LayerOption::CloseOther);
}
} else if (error.type() == qstr("CHAT_FORWARDS_RESTRICTED")) {
} else if (error == qstr("CHAT_FORWARDS_RESTRICTED")) {
if (show->valid()) {
Ui::ShowMultilineToast({
.parentOverride = show->toastParent(),
@@ -489,7 +503,7 @@ void ApiWrap::sendMessageFail(
.duration = kJoinErrorDuration
});
}
} else if (error.type() == qstr("PREMIUM_ACCOUNT_REQUIRED")) {
} else if (error == qstr("PREMIUM_ACCOUNT_REQUIRED")) {
Settings::ShowPremium(&session(), "premium_stickers");
}
if (const auto item = _session->data().message(itemId)) {
@@ -984,7 +998,7 @@ rpl::producer<bool> ApiWrap::dialogsLoadBlockedByDate() const {
void ApiWrap::requestWallPaper(
const QString &slug,
Fn<void(const Data::WallPaper &)> done,
Fn<void(const MTP::Error &)> fail) {
Fn<void()> fail) {
if (_wallPaperSlug != slug) {
_wallPaperSlug = slug;
if (_wallPaperRequestId) {
@@ -1006,13 +1020,13 @@ void ApiWrap::requestWallPaper(
done(*paper);
}
} else if (const auto fail = base::take(_wallPaperFail)) {
fail(MTP::Error::Local("BAD_DOCUMENT", "In a wallpaper."));
fail();
}
}).fail([=](const MTP::Error &error) {
_wallPaperRequestId = 0;
_wallPaperSlug = QString();
if (const auto fail = base::take(_wallPaperFail)) {
fail(error);
fail();
}
}).send();
}
@@ -1117,44 +1131,6 @@ void ApiWrap::gotUserFull(
Data::PeerUpdate::Flag::FullInfo);
}
void ApiWrap::requestPeer(not_null<PeerData*> peer) {
if (_fullPeerRequests.contains(peer) || _peerRequests.contains(peer)) {
return;
}
const auto requestId = [&] {
const auto failHandler = [=] {
_peerRequests.remove(peer);
};
const auto chatHandler = [=](const MTPmessages_Chats &result) {
_peerRequests.remove(peer);
const auto &chats = result.match([](const auto &data) {
return data.vchats();
});
_session->data().applyMaximumChatVersions(chats);
_session->data().processChats(chats);
};
if (const auto user = peer->asUser()) {
return request(MTPusers_GetUsers(
MTP_vector<MTPInputUser>(1, user->inputUser)
)).done([=](const MTPVector<MTPUser> &result) {
_peerRequests.remove(user);
_session->data().processUsers(result);
}).fail(failHandler).send();
} else if (const auto chat = peer->asChat()) {
return request(MTPmessages_GetChats(
MTP_vector<MTPlong>(1, chat->inputChat)
)).done(chatHandler).fail(failHandler).send();
} else if (const auto channel = peer->asChannel()) {
return request(MTPchannels_GetChannels(
MTP_vector<MTPInputChannel>(1, channel->inputChannel)
)).done(chatHandler).fail(failHandler).send();
}
Unexpected("Peer type in requestPeer.");
}();
_peerRequests.emplace(peer, requestId);
}
void ApiWrap::requestPeerSettings(not_null<PeerData*> peer) {
if (!_requestedPeerSettings.emplace(peer).second) {
return;
@@ -1311,51 +1287,6 @@ void ApiWrap::markContentsRead(not_null<HistoryItem*> item) {
}
}
void ApiWrap::requestPeers(const QList<PeerData*> &peers) {
QVector<MTPlong> chats;
QVector<MTPInputChannel> channels;
QVector<MTPInputUser> users;
chats.reserve(peers.size());
channels.reserve(peers.size());
users.reserve(peers.size());
for (const auto peer : peers) {
if (!peer
|| _fullPeerRequests.contains(peer)
|| _peerRequests.contains(peer)) {
continue;
}
if (const auto user = peer->asUser()) {
users.push_back(user->inputUser);
} else if (const auto chat = peer->asChat()) {
chats.push_back(chat->inputChat);
} else if (const auto channel = peer->asChannel()) {
channels.push_back(channel->inputChannel);
}
}
const auto handleChats = [=](const MTPmessages_Chats &result) {
_session->data().processChats(result.match([](const auto &data) {
return data.vchats();
}));
};
if (!chats.isEmpty()) {
request(MTPmessages_GetChats(
MTP_vector<MTPlong>(chats)
)).done(handleChats).send();
}
if (!channels.isEmpty()) {
request(MTPchannels_GetChannels(
MTP_vector<MTPInputChannel>(channels)
)).done(handleChats).send();
}
if (!users.isEmpty()) {
request(MTPusers_GetUsers(
MTP_vector<MTPInputUser>(users)
)).done([=](const MTPVector<MTPUser> &result) {
_session->data().processUsers(result);
}).send();
}
}
void ApiWrap::deleteAllFromParticipant(
not_null<ChannelData*> channel,
not_null<PeerData*> from) {
@@ -1559,6 +1490,8 @@ void ApiWrap::saveStickerSets(
if (!archived) {
const auto featured = !!(set->flags & Flag::Featured);
const auto special = !!(set->flags & Flag::Special);
const auto emoji = !!(set->flags & Flag::Emoji);
const auto locked = (set->locked > 0);
const auto setId = set->mtpInput();
auto requestId = request(MTPmessages_UninstallStickerSet(
@@ -1575,7 +1508,7 @@ void ApiWrap::saveStickerSets(
if (removeIndex >= 0) {
orderRef.removeAt(removeIndex);
}
if (!featured && !special) {
if (!featured && !special && !emoji && !locked) {
sets.erase(it);
} else {
if (archived) {
@@ -1642,7 +1575,9 @@ void ApiWrap::saveStickerSets(
if ((set->flags & Flag::Featured)
|| (set->flags & Flag::Installed)
|| (set->flags & Flag::Archived)
|| (set->flags & Flag::Special)) {
|| (set->flags & Flag::Special)
|| (set->flags & Flag::Emoji)
|| (set->locked > 0)) {
++it;
} else {
it = sets.erase(it);
@@ -3191,7 +3126,7 @@ void ApiWrap::forwardMessages(
? PeerId(0)
: self->id;
const auto messagePostAuthor = peer->isBroadcast()
? self->name
? self->name()
: QString();
history->addNewLocalMessage(
newId.msg,
@@ -3274,7 +3209,7 @@ void ApiWrap::sendSharedContact(
? PeerId()
: _session->userPeerId();
const auto messagePostAuthor = peer->isBroadcast()
? _session->user()->name
? _session->user()->name()
: QString();
const auto viaBotId = UserId();
const auto item = history->addNewLocalMessage(
@@ -3537,7 +3472,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
sendFlags |= MTPmessages_SendMessage::Flag::f_send_as;
}
const auto messagePostAuthor = peer->isBroadcast()
? _session->user()->name
? _session->user()->name()
: QString();
if (action.options.scheduled) {
flags |= MessageFlag::IsOrWasScheduled;
@@ -3685,7 +3620,7 @@ void ApiWrap::sendInlineResult(
sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_send_as;
}
const auto messagePostAuthor = peer->isBroadcast()
? _session->user()->name
? _session->user()->name()
: QString();
_session->data().registerMessageRandomId(randomId, newId);

View File

@@ -171,11 +171,9 @@ public:
void requestWallPaper(
const QString &slug,
Fn<void(const Data::WallPaper &)> done,
Fn<void(const MTP::Error &)> fail);
Fn<void()> fail);
void requestFullPeer(not_null<PeerData*> peer);
void requestPeer(not_null<PeerData*> peer);
void requestPeers(const QList<PeerData*> &peers);
void requestPeerSettings(not_null<PeerData*> peer);
using UpdatedFileReferences = Data::UpdatedFileReferences;
@@ -195,7 +193,7 @@ public:
void refreshTopPromotion();
void requestDeepLinkInfo(
const QString &path,
Fn<void(const MTPDhelp_deepLinkInfo &result)> callback);
Fn<void(TextWithEntities message, bool updateRequired)> callback);
void requestTermsUpdate();
void acceptTerms(bytes::const_span termsId);
@@ -343,6 +341,11 @@ public:
not_null<PeerData*> peer,
uint64 randomId = 0,
FullMsgId itemId = FullMsgId());
void sendMessageFail(
const QString &error,
not_null<PeerData*> peer,
uint64 randomId = 0,
FullMsgId itemId = FullMsgId());
void reloadContactSignupSilent();
rpl::producer<bool> contactSignupSilent() const;
@@ -533,7 +536,6 @@ private:
using PeerRequests = base::flat_map<PeerData*, mtpRequestId>;
PeerRequests _fullPeerRequests;
PeerRequests _peerRequests;
base::flat_set<not_null<PeerData*>> _requestedPeerSettings;
base::flat_map<
@@ -616,8 +618,6 @@ private:
mtpRequestId _termsUpdateRequestId = 0;
mtpRequestId _checkInviteRequestId = 0;
FnMut<void(const MTPChatInvite &result)> _checkInviteDone;
Fn<void(const MTP::Error &error)> _checkInviteFail;
struct MigrateCallbacks {
FnMut<void(not_null<ChannelData*>)> done;
@@ -627,8 +627,6 @@ private:
not_null<PeerData*>,
std::vector<MigrateCallbacks>> _migrateCallbacks;
std::vector<FnMut<void(const MTPUser &)>> _supportContactCallbacks;
struct {
mtpRequestId requestId = 0;
QString requestedText;
@@ -656,7 +654,7 @@ private:
mtpRequestId _wallPaperRequestId = 0;
QString _wallPaperSlug;
Fn<void(const Data::WallPaper &)> _wallPaperDone;
Fn<void(const MTP::Error &)> _wallPaperFail;
Fn<void()> _wallPaperFail;
mtpRequestId _contactSignupSilentRequestId = 0;
std::optional<bool> _contactSignupSilent;

View File

@@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_utilities.h"
#include "ui/unread_badge.h"
#include "ui/ui_utility.h"
#include "ui/painter.h"
#include "data/data_channel.h"
#include "data/data_chat.h"
#include "data/data_user.h"
@@ -269,7 +270,7 @@ void AddContactBox::setInnerFocus() {
void AddContactBox::paintEvent(QPaintEvent *e) {
BoxContent::paintEvent(e);
Painter p(this);
auto p = QPainter(this);
if (_retrying) {
p.setPen(st::boxTextFg);
p.setFont(st::boxTextFont);
@@ -897,10 +898,10 @@ void SetupChannelBox::prepare() {
}
void SetupChannelBox::setInnerFocus() {
if (_link->isHidden()) {
setFocus();
} else {
if (!_link->isHidden()) {
_link->setFocusFast();
} else {
BoxContent::setInnerFocus();
}
}
@@ -1091,7 +1092,7 @@ void SetupChannelBox::save() {
MTP_string(_sentUsername)
)).done([=] {
_channel->setName(
TextUtilities::SingleLine(_channel->name),
TextUtilities::SingleLine(_channel->name()),
_sentUsername);
closeBox();
}).fail([=](const MTP::Error &error) {
@@ -1164,7 +1165,7 @@ void SetupChannelBox::handleChange() {
void SetupChannelBox::check() {
if (_checkRequestId) {
_channel->session().api().request(_checkRequestId).cancel();
_api.request(_checkRequestId).cancel();
}
const auto link = _link->text().trimmed();
if (link.size() >= Ui::EditPeer::kMinUsernameLength) {
@@ -1239,7 +1240,7 @@ void SetupChannelBox::updateFail(UsernameResult result) {
if ((result == UsernameResult::Ok)
|| (_sentUsername == _channel->username)) {
_channel->setName(
TextUtilities::SingleLine(_channel->name),
TextUtilities::SingleLine(_channel->name()),
TextUtilities::SingleLine(_sentUsername));
closeBox();
} else if (result == UsernameResult::Invalid) {

View File

@@ -111,7 +111,7 @@ private:
void requestPapers();
void sortPapers();
void paintPaper(
Painter &p,
QPainter &p,
const Paper &paper,
int column,
int row) const;
@@ -289,7 +289,7 @@ void BackgroundBox::Inner::resizeToContentAndPreload() {
void BackgroundBox::Inner::paintEvent(QPaintEvent *e) {
QRect r(e->rect());
Painter p(this);
auto p = QPainter(this);
if (_papers.empty()) {
p.setFont(st::noContactsFont);
@@ -361,7 +361,7 @@ void BackgroundBox::Inner::validatePaperThumbnail(
}
void BackgroundBox::Inner::paintPaper(
Painter &p,
QPainter &p,
const Paper &paper,
int column,
int row) const {

View File

@@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/toast/toast.h"
#include "ui/image/image.h"
#include "ui/widgets/checkbox.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "history/history.h"
#include "history/history_message.h"
@@ -357,7 +358,8 @@ void BackgroundPreviewBox::paintTexts(Painter &p, crl::time ms) {
auto context = _controller->defaultChatTheme()->preparePaintContext(
_chatStyle.get(),
rect(),
rect());
rect(),
_controller->isGifPausedAtLeastFor(Window::GifPauseReason::Layer));
p.translate(0, textsTop());
paintDate(p);
@@ -552,7 +554,7 @@ bool BackgroundPreviewBox::Start(
controller->show(Box<BackgroundPreviewBox>(
controller,
result.withUrlParams(params)));
}), crl::guard(controller, [=](const MTP::Error &error) {
}), crl::guard(controller, [=] {
controller->show(Ui::MakeInformBox(tr::lng_background_bad_link()));
}));
return true;

View File

@@ -215,6 +215,11 @@ void ChangePhone::EnterPhone::sendPhoneDone(
return data;
});
const auto bad = [&](const char *type) {
LOG(("API Error: Should not be '%1'.").arg(type));
showError(Lang::Hard::ServerError());
return false;
};
auto codeLength = 0;
const auto hasLength = data.vtype().match([&](
const MTPDauth_sentCodeTypeApp &typeData) {
@@ -227,14 +232,14 @@ void ChangePhone::EnterPhone::sendPhoneDone(
}, [&](const MTPDauth_sentCodeTypeCall &typeData) {
codeLength = typeData.vlength().v;
return true;
}, [&](const MTPDauth_sentCodeTypeFlashCall &typeData) {
LOG(("Error: should not be flashcall!"));
showError(Lang::Hard::ServerError());
return false;
}, [&](const MTPDauth_sentCodeTypeMissedCall &data) {
LOG(("Error: should not be missedcall!"));
showError(Lang::Hard::ServerError());
return false;
}, [&](const MTPDauth_sentCodeTypeFlashCall &) {
return bad("FlashCall");
}, [&](const MTPDauth_sentCodeTypeMissedCall &) {
return bad("MissedCall");
}, [&](const MTPDauth_sentCodeTypeEmailCode &) {
return bad("EmailCode");
}, [&](const MTPDauth_sentCodeTypeSetUpEmailRequired &) {
return bad("SetUpEmailRequired");
});
if (!hasLength) {
return;

View File

@@ -69,7 +69,7 @@ void ChangeFilterById(
MTP_flags(MTPmessages_UpdateDialogFilter::Flag::f_filter),
MTP_int(filter.id()),
filter.tl()
)).done([=, chat = history->peer->name, filterName = filter.title()] {
)).done([=, chat = history->peer->name(), name = filter.title()]{
// Since only the primary window has dialogs list,
// We can safely show toast there.
if (const auto controller = Core::App().primaryWindow()) {
@@ -80,7 +80,7 @@ void ChangeFilterById(
lt_chat,
Ui::Text::Bold(chat),
lt_folder,
Ui::Text::Bold(filterName),
Ui::Text::Bold(name),
Ui::Text::WithEntities);
Ui::Toast::Show(
Window::Show(controller).toastParent(),

View File

@@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_options.h"
#include "ui/text/text_utilities.h"
#include "ui/basic_click_handlers.h"
#include "ui/painter.h"
#include "boxes/abstract_box.h" // Ui::show().
#include "styles/style_layers.h"
#include "styles/style_boxes.h"

View File

@@ -120,20 +120,29 @@ void DeleteMessagesBox::prepare() {
: peer->isSelf()
? tr::lng_sure_delete_saved_messages(tr::now)
: peer->isUser()
? tr::lng_sure_delete_history(tr::now, lt_contact, peer->name)
? tr::lng_sure_delete_history(
tr::now,
lt_contact,
peer->name())
: tr::lng_sure_delete_group_history(
tr::now,
lt_group,
peer->name);
peer->name());
details = Ui::Text::RichLangValue(details.text);
deleteStyle = &st::attentionBoxButton;
} else {
details.text = peer->isSelf()
? tr::lng_sure_delete_saved_messages(tr::now)
: peer->isUser()
? tr::lng_sure_delete_history(tr::now, lt_contact, peer->name)
? tr::lng_sure_delete_history(
tr::now,
lt_contact,
peer->name())
: peer->isChat()
? tr::lng_sure_delete_and_exit(tr::now, lt_group, peer->name)
? tr::lng_sure_delete_and_exit(
tr::now,
lt_group,
peer->name())
: peer->isMegagroup()
? tr::lng_sure_leave_group(tr::now)
: tr::lng_sure_leave_channel(tr::now);
@@ -189,7 +198,7 @@ void DeleteMessagesBox::prepare() {
tr::lng_delete_all_from_user(
tr::now,
lt_user,
Ui::Text::Bold(_moderateFrom->name),
Ui::Text::Bold(_moderateFrom->name()),
Ui::Text::WithEntities),
false,
st::defaultBoxCheckbox);

View File

@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "apiwrap.h"
#include "base/event_filter.h"
#include "boxes/premium_limits_box.h"
#include "boxes/premium_preview_box.h"
#include "chat_helpers/emoji_suggestions_widget.h"
#include "chat_helpers/message_field.h"
#include "chat_helpers/tabbed_panel.h"
@@ -25,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "data/data_user.h"
#include "data/data_premium_limits.h"
#include "data/stickers/data_stickers.h"
#include "data/stickers/data_custom_emoji.h"
#include "editor/photo_editor_layer_widget.h"
#include "history/history_drag_area.h"
@@ -46,6 +48,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/scroll_content_shadow.h"
#include "ui/image/image.h"
#include "ui/toast/toast.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/input_fields.h"
@@ -67,7 +70,7 @@ auto ListFromMimeData(not_null<const QMimeData*> data, bool premium) {
auto result = data->hasUrls()
? Storage::PrepareMediaList(
// When we edit media, we need only 1 file.
data->urls().mid(0, 1),
base::GetMimeUrls(data).mid(0, 1),
st::sendMediaPreviewSize,
premium)
: Ui::PreparedList(Error::EmptyFile, QString());
@@ -128,8 +131,7 @@ EditCaptionBox::EditCaptionBox(
this,
st::confirmCaptionArea,
Ui::InputField::Mode::MultiLine,
tr::lng_photo_caption(),
PrepareEditText(item)))
tr::lng_photo_caption()))
, _emojiToggle(base::make_unique_q<Ui::EmojiButton>(
this,
st::boxAttachEmoji)) {
@@ -153,6 +155,7 @@ void EditCaptionBox::prepare() {
setupField();
setupEmojiPanel();
setInitialText();
rebuildPreview();
setupEditEventHandler();
@@ -280,7 +283,12 @@ void EditCaptionBox::setupField() {
}
Unexpected("Action in MimeData hook.");
});
}
void EditCaptionBox::setInitialText() {
_field->setTextWithTags(
PrepareEditText(_historyItem),
Ui::InputField::HistoryAction::Clear);
auto cursor = _field->textCursor();
cursor.movePosition(QTextCursor::End);
_field->setTextCursor(cursor);
@@ -497,14 +505,22 @@ void EditCaptionBox::setupEmojiPanel() {
_emojiPanel->hide();
_emojiPanel->selector()->setCurrentPeer(_historyItem->history()->peer);
_emojiPanel->selector()->emojiChosen(
) | rpl::start_with_next([=](EmojiPtr emoji) {
Ui::InsertEmojiAtCursor(_field->textCursor(), emoji);
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
Ui::InsertEmojiAtCursor(_field->textCursor(), data.emoji);
}, lifetime());
_emojiPanel->selector()->customEmojiChosen(
) | rpl::start_with_next([=](Selector::FileChosen data) {
Data::InsertCustomEmoji(_field.get(), data.document);
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
const auto info = data.document->sticker();
if (info
&& info->setType == Data::StickersType::Emoji
&& !_controller->session().premium()) {
ShowPremiumPreviewBox(
_controller,
PremiumPreview::AnimatedEmoji);
} else {
Data::InsertCustomEmoji(_field.get(), data.document);
}
}, lifetime());
_emojiPanel->selector()->showPromoForPremiumEmoji();
const auto filterCallback = [=](not_null<QEvent*> event) {
emojiFilterForGeometry(event);
@@ -723,20 +739,19 @@ void EditCaptionBox::save() {
return;
}
const auto done = crl::guard(this, [=](const MTPUpdates &updates) {
const auto done = crl::guard(this, [=] {
_saveRequestId = 0;
closeBox();
});
const auto fail = crl::guard(this, [=](const MTP::Error &error) {
const auto fail = crl::guard(this, [=](const QString &error) {
_saveRequestId = 0;
const auto &type = error.type();
if (ranges::contains(Api::kDefaultEditMessagesErrors, type)) {
if (ranges::contains(Api::kDefaultEditMessagesErrors, error)) {
_error = tr::lng_edit_error(tr::now);
update();
} else if (type == u"MESSAGE_NOT_MODIFIED"_q) {
} else if (error == u"MESSAGE_NOT_MODIFIED"_q) {
closeBox();
} else if (type == u"MESSAGE_EMPTY"_q) {
} else if (error == u"MESSAGE_EMPTY"_q) {
_field->setFocus();
_field->showError();
update();

View File

@@ -52,6 +52,7 @@ private:
void setupPhotoEditorEventHandler();
void setupField();
void setupControls();
void setInitialText();
void updateBoxSize();
void captionResized();

View File

@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "ui/widgets/shadow.h"
#include "ui/widgets/input_fields.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "base/platform/base_platform_info.h"
#include "styles/style_boxes.h"
@@ -72,7 +73,7 @@ QCursor EditColorBox::Picker::generateCursor() {
cursor.setDevicePixelRatio(cRetinaFactor());
cursor.fill(Qt::transparent);
{
Painter p(&cursor);
auto p = QPainter(&cursor);
PainterHighQualityEnabler hq(p);
p.setBrush(Qt::NoBrush);
@@ -102,7 +103,7 @@ EditColorBox::Picker::Picker(QWidget *parent, Mode mode, QColor color)
}
void EditColorBox::Picker::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
preparePalette();
@@ -360,7 +361,7 @@ void EditColorBox::Slider::prepareMinSize() {
}
void EditColorBox::Slider::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
auto to = rect().marginsRemoved(QMargins(st::colorSliderSkip, st::colorSliderSkip, st::colorSliderSkip, st::colorSliderSkip));
Ui::Shadow::paint(p, to, width(), st::defaultRoundShadow);
if (_type == Type::Opacity) {
@@ -573,7 +574,7 @@ public:
protected:
void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) override;
void paintAdditionalPlaceholder(Painter &p) override;
void paintAdditionalPlaceholder(QPainter &p) override;
void wheelEvent(QWheelEvent *e) override;
void keyPressEvent(QKeyEvent *e) override;
@@ -632,7 +633,7 @@ void EditColorBox::Field::correctValue(const QString &was, int wasCursor, QStrin
}
}
void EditColorBox::Field::paintAdditionalPlaceholder(Painter &p) {
void EditColorBox::Field::paintAdditionalPlaceholder(QPainter &p) {
p.setFont(_st.font);
p.setPen(_st.placeholderFg);
auto inner = QRect(_st.textMargins.right(), _st.textMargins.top(), width() - 2 * _st.textMargins.right(), height() - _st.textMargins.top() - _st.textMargins.bottom());
@@ -696,7 +697,7 @@ public:
protected:
void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) override;
void paintAdditionalPlaceholder(Painter &p) override;
void paintAdditionalPlaceholder(QPainter &p) override;
};
@@ -737,7 +738,7 @@ void EditColorBox::ResultField::correctValue(const QString &was, int wasCursor,
}
}
void EditColorBox::ResultField::paintAdditionalPlaceholder(Painter &p) {
void EditColorBox::ResultField::paintAdditionalPlaceholder(QPainter &p) {
p.setFont(_st.font);
p.setPen(_st.placeholderFg);
p.drawText(QRect(_st.textMargins.right(), _st.textMargins.top(), width(), height() - _st.textMargins.top() - _st.textMargins.bottom()), "#", style::al_topleft);

View File

@@ -11,11 +11,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "chat_helpers/emoji_suggestions_widget.h"
#include "ui/layers/generic_box.h"
#include "ui/text/text_utilities.h"
#include "ui/text/text_options.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/input_fields.h"
#include "ui/effects/panel_animation.h"
#include "ui/filter_icons.h"
#include "ui/filter_icon_panel.h"
#include "ui/painter.h"
#include "data/data_chat_filters.h"
#include "data/data_peer.h"
#include "data/data_peer_values.h" // Data::AmPremiumValue.
@@ -82,6 +84,7 @@ private:
struct PeerButton {
not_null<History*> history;
std::shared_ptr<Data::CloudImageView> userpic;
Ui::Text::String name;
Button button;
};
@@ -208,7 +211,7 @@ int FilterChatsPreview::resizeGetHeight(int newWidth) {
for (const auto &[flag, button] : _removeFlag) {
moveNextButton(button.get());
}
for (const auto &[history, userpic, button] : _removePeer) {
for (const auto &[history, userpic, name, button] : _removePeer) {
moveNextButton(button.get());
}
return top;
@@ -240,7 +243,7 @@ void FilterChatsPreview::paintEvent(QPaintEvent *e) {
FilterChatsTypeName(flag));
top += st.height;
}
for (auto &[history, userpic, button] : _removePeer) {
for (auto &[history, userpic, name, button] : _removePeer) {
const auto savedMessages = history->peer->isSelf();
const auto repliesMessages = history->peer->isRepliesChat();
if (savedMessages || repliesMessages) {
@@ -276,7 +279,13 @@ void FilterChatsPreview::paintEvent(QPaintEvent *e) {
width(),
st.photoSize);
p.setPen(st::contactsNameFg);
history->peer->nameText().drawLeftElided(
if (name.isEmpty()) {
name.setText(
st::msgNameStyle,
history->peer->name(),
Ui::NameTextOptions());
}
name.drawLeftElided(
p,
nameLeft,
top + nameTop,

View File

@@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "ui/widgets/labels.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/painter.h"
#include "main/main_app_config.h"
#include "main/main_account.h"
#include "main/main_session.h"
@@ -125,7 +126,7 @@ QString TypeRow::generateShortName() {
PaintRoundImageCallback TypeRow::generatePaintUserpicCallback() {
const auto flag = this->flag();
return [=](Painter &p, int x, int y, int outerWidth, int size) {
return [=](QPainter &p, int x, int y, int outerWidth, int size) {
PaintFilterChatsTypeIcon(p, flag, x, y, outerWidth, size);
};
}
@@ -241,7 +242,7 @@ auto TypeController::rowSelectionChanges() const
}
void PaintFilterChatsTypeIcon(
Painter &p,
QPainter &p,
Data::ChatFilter::Flag flag,
int x,
int y,

View File

@@ -28,7 +28,7 @@ class Painter;
[[nodiscard]] QString FilterChatsTypeName(Data::ChatFilter::Flag flag);
void PaintFilterChatsTypeIcon(
Painter &p,
QPainter &p,
Data::ChatFilter::Flag flag,
int x,
int y,

View File

@@ -8,19 +8,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/gift_premium_box.h"
#include "apiwrap.h"
#include "api/api_premium_option.h"
#include "base/weak_ptr.h"
#include "core/click_handler_types.h" // ClickHandlerContext.
#include "core/local_url_handlers.h" // TryConvertUrlToLocal.
#include "data/data_changes.h"
#include "data/data_peer_values.h" // Data::PeerPremiumValue.
#include "data/data_session.h"
#include "data/data_subscription_option.h"
#include "data/data_user.h"
#include "lang/lang_keys.h"
#include "main/main_session.h"
#include "settings/settings_premium.h"
#include "ui/basic_click_handlers.h" // UrlClickHandler::Open.
#include "ui/effects/premium_graphics.h"
#include "ui/effects/premium_stars.h"
#include "ui/effects/premium_stars_colored.h"
#include "ui/layers/generic_box.h"
#include "ui/special_buttons.h"
#include "ui/text/format_values.h"
@@ -39,11 +39,8 @@ namespace {
constexpr auto kDiscountDivider = 5.;
struct GiftOption final {
QString url;
Ui::Premium::GiftInfo info;
};
using GiftOptions = std::vector<GiftOption>;
using GiftOption = Data::SubscriptionOption;
using GiftOptions = Data::SubscriptionOptions;
GiftOptions GiftOptionFromTL(const MTPDuserFull &data) {
auto result = GiftOptions();
@@ -51,115 +48,16 @@ GiftOptions GiftOptionFromTL(const MTPDuserFull &data) {
if (!gifts) {
return result;
}
const auto monthlyAmount = [&] {
const auto &min = ranges::min_element(
gifts->v,
ranges::less(),
[](const MTPPremiumGiftOption &o) { return o.data().vamount().v; }
)->data();
return min.vamount().v / float64(min.vmonths().v);
}();
result.reserve(gifts->v.size());
for (const auto &gift : gifts->v) {
const auto &option = gift.data();
const auto botUrl = qs(option.vbot_url());
const auto months = option.vmonths().v;
const auto amount = option.vamount().v;
const auto currency = qs(option.vcurrency());
const auto discount = [&] {
const auto percent = monthlyAmount * months / float64(amount)
- 1.;
return std::round(percent * 100. / kDiscountDivider)
* kDiscountDivider;
}();
auto info = Ui::Premium::GiftInfo{
.duration = Ui::FormatTTL(months * 86400 * 31),
.discount = discount
? QString::fromUtf8("\xe2\x88\x92%1%").arg(discount)
: QString(),
.perMonth = tr::lng_premium_gift_per(
tr::now,
lt_cost,
Ui::FillAmountAndCurrency(
amount / float64(months),
currency)),
.total = Ui::FillAmountAndCurrency(amount, currency),
};
result.push_back({ .url = botUrl, .info = std::move(info) });
result = Api::SubscriptionOptionsFromTL(gifts->v);
for (auto &option : result) {
option.costPerMonth = tr::lng_premium_gift_per(
tr::now,
lt_cost,
option.costPerMonth);
}
return result;
}
class ColoredMiniStars final {
public:
ColoredMiniStars(not_null<Ui::RpWidget*> parent);
void setSize(const QSize &size);
void setPosition(QPoint position);
void paint(Painter &p);
private:
Ui::Premium::MiniStars _ministars;
QRectF _ministarsRect;
QImage _frame;
QImage _mask;
QSize _size;
QPoint _position;
};
ColoredMiniStars::ColoredMiniStars(not_null<Ui::RpWidget*> parent)
: _ministars([=](const QRect &r) {
parent->update(r.translated(_position));
}, true) {
}
void ColoredMiniStars::setSize(const QSize &size) {
_frame = QImage(
size * style::DevicePixelRatio(),
QImage::Format_ARGB32_Premultiplied);
_frame.setDevicePixelRatio(style::DevicePixelRatio());
_mask = _frame;
_mask.fill(Qt::transparent);
{
Painter p(&_mask);
auto gradient = QLinearGradient(0, 0, size.width(), 0);
gradient.setStops(Ui::Premium::GiftGradientStops());
p.setPen(Qt::NoPen);
p.setBrush(gradient);
p.drawRect(0, 0, size.width(), size.height());
}
_size = size;
{
const auto s = _size / Ui::Premium::MiniStars::kSizeFactor;
const auto margins = QMarginsF(
s.width() / 2.,
s.height() / 2.,
s.width() / 2.,
s.height() / 2.);
_ministarsRect = QRectF(QPointF(), _size) - margins;
}
}
void ColoredMiniStars::setPosition(QPoint position) {
_position = std::move(position);
}
void ColoredMiniStars::paint(Painter &p) {
_frame.fill(Qt::transparent);
{
Painter q(&_frame);
_ministars.paint(q, _ministarsRect);
q.setCompositionMode(QPainter::CompositionMode_SourceIn);
q.drawImage(0, 0, _mask);
}
p.drawImage(_position, _frame);
}
void GiftBox(
not_null<Ui::GenericBox*> box,
not_null<Window::SessionController*> controller,
@@ -182,6 +80,7 @@ void GiftBox(
+ userpicPadding.bottom()
+ st::defaultUserpicButton.size.height()));
using ColoredMiniStars = Ui::Premium::ColoredMiniStars;
const auto stars = box->lifetime().make_state<ColoredMiniStars>(top);
const auto userpic = Ui::CreateChild<Ui::UserpicButton>(
@@ -209,7 +108,7 @@ void GiftBox(
top->paintRequest(
) | rpl::start_with_next([=](const QRect &r) {
Painter p(top);
auto p = QPainter(top);
p.fillRect(r, Qt::transparent);
stars->paint(p);
@@ -263,17 +162,14 @@ void GiftBox(
auto text = tr::lng_premium_gift_button(
tr::now,
lt_cost,
options[value].info.total);
options[value].costTotal);
state->buttonText.fire(std::move(text));
});
Ui::Premium::AddGiftOptions(
buttonsParent,
group,
ranges::views::all(
options
) | ranges::views::transform([](const GiftOption &option) {
return option.info;
}) | ranges::to_vector);
options,
st::premiumGiftOption);
// Footer.
auto terms = object_ptr<Ui::FlatLabel>(
@@ -304,26 +200,17 @@ void GiftBox(
[] { return QString("gift"); },
state->buttonText.events(),
Ui::Premium::GiftGradientStops(),
[=] {
const auto value = group->value();
return (value < options.size() && value >= 0)
? options[value].botUrl
: QString();
},
});
auto button = object_ptr<Ui::GradientButton>::fromRaw(raw);
button->resizeToWidth(boxWidth
- stButton.buttonPadding.left()
- stButton.buttonPadding.right());
button->setClickedCallback([=] {
const auto value = group->value();
Assert(value < options.size() && value >= 0);
const auto local = Core::TryConvertUrlToLocal(options[value].url);
if (local.isEmpty()) {
return;
}
UrlClickHandler::Open(
local,
QVariant::fromValue(ClickHandlerContext{
.sessionWindow = base::make_weak(controller.get()),
.botStartAutoSubmit = true,
}));
});
box->setShowFinishedCallback([raw = button.data()]{
raw->startGlareAnimation();
});

View File

@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/ripple_animation.h"
#include "ui/toast/toast.h"
#include "ui/text/text_options.h"
#include "ui/painter.h"
#include "storage/localstorage.h"
#include "ui/boxes/confirm_box.h"
#include "mainwidget.h"

View File

@@ -242,7 +242,7 @@ void LocalStorageBox::Row::paintEvent(QPaintEvent *e) {
if (!_progress || true) {
return;
}
Painter p(this);
auto p = QPainter(this);
const auto padding = st::localStorageRowPadding;
const auto height = st::localStorageRowHeight;
const auto bottom = height - padding.bottom() - _description->height();
@@ -595,12 +595,3 @@ void LocalStorageBox::save() {
_session->data().cache().updateSettings(update);
closeBox();
}
void LocalStorageBox::paintEvent(QPaintEvent *e) {
BoxContent::paintEvent(e);
Painter p(this);
p.setFont(st::boxTextFont);
p.setPen(st::windowFg);
}

View File

@@ -45,8 +45,6 @@ public:
protected:
void prepare() override;
void paintEvent(QPaintEvent *e) override;
private:
class Row;

View File

@@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/layers/generic_box.h"
#include "ui/text/text_utilities.h"
#include "ui/toast/toast.h"
#include "ui/painter.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"

View File

@@ -46,7 +46,7 @@ void MuteSettingsBox::prepare() {
icon->moveToLeft(st::boxPadding.left(), y);
object_ptr<Ui::FlatLabel> title(this, st::muteChatTitle);
title->setText(_peer->name);
title->setText(_peer->name());
title->moveToLeft(
st::boxPadding.left() + st::muteChatTitleLeft,
y + (icon->height() / 2) - (title->height() / 2));
@@ -76,7 +76,9 @@ void MuteSettingsBox::prepare() {
_save = [=] {
const auto muteForSeconds = group->value() * 3600;
_peer->owner().notifySettings().update(_peer, muteForSeconds);
_peer->owner().notifySettings().update(
_peer,
{ .period = muteForSeconds });
closeBox();
};
addButton(tr::lng_box_ok(), _save);

View File

@@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/sent_code_field.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/wrap/fade_wrap.h"
#include "ui/painter.h"
#include "passport/passport_encryption.h"
#include "passport/passport_panel_edit_contact.h"
#include "settings/settings_privacy_security.h"
@@ -1297,6 +1298,7 @@ void RecoverBox::proceedToChange(const QString &code) {
// like if (_cloudFields.turningOff) { just RecoverPassword else Check }
fields.mtp.curRequest = {};
fields.hasPassword = false;
fields.customCheckCallback = nullptr;
auto box = Box<PasscodeBox>(_session, fields);
box->boxClosing(

View File

@@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/empty_userpic.h"
#include "ui/wrap/slide_wrap.h"
#include "ui/text/text_options.h"
#include "ui/painter.h"
#include "lang/lang_keys.h"
#include "storage/file_download.h"
#include "data/data_peer_values.h"
@@ -37,11 +38,11 @@ PaintRoundImageCallback PaintUserpicCallback(
bool respectSavedMessagesChat) {
if (respectSavedMessagesChat) {
if (peer->isSelf()) {
return [](Painter &p, int x, int y, int outerWidth, int size) {
return [](QPainter &p, int x, int y, int outerWidth, int size) {
Ui::EmptyUserpic::PaintSavedMessages(p, x, y, outerWidth, size);
};
} else if (peer->isRepliesChat()) {
return [](Painter &p, int x, int y, int outerWidth, int size) {
return [](QPainter &p, int x, int y, int outerWidth, int size) {
Ui::EmptyUserpic::PaintRepliesMessages(p, x, y, outerWidth, size);
};
}
@@ -206,7 +207,7 @@ void PeerListBox::resizeEvent(QResizeEvent *e) {
}
void PeerListBox::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
const auto &bg = (_controller->listSt()
? *_controller->listSt()
@@ -613,7 +614,7 @@ void PeerListRow::elementsPaint(
}
QString PeerListRow::generateName() {
return peer()->name;
return peer()->name();
}
QString PeerListRow::generateShortName() {
@@ -653,27 +654,45 @@ void PeerListRow::invalidatePixmapsCache() {
}
}
int PeerListRow::nameIconWidth() const {
return special()
? 0
: _peer->isVerified()
? st::dialogsVerifiedIcon.width()
: (_peer->isPremium() && !_peer->isSelf())
? st::dialogsPremiumIcon.width()
: 0;
}
void PeerListRow::paintNameIcon(
int PeerListRow::paintNameIconGetWidth(
Painter &p,
int x,
int y,
Fn<void()> repaint,
crl::time now,
int nameLeft,
int nameTop,
int nameWidth,
int availableWidth,
int outerWidth,
bool selected) {
if (_peer->isVerified()) {
st::dialogsVerifiedIcon.paint(p, x, y, outerWidth);
} else if (_peer->isPremium() && !_peer->isSelf()) {
st::dialogsPremiumIcon.paint(p, x, y, outerWidth);
if (special() || _isSavedMessagesChat || _isRepliesMessagesChat) {
return 0;
}
return _bagde.drawGetWidth(
p,
QRect(
nameLeft,
nameTop,
availableWidth,
st::msgNameStyle.font->height),
nameWidth,
outerWidth,
{
.peer = _peer,
.verified = &(selected
? st::dialogsVerifiedIconOver
: st::dialogsVerifiedIcon),
.premium = &(selected
? st::dialogsPremiumIconOver
: st::dialogsPremiumIcon),
.scam = &(selected ? st::dialogsScamFgOver : st::dialogsScamFg),
.premiumFg = &(selected
? st::dialogsVerifiedIconBgOver
: st::dialogsVerifiedIconBg),
.preview = st::windowBgOver->c,
.customEmojiRepaint = repaint,
.now = now,
.paused = false,
});
}
void PeerListRow::paintStatusText(
@@ -829,7 +848,7 @@ PeerListContent::PeerListContent(
using UpdateFlag = Data::PeerUpdate::Flag;
_controller->session().changes().peerUpdates(
UpdateFlag::Name | UpdateFlag::Photo
UpdateFlag::Name | UpdateFlag::Photo | UpdateFlag::EmojiStatus
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
if (update.flags & UpdateFlag::Name) {
handleNameChanged(update.peer);
@@ -1549,33 +1568,49 @@ crl::time PeerListContent::paintRow(
p.setPen(st::contactsNameFg);
auto skipRight = _st.item.photoPosition.x();
auto rightActionSize = row->rightActionSize();
auto rightActionMargins = rightActionSize.isEmpty()
const auto skipRight = _st.item.photoPosition.x();
const auto rightActionSize = row->rightActionSize();
const auto rightActionMargins = rightActionSize.isEmpty()
? QMargins()
: row->rightActionMargins();
auto &name = row->name();
auto namex = _st.item.namePosition.x();
const auto &name = row->name();
const auto namex = _st.item.namePosition.x();
const auto namey = _st.item.namePosition.y();
auto namew = outerWidth - namex - skipRight;
if (!rightActionSize.isEmpty()) {
if (!rightActionSize.isEmpty()
&& (namey < rightActionMargins.top() + rightActionSize.height())
&& (namey + _st.item.nameStyle.font->height
> rightActionMargins.top())) {
namew -= rightActionMargins.left()
+ rightActionSize.width()
+ rightActionMargins.right()
- skipRight;
}
auto statusw = namew;
if (auto iconWidth = row->nameIconWidth()) {
namew -= iconWidth;
row->paintNameIcon(
p,
namex + qMin(name.maxWidth(), namew),
_st.item.namePosition.y(),
width(),
selected);
const auto statusx = _st.item.statusPosition.x();
const auto statusy = _st.item.statusPosition.y();
auto statusw = outerWidth - statusx - skipRight;
if (!rightActionSize.isEmpty()
&& (statusy < rightActionMargins.top() + rightActionSize.height())
&& (statusy + st::contactsStatusFont->height
> rightActionMargins.top())) {
statusw -= rightActionMargins.left()
+ rightActionSize.width()
+ rightActionMargins.right()
- skipRight;
}
namew -= row->paintNameIconGetWidth(
p,
[=] { updateRow(row); },
now,
namex,
namey,
name.maxWidth(),
namew,
width(),
selected);
auto nameCheckedRatio = row->disabled() ? 0. : row->checkedRatio();
p.setPen(anim::pen(_st.item.nameFg, _st.item.nameFgChecked, nameCheckedRatio));
name.drawLeftElided(p, namex, _st.item.namePosition.y(), namew, width());
name.drawLeftElided(p, namex, namey, namew, width());
p.setFont(st::contactsStatusFont);
if (row->isSearchResult()
@@ -1594,16 +1629,16 @@ crl::time PeerListContent::paintRow(
highlightedPart = st::contactsStatusFont->elided(highlightedPart, availableWidth);
}
p.setPen(_st.item.statusFgActive);
p.drawTextLeft(_st.item.statusPosition.x(), _st.item.statusPosition.y(), width(), highlightedPart);
p.drawTextLeft(statusx, statusy, width(), highlightedPart);
} else {
grayedPart = st::contactsStatusFont->elided(grayedPart, availableWidth - highlightedWidth);
p.setPen(_st.item.statusFgActive);
p.drawTextLeft(_st.item.statusPosition.x(), _st.item.statusPosition.y(), width(), highlightedPart);
p.drawTextLeft(statusx, statusy, width(), highlightedPart);
p.setPen(selected ? _st.item.statusFgOver : _st.item.statusFg);
p.drawTextLeft(_st.item.statusPosition.x() + highlightedWidth, _st.item.statusPosition.y(), width(), grayedPart);
p.drawTextLeft(statusx + highlightedWidth, statusy, width(), grayedPart);
}
} else {
row->paintStatusText(p, _st.item, _st.item.statusPosition.x(), _st.item.statusPosition.y(), statusw, width(), selected);
row->paintStatusText(p, _st.item, statusx, statusy, statusw, width(), selected);
}
row->elementsPaint(

View File

@@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/rp_widget.h"
#include "ui/empty_userpic.h"
#include "ui/unread_badge.h"
#include "boxes/abstract_box.h"
#include "mtproto/sender.h"
#include "data/data_cloud_file.h"
@@ -94,11 +95,14 @@ public:
void clearCustomStatus();
// Box interface.
virtual int nameIconWidth() const;
virtual void paintNameIcon(
virtual int paintNameIconGetWidth(
Painter &p,
int x,
int y,
Fn<void()> repaint,
crl::time now,
int nameLeft,
int nameTop,
int nameWidth,
int availableWidth,
int outerWidth,
bool selected);
@@ -258,6 +262,7 @@ private:
std::unique_ptr<Ui::RoundImageCheckbox> _checkbox;
Ui::Text::String _name;
Ui::Text::String _status;
Ui::PeerBadge _bagde;
StatusType _statusType = StatusType::Online;
crl::time _statusValidTill = 0;
base::flat_set<QChar> _nameFirstLetters;

View File

@@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/random.h"
#include "ui/boxes/confirm_box.h"
#include "ui/widgets/checkbox.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "main/main_session.h"
#include "data/data_session.h"

View File

@@ -278,7 +278,7 @@ void PeerListsBox::resizeEvent(QResizeEvent *e) {
}
void PeerListsBox::paintEvent(QPaintEvent *e) {
Painter p(this);
auto p = QPainter(this);
const auto &bg = (firstController()->listSt()
? *firstController()->listSt()

View File

@@ -207,9 +207,15 @@ void AddBotToGroupBoxController::shareBotGame(not_null<PeerData*> chat) {
});
auto confirmText = [chat] {
if (chat->isUser()) {
return tr::lng_bot_sure_share_game(tr::now, lt_user, chat->name);
return tr::lng_bot_sure_share_game(
tr::now,
lt_user,
chat->name());
}
return tr::lng_bot_sure_share_game_group(tr::now, lt_group, chat->name);
return tr::lng_bot_sure_share_game_group(
tr::now,
lt_group,
chat->name());
}();
_controller->show(
Ui::MakeConfirmBox({
@@ -320,7 +326,7 @@ void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
});
controller->show(
Ui::MakeConfirmBox({
tr::lng_bot_sure_invite(tr::now, lt_group, chat->name),
tr::lng_bot_sure_invite(tr::now, lt_group, chat->name()),
std::move(callback),
}),
Ui::LayerOption::KeepOther);

View File

@@ -262,16 +262,16 @@ void AddParticipantsBoxController::inviteSelectedUsers(
? tr::lng_participant_invite_sure(
tr::now,
lt_user,
{ users.front()->name },
{ users.front()->name()},
lt_group,
{ _peer->name },
{ _peer->name()},
Ui::Text::RichLangValue)
: tr::lng_participant_invite_sure_many(
tr::now,
lt_count,
int(users.size()),
lt_group,
{ _peer->name },
{ _peer->name() },
Ui::Text::RichLangValue);
Ui::ConfirmBox(box, {
.text = std::move(text),
@@ -834,7 +834,7 @@ void AddSpecialBoxController::kickUser(
: tr::lng_profile_sure_kick_channel)(
tr::now,
lt_user,
participant->name);
participant->name());
_editBox = showBox(Ui::MakeConfirmBox({ text, kickUserSure }));
return;
}

View File

@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/peers/edit_peer_common.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/widgets/labels.h"
#include "ui/widgets/checkbox.h"
#include "ui/widgets/input_fields.h"
#include "ui/text/format_values.h" // Ui::FormatPhone
#include "ui/text/text_utilities.h"

View File

@@ -134,9 +134,9 @@ void Controller::choose(not_null<ChannelData*> chat) {
auto text = tr::lng_manage_discussion_group_sure(
tr::now,
lt_group,
Ui::Text::Bold(chat->name),
Ui::Text::Bold(chat->name()),
lt_channel,
Ui::Text::Bold(_channel->name),
Ui::Text::Bold(_channel->name()),
Ui::Text::WithEntities);
if (!_channel->isPublic()) {
text.append(
@@ -170,9 +170,9 @@ void Controller::choose(not_null<ChatData*> chat) {
auto text = tr::lng_manage_discussion_group_sure(
tr::now,
lt_group,
Ui::Text::Bold(chat->name),
Ui::Text::Bold(chat->name()),
lt_channel,
Ui::Text::Bold(_channel->name),
Ui::Text::Bold(_channel->name()),
Ui::Text::WithEntities);
if (!_channel->isPublic()) {
text.append("\n\n" + tr::lng_manage_linked_channel_private(tr::now));
@@ -212,13 +212,13 @@ object_ptr<Ui::RpWidget> SetupAbout(
return tr::lng_manage_linked_channel_about(
tr::now,
lt_channel,
Ui::Text::Bold(chat->name),
Ui::Text::Bold(chat->name()),
Ui::Text::WithEntities);
} else if (chat != nullptr) {
return tr::lng_manage_discussion_group_about_chosen(
tr::now,
lt_group,
Ui::Text::Bold(chat->name),
Ui::Text::Bold(chat->name()),
Ui::Text::WithEntities);
}
return tr::lng_manage_discussion_group_about(
@@ -257,7 +257,7 @@ object_ptr<Ui::RpWidget> SetupCreateGroup(
Box<GroupInfoBox>(
navigation,
GroupInfoBox::Type::Megagroup,
channel->name + " Chat",
channel->name() + " Chat",
guarded),
Ui::LayerOption::KeepOther);
});

View File

@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_utilities.h"
#include "ui/text/text_options.h"
#include "ui/special_buttons.h"
#include "ui/painter.h"
#include "chat_helpers/emoji_suggestions_widget.h"
#include "settings/settings_privacy_security.h"
#include "ui/boxes/choose_date_time.h"
@@ -99,7 +100,7 @@ EditParticipantBox::Inner::Inner(
_userPhoto->setPointerCursor(false);
_userName.setText(
st::rightsNameStyle,
_user->name,
_user->name(),
Ui::NameTextOptions());
}
@@ -394,7 +395,7 @@ void EditAdminBox::prepare() {
phrase(
tr::now,
lt_group,
Ui::Text::Bold(peer()->name),
Ui::Text::Bold(peer()->name()),
Ui::Text::WithEntities),
crl::guard(this, [=] { finishAddAdmin(); })
}), Ui::LayerOption::KeepOther);
@@ -542,7 +543,7 @@ void EditAdminBox::transferOwnership() {
.text = tr::lng_rights_transfer_about(
tr::now,
lt_group,
Ui::Text::Bold(peer()->name),
Ui::Text::Bold(peer()->name()),
lt_user,
Ui::Text::Bold(user()->shortName()),
Ui::Text::RichLangValue),

View File

@@ -1298,7 +1298,7 @@ void ParticipantsBoxController::rebuildChatAdmins(
list.emplace_back(creator);
}
ranges::sort(list, [](not_null<UserData*> a, not_null<UserData*> b) {
return (a->name.compare(b->name, Qt::CaseInsensitive) < 0);
return (a->name().compare(b->name(), Qt::CaseInsensitive) < 0);
});
const auto same = [&] {
@@ -1723,7 +1723,7 @@ void ParticipantsBoxController::kickParticipant(not_null<PeerData*> participant)
: tr::lng_profile_sure_kick_channel)(
tr::now,
lt_user,
user ? user->firstName : participant->name);
user ? user->firstName : participant->name());
_editBox = showBox(
Ui::MakeConfirmBox({
.text = text,
@@ -1932,18 +1932,6 @@ auto ParticipantsBoxController::computeType(
? Rights::Admin
: Rights::Normal;
result.adminRank = user ? _additional.adminRank(user) : QString();
using Badge = Info::Profile::Badge;
result.badge = !user
? Badge::None
: user->isScam()
? Badge::Scam
: user->isFake()
? Badge::Fake
: user->isVerified()
? Badge::Verified
: (user->isPremium() && participant->session().premiumBadgesShown())
? Badge::Premium
: Badge::None;
return result;
}
@@ -1952,7 +1940,8 @@ void ParticipantsBoxController::recomputeTypeFor(
if (_role != Role::Profile) {
return;
}
if (const auto row = delegate()->peerListFindRow(participant->id.value)) {
const auto row = delegate()->peerListFindRow(participant->id.value);
if (row) {
static_cast<Row*>(row)->setType(computeType(participant));
}
}
@@ -1967,7 +1956,7 @@ void ParticipantsBoxController::refreshCustomStatus(
row->setCustomStatus(tr::lng_channel_admin_status_promoted_by(
tr::now,
lt_user,
by->name));
by->name()));
} else {
if (_additional.isCreator(user)) {
row->setCustomStatus(
@@ -1984,7 +1973,7 @@ void ParticipantsBoxController::refreshCustomStatus(
: tr::lng_channel_banned_status_restricted_by)(
tr::now,
lt_user,
by ? by->name : "Unknown"));
by ? by->name() : "Unknown"));
}
}

View File

@@ -473,7 +473,7 @@ object_ptr<Ui::RpWidget> Controller::createTitleEdit() {
(_isGroup
? tr::lng_dlg_new_group_name
: tr::lng_dlg_new_channel_name)(),
_peer->name),
_peer->name()),
st::editPeerTitleMargins);
result->entity()->setMaxLength(Ui::EditPeer::kMaxGroupChannelTitle);
result->entity()->setInstantReplaces(Ui::InstantReplaces::Default());
@@ -769,15 +769,13 @@ void Controller::fillLinkedChatButton() {
auto label = isGroup
? _linkedChatUpdates.events(
) | rpl::map([](ChannelData *chat) {
return chat ? chat->name : QString();
return chat ? chat->name() : QString();
}) | rpl::type_erased()
: rpl::combine(
tr::lng_manage_discussion_group_add(),
_linkedChatUpdates.events()
) | rpl::map([=](const QString &add, ChannelData *chat) {
return chat
? chat->name
: add;
return chat ? chat->name() : add;
}) | rpl::type_erased();
AddButtonWithText(
_controls.buttonsLayout,
@@ -990,21 +988,30 @@ void Controller::fillManageSection() {
if (canEditReactions()) {
const auto session = &_peer->session();
auto reactionsCount = Info::Profile::MigratedOrMeValue(
auto allowedReactions = Info::Profile::MigratedOrMeValue(
_peer
) | rpl::map(
Info::Profile::AllowedReactionsCountValue
) | rpl::flatten_latest();
auto fullCount = Info::Profile::FullReactionsCountValue(session);
) | rpl::map([=](not_null<PeerData*> peer) {
return peer->session().changes().peerFlagsValue(
peer,
Data::PeerUpdate::Flag::Reactions
) | rpl::map([=] {
return Data::PeerAllowedReactions(peer);
});
}) | rpl::flatten_latest();
auto label = rpl::combine(
std::move(reactionsCount),
std::move(fullCount)
) | rpl::map([=](int allowed, int total) {
return allowed
? QString::number(allowed) + " / " + QString::number(total)
std::move(allowedReactions),
Info::Profile::FullReactionsCountValue(session)
) | rpl::map([=](const Data::AllowedReactions &allowed, int total) {
const auto some = int(allowed.some.size());
return (allowed.type != Data::AllowedReactionsType::Some)
? tr::lng_manage_peer_reactions_on(tr::now)
: some
? (QString::number(some)
+ " / "
+ QString::number(std::max(some, total)))
: tr::lng_manage_peer_reactions_off(tr::now);
});
const auto done = [=](const std::vector<QString> &chosen) {
const auto done = [=](const Data::AllowedReactions &chosen) {
SaveAllowedReactions(_peer, chosen);
};
AddButtonWithCount(
@@ -1014,10 +1021,11 @@ void Controller::fillManageSection() {
[=] {
_navigation->parentController()->show(Box(
EditAllowedReactionsBox,
_navigation,
!_peer->isBroadcast(),
session->data().reactions().list(
Data::Reactions::Type::Active),
*Data::PeerAllowedReactions(_peer),
Data::PeerAllowedReactions(_peer),
done));
},
{ &st::infoRoundedIconReactions, Settings::kIconRed });
@@ -1388,14 +1396,14 @@ void Controller::saveUsername() {
MTP_string(*_savingData.username)
)).done([=] {
channel->setName(
TextUtilities::SingleLine(channel->name),
TextUtilities::SingleLine(channel->name()),
*_savingData.username);
continueSave();
}).fail([=](const MTP::Error &error) {
const auto &type = error.type();
if (type == qstr("USERNAME_NOT_MODIFIED")) {
channel->setName(
TextUtilities::SingleLine(channel->name),
TextUtilities::SingleLine(channel->name()),
TextUtilities::SingleLine(*_savingData.username));
continueSave();
return;
@@ -1450,7 +1458,7 @@ void Controller::saveLinkedChat() {
}
void Controller::saveTitle() {
if (!_savingData.title || *_savingData.title == _peer->name) {
if (!_savingData.title || *_savingData.title == _peer->name()) {
return continueSave();
}

View File

@@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/toasts/common_toasts.h"
#include "ui/text/text_utilities.h"
#include "ui/boxes/edit_invite_link.h"
#include "ui/painter.h"
#include "boxes/share_box.h"
#include "history/view/history_view_group_call_bar.h" // GenerateUserpics...
#include "history/history_message.h" // GetErrorTextForSending.
@@ -809,7 +810,7 @@ void Controller::processRequest(
: tr::lng_group_requests_was_added)(
tr::now,
lt_user,
Ui::Text::Bold(user->name),
Ui::Text::Bold(user->name()),
Ui::Text::WithEntities)
});
}
@@ -1164,7 +1165,7 @@ object_ptr<Ui::BoxContent> ShareInviteLinkBox(
auto text = TextWithEntities();
if (result.size() > 1) {
text.append(
Ui::Text::Bold(error.second->name)
Ui::Text::Bold(error.second->name())
).append("\n\n");
}
text.append(error.first);

View File

@@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/slide_wrap.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/popup_menu.h"
#include "ui/painter.h"
#include "lang/lang_keys.h"
#include "ui/boxes/confirm_box.h"
#include "boxes/peer_list_controllers.h"
@@ -328,7 +329,7 @@ QString Row::generateShortName() {
PaintRoundImageCallback Row::generatePaintUserpicCallback() {
return [=](
Painter &p,
QPainter &p,
int x,
int y,
int outerWidth,

View File

@@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "boxes/peers/edit_peer_reactions.h"
#include "boxes/reactions_settings_box.h" // AddReactionLottieIcon
#include "boxes/reactions_settings_box.h" // AddReactionAnimatedIcon
#include "data/data_message_reactions.h"
#include "data/data_peer.h"
#include "data/data_chat.h"
@@ -18,47 +18,76 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "ui/layers/generic_box.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/checkbox.h"
#include "ui/wrap/slide_wrap.h"
#include "settings/settings_common.h"
#include "window/window_session_controller.h"
#include "styles/style_settings.h"
#include "styles/style_info.h"
void EditAllowedReactionsBox(
not_null<Ui::GenericBox*> box,
not_null<Window::SessionNavigation*> navigation,
bool isGroup,
const std::vector<Data::Reaction> &list,
const base::flat_set<QString> &selected,
Fn<void(const std::vector<QString> &)> callback) {
const Data::AllowedReactions &allowed,
Fn<void(const Data::AllowedReactions &)> callback) {
using namespace Data;
using namespace rpl::mappers;
const auto iconHeight = st::editPeerReactionsPreview;
box->setTitle(tr::lng_manage_peer_reactions());
struct State {
base::flat_map<QString, not_null<Ui::SettingsButton*>> toggles;
rpl::variable<bool> anyToggled;
rpl::event_stream<bool> forceToggleAll;
enum class Option {
All,
Some,
None,
};
struct State {
base::flat_map<ReactionId, not_null<Ui::SettingsButton*>> toggles;
rpl::variable<Option> option; // For groups.
rpl::variable<bool> anyToggled; // For channels.
rpl::event_stream<bool> forceToggleAll; // For channels.
};
const auto optionInitial = (allowed.type != AllowedReactionsType::Some)
? Option::All
: allowed.some.empty()
? Option::None
: Option::Some;
const auto state = box->lifetime().make_state<State>(State{
.anyToggled = !selected.empty(),
.option = optionInitial,
.anyToggled = (optionInitial != Option::None),
});
const auto collect = [=] {
auto result = std::vector<QString>();
result.reserve(state->toggles.size());
for (const auto &[emoji, button] : state->toggles) {
if (button->toggled()) {
result.push_back(emoji);
auto result = AllowedReactions();
if (!isGroup || state->option.current() == Option::Some) {
result.some.reserve(state->toggles.size());
for (const auto &[id, button] : state->toggles) {
if (button->toggled()) {
result.some.push_back(id);
}
}
}
result.type = isGroup
? (state->option.current() != Option::All
? AllowedReactionsType::Some
: AllowedReactionsType::All)
: (result.some.size() == state->toggles.size())
? AllowedReactionsType::Default
: AllowedReactionsType::Some;
return result;
};
const auto container = box->verticalLayout();
const auto enabled = Settings::AddButton(
const auto enabled = isGroup ? nullptr : Settings::AddButton(
container,
tr::lng_manage_peer_reactions_enable(),
st::manageGroupButton.button);
if (!list.empty()) {
AddReactionLottieIcon(
st::manageGroupButton.button
).get();
if (enabled && !list.empty()) {
AddReactionAnimatedIcon(
enabled,
enabled->sizeValue(
) | rpl::map([=](const QSize &size) {
@@ -72,33 +101,88 @@ void EditAllowedReactionsBox(
rpl::never<>(),
&enabled->lifetime());
}
enabled->toggleOn(state->anyToggled.value());
enabled->toggledChanges(
) | rpl::filter([=](bool value) {
return (value != state->anyToggled.current());
}) | rpl::start_to_stream(state->forceToggleAll, enabled->lifetime());
if (enabled) {
enabled->toggleOn(state->anyToggled.value());
enabled->toggledChanges(
) | rpl::filter([=](bool value) {
return (value != state->anyToggled.current());
}) | rpl::start_to_stream(state->forceToggleAll, enabled->lifetime());
}
const auto group = std::make_shared<Ui::RadioenumGroup<Option>>(
state->option.current());
group->setChangedCallback([=](Option value) {
state->option = value;
});
const auto addOption = [&](Option option, const QString &text) {
if (!isGroup) {
return;
}
container->add(
object_ptr<Ui::Radioenum<Option>>(
container,
group,
option,
text,
st::settingsSendType),
st::settingsSendTypePadding);
};
addOption(Option::All, tr::lng_manage_peer_reactions_all(tr::now));
addOption(Option::Some, tr::lng_manage_peer_reactions_some(tr::now));
addOption(Option::None, tr::lng_manage_peer_reactions_none(tr::now));
const auto about = [](Option option) {
switch (option) {
case Option::All: return tr::lng_manage_peer_reactions_all_about();
case Option::Some: return tr::lng_manage_peer_reactions_some_about();
case Option::None: return tr::lng_manage_peer_reactions_none_about();
}
Unexpected("Option value in EditAllowedReactionsBox.");
};
Settings::AddSkip(container);
Settings::AddDividerText(
container,
(isGroup
? tr::lng_manage_peer_reactions_about
: tr::lng_manage_peer_reactions_about_channel)());
? (state->option.value()
| rpl::map(about)
| rpl::flatten_latest())
: tr::lng_manage_peer_reactions_about_channel()));
Settings::AddSkip(container);
Settings::AddSubsectionTitle(
container,
tr::lng_manage_peer_reactions_available());
const auto active = [&](const Data::Reaction &entry) {
return selected.contains(entry.emoji);
};
const auto add = [&](const Data::Reaction &entry) {
const auto button = Settings::AddButton(
const auto wrap = enabled ? nullptr : container->add(
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
container,
object_ptr<Ui::VerticalLayout>(container)));
if (wrap) {
wrap->toggleOn(state->option.value() | rpl::map(_1 == Option::Some));
wrap->finishAnimating();
}
const auto reactions = wrap ? wrap->entity() : container.get();
Settings::AddSkip(reactions);
Settings::AddSubsectionTitle(
reactions,
(enabled
? tr::lng_manage_peer_reactions_available()
: tr::lng_manage_peer_reactions_some_title()));
const auto like = QString::fromUtf8("\xf0\x9f\x91\x8d");
const auto dislike = QString::fromUtf8("\xf0\x9f\x91\x8e");
const auto activeOnStart = [&](const ReactionId &id) {
const auto inSome = ranges::contains(allowed.some, id);
if (!isGroup) {
return inSome || (allowed.type != AllowedReactionsType::Some);
}
const auto emoji = id.emoji();
const auto isDefault = (emoji == like) || (emoji == dislike);
return (allowed.type != AllowedReactionsType::Some)
? isDefault
: (inSome || (isDefault && allowed.some.empty()));
};
const auto add = [&](const Reaction &entry) {
const auto button = Settings::AddButton(
reactions,
rpl::single(entry.title),
st::manageGroupButton.button);
AddReactionLottieIcon(
AddReactionAnimatedIcon(
button,
button->sizeValue(
) | rpl::map([=](const QSize &size) {
@@ -114,29 +198,56 @@ void EditAllowedReactionsBox(
}) | rpl::to_empty,
rpl::never<>(),
&button->lifetime());
state->toggles.emplace(entry.emoji, button);
state->toggles.emplace(entry.id, button);
button->toggleOn(rpl::single(
active(entry)
) | rpl::then(
state->forceToggleAll.events()
activeOnStart(entry.id)
) | rpl::then(enabled
? (state->forceToggleAll.events() | rpl::type_erased())
: rpl::never<bool>()
));
button->toggledChanges(
) | rpl::start_with_next([=](bool toggled) {
if (toggled) {
state->anyToggled = true;
} else if (collect().empty()) {
state->anyToggled = false;
}
}, button->lifetime());
if (enabled) {
button->toggledChanges(
) | rpl::start_with_next([=](bool toggled) {
if (toggled) {
state->anyToggled = true;
} else if (collect().some.empty()) {
state->anyToggled = false;
}
}, button->lifetime());
}
};
for (const auto &entry : list) {
add(entry);
}
for (const auto &id : allowed.some) {
if (const auto customId = id.custom()) {
// Some possible forward compatibility.
const auto button = Settings::AddButton(
reactions,
rpl::single(u"Custom reaction"_q),
st::manageGroupButton.button);
AddReactionCustomIcon(
button,
button->sizeValue(
) | rpl::map([=](const QSize &size) {
return QPoint(
st::editPeerReactionsIconLeft,
(size.height() - iconHeight) / 2);
}),
iconHeight,
navigation->parentController(),
customId,
rpl::never<>(),
&button->lifetime());
state->toggles.emplace(id, button);
button->toggleOn(rpl::single(true));
}
}
box->addButton(tr::lng_settings_save(), [=] {
const auto ids = collect();
const auto result = collect();
box->closeBox();
callback(ids);
callback(result);
});
box->addButton(tr::lng_cancel(), [=] {
box->closeBox();
@@ -145,27 +256,35 @@ void EditAllowedReactionsBox(
void SaveAllowedReactions(
not_null<PeerData*> peer,
const std::vector<QString> &allowed) {
auto ids = allowed | ranges::views::transform([=](QString value) {
return MTP_string(value);
}) | ranges::to<QVector<MTPstring>>;
const Data::AllowedReactions &allowed) {
auto ids = allowed.some | ranges::views::transform(
Data::ReactionToMTP
) | ranges::to<QVector<MTPReaction>>;
using Type = Data::AllowedReactionsType;
const auto updated = (allowed.type != Type::Some)
? MTP_chatReactionsAll(MTP_flags((allowed.type == Type::Default)
? MTPDchatReactionsAll::Flag(0)
: MTPDchatReactionsAll::Flag::f_allow_custom))
: allowed.some.empty()
? MTP_chatReactionsNone()
: MTP_chatReactionsSome(MTP_vector<MTPReaction>(ids));
peer->session().api().request(MTPmessages_SetChatAvailableReactions(
peer->input,
MTP_vector<MTPstring>(ids)
updated
)).done([=](const MTPUpdates &result) {
peer->session().api().applyUpdates(result);
if (const auto chat = peer->asChat()) {
chat->setAllowedReactions({ begin(allowed), end(allowed) });
chat->setAllowedReactions(Data::Parse(updated));
} else if (const auto channel = peer->asChannel()) {
channel->setAllowedReactions({ begin(allowed), end(allowed) });
channel->setAllowedReactions(Data::Parse(updated));
} else {
Unexpected("Invalid peer type in SaveAllowedReactions.");
}
}).fail([=](const MTP::Error &error) {
if (error.type() == qstr("REACTION_INVALID")) {
peer->updateFullForced();
peer->owner().reactions().refresh();
peer->owner().reactions().refreshDefault();
}
}).send();
}

View File

@@ -11,19 +11,25 @@ class PeerData;
namespace Data {
struct Reaction;
struct AllowedReactions;
} // namespace Data
namespace Ui {
class GenericBox;
} // namespace Ui
namespace Window {
class SessionNavigation;
} // namespace Window
void EditAllowedReactionsBox(
not_null<Ui::GenericBox*> box,
not_null<Window::SessionNavigation*> navigation,
bool isGroup,
const std::vector<Data::Reaction> &list,
const base::flat_set<QString> &selected,
Fn<void(const std::vector<QString> &)> callback);
const Data::AllowedReactions &allowed,
Fn<void(const Data::AllowedReactions &)> callback);
void SaveAllowedReactions(
not_null<PeerData*> peer,
const std::vector<QString> &allowed);
const Data::AllowedReactions &allowed);

View File

@@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mtproto/sender.h"
#include "ui/text/text_utilities.h"
#include "ui/toasts/common_toasts.h"
#include "ui/painter.h"
#include "lang/lang_keys.h"
#include "window/window_session_controller.h"
#include "apiwrap.h"
@@ -388,7 +389,7 @@ void RequestsBoxController::processRequest(
: tr::lng_group_requests_was_added)(
tr::now,
lt_user,
Ui::Text::Bold(user->name),
Ui::Text::Bold(user->name()),
Ui::Text::WithEntities)
});
}

View File

@@ -241,6 +241,10 @@ void Controller::createContent() {
) | rpl::start_with_next([=](bool toggled) {
_dataSavedValue->joinToWrite = toggled;
}, wrap->lifetime());
} else {
_controls.whoSendWrap->toggle(
(_controls.privacy->value() == Privacy::HasUsername),
anim::type::instant);
}
auto joinToWrite = _controls.joinToWrite
? _controls.joinToWrite->toggledValue()

View File

@@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/wrap/wrap.h"
#include "ui/image/image_prepare.h"
#include "ui/text/text_utilities.h"
#include "ui/painter.h"
#include "info/profile/info_profile_text.h"
#include "media/streaming/media_streaming_instance.h"
#include "media/streaming/media_streaming_player.h"

View File

@@ -209,7 +209,7 @@ void ProcessFullPhoto(
const auto user = peer->asUser();
const auto username = peer->userName();
return PeerShortInfoFields{
.name = peer->name,
.name = peer->name(),
.phone = user ? Ui::FormatPhone(user->phone()) : QString(),
.link = ((user || username.isEmpty())
? QString()

View File

@@ -356,7 +356,7 @@ void PublicsController::rowRightActionClicked(not_null<PeerListRow*> row) {
lt_link,
peer->session().createInternalLink(peer->userName()),
lt_group,
peer->name);
peer->name());
const auto confirmText = tr::lng_channels_too_much_public_revoke(
tr::now);
const auto closeBox = _closeBox;
@@ -929,7 +929,7 @@ void AccountsLimitBox(
&& account->session().premiumPossible();
}) | ranges::views::transform([&](not_null<Main::Account*> account) {
const auto user = account->session().user();
return Args::Entry{ user->name, PaintUserpicCallback(user, false) };
return Args::Entry{ user->name(), PaintUserpicCallback(user, false)};
}) | ranges::views::take(defaultLimit) | ranges::to_vector;
const auto premiumPossible = !promotePossible.empty();

View File

@@ -12,7 +12,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_file_origin.h"
#include "data/data_document.h"
#include "data/data_session.h"
#include "data/data_message_reactions.h"
#include "data/data_document_media.h"
#include "data/data_streaming.h"
#include "data/data_peer_values.h"
@@ -32,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/gradient_round_button.h"
#include "ui/wrap/padding_wrap.h"
#include "ui/boxes/confirm_box.h"
#include "ui/painter.h"
#include "settings/settings_premium.h"
#include "lottie/lottie_single_player.h"
#include "history/view/media/history_view_sticker.h"
@@ -50,7 +50,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace {
constexpr auto kPremiumShift = 21. / 240;
constexpr auto kShiftDuration = crl::time(200);
constexpr auto kReactionsPerRow = 5;
constexpr auto kDisabledOpacity = 0.5;
constexpr auto kPreviewsCount = int(PremiumPreview::kCount);
@@ -59,10 +58,11 @@ constexpr auto kStarOpacityOff = 0.1;
constexpr auto kStarOpacityOn = 1.;
constexpr auto kStarPeriod = 3 * crl::time(1000);
using Data::ReactionId;
struct Descriptor {
PremiumPreview section = PremiumPreview::Stickers;
DocumentData *requestedSticker = nullptr;
base::flat_map<QString, ReactionDisableType> disabled;
bool fromSettings = false;
Fn<void()> hiddenCallback;
Fn<void(not_null<Ui::BoxContent*>)> shownCallback;
@@ -71,27 +71,9 @@ struct Descriptor {
bool operator==(const Descriptor &a, const Descriptor &b) {
return (a.section == b.section)
&& (a.requestedSticker == b.requestedSticker)
&& (a.disabled == b.disabled)
&& (a.fromSettings == b.fromSettings);
}
[[nodiscard]] int ComputeX(int column, int columns) {
const auto skip = st::premiumReactionWidthSkip;
const auto fullWidth = columns * skip;
const auto left = (st::boxWideWidth - fullWidth) / 2;
return left + column * skip + (skip / 2);
}
[[nodiscard]] int ComputeY(int row, int rows) {
const auto middle = (rows > 3)
? (st::premiumReactionInfoTop / 2)
: st::premiumReactionsMiddle;
const auto skip = st::premiumReactionHeightSkip;
const auto fullHeight = rows * skip;
const auto top = middle - (fullHeight / 2);
return top + row * skip + (skip / 2);
}
struct Preload {
Descriptor descriptor;
std::shared_ptr<Data::DocumentMedia> media;
@@ -119,8 +101,10 @@ void PreloadSticker(const std::shared_ptr<Data::DocumentMedia> &media) {
return tr::lng_premium_summary_subtitle_voice_to_text();
case PremiumPreview::NoAds:
return tr::lng_premium_summary_subtitle_no_ads();
case PremiumPreview::Reactions:
return tr::lng_premium_summary_subtitle_unique_reactions();
case PremiumPreview::EmojiStatus:
return tr::lng_premium_summary_subtitle_emoji_status();
case PremiumPreview::InfiniteReactions:
return tr::lng_premium_summary_subtitle_infinite_reactions();
case PremiumPreview::Stickers:
return tr::lng_premium_summary_subtitle_premium_stickers();
case PremiumPreview::AnimatedEmoji:
@@ -145,8 +129,10 @@ void PreloadSticker(const std::shared_ptr<Data::DocumentMedia> &media) {
return tr::lng_premium_summary_about_voice_to_text();
case PremiumPreview::NoAds:
return tr::lng_premium_summary_about_no_ads();
case PremiumPreview::Reactions:
return tr::lng_premium_summary_about_unique_reactions();
case PremiumPreview::EmojiStatus:
return tr::lng_premium_summary_about_emoji_status();
case PremiumPreview::InfiniteReactions:
return tr::lng_premium_summary_about_infinite_reactions();
case PremiumPreview::Stickers:
return tr::lng_premium_summary_about_premium_stickers();
case PremiumPreview::AnimatedEmoji:
@@ -464,6 +450,8 @@ struct VideoPreviewDocument {
case PremiumPreview::AnimatedEmoji: return "animated_emoji";
case PremiumPreview::AdvancedChatManagement:
return "advanced_chat_management";
case PremiumPreview::EmojiStatus: return "emoji_status";
case PremiumPreview::InfiniteReactions: return "infinite_reactions";
case PremiumPreview::ProfileBadge: return "profile_badge";
case PremiumPreview::AnimatedUserpics: return "animated_userpics";
}
@@ -725,423 +713,12 @@ struct VideoPreviewDocument {
return result;
}
class ReactionPreview final {
public:
ReactionPreview(
not_null<Window::SessionController*> controller,
const Data::Reaction &reaction,
ReactionDisableType type,
Fn<void()> update,
QPoint position);
[[nodiscard]] bool playsEffect() const;
void paint(Painter &p);
void paintEffect(QPainter &p);
void setOver(bool over);
void startAnimations();
void cancelAnimations();
[[nodiscard]] bool ready() const;
[[nodiscard]] bool disabled() const;
[[nodiscard]] QRect geometry() const;
private:
void checkReady();
const not_null<Window::SessionController*> _controller;
const Fn<void()> _update;
const QPoint _position;
Ui::Animations::Simple _scale;
std::shared_ptr<Data::DocumentMedia> _centerMedia;
std::shared_ptr<Data::DocumentMedia> _aroundMedia;
std::unique_ptr<Lottie::SinglePlayer> _center;
std::unique_ptr<Lottie::SinglePlayer> _around;
std::unique_ptr<Ui::PathShiftGradient> _pathGradient;
QImage _cache1;
QImage _cache2;
bool _over = false;
bool _disabled = false;
bool _playRequested = false;
bool _aroundPlaying = false;
bool _centerPlaying = false;
rpl::lifetime _lifetime;
};
ReactionPreview::ReactionPreview(
not_null<Window::SessionController*> controller,
const Data::Reaction &reaction,
ReactionDisableType type,
Fn<void()> update,
QPoint position)
: _controller(controller)
, _update(std::move(update))
, _position(position)
, _centerMedia(reaction.centerIcon->createMediaView())
, _aroundMedia(reaction.aroundAnimation->createMediaView())
, _pathGradient(
HistoryView::MakePathShiftGradient(
controller->chatStyle(),
_update))
, _disabled(type != ReactionDisableType::None) {
_centerMedia->checkStickerLarge();
_aroundMedia->checkStickerLarge();
checkReady();
if (!_center || !_around) {
_controller->session().downloaderTaskFinished(
) | rpl::take_while([=] {
checkReady();
return !_center || !_around;
}) | rpl::start(_lifetime);
}
}
QRect ReactionPreview::geometry() const {
const auto xsize = st::premiumReactionWidthSkip;
const auto ysize = st::premiumReactionHeightSkip;
return { _position - QPoint(xsize / 2, ysize / 2), QSize(xsize, ysize) };
}
void ReactionPreview::checkReady() {
const auto make = [&](
const std::shared_ptr<Data::DocumentMedia> &media,
int size) {
const auto bytes = media->bytes();
const auto filepath = media->owner()->filepath();
auto result = ChatHelpers::LottiePlayerFromDocument(
media.get(),
nullptr,
ChatHelpers::StickerLottieSize::PremiumReactionPreview,
QSize(size, size) * style::DevicePixelRatio(),
Lottie::Quality::Default);
result->updates() | rpl::start_with_next(_update, _lifetime);
return result;
};
if (!_center && _centerMedia->loaded()) {
_center = make(_centerMedia, st::premiumReactionSize);
}
if (!_around && _aroundMedia->loaded()) {
_around = make(_aroundMedia, st::premiumReactionAround);
}
}
void ReactionPreview::setOver(bool over) {
if (_over == over || _disabled) {
return;
}
_over = over;
const auto from = st::premiumReactionScale;
_scale.start(
_update,
over ? from : 1.,
over ? 1. : from,
st::slideWrapDuration);
}
void ReactionPreview::startAnimations() {
if (_disabled) {
return;
}
_playRequested = true;
if (!_center || !_center->ready() || !_around || !_around->ready()) {
return;
}
_update();
}
void ReactionPreview::cancelAnimations() {
_playRequested = false;
}
bool ReactionPreview::ready() const {
return _center && _center->ready();
}
bool ReactionPreview::disabled() const {
return _disabled;
}
void ReactionPreview::paint(Painter &p) {
const auto center = st::premiumReactionSize;
const auto scale = _scale.value(_over ? 1. : st::premiumReactionScale);
const auto inner = QRect(
-center / 2,
-center / 2,
center,
center
).translated(_position);
auto hq = PainterHighQualityEnabler(p);
const auto centerReady = _center && _center->ready();
const auto staticCenter = centerReady && !_centerPlaying;
const auto use1 = staticCenter && scale == 1.;
const auto use2 = staticCenter && scale == st::premiumReactionScale;
const auto useScale = (!use1 && !use2 && scale != 1.);
if (useScale) {
p.save();
p.translate(inner.center());
p.scale(scale, scale);
p.translate(-inner.center());
}
if (_disabled) {
p.setOpacity(kDisabledOpacity);
}
checkReady();
if (centerReady) {
if (use1 || use2) {
auto &cache = use1 ? _cache1 : _cache2;
const auto use = int(std::round(center * scale));
const auto rect = QRect(-use / 2, -use / 2, use, use).translated(
_position);
if (cache.isNull()) {
cache = _center->frame().scaledToWidth(
use * style::DevicePixelRatio(),
Qt::SmoothTransformation);
}
p.drawImage(rect, cache);
} else {
p.drawImage(inner, _center->frame());
}
if (_centerPlaying) {
const auto almost = (_center->frameIndex() + 1)
== _center->framesCount();
const auto marked = _center->markFrameShown();
if (almost && marked) {
_centerPlaying = false;
}
}
if (_around
&& _around->ready()
&& !_aroundPlaying
&& !_centerPlaying
&& _playRequested) {
_aroundPlaying = _centerPlaying = true;
_playRequested = false;
}
} else {
p.setBrush(_controller->chatStyle()->msgServiceBg());
ChatHelpers::PaintStickerThumbnailPath(
p,
_centerMedia.get(),
inner,
_pathGradient.get());
}
if (useScale) {
p.restore();
} else if (_disabled) {
p.setOpacity(1.);
}
}
bool ReactionPreview::playsEffect() const {
return _aroundPlaying;
}
void ReactionPreview::paintEffect(QPainter &p) {
if (!_aroundPlaying) {
return;
}
const auto size = st::premiumReactionAround;
const auto outer = QRect(-size/2, -size/2, size, size).translated(
_position);
const auto scale = _scale.value(_over ? 1. : st::premiumReactionScale);
auto hq = PainterHighQualityEnabler(p);
if (scale != 1.) {
p.save();
p.translate(outer.center());
p.scale(scale, scale);
p.translate(-outer.center());
}
p.drawImage(outer, _around->frame());
if (scale != 1.) {
p.restore();
}
if (_aroundPlaying) {
const auto almost = (_around->frameIndex() + 1)
== _around->framesCount();
const auto marked = _around->markFrameShown();
if (almost && marked) {
_aroundPlaying = false;
}
}
}
[[nodiscard]] not_null<Ui::RpWidget*> ReactionsPreview(
not_null<Ui::RpWidget*> parent,
not_null<Window::SessionController*> controller,
const base::flat_map<QString, ReactionDisableType> &disabled,
Fn<void()> readyCallback) {
struct State {
std::vector<std::unique_ptr<ReactionPreview>> entries;
Ui::Text::String bottom;
int selected = -1;
bool readyInvoked = false;
};
const auto result = Ui::CreateChild<Ui::RpWidget>(parent.get());
result->show();
auto &lifetime = result->lifetime();
const auto state = lifetime.make_state<State>();
result->setMouseTracking(true);
parent->sizeValue(
) | rpl::start_with_next([=] {
result->setGeometry(parent->rect());
}, result->lifetime());
using namespace HistoryView;
const auto list = controller->session().data().reactions().list(
Data::Reactions::Type::Active);
const auto count = ranges::count(list, true, &Data::Reaction::premium);
const auto rows = (count + kReactionsPerRow - 1) / kReactionsPerRow;
const auto inrowmax = (count + rows - 1) / rows;
const auto inrowless = (inrowmax * rows - count);
const auto inrowmore = rows - inrowless;
const auto inmaxrows = inrowmore * inrowmax;
auto index = 0;
auto disableType = ReactionDisableType::None;
for (const auto &reaction : list) {
if (!reaction.premium) {
continue;
}
const auto inrow = (index < inmaxrows) ? inrowmax : (inrowmax - 1);
const auto row = (index < inmaxrows)
? (index / inrow)
: (inrowmore + ((index - inmaxrows) / inrow));
const auto column = (index < inmaxrows)
? (index % inrow)
: ((index - inmaxrows) % inrow);
++index;
if (!reaction.centerIcon || !reaction.aroundAnimation) {
continue;
}
const auto i = disabled.find(reaction.emoji);
const auto disable = (i != end(disabled))
? i->second
: ReactionDisableType::None;
if (disable != ReactionDisableType::None) {
disableType = disable;
}
state->entries.push_back(std::make_unique<ReactionPreview>(
controller,
reaction,
disable,
[=] { result->update(); },
QPoint(ComputeX(column, inrow), ComputeY(row, rows))));
}
const auto bottom1 = tr::lng_reaction_premium_info(tr::now);
const auto bottom2 = (disableType == ReactionDisableType::None)
? QString()
: (disableType == ReactionDisableType::Group)
? tr::lng_reaction_premium_no_group(tr::now)
: tr::lng_reaction_premium_no_channel(tr::now);
state->bottom.setText(
st::defaultTextStyle,
(bottom1 + '\n' + bottom2).trimmed());
result->paintRequest(
) | rpl::start_with_next([=] {
auto p = Painter(result);
auto effects = std::vector<Fn<void()>>();
auto ready = 0;
for (const auto &entry : state->entries) {
entry->paint(p);
if (entry->ready()) {
++ready;
}
if (entry->playsEffect()) {
effects.push_back([&] {
entry->paintEffect(p);
});
}
}
if (!state->readyInvoked
&& readyCallback
&& ready > 0
&& ready == state->entries.size()) {
state->readyInvoked = true;
readyCallback();
}
const auto padding = st::boxRowPadding;
const auto available = parent->width()
- padding.left()
- padding.right();
const auto top = st::premiumReactionInfoTop
+ ((state->bottom.maxWidth() > available)
? st::normalFont->height
: 0);
p.setPen(st::premiumButtonFg);
state->bottom.draw(
p,
padding.left(),
top,
available,
style::al_top);
for (const auto &paint : effects) {
paint();
}
}, lifetime);
const auto lookup = [=](QPoint point) {
auto index = 0;
for (const auto &entry : state->entries) {
if (entry->geometry().contains(point) && !entry->disabled()) {
return index;
}
++index;
}
return -1;
};
const auto select = [=](int index) {
const auto wasInside = (state->selected >= 0);
const auto nowInside = (index >= 0);
if (state->selected != index) {
if (wasInside) {
state->entries[state->selected]->setOver(false);
}
if (nowInside) {
state->entries[index]->setOver(true);
}
state->selected = index;
}
if (wasInside != nowInside) {
result->setCursor(nowInside
? style::cur_pointer
: style::cur_default);
}
};
result->events(
) | rpl::start_with_next([=](not_null<QEvent*> event) {
if (event->type() == QEvent::MouseButtonPress) {
const auto point = static_cast<QMouseEvent*>(event.get())->pos();
if (state->selected >= 0) {
state->entries[state->selected]->cancelAnimations();
}
if (const auto index = lookup(point); index >= 0) {
state->entries[index]->startAnimations();
}
} else if (event->type() == QEvent::MouseMove) {
const auto point = static_cast<QMouseEvent*>(event.get())->pos();
select(lookup(point));
} else if (event->type() == QEvent::Leave) {
select(-1);
}
}, lifetime);
return result;
}
[[nodiscard]] not_null<Ui::RpWidget*> GenerateDefaultPreview(
not_null<Ui::RpWidget*> parent,
not_null<Window::SessionController*> controller,
PremiumPreview section,
Fn<void()> readyCallback) {
switch (section) {
case PremiumPreview::Reactions:
return ReactionsPreview(parent, controller, {}, readyCallback);
case PremiumPreview::Stickers:
return StickersPreview(parent, controller, readyCallback);
default:
@@ -1227,8 +804,6 @@ void PreviewBox(
Ui::RpWidget *content = nullptr;
Ui::RpWidget *stickersPreload = nullptr;
bool stickersPreloadReady = false;
Ui::RpWidget *reactionsPreload = nullptr;
bool reactionsPreloadReady = false;
bool preloadScheduled = false;
bool showFinished = false;
Ui::Animations::Simple animation;
@@ -1291,21 +866,6 @@ void PreviewBox(
ready);
state->stickersPreload->hide();
}
if (now != PremiumPreview::Reactions && !state->reactionsPreload) {
const auto ready = [=] {
if (state->reactionsPreload) {
state->reactionsPreloadReady = true;
} else {
state->preload();
}
};
state->reactionsPreload = GenerateDefaultPreview(
outer,
controller,
PremiumPreview::Reactions,
ready);
state->reactionsPreload->hide();
}
};
switch (descriptor.section) {
@@ -1314,13 +874,6 @@ void PreviewBox(
? StickerPreview(outer, controller, media, state->preload)
: StickersPreview(outer, controller, state->preload);
break;
case PremiumPreview::Reactions:
state->content = ReactionsPreview(
outer,
controller,
descriptor.disabled,
state->preload);
break;
default:
state->content = GenericPreview(
outer,
@@ -1380,13 +933,6 @@ void PreviewBox(
if (base::take(state->stickersPreloadReady)) {
state->preload();
}
} else if (now == PremiumPreview::Reactions
&& state->reactionsPreload) {
state->content = base::take(state->reactionsPreload);
state->content->show();
if (base::take(state->reactionsPreloadReady)) {
state->preload();
}
} else {
state->content = GenerateDefaultPreview(
outer,
@@ -1456,12 +1002,14 @@ void PreviewBox(
};
auto unlock = state->selected.value(
) | rpl::map([=](PremiumPreview section) {
return (section == PremiumPreview::Reactions)
return (section == PremiumPreview::InfiniteReactions)
? tr::lng_premium_unlock_reactions()
: (section == PremiumPreview::Stickers)
? tr::lng_premium_unlock_stickers()
: (section == PremiumPreview::AnimatedEmoji)
? tr::lng_premium_unlock_emoji()
: (section == PremiumPreview::EmojiStatus)
? tr::lng_premium_unlock_status()
: tr::lng_premium_more_about();
}) | rpl::flatten_latest();
auto button = descriptor.fromSettings
@@ -1624,11 +1172,9 @@ void ShowStickerPreviewBox(
void ShowPremiumPreviewBox(
not_null<Window::SessionController*> controller,
PremiumPreview section,
const base::flat_map<QString, ReactionDisableType> &disabled,
Fn<void(not_null<Ui::BoxContent*>)> shown) {
Show(controller, Descriptor{
.section = section,
.disabled = disabled,
.shownCallback = std::move(shown),
});
}
@@ -1671,14 +1217,14 @@ void DoubledLimitsPreviewBox(
});
}
{
const auto premium = limits.dialogsFolderPinnedPremium();
const auto premium = limits.dialogsPinnedPremium();
entries.push_back(Ui::Premium::ListEntry{
tr::lng_premium_double_limits_subtitle_pins(),
tr::lng_premium_double_limits_about_pins(
lt_count,
rpl::single(float64(premium)),
Ui::Text::RichLangValue),
limits.dialogsFolderPinnedDefault(),
limits.dialogsPinnedDefault(),
premium,
});
}

View File

@@ -11,6 +11,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
class DocumentData;
namespace Data {
struct ReactionId;
} // namespace Data
namespace Ui {
class BoxContent;
class GenericBox;
@@ -38,7 +42,8 @@ enum class PremiumPreview {
FasterDownload,
VoiceToText,
NoAds,
Reactions,
EmojiStatus,
InfiniteReactions,
Stickers,
AnimatedEmoji,
AdvancedChatManagement,
@@ -47,16 +52,10 @@ enum class PremiumPreview {
kCount,
};
enum class ReactionDisableType {
None,
Group,
Channel,
};
void ShowPremiumPreviewBox(
not_null<Window::SessionController*> controller,
PremiumPreview section,
const base::flat_map<QString, ReactionDisableType> &disabled = {},
Fn<void(not_null<Ui::BoxContent*>)> shown = nullptr);
void ShowPremiumPreviewToBuy(

Some files were not shown because too many files have changed in this diff Show More