Compare commits

..

180 Commits

Author SHA1 Message Date
John Preston
d679703bbf Version 2.1.6.
- Fix automatic downloads on Windows by clean rebuild.
2020-05-14 01:16:13 +04:00
John Preston
66a3e36024 Version 2.1.5.
- Disable the taskbar icon flash or the dock icon bounce
in Settings > Notifications.
- View messages containing long monospace texts in wide bubbles.
- Bug fixes and other minor improvements.
2020-05-13 18:22:05 +04:00
John Preston
31e38e1690 Fix layout of community transfer error box. 2020-05-13 18:19:09 +04:00
John Preston
da10059f45 Update lib_lottie, hide rlottie dependency. 2020-05-13 17:07:26 +04:00
John Preston
cb5863177f Apply edition updates to search result previews. 2020-05-12 20:29:18 +04:00
John Preston
84399286c1 Update build instructions. 2020-05-12 19:43:39 +04:00
John Preston
2e92441b3a Add input method field text edit workaround. 2020-05-12 19:26:50 +04:00
John Preston
7883f97c94 Use precise sync of the server unixtime. 2020-05-12 17:33:06 +04:00
Ilya Fedin
297b5d6a76 Update submodules 2020-05-12 17:32:40 +04:00
Ilya Fedin
492dc2568c Add DESKTOP_APP_USE_PACKAGED support for Windows 2020-05-12 17:32:40 +04:00
John Preston
547c657b1a Don't reset search results on dialogs re-open. 2020-05-12 16:30:31 +04:00
John Preston
c478d96385 Add debug logs for chats reading requests. 2020-05-12 16:18:19 +04:00
John Preston
2ede53e0ee Always try to open new provided URL.
Fixes #6941.
2020-05-12 16:15:22 +04:00
John Preston
6f760d513e Add a checkbox to disable taskbar flash.
Also add ability to set urgent flag for the window on Linux.

Fixes #223, fixes #897, fixes #906.
2020-05-12 14:16:24 +04:00
John Preston
f4f6550d66 Clear fake-unread status when switching folders. 2020-05-12 12:18:52 +04:00
John Preston
c7878f9d21 Pause by-emoji stickers on sticker preview. 2020-05-12 12:18:31 +04:00
John Preston
cd75a45673 Disable create polls in support accounts. 2020-05-12 11:26:47 +04:00
John Preston
07e3671ca8 Allow monospace blocks to extend bubble width.
This partially fixes #2060 instead of additional settings from #7822.
2020-05-12 11:07:41 +04:00
23rd
295aa644bf Fixed master branch updater Github Action. 2020-05-12 09:55:36 +04:00
John Preston
b5b78c0ade Update submodules. 2020-05-12 09:44:24 +04:00
John Preston
f5c0e5d31d Remove unnecessary include. 2020-05-12 09:43:54 +04:00
root
246ed43046 Remove replyTo from switchInlineBotButton in same peer 2020-05-12 09:29:30 +04:00
Ilya Fedin
701e1d7b4d Add fcitx5 support 2020-05-12 09:26:04 +04:00
Ilya Fedin
9cbe899688 Fix call window hiding when compositing is not supported 2020-05-12 09:17:27 +04:00
Ilya Fedin
7409d615a3 Add a cheat code to enable freetype on Windows and macOS 2020-05-10 17:09:59 +04:00
John Preston
c9553c2d4c Version 2.1.4.
- Improve bold font selection.
2020-05-08 20:34:00 +04:00
John Preston
bedefaee4d Version 2.1.3.
- Added support for new emoji.
- Channels to which you can't post will no longer be suggested when forwarding.
- Improved font selection and bold font support for CJK and Farsi.
2020-05-08 16:48:56 +04:00
John Preston
5d3b8f02fc Add Vazir font as a fallback for Farsi. 2020-05-08 13:38:23 +04:00
John Preston
5120d3ef2c Skip channels without write access in forward box. 2020-05-08 13:35:16 +04:00
John Preston
82a372873f Add two local urls to open language selection box.
tg://setlanguage and tg://settings/language

Fixes #7831.
2020-05-08 13:03:49 +04:00
Ilya Fedin
d1d1f83881 Remove outdated LIBGL_ALWAYS_INDIRECT hack 2020-05-08 12:54:21 +04:00
Ilya Fedin
78c3c86fe6 Check only if at least one audio device is exist on startup
This makes https://github.com/telegramdesktop/tdesktop/issues/1548 don't affect on startup, but only when capture feature is used
2020-05-08 12:50:25 +04:00
Ilya Fedin
447d4e6c47 Remove Portaudio from building instructions
Since it loaded at runtime with dlopen anyway and headers from the system package are OK
2020-05-08 12:49:21 +04:00
John Preston
d0e3d15e8e Update supported systems information. 2020-05-08 12:27:55 +04:00
John Preston
0251f58bf2 Use Semibold in names, use Bold in messages.
Fixes #7813, fixes #7823.
2020-05-08 12:12:47 +04:00
John Preston
36997f084a Automatically load and apply old emoji set by id. 2020-05-08 11:22:22 +04:00
John Preston
942fcb9aae Add new emoji sets file ids. 2020-05-07 19:05:57 +04:00
John Preston
6232dce1a3 Update emoji in the built-in data and sprites. 2020-05-06 19:29:02 +04:00
23rd
0c0fc46b90 Added Github Action that updates code in master branch. 2020-05-06 13:29:17 +04:00
23rd
dcf737bebe Fixed Linux build instruction. 2020-05-06 00:36:48 +03:00
23rd
919834093e Added TG for macOS version check to issue closer. 2020-05-05 18:22:54 +04:00
John Preston
99ccd49e13 Version 2.1.2: Update patches revision in docs. 2020-05-05 18:14:38 +04:00
John Preston
29896b2efd Version 2.1.2: Update Mac App Store build script. 2020-05-05 17:35:42 +04:00
John Preston
1b7f3db43a Version 2.1.2.
- Fix polls and quizes results viewing.
- Fix memory leak in web page previews with autoplayed videos.
- Fix running on OS X 10.10.
- Other minor bug fixes and improvements.
2020-05-05 17:20:03 +04:00
John Preston
1fa22398a9 Fix returning of tabbed panel in third column. 2020-05-05 16:55:05 +04:00
John Preston
0e16b3fe69 Decrease sticker size 256px -> 228px. 2020-05-05 16:19:10 +04:00
John Preston
462020d54c Update submodules. 2020-05-05 16:19:00 +04:00
John Preston
9c17147f60 Show only one dice-media tooltip. Hide on SEND. 2020-05-05 15:51:55 +04:00
Ilya Fedin
0bf933b009 Remove dependencies from snap that are present in kde-frameworks-5-core18 snap 2020-05-05 14:31:18 +04:00
Ilya Fedin
27f6c8ce62 Move CMAKE_DL_LIBS to libtgvoip cmake file and add missed pthread
Remove unneeded minizip include directory from cmake

Remove unneeded compile definations

Opus is needed only by libtgvoip
2020-05-05 14:31:18 +04:00
Ilya Fedin
3135463017 Add new option to simplify creation of self-contained packages (snap/flatpak/appimage) 2020-05-05 14:31:18 +04:00
RadRussianRus
89950de93e Do not ignore changes for docs needed for build 2020-05-05 14:20:58 +04:00
Ilya Fedin
13c2d6ff72 Detect global menu at runtime 2020-05-05 09:54:35 +04:00
John Preston
5e70bf64c6 Fix adding the string. 2020-05-04 19:16:41 +04:00
John Preston
3260e9e752 Add a separate string for empty channel admin log. 2020-05-04 19:15:10 +04:00
John Preston
1f16ac59ca Try to fix a crash in pinned reordering. 2020-05-04 19:06:53 +04:00
RadRussianRus
87bf0654a2 Move "X groups in common" in shared media to bottom 2020-05-04 18:36:47 +04:00
John Preston
6adcf660f1 Guard click handlers that capture session data.
Click handlers invocation is done by posting on_main,
so in rare cases the session may be already destroyed.
2020-05-04 17:38:49 +04:00
John Preston
038d8f1781 Force non-empty text in message bubbles. 2020-05-04 17:03:47 +04:00
John Preston
a5977f5f7a Don't link unneeded frameworks in OS X version.
Fixes #7786.
2020-05-04 16:52:07 +04:00
John Preston
2143864fd5 Remove views count from admin log. 2020-05-04 16:15:09 +04:00
John Preston
73691e795b Fix broken poll results view.
Regression was introduced in dd78052f92.

Fixes #7780.

Copy-Paste is bad.
2020-05-04 14:42:06 +04:00
John Preston
c0246a9373 Fix pasting of an image with attached URL data.
Regression was introduced in db5d599052.

Fixes #7794.
2020-05-04 14:18:33 +04:00
John Preston
1af394a485 Fix video unloading in streaming in WebPage-s.
Fixes #7778.
2020-05-04 13:27:30 +04:00
Ilya Fedin
5180d31b40 Fix decoration applying and trigger repainting on update
For some reason this is needed for newer Qt in flatpak
2020-05-02 16:29:00 +04:00
John Preston
07c8aae225 Version 2.1.1: Pin to top only new bots. 2020-05-01 21:20:10 +04:00
John Preston
3c1c17ef80 Version 2.1.1: Remove font substitutions on Win. 2020-05-01 19:59:54 +04:00
Ilya Fedin
b79ecb5909 Show friendly warning if snapd didn't update snap right for some reason 2020-05-01 17:30:11 +04:00
John Preston
b98f0933af Version 2.1.1.
- Improve quiz explanation tooltip layout.
- Fix possible crash in theme editor.
- Other minor bug fixes and improvements.
2020-05-01 17:16:57 +04:00
John Preston
05dcd6fc9c Fix possible crash in rlottie.
Fixes #7767.
2020-05-01 17:16:57 +04:00
John Preston
19bcc145ad Fix crash in theme editor. 2020-05-01 16:27:55 +04:00
John Preston
4ae760dd7e Fix send files emoji panel geometry.
Fixes #7704.
2020-05-01 16:05:24 +04:00
RadRussianRus
cad4d19272 Use "subscribers" instead of "members" in channels 2020-05-01 15:48:07 +04:00
Aokromes
ae64747489 Remove whitespaces, fix spaces 2020-05-01 14:47:33 +04:00
John Preston
db5d599052 Don't resolve the actual QImage on paste check. 2020-05-01 14:43:02 +04:00
John Preston
cc463b07b1 Don't send dice / dart to channels.
Fixes #7703.
2020-05-01 14:35:20 +04:00
John Preston
d8e55081b0 Disallow revoking dice media in first 24 hours.
Fixes #7745.
2020-05-01 13:21:57 +04:00
John Preston
9c66bd553a Increment emoji cache version. 2020-05-01 12:59:23 +04:00
23rd
a6bb180e22 Fixed rendering of colored Apple emoji with gender.
Fixed #6024.
2020-05-01 12:46:31 +04:00
John Preston
38ca3ba341 Update submodules. 2020-05-01 12:32:03 +04:00
23rd
8ef00dc4ff Fixed resetting menu scroll after refresh of filter list. 2020-05-01 12:31:13 +04:00
23rd
1630ad0804 Fixed crash when user pins chat in remotely removed filter. 2020-05-01 12:31:13 +04:00
23rd
c3c482aa50 Improved peer context menu item to archive chat. 2020-05-01 12:31:13 +04:00
23rd
f4a63e1e9d Removed info display for last messages in Saved Messages. 2020-05-01 12:31:13 +04:00
Ilya Fedin
161e51757c Change color of wayland decoration according to theme 2020-05-01 12:26:10 +04:00
Ilya Fedin
46d4b03d49 Fix freeze in notifications settings when notification daemon is unavailable 2020-05-01 12:15:01 +04:00
RadRussianRus
48743a7973 Exclude files that aren't necessary for actions 2020-05-01 12:12:49 +04:00
seniorivn
6709147560 Update shortcuts.cpp 2020-05-01 12:11:14 +04:00
seniorivn
0b2d4326e7 add folder commands for custom config 2020-05-01 12:11:14 +04:00
RadRussianRus
ca49e74b6f Show bot privacy status 2020-05-01 12:10:32 +04:00
Ilya Fedin
95b4f56b86 Don't use QDesktopServices::openUrl on snap 2020-05-01 12:06:01 +04:00
Nicholas Guriev
9828262a03 Update GSL to v3.0.1 and lib_base
* Use identical types for std::min.
2020-05-01 12:03:18 +04:00
John Preston
f76e094e98 Use info toast to show proxy / psa about text. 2020-04-30 15:20:50 +04:00
John Preston
067e52f5d1 Add an icon to the psa / quiz tooltip. 2020-04-30 14:51:26 +04:00
John Preston
4efd649c27 Hide tooltip button in psa / quizes. 2020-04-30 14:11:05 +04:00
John Preston
ff25f1d5c9 Slide psa / quiz toast from the top. 2020-04-30 13:16:42 +04:00
John Preston
dd78052f92 Use new toast style structure. 2020-04-30 11:35:01 +04:00
John Preston
8a4c7e3994 Show PSA tooltip icon and tooltip. 2020-04-30 11:35:01 +04:00
John Preston
44e71dfa03 Allow hiding PSA from the chats list. 2020-04-30 11:35:01 +04:00
John Preston
b6e184d0c8 Support bots as top promoted dialog entries. 2020-04-30 11:35:01 +04:00
John Preston
042ed8f54a Support psa_message in chats list. 2020-04-30 11:35:01 +04:00
John Preston
aabc8173c3 Use similar margins in all controls. 2020-04-30 11:35:01 +04:00
John Preston
c14e20b33f Support PSA forwarded info. 2020-04-30 11:35:01 +04:00
John Preston
266c1531ce Display PSA label instead of the proxy sponsor. 2020-04-30 11:35:01 +04:00
John Preston
8d632bd2be Update API scheme to layer 103. 2020-04-30 11:35:01 +04:00
John Preston
c70a1f03de Fix applying poll updates. 2020-04-30 11:35:01 +04:00
Ilya Fedin
17de6c1ff3 Fix scaling in crash reporter 2020-04-29 15:51:24 +04:00
Stepan Skryabin
4e210e40a2 Update supported Ubuntu version 2020-04-28 19:01:05 +04:00
Ilya Fedin
e13593b095 Restore setFamily in crash report window
Since setFamily in QApplication::setFont was removed
2020-04-28 19:00:44 +04:00
Ilya Fedin
e149f10d40 Revert gtk3 dialog in snap 2020-04-26 12:28:34 +04:00
Ilya Fedin
7f890122e6 Add methods to detect appimage, static binary and forced gtk dialog 2020-04-26 12:28:34 +04:00
Ilya Fedin
422831fa79 Update snap cache 2020-04-26 12:25:01 +04:00
Ilya Fedin
7494468f1f Add cinnamon gsettings schema to snap
Fixes #7697
2020-04-26 12:25:01 +04:00
Ilya Fedin
7bc86cc9af Fix directory opening with portal and use them by default with KDE 2020-04-24 14:33:26 +04:00
John Preston
c1f3fe1961 Version 2.1.
- Access a catalog of over 20,000 stickers made by professional
artists from the updated Sticker Panel by clicking the '+' icon.
- Use sticker search to find the stickers you're looking for - or
scroll from the latest packs all the way to the classics.
- Add explanations that appear after users respond to a quiz question.
- See how much time you have left to answer a question from @QuizBot
with the new countdown animation.
- Send a single 🎯 emoji to see if you hit the bullseye.
2020-04-24 09:08:08 +04:00
John Preston
cfd733c54c Add confirmation box for suspicious urls. 2020-04-23 19:00:19 +04:00
John Preston
3fa5e004fe Allow editing messages in channels indefinitely. 2020-04-23 16:21:30 +04:00
John Preston
862e4e45ad Closed alpha version 2.0.1.3. 2020-04-21 18:55:56 +04:00
John Preston
53df4d1b10 Fix magic for initConnection. 2020-04-21 18:55:35 +04:00
John Preston
5cfd402b70 Make darker toasts for quiz solutions. 2020-04-21 18:55:35 +04:00
John Preston
57e9651a8a Fix visual glitch in poll results viewing.
We need a visible widget to mark more button height.
An invisible 'more' button doesn't receive geometry change events.
2020-04-21 18:55:35 +04:00
John Preston
53d206c12c Custom tab-order for create poll box. 2020-04-21 18:55:35 +04:00
John Preston
46f3cf3395 Load more official sets while scrolling. 2020-04-21 18:55:35 +04:00
John Preston
dfc0491524 Improve trending stickers layout and position. 2020-04-21 18:55:35 +04:00
John Preston
54f757e770 Allow sending dice from dice media tooltip. 2020-04-21 18:55:35 +04:00
John Preston
abfd3ad1b9 Use built-in zero-value dice animations. 2020-04-21 18:55:35 +04:00
John Preston
bed208d621 Send dice media based on appconfig. 2020-04-21 18:55:35 +04:00
John Preston
33c453a13c Scroll history to bottom on sending a message. 2020-04-21 18:55:35 +04:00
John Preston
e118972d5c Support generic dice media display. 2020-04-21 18:55:35 +04:00
John Preston
fb8a9a930c Closed alpha version 2.0.1.2. 2020-04-21 18:55:35 +04:00
John Preston
7a9cfcc40d Improve poll closing by timer and results reloading. 2020-04-21 18:55:35 +04:00
John Preston
e1dc15321a Work around 32-bitness of GetLastInputInfo.
Fixes #7637.
2020-04-21 18:55:35 +04:00
John Preston
2b5e575b67 Closed alpha version 2.0.1.1: Fix macOS fonts. 2020-04-21 18:55:34 +04:00
John Preston
42e216603c Closed alpha version 2.0.1.1. 2020-04-21 18:55:34 +04:00
23rd
d46e145c61 Updated Qt to 5.12.8. 2020-04-21 18:55:34 +04:00
John Preston
5dcb232b77 Force reload results on auto-closed quiz. 2020-04-21 18:55:34 +04:00
John Preston
b34d5b8306 Check solution length in CreatePollBox. 2020-04-21 18:55:34 +04:00
John Preston
76d81ff197 Improve polls solution icon color. 2020-04-21 18:55:34 +04:00
John Preston
71637d2a0e Show progress left to close by timer in polls. 2020-04-21 18:55:34 +04:00
John Preston
423daecbde Add view solution button to polls. 2020-04-21 18:55:34 +04:00
John Preston
3cb76fb80b Support poll closing by date. 2020-04-21 18:55:34 +04:00
John Preston
6882093ed1 Send init connection params. 2020-04-21 18:55:34 +04:00
John Preston
699761b42f Support poll solution display in a toast. 2020-04-21 18:55:34 +04:00
John Preston
f50c50a152 Fix path choosing for Windows Store version. 2020-04-21 18:55:34 +04:00
John Preston
13d22947df Send poll solution with entities. 2020-04-21 18:55:34 +04:00
John Preston
6c08bab550 Add explanation block to CreatePollBox. 2020-04-21 18:55:34 +04:00
John Preston
3e2f4bed50 Update scheme to layer 102.
Support different dice-like media.
2020-04-21 18:55:34 +04:00
Ilya Fedin
41d39012d2 Synchronize AppMenu availability check with Qt 2020-04-21 14:06:03 +04:00
Ilya Fedin
a7764f84f0 Proper usage of pkg-config 2020-04-21 14:05:22 +04:00
VictorienXP
85fcec2fb5 Add .opus and .oga files as song formats 2020-04-21 14:04:51 +04:00
Ilya Fedin
82e835fbc2 Fix snap action 2020-04-20 10:52:10 +04:00
Ilya Fedin
80684d9073 Remove unnecessary files from snap 2020-04-20 10:52:10 +04:00
Ilya Fedin
b04f0e0d3d Use kde-neon extension for better desktop integration 2020-04-20 10:52:10 +04:00
23rd
65cc9bcd87 Updated parser of issue closer since template was changed.
The issue template was changed in de78f4255e.
2020-04-13 17:18:59 +03:00
Ilya Fedin
bc06a3aea3 Make actions ignore .md files not only in the root of repository 2020-04-13 17:39:00 +04:00
Ilya Fedin
de78f4255e Add installation method to bug report template 2020-04-13 17:39:00 +04:00
John Preston
d67dafaccb Fix check for 4K frame size in streaming. 2020-04-13 15:32:20 +04:00
John Preston
4f8ea4c807 Allow to play in-app large videos. 2020-04-13 15:32:14 +04:00
John Preston
15b19f8565 Allow sending large images again (up to 108MP). 2020-04-13 15:32:06 +04:00
John Preston
b16696db93 Don't scroll down when read from another device. 2020-04-13 15:31:54 +04:00
John Preston
63129072ba Mark voice/video message as read on mention click.
Fixes #5623.
2020-04-13 15:30:56 +04:00
John Preston
1fdd591aa0 Change manage folders button icon. 2020-04-13 15:30:40 +04:00
John Preston
f370ca97d0 Fix folders visibility above passcode lock. 2020-04-13 15:30:23 +04:00
John Preston
f5aba5a907 Fix build with new lib_ui commits. 2020-04-13 15:26:09 +04:00
Ilya Fedin
1d613995db Disable building of dav1d tools and tests in snap 2020-04-13 15:16:33 +04:00
Ilya Fedin
5bb1c77199 Use OpenAL without direct channels 2020-04-13 15:15:29 +04:00
Ilya Fedin
5b39c7013a Better algorithm for font choosing 2020-04-13 11:48:14 +04:00
Ilya Fedin
ed91c07f99 Restore the old behavior with fallback fontconfig configuration
With current code fallback works only through time and replaces the config even if it is changed by the user.

This commit fixes that.
2020-04-13 10:49:30 +04:00
Ilya Fedin
a66b2a4056 Synchronize snap ffmpeg arguments with generic linux one 2020-04-13 10:44:29 +04:00
Ilya Fedin
a1a7399023 Don't remove SNI object when SNI is lost 2020-04-13 10:43:37 +04:00
Ilya Fedin
e71b7dd384 Don't overwrite artifacts by multiple runs 2020-04-13 10:42:32 +04:00
Ilya Fedin
664b43acd7 Fixes for linux action:
* Disable building of unneeded openal tools and tests
* Disable ffmpeg linkage with unneeded libraries
* Disable unneeded dtd validation for libwayland
* Omit Qt flags that set to default values
* Fix prefix usage
* Build dependencies in release mode to reduce build size
2020-04-12 19:21:59 +04:00
Ilya Fedin
eac867ce85 Add possibility to enable autoupdate on non-special target 2020-04-10 15:06:09 +04:00
John Preston
2ad48f18f2 Use only safe file saving in localstorage. 2020-04-02 18:31:15 +04:00
John Preston
e823fe5891 Fix support / media shortcuts. 2020-04-02 16:20:53 +04:00
John Preston
aae5024b28 Version 2.0.1.
- Switch between folders using Ctrl+1, ..., Ctrl+8.
- Fix crash when a pinned in folder chat was added to archive.
- Fix font issues in Linux version.
2020-03-31 13:06:33 +04:00
John Preston
69d3414594 Improve empty chat list layout. 2020-03-31 12:36:33 +04:00
John Preston
9ef41062d3 Ignore whitespaces in dice sending. 2020-03-30 23:53:10 +04:00
John Preston
c2ff27793a Try to use Ctrl+1..Ctrl+8 for folders. 2020-03-30 23:34:07 +04:00
John Preston
2f7563767d Fix crash in archive / pinned in folder management. 2020-03-30 21:04:49 +04:00
275 changed files with 4959 additions and 2335 deletions

View File

@@ -25,6 +25,8 @@ Tell us what happens instead
**Version of Telegram Desktop:**
**Installation source (Linux Only)** - the official website / GitHub releases / flatpak / snap / distribution package:
**Used theme**:
<details><summary><b>Logs</b>:</summary>

View File

@@ -14,6 +14,22 @@ jobs:
echo $tag
echo ::set-env name=LATEST_TAG::$tag
- name: Get the latest macOS version.
shell: python
run: |
import subprocess;
from xml.dom import minidom;
url = "https://osx.telegram.org/updates/versions.xml";
subprocess.check_call("wget %s" % url, shell=True);
xmldoc = minidom.parse('versions.xml');
itemlist = xmldoc.getElementsByTagName('enclosure');
ver = itemlist[0].attributes['sparkle:shortVersionString'].value;
print(ver);
subprocess.check_call("echo ::set-env name=%s::%s" % ("LATEST_MACOS", ver), shell=True);
- name: Check a version from an issue.
uses: actions/github-script@0.4.0
with:
@@ -21,14 +37,24 @@ jobs:
script: |
let errorStr = "Version not found.";
function maxIndexOf(str, i) {
let index = str.indexOf(i);
return (index == -1) ? Number.MAX_SAFE_INTEGER : index;
}
let item1 = "Version of Telegram Desktop";
let item2 = "Used theme";
let item2 = "Installation source";
let item3 = "Used theme";
let item4 = "<details>";
let body = context.payload.issue.body;
console.log("Body of issue:\n" + body);
let index1 = body.indexOf(item1);
let index2 = body.indexOf(item2);
index2 = (index2 == -1) ? Number.MAX_SAFE_INTEGER : index2;
let index2 = Math.min(
Math.min(
maxIndexOf(body, item2),
maxIndexOf(body, item3)),
maxIndexOf(body, item4));
console.log("Index 1: " + index1);
console.log("Index 2: " + index2);
@@ -65,10 +91,20 @@ jobs:
let issueNum = firstNum(issueVer);
let latestNum = firstNum(latestVer);
if (issueNum <= latestNum && issueNum < 5) {
let macos_ver = process.env.LATEST_MACOS;
console.log("Telegram for MacOS version from website: " + macos_ver);
if (issueNum <= latestNum && issueNum < macos_ver) {
console.log("Seems the version of this issue is fine!");
return;
}
if (issueNum > macos_ver) {
let message = `Seems like it's neither the Telegram Desktop\
nor the Telegram for macOS version.
`;
console.log(message);
return;
}
let message = `
Sorry, but according to the version you specify in this issue, \
@@ -77,7 +113,7 @@ jobs:
You can report your issue to [the group](https://t.me/macswift) \
or to [the repository of Telegram for macOS](https://github.com/overtake/TelegramSwift).
If I made a mistake and closed your issue wrongly, please reopen it. Thanks!
**If I made a mistake and closed your issue wrongly, please reopen it. Thanks!**
`;
let params = {

View File

@@ -4,11 +4,43 @@ on:
push:
paths-ignore:
- 'docs/**'
- '*.md'
- '**.md'
- '!docs/building-cmake.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/linux.yml'
- 'snap/**'
- 'Telegram/build/**'
- 'Telegram/Patches/**'
- 'Telegram/Resources/uwp/**'
- 'Telegram/Resources/winrc/**'
- 'Telegram/SourceFiles/platform/win/**'
- 'Telegram/SourceFiles/platform/mac/**'
- 'Telegram/Telegram/**'
- 'Telegram/configure.bat'
- 'Telegram/Telegram.plist'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
- '**.md'
- '!docs/building-cmake.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/linux.yml'
- 'snap/**'
- 'Telegram/build/**'
- 'Telegram/Patches/**'
- 'Telegram/Resources/uwp/**'
- 'Telegram/Resources/winrc/**'
- 'Telegram/SourceFiles/platform/win/**'
- 'Telegram/SourceFiles/platform/mac/**'
- 'Telegram/Telegram/**'
- 'Telegram/configure.bat'
- 'Telegram/Telegram.plist'
jobs:
@@ -25,8 +57,8 @@ jobs:
env:
GIT: "https://github.com"
QT: "5_12_5"
QT_PREFIX: "/usr/local/desktop-app/Qt-5.12.5"
QT: "5_12_8"
QT_PREFIX: "/usr/local/desktop-app/Qt-5.12.8"
OPENSSL_VER: "1_1_1"
OPENSSL_PREFIX: "/usr/local/desktop-app/openssl-1.1.1"
CMAKE_VER: "3.17.0"
@@ -101,14 +133,6 @@ jobs:
cd Libraries
echo ::set-env name=LibrariesPath::`pwd`
- name: Range-v3.
run: |
echo "Find necessary branch from doc."
cloneRange=$(grep -A 1 "range-v3" $REPO_NAME/$DOC_PATH | sed -n 1p)
cd $LibrariesPath
echo $cloneRange
eval $cloneRange
- name: Patches.
run: |
echo "Find necessary commit from doc."
@@ -189,23 +213,28 @@ jobs:
git clone --branch release/3.4 $GIT/FFmpeg/FFmpeg ffmpeg
cd ffmpeg
./configure --prefix=$LibrariesPath/ffmpeg-cache \
--enable-protocol=file --enable-libopus \
./configure \
--disable-debug \
--disable-programs \
--disable-doc \
--disable-network \
--disable-autodetect \
--disable-everything \
--disable-neon \
--disable-iconv \
--enable-libopus \
--enable-vaapi \
--enable-vdpau \
--enable-protocol=file \
--enable-hwaccel=h264_vaapi \
--enable-hwaccel=h264_vdpau \
--enable-hwaccel=mpeg4_vaapi \
--enable-hwaccel=mpeg4_vdpau \
--enable-decoder=aac \
--enable-decoder=aac_at \
--enable-decoder=aac_fixed \
--enable-decoder=aac_latm \
--enable-decoder=aasc \
--enable-decoder=alac \
--enable-decoder=alac_at \
--enable-decoder=flac \
--enable-decoder=gif \
--enable-decoder=h264 \
@@ -227,14 +256,12 @@ jobs:
--enable-decoder=msmpeg4v3 \
--enable-decoder=opus \
--enable-decoder=pcm_alaw \
--enable-decoder=pcm_alaw_at \
--enable-decoder=pcm_f32be \
--enable-decoder=pcm_f32le \
--enable-decoder=pcm_f64be \
--enable-decoder=pcm_f64le \
--enable-decoder=pcm_lxf \
--enable-decoder=pcm_mulaw \
--enable-decoder=pcm_mulaw_at \
--enable-decoder=pcm_s16be \
--enable-decoder=pcm_s16be_planar \
--enable-decoder=pcm_s16le \
@@ -289,7 +316,7 @@ jobs:
--enable-muxer=opus
make -j$(nproc)
sudo make install
sudo make DESTDIR="$LibrariesPath/ffmpeg-cache" install
cd ..
rm -rf ffmpeg
- name: FFmpeg install.
@@ -298,7 +325,7 @@ jobs:
#List of files from cmake/external/ffmpeg/CMakeLists.txt.
copyLib() {
mkdir -p ffmpeg/$1
yes | cp -i ffmpeg-cache/lib/$1.a ffmpeg/$1/$1.a
yes | cp -i ffmpeg-cache/usr/local/lib/$1.a ffmpeg/$1/$1.a
}
copyLib libavformat
copyLib libavcodec
@@ -306,20 +333,7 @@ jobs:
copyLib libswscale
copyLib libavutil
sudo cp -R ffmpeg-cache/. /usr/local/
- name: PortAudio.
run: |
cd $LibrariesPath
git clone https://git.assembla.com/portaudio.git
cd portaudio
git checkout 396fe4b669
./configure
make -j$(nproc)
sudo make install
cd ..
rm -rf portaudio
sudo cp -R ffmpeg-cache/. /
- name: OpenAL Soft.
run: |
@@ -327,7 +341,13 @@ jobs:
git clone -b openal-soft-1.20.1 --depth=1 $GIT/kcat/openal-soft.git
cd openal-soft/build
cmake -D LIBTYPE:STRING=STATIC ..
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DLIBTYPE:STRING=STATIC \
-DALSOFT_EXAMPLES=OFF \
-DALSOFT_TESTS=OFF \
-DALSOFT_UTILS=OFF \
-DALSOFT_CONFIG=OFF
make -j$(nproc)
sudo make install
cd -
@@ -348,16 +368,15 @@ jobs:
git clone -b OpenSSL_${OPENSSL_VER}-stable --depth=1 \
$GIT/openssl/openssl $opensslDir
cd $opensslDir
./config --prefix=$LibrariesPath/openssl-cache
./config --prefix="$OPENSSL_PREFIX"
make -j$(nproc)
sudo make install_sw
sudo make DESTDIR="$LibrariesPath/openssl-cache" install_sw
cd ..
rm -rf $opensslDir
- name: OpenSSL install.
run: |
cd $LibrariesPath
sudo mkdir -p $OPENSSL_PREFIX
sudo cp -R openssl-cache/. $OPENSSL_PREFIX/
sudo cp -R openssl-cache/. /
- name: Libxkbcommon.
run: |
@@ -377,38 +396,33 @@ jobs:
git clone -b 1.16 https://gitlab.freedesktop.org/wayland/wayland
cd wayland
./autogen.sh --enable-static --disable-documentation
./autogen.sh --enable-static --disable-documentation --disable-dtd-validation
make -j$(nproc)
sudo make install
cd ..
rm -rf wayland
- name: Qt 5.12.5 cache.
- name: Qt 5.12.8 cache.
id: cache-qt
uses: actions/cache@v1
with:
path: ${{ env.LibrariesPath }}/qt-cache
key: ${{ runner.OS }}-qt-${{ env.CACHE_KEY }}-${{ hashFiles('**/qtbase_5_12_5.diff') }}
- name: Qt 5.12.5 build.
key: ${{ runner.OS }}-qt-${{ env.CACHE_KEY }}-${{ hashFiles('**/qtbase_5_12_8.diff') }}
- name: Qt 5.12.8 build.
if: steps.cache-qt.outputs.cache-hit != 'true'
run: |
cd $LibrariesPath
git clone -b v5.12.5 --depth=1 git://code.qt.io/qt/qt5.git qt_${QT}
git clone -b v5.12.8 --depth=1 git://code.qt.io/qt/qt5.git qt_${QT}
cd qt_${QT}
perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg
git submodule update qtbase qtwayland qtimageformats qtsvg
perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg,qtx11extras
git submodule update qtbase qtwayland qtimageformats qtsvg qtx11extras
cd qtbase
git apply ../../patches/qtbase_${QT}.diff
cd src/plugins/platforminputcontexts
git clone $GIT/desktop-app/fcitx.git
git clone $GIT/desktop-app/hime.git
git clone $GIT/desktop-app/nimf.git
cd ../../../..
cd ../
./configure -prefix "$LibrariesPath/qt-cache" \
./configure -prefix "$QT_PREFIX" \
-release \
-force-debug-info \
-opensource \
-confirm-license \
-qt-zlib \
@@ -417,8 +431,6 @@ jobs:
-qt-harfbuzz \
-qt-pcre \
-qt-xcb \
-system-freetype \
-fontconfig \
-no-gtk \
-static \
-dbus-runtime \
@@ -428,14 +440,13 @@ jobs:
-nomake tests
make -j$(nproc)
sudo make install
sudo make INSTALL_ROOT="$LibrariesPath/qt-cache" install
cd ..
rm -rf qt_${QT}
- name: Qt 5.12.5 install.
- name: Qt 5.12.8 install.
run: |
cd $LibrariesPath
sudo mkdir -p $QT_PREFIX
sudo cp -R qt-cache/. $QT_PREFIX/
sudo cp -R qt-cache/. /
- name: Breakpad cache.
id: cache-breakpad
@@ -467,9 +478,9 @@ jobs:
cd ..
cd breakpad
./configure --prefix=$BreakpadCache
./configure
make -j$(nproc)
sudo make install
sudo make DESTDIR="$BreakpadCache" install
cd src
rm -r testing
git clone $GIT/google/googletest testing
@@ -486,7 +497,7 @@ jobs:
- name: Breakpad install.
run: |
cd $LibrariesPath
sudo cp -R breakpad-cache/. /usr/local/
sudo cp -R breakpad-cache/. /
mkdir -p breakpad/out/Default/
cp breakpad-cache/dump_syms breakpad/out/Default/dump_syms
@@ -499,6 +510,9 @@ jobs:
if [ -n "${{ matrix.defines }}" ]; then
DEFINE="-D ${{ matrix.defines }}=ON"
echo Define from matrix: $DEFINE
echo ::set-env name=ARTIFACT_NAME::Telegram_${{ matrix.defines }}
else
echo ::set-env name=ARTIFACT_NAME::Telegram
fi
./configure.sh \
@@ -534,5 +548,5 @@ jobs:
if: env.UPLOAD_ARTIFACT == 'true'
name: Upload artifact.
with:
name: Telegram
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.REPO_NAME }}/out/Debug/bin/artifact/

View File

@@ -4,11 +4,41 @@ on:
push:
paths-ignore:
- 'docs/**'
- '*.md'
- '**.md'
- '!docs/building-xcode.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/mac.yml'
- 'lib/xdg/**'
- 'snap/**'
- 'Telegram/build/**'
- 'Telegram/Patches/**'
- 'Telegram/Resources/uwp/**'
- 'Telegram/Resources/winrc/**'
- 'Telegram/SourceFiles/platform/win/**'
- 'Telegram/SourceFiles/platform/linux/**'
- 'Telegram/configure.bat'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
- '**.md'
- '!docs/building-xcode.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/mac.yml'
- 'lib/xdg/**'
- 'snap/**'
- 'Telegram/build/**'
- 'Telegram/Patches/**'
- 'Telegram/Resources/uwp/**'
- 'Telegram/Resources/winrc/**'
- 'Telegram/SourceFiles/platform/win/**'
- 'Telegram/SourceFiles/platform/linux/**'
- 'Telegram/configure.bat'
jobs:
@@ -27,9 +57,9 @@ jobs:
PREFIX: "/usr/local/macos"
MACOSX_DEPLOYMENT_TARGET: "10.12"
XZ: "xz-5.2.4"
QT: "5_12_5"
QT: "5_12_8"
OPENSSL_VER: "1_1_1"
QT_PREFIX: "/usr/local/desktop-app/Qt-5.12.5"
QT_PREFIX: "/usr/local/desktop-app/Qt-5.12.8"
LIBICONV_VER: "libiconv-1.16"
UPLOAD_ARTIFACT: "false"
ONLY_CACHE: "false"
@@ -70,14 +100,6 @@ jobs:
cd Libraries/macos
echo ::set-env name=LibrariesPath::`pwd`
- name: Range-v3.
run: |
echo "Find necessary branch from doc."
cloneRange=$(grep -A 1 "range-v3" $REPO_NAME/$DOC_PATH | sed -n 1p)
cd $LibrariesPath
echo $cloneRange
eval $cloneRange
- name: Patches.
run: |
echo "Find necessary commit from doc."
@@ -376,20 +398,20 @@ jobs:
build/gyp_crashpad.py -Dmac_deployment_target=10.10
ninja -C out/Debug
- name: Qt 5.12.5 cache.
- name: Qt 5.12.8 cache.
id: cache-qt
uses: actions/cache@v1
with:
path: ${{ env.LibrariesPath }}/qt-cache
key: ${{ runner.OS }}-qt-${{ env.CACHE_KEY }}-${{ hashFiles('**/qtbase_5_12_5.diff') }}
- name: Use cached Qt 5.12.5.
key: ${{ runner.OS }}-qt-${{ env.CACHE_KEY }}-${{ hashFiles('**/qtbase_5_12_8.diff') }}
- name: Use cached Qt 5.12.8.
if: steps.cache-qt.outputs.cache-hit == 'true'
run: |
cd $LibrariesPath
mv qt-cache Qt-5.12.5
mv qt-cache Qt-5.12.8
sudo mkdir -p $QT_PREFIX
sudo mv -f Qt-5.12.5 "$(dirname "$QT_PREFIX")"/
- name: Qt 5.12.5 build.
sudo mv -f Qt-5.12.8 "$(dirname "$QT_PREFIX")"/
- name: Qt 5.12.8 build.
if: steps.cache-qt.outputs.cache-hit != 'true'
run: |
cd $LibrariesPath
@@ -397,7 +419,7 @@ jobs:
git clone git://code.qt.io/qt/qt5.git qt$QT
cd qt$QT
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v5.12.5
git checkout v5.12.8
git submodule update qtbase
git submodule update qtimageformats
cd qtbase
@@ -433,6 +455,9 @@ jobs:
if [ -n "${{ matrix.defines }}" ]; then
DEFINE="-D ${{ matrix.defines }}=ON"
echo Define from matrix: $DEFINE
echo ::set-env name=ARTIFACT_NAME::Telegram_${{ matrix.defines }}
else
echo ::set-env name=ARTIFACT_NAME::Telegram
fi
./configure.sh -D TDESKTOP_API_TEST=ON -D DESKTOP_APP_USE_PACKAGED=OFF $DEFINE
@@ -453,5 +478,5 @@ jobs:
if: env.UPLOAD_ARTIFACT == 'true'
name: Upload artifact.
with:
name: Telegram
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.REPO_NAME }}/out/Debug/artifact/

35
.github/workflows/master_updater.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Master branch updater.
on:
release:
types: released
jobs:
updater:
runs-on: ubuntu-latest
env:
SKIP: "0"
to_branch: "master"
steps:
- uses: actions/checkout@v1
if: env.SKIP == '0'
- name: Push the code to the master branch.
if: env.SKIP == '0'
run: |
token=${{ secrets.TOKEN_FOR_MASTER_UPDATER }}
if [ -z "${token}" ]; then
echo "Token is unset. Nothing to do."
exit 0
fi
url=https://x-access-token:$token@github.com/$GITHUB_REPOSITORY
latest_tag=$(git describe --tags --abbrev=0)
echo "Latest tag: $latest_tag"
git remote set-url origin $url
git remote -v
git checkout master
git merge $latest_tag
git push origin HEAD:refs/heads/$to_branch
echo "Done!"

View File

@@ -4,11 +4,41 @@ on:
push:
paths-ignore:
- 'docs/**'
- '*.md'
- '**.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/snap.yml'
- 'Telegram/build/**'
- 'Telegram/Patches/**'
- '!Telegram/Patches/ffmpeg.diff'
- 'Telegram/Resources/uwp/**'
- 'Telegram/Resources/winrc/**'
- 'Telegram/SourceFiles/platform/win/**'
- 'Telegram/SourceFiles/platform/mac/**'
- 'Telegram/Telegram/**'
- 'Telegram/configure.bat'
- 'Telegram/Telegram.plist'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
- '**.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/snap.yml'
- 'Telegram/build/**'
- 'Telegram/Patches/**'
- '!Telegram/Patches/ffmpeg.diff'
- 'Telegram/Resources/uwp/**'
- 'Telegram/Resources/winrc/**'
- 'Telegram/SourceFiles/platform/win/**'
- 'Telegram/SourceFiles/platform/mac/**'
- 'Telegram/Telegram/**'
- 'Telegram/configure.bat'
- 'Telegram/Telegram.plist'
jobs:
@@ -19,7 +49,7 @@ jobs:
env:
UPLOAD_ARTIFACT: "false"
ONLY_CACHE: "false"
MANUAL_CACHING: "3"
MANUAL_CACHING: "5"
steps:
- name: Clone.
@@ -29,9 +59,6 @@ jobs:
- name: First set up.
run: |
# Workaround for Heroku
curl https://cli-assets.heroku.com/apt/release.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install gcc-8 g++-8 -y
sudo snap install --classic snapcraft
@@ -50,7 +77,7 @@ jobs:
md5 $keyName
}
snapcraft --version > CACHE_KEY.txt
snap run snapcraft --version > CACHE_KEY.txt
gcc-8 --version >> CACHE_KEY.txt
echo $MANUAL_CACHING >> CACHE_KEY.txt
md5 CACHE_KEY
@@ -67,7 +94,7 @@ jobs:
- name: CMake build.
if: steps.cache-cmake.outputs.cache-hit != 'true'
run: sudo snapcraft build --destructive-mode cmake
run: sudo snap run snapcraft build --destructive-mode cmake
- name: FFmpeg cache.
id: cache-ffmpeg
@@ -78,11 +105,11 @@ jobs:
- name: FFmpeg build.
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
run: sudo snapcraft build --destructive-mode ffmpeg
run: sudo snap run snapcraft build --destructive-mode ffmpeg
- name: Telegram Desktop snap build.
if: env.ONLY_CACHE == 'false'
run: sudo snapcraft --destructive-mode
run: sudo snap run snapcraft --destructive-mode
- name: Move artifact.
if: env.UPLOAD_ARTIFACT == 'true'
@@ -102,5 +129,5 @@ jobs:
- name: Remove unneeded directories for cache.
run: |
sudo rm -rf parts/{cmake,ffmpeg}/{build,src,ubuntu}
sudo rm -rf parts/{cmake,ffmpeg}/state/{stage,prime}
sudo rm -rf parts/*/{build,src,ubuntu}
sudo rm -rf parts/*/state/{stage,prime}

View File

@@ -4,11 +4,46 @@ on:
push:
paths-ignore:
- 'docs/**'
- '*.md'
- '**.md'
- '!docs/building-msvc.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/win.yml'
- 'lib/xdg/**'
- 'snap/**'
- 'Telegram/build/**'
- 'Telegram/Patches/**'
- '!Telegram/Patches/build_ffmpeg_win.sh'
- 'Telegram/Resources/uwp/**'
- 'Telegram/SourceFiles/platform/linux/**'
- 'Telegram/SourceFiles/platform/mac/**'
- 'Telegram/Telegram/**'
- 'Telegram/configure.sh'
- 'Telegram/Telegram.plist'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
- '**.md'
- '!docs/building-msvc.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/win.yml'
- 'lib/xdg/**'
- 'snap/**'
- 'Telegram/build/**'
- 'Telegram/Patches/**'
- '!Telegram/Patches/build_ffmpeg_win.sh'
- 'Telegram/Resources/uwp/**'
- 'Telegram/SourceFiles/platform/linux/**'
- 'Telegram/SourceFiles/platform/mac/**'
- '!Telegram/Patches/breakpad.diff'
- 'Telegram/Telegram/**'
- 'Telegram/configure.sh'
- 'Telegram/Telegram.plist'
jobs:
@@ -24,7 +59,7 @@ jobs:
SDK: "10.0.18362.0"
VC: "call vcvars32.bat && cd Libraries"
GIT: "https://github.com"
QT: "5_12_5"
QT: "5_12_8"
OPENSSL_VER: "1_1_1"
UPLOAD_ARTIFACT: "false"
ONLY_CACHE: "false"
@@ -76,15 +111,6 @@ jobs:
run: |
choco install --no-progress -y nasm yasm jom ninja
- name: Range-v3.
shell: bash
run: |
echo "Find necessary branch from doc."
cloneRange=$(grep -A 1 "range-v3" $REPO_NAME/$DOC_PATH | sed -n 1p)
cd $LibrariesPath
echo $cloneRange
eval $cloneRange
- name: Patches.
shell: bash
run: |
@@ -263,13 +289,13 @@ jobs:
rmdir /S /Q .git
- name: Qt 5.12.5 cache.
- name: Qt 5.12.8 cache.
id: cache-qt
uses: actions/cache@v1
with:
path: ${{ env.LibrariesPath }}/Qt-5.12.5
key: ${{ runner.OS }}-qt-${{ env.CACHE_KEY }}-${{ hashFiles('**/qtbase_5_12_5.diff') }}
- name: Configure Qt 5.12.5.
path: ${{ env.LibrariesPath }}/Qt-5.12.8
key: ${{ runner.OS }}-qt-${{ env.CACHE_KEY }}-${{ hashFiles('**/qtbase_5_12_8.diff') }}
- name: Configure Qt 5.12.8.
if: steps.cache-qt.outputs.cache-hit != 'true'
shell: cmd
run: |
@@ -278,7 +304,7 @@ jobs:
git clone git://code.qt.io/qt/qt5.git qt_%QT%
cd qt_%QT%
perl init-repository --module-subset=qtbase,qtimageformats
git checkout v5.12.5
git checkout v5.12.8
git submodule update qtbase
git submodule update qtimageformats
cd qtbase
@@ -289,7 +315,7 @@ jobs:
SET LIBS=libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib
configure ^
-prefix "%LibrariesPath%\Qt-5.12.5" ^
-prefix "%LibrariesPath%\Qt-5.12.8" ^
-debug ^
-force-debug-info ^
-opensource ^
@@ -304,7 +330,7 @@ jobs:
-nomake examples ^
-nomake tests ^
-platform win32-msvc
- name: Qt 5.12.5 build.
- name: Qt 5.12.8 build.
if: steps.cache-qt.outputs.cache-hit != 'true'
shell: cmd
run: |
@@ -324,6 +350,9 @@ jobs:
if [ -n "${{ matrix.defines }}" ]; then
DEFINE="-D ${{ matrix.defines }}=ON"
echo Define from matrix: $DEFINE
echo ::set-env name=ARTIFACT_NAME::Telegram_${{ matrix.defines }}
else
echo ::set-env name=ARTIFACT_NAME::Telegram
fi
echo "::set-env name=TDESKTOP_BUILD_DEFINE::$DEFINE"
@@ -355,5 +384,5 @@ jobs:
name: Upload artifact.
if: env.UPLOAD_ARTIFACT == 'true'
with:
name: Telegram
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.REPO_NAME }}\out\Debug\artifact\

27
.gitmodules vendored
View File

@@ -67,3 +67,30 @@
[submodule "Telegram/ThirdParty/hunspell"]
path = Telegram/ThirdParty/hunspell
url = https://github.com/hunspell/hunspell
[submodule "Telegram/ThirdParty/materialdecoration"]
path = Telegram/ThirdParty/materialdecoration
url = https://github.com/desktop-app/materialdecoration.git
[submodule "Telegram/ThirdParty/range-v3"]
path = Telegram/ThirdParty/range-v3
url = https://github.com/ericniebler/range-v3.git
[submodule "Telegram/ThirdParty/fcitx-qt5"]
path = Telegram/ThirdParty/fcitx-qt5
url = https://github.com/fcitx/fcitx-qt5.git
[submodule "Telegram/ThirdParty/nimf"]
path = Telegram/ThirdParty/nimf
url = https://github.com/hamonikr/nimf.git
[submodule "Telegram/ThirdParty/hime"]
path = Telegram/ThirdParty/hime
url = https://github.com/hime-ime/hime.git
[submodule "Telegram/ThirdParty/qt5ct"]
path = Telegram/ThirdParty/qt5ct
url = https://github.com/desktop-app/qt5ct.git
[submodule "Telegram/ThirdParty/lxqt-qtplugin"]
path = Telegram/ThirdParty/lxqt-qtplugin
url = https://github.com/lxqt/lxqt-qtplugin.git
[submodule "Telegram/ThirdParty/libqtxdg"]
path = Telegram/ThirdParty/libqtxdg
url = https://github.com/lxqt/libqtxdg.git
[submodule "Telegram/ThirdParty/fcitx5-qt"]
path = Telegram/ThirdParty/fcitx5-qt
url = https://github.com/fcitx/fcitx5-qt.git

View File

@@ -13,18 +13,27 @@ The source code is published under GPLv3 with OpenSSL exception, the license is
## Supported systems
* Windows XP - Windows 10 (**not** RT)
* Mac OS X 10.8 - Mac OS X 10.15
* Mac OS X 10.6 - Mac OS X 10.7 (separate build)
* Ubuntu 12.04 - Ubuntu 19.10
* Fedora 22 - Fedora 31
* [Snappy](https://snapcraft.io/telegram-desktop)
* [Flathub](https://flathub.org/apps/details/org.telegram.desktop)
The latest version is available for
* [Windows 7 and above](https://telegram.org/dl/desktop/win) ([portable](https://telegram.org/dl/desktop/win_portable))
* [macOS 10.12 and above](https://telegram.org/dl/desktop/mac)
* [OS X 10.10 and 10.11](https://telegram.org/dl/desktop/osx)
* [Linux static build for 64 bit](https://telegram.org/dl/desktop/linux) ([32 bit](https://telegram.org/dl/desktop/linux32))
* [Snap](https://snapcraft.io/telegram-desktop)
* [Flatpak](https://flathub.org/apps/details/org.telegram.desktop)
## Old system versions
Version **1.8.15** was the last that supports older systems
* [Windows XP and Vista](https://updates.tdesktop.com/tsetup/tsetup.1.8.15.exe) ([portable](https://updates.tdesktop.com/tsetup/tportable.1.8.15.zip))
* [OS X 10.8 and 10.9](https://updates.tdesktop.com/tmac/tsetup.1.8.15.dmg)
* [OS X 10.6 and 10.7](https://updates.tdesktop.com/tmac32/tsetup32.1.8.15.dmg)
## Third-party
* Qt 5.12.5 and 5.6.2, slightly patched ([LGPL](http://doc.qt.io/qt-5/lgpl.html))
* OpenSSL 1.1.1 ([OpenSSL License](https://www.openssl.org/source/license.html))
* Qt 5.12.8, 5.6.2 and 5.3.2 slightly patched ([LGPL](http://doc.qt.io/qt-5/lgpl.html))
* OpenSSL 1.1.1 and 1.0.1 ([OpenSSL License](https://www.openssl.org/source/license.html))
* zlib 1.2.11 ([zlib License](http://www.zlib.net/zlib_license.html))
* LZMA SDK 9.20 ([public domain](http://www.7-zip.org/sdk.html))
* liblzma ([public domain](http://tukaani.org/xz/))
@@ -39,6 +48,7 @@ The source code is published under GPLv3 with OpenSSL exception, the license is
* Mapbox Variant ([BSD License](https://github.com/mapbox/variant/blob/master/LICENSE))
* Range-v3 ([Boost License](https://github.com/ericniebler/range-v3/blob/master/LICENSE.txt))
* Open Sans font ([Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html))
* Vazir font ([License](https://github.com/rastikerdar/vazir-font/blob/master/LICENSE))
* Emoji alpha codes ([MIT License](https://github.com/emojione/emojione/blob/master/extras/alpha-codes/LICENSE.md))
* Catch test framework ([Boost License](https://github.com/philsquared/Catch/blob/master/LICENSE.txt))
* xxHash ([BSD License](https://github.com/Cyan4973/xxHash/blob/dev/LICENSE))

View File

@@ -67,12 +67,33 @@ generate_numbers(Telegram ${res_loc}/numbers.txt)
set_target_properties(Telegram PROPERTIES AUTOMOC ON AUTORCC ON)
if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
if (LINUX)
target_link_libraries(Telegram
PRIVATE
desktop-app::external_statusnotifieritem
desktop-app::external_dbusmenu_qt
desktop-app::external_materialdecoration
desktop-app::external_nimf_qt5
desktop-app::external_qt5ct
desktop-app::external_qt5ct_style
desktop-app::external_qt5ct_qtplugin
)
if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
# conflicts with Qt static link
if (DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES)
target_link_libraries(Telegram
PRIVATE
desktop-app::external_lxqt_qtplugin
)
endif()
target_link_libraries(Telegram
PRIVATE
desktop-app::external_statusnotifieritem
desktop-app::external_dbusmenu_qt
desktop-app::external_fcitx5_qt5
desktop-app::external_hime_qt
)
endif()
endif()
if (add_hunspell_library)
@@ -105,10 +126,6 @@ PRIVATE
desktop-app::external_openal
)
if (NOT DESKTOP_APP_USE_PACKAGED)
target_link_libraries(Telegram PRIVATE desktop-app::external_opus)
endif()
# Telegram uses long atomic types, so on some architectures libatomic is needed.
check_cxx_source_compiles("
#include <atomic>
@@ -121,11 +138,10 @@ endif()
if (DESKTOP_APP_USE_PACKAGED)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads)
find_package(Threads REQUIRED)
target_link_libraries(Telegram
PRIVATE
${CMAKE_DL_LIBS}
Threads::Threads
)
endif()
@@ -1010,14 +1026,13 @@ PRIVATE
mainwindow.h
observer_peer.cpp
observer_peer.h
qt_static_plugins.cpp
settings.cpp
settings.h
)
if (DESKTOP_APP_USE_PACKAGED)
nice_target_sources(Telegram ${src_loc} PRIVATE qt_functions.cpp)
else()
nice_target_sources(Telegram ${src_loc} PRIVATE qt_static_plugins.cpp)
endif()
nice_target_sources(Telegram ${res_loc}
@@ -1027,12 +1042,15 @@ PRIVATE
qrc/emoji_3.qrc
qrc/emoji_4.qrc
qrc/emoji_5.qrc
qrc/emoji_6.qrc
qrc/emoji_7.qrc
qrc/emoji_preview.qrc
qrc/telegram/telegram.qrc
qrc/telegram/sounds.qrc
winrc/Telegram.rc
winrc/Telegram.manifest
langs/lang.strings
langs/cloud_lang.strings
numbers.txt
)
@@ -1162,21 +1180,12 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Telegram PREFIX Resources FILES ${
target_include_directories(Telegram PRIVATE ${src_loc})
if (NOT DESKTOP_APP_USE_PACKAGED)
target_include_directories(Telegram PRIVATE ${third_party_loc}/minizip)
endif()
target_compile_definitions(Telegram
PRIVATE
TDESKTOP_API_ID=${TDESKTOP_API_ID}
TDESKTOP_API_HASH=${TDESKTOP_API_HASH}
AL_ALEXT_PROTOTYPES
)
if (NOT DESKTOP_APP_USE_PACKAGED)
target_compile_definitions(Telegram PRIVATE AL_LIBTYPE_STATIC)
endif()
if (${CMAKE_GENERATOR} MATCHES "(Visual Studio|Xcode)")
set(output_folder ${CMAKE_BINARY_DIR})
elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
@@ -1187,7 +1196,7 @@ endif()
set_target_properties(Telegram PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder})
if ((NOT disable_autoupdate OR NOT LINUX) AND NOT build_macstore AND NOT build_winstore)
if ((NOT DESKTOP_APP_DISABLE_AUTOUPDATE OR NOT LINUX) AND NOT build_macstore AND NOT build_winstore)
add_executable(Updater WIN32)
init_target(Updater)
@@ -1203,6 +1212,10 @@ if ((NOT disable_autoupdate OR NOT LINUX) AND NOT build_macstore AND NOT build_w
set_target_properties(Updater PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${output_folder})
if (WIN32 AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_link_options(Updater PRIVATE -municode)
endif()
if (LINUX)
target_link_options(Updater PRIVATE -static-libstdc++)
endif()

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 894 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -6,6 +6,11 @@ For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
"cloud_lng_badge_psa_covid" = "COVID-19";
"cloud_lng_about_psa_covid" = "This message provides you with a public service announcement in relation to the ongoing COVID-19 pandemic. To remove it from your chats list, right click it and select **Hide**.";
"cloud_lng_forwarded_psa_covid" = "COVID-19 Notification from {channel}";
"cloud_lng_tooltip_psa_covid" = "This message provides you with a public service announcement in relation to the ongoing COVID-19 pandemic. Learn more about this initiative at https://telegram.org/blog/coronavirus";
"cloud_lng_passport_in_ar" = "Arabic";
"cloud_lng_passport_in_az" = "Azerbaijani";
"cloud_lng_passport_in_bg" = "Bulgarian";

View File

@@ -118,6 +118,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_chat_status_online#one" = "{count} online";
"lng_chat_status_online#other" = "{count} online";
"lng_chat_status_members_online" = "{members_count}, {online_count}";
"lng_chat_status_subscribers#one" = "{count} subscriber";
"lng_chat_status_subscribers#other" = "{count} subscribers";
"lng_channel_status" = "channel";
"lng_group_status" = "group";
@@ -298,6 +300,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_settings_notifications_position" = "Location on the screen";
"lng_settings_notifications_count" = "Notifications count";
"lng_settings_sound_notify" = "Play sound";
"lng_settings_alert_windows" = "Flash the taskbar icon";
"lng_settings_alert_mac" = "Bounce the dock icon";
"lng_settings_alert_linux" = "Draw attention to the window";
"lng_settings_badge_title" = "Badge counter";
"lng_settings_include_muted" = "Include muted chats in unread count";
"lng_settings_count_unread" = "Count unread messages";
@@ -600,6 +605,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_proxy_sponsor" = "Proxy sponsor";
"lng_proxy_sponsor_about" = "This channel is shown by your proxy server.\nTo remove this channel from your chats list,\ndisable the proxy in Telegram Settings.";
"lng_proxy_sponsor_warning" = "This proxy may display a sponsored channel in your chat list. This doesn't reveal any of your Telegram traffic.";
"lng_badge_psa_default" = "PSA";
"lng_about_psa_default" = "This message provides you with a public service announcement. To remove it from your chats list, right click it and select **Hide**.";
"lng_tooltip_psa_default" = "This message provides you with a public service announcement.";
"lng_settings_blocked_users" = "Blocked users";
"lng_settings_no_blocked_users" = "None";
@@ -764,6 +772,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_profile_common_groups#one" = "{count} group in common";
"lng_profile_common_groups#other" = "{count} groups in common";
"lng_profile_participants_section" = "Members";
"lng_profile_subscribers_section" = "Subscribers";
"lng_profile_mobile_number" = "Mobile:";
"lng_profile_username" = "Username:";
"lng_profile_link" = "Link:";
@@ -885,6 +894,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_manage_channel_info" = "Channel Info";
"lng_manage_peer_recent_actions" = "Recent Actions";
"lng_manage_peer_members" = "Members";
"lng_manage_peer_subscribers" = "Subscribers";
"lng_manage_peer_administrators" = "Administrators";
"lng_manage_peer_exceptions" = "Exceptions";
"lng_manage_peer_removed_users" = "Removed users";
@@ -1126,6 +1136,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_forwarded" = "Forwarded from {user}";
"lng_forwarded_date" = "Original: {date}";
"lng_forwarded_channel" = "Forwarded from {channel}";
"lng_forwarded_psa_default" = "Forwarded from {channel}";
"lng_forwarded_via" = "Forwarded from {user} via {inline_bot}";
"lng_forwarded_channel_via" = "Forwarded from {channel} via {inline_bot}";
"lng_forwarded_signed" = "{channel} ({user})";
@@ -1329,7 +1340,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_dialogs_skip_archive_in_search" = "Skip results from archive";
"lng_dialogs_show_archive_in_search" = "With results from archive";
"lng_about_dice" = "Send a 🎲 emoji to any chat to get a random number from Telegram.";
"lng_about_random" = "Send a {emoji} emoji to any chat to get a random number from Telegram.";
"lng_about_random_send" = "Send";
"lng_open_this_link" = "Open this link?";
"lng_open_link" = "Open";
@@ -1400,6 +1412,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_context_view_group" = "View group info";
"lng_context_view_channel" = "View channel info";
//"lng_context_view_feed_info" = "View feed info";
"lng_context_hide_psa" = "Hide this announcement";
"lng_context_pin_to_top" = "Pin to top";
"lng_context_unpin_from_top" = "Unpin from top";
"lng_context_mark_unread" = "Mark as unread";
@@ -1850,6 +1863,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_admin_log_no_results_search_text" = "No recent actions that contain '{query}' have been found.";
"lng_admin_log_no_events_title" = "No actions yet";
"lng_admin_log_no_events_text" = "There were no service actions\ntaken by the group's members\nand admins in the last 48 hours.";
"lng_admin_log_no_events_text_channel" = "There were no service actions\ntaken by the channels's admins\nin the last 48 hours.";
"lng_admin_log_empty_text" = "Empty";
"lng_admin_log_changed_title_group" = "{from} changed group name to «{title}»";
@@ -2223,6 +2237,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_polls_choose_question" = "Please enter a question.";
"lng_polls_choose_answers" = "Please enter at least two options.";
"lng_polls_choose_correct" = "Please choose the correct answer.";
"lng_polls_solution_title" = "Explanation";
"lng_polls_solution_placeholder" = "Add a Comment (Optional)";
"lng_polls_solution_about" = "Users will see this comment after choosing a wrong answer, good for educational purposes.";
"lng_polls_poll_results_title" = "Poll results";
"lng_polls_quiz_results_title" = "Quiz results";

View File

@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/gui">
<file alias="emoji/emoji_6.webp">../emoji/emoji_6.webp</file>
</qresource>
</RCC>

View File

@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/gui">
<file alias="emoji/emoji_7.webp">../emoji/emoji_7.webp</file>
</qresource>
</RCC>

View File

@@ -48,6 +48,7 @@
<file alias="art/logo_256_no_margin.png">../../art/logo_256_no_margin.png</file>
<file alias="art/sunrise.jpg">../../art/sunrise.jpg</file>
<file alias="art/dice_idle.tgs">../../art/dice_idle.tgs</file>
<file alias="art/dart_idle.tgs">../../art/dart_idle.tgs</file>
<file alias="day-blue.tdesktop-theme">../../day-blue.tdesktop-theme</file>
<file alias="night.tdesktop-theme">../../night.tdesktop-theme</file>
<file alias="night-green.tdesktop-theme">../../night-green.tdesktop-theme</file>

View File

@@ -71,8 +71,8 @@ inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int =
inputMediaGame#d33f43f3 id:InputGame = InputMedia;
inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia;
inputMediaGeoLive#ce4e82fd flags:# stopped:flags.0?true geo_point:InputGeoPoint period:flags.1?int = InputMedia;
inputMediaPoll#abe9ca25 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> = InputMedia;
inputMediaDice#aeffa807 = 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;
inputChatPhotoEmpty#1ca48f57 = InputChatPhoto;
inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto;
@@ -157,7 +157,7 @@ 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;
messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia;
messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;
messageMediaDice#638fe46b value:int = MessageMedia;
messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia;
messageActionEmpty#b6aef7b0 = MessageAction;
messageActionChatCreate#a6638b9a title:string users:Vector<int> = MessageAction;
@@ -533,7 +533,7 @@ inputStickerSetEmpty#ffb62b95 = InputStickerSet;
inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;
inputStickerSetDice#79e21a53 = InputStickerSet;
inputStickerSetDice#e67f520e emoticon:string = InputStickerSet;
stickerSet#eeb46f27 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumb:flags.4?PhotoSize thumb_dc_id:flags.4?int count:int hash:int = StickerSet;
@@ -651,7 +651,7 @@ messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_off
exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink;
messageFwdHeader#ec338270 flags:# from_id:flags.0?int from_name:flags.5?string date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int = MessageFwdHeader;
messageFwdHeader#353a686b flags:# from_id:flags.0?int from_name:flags.5?string date:int channel_id:flags.1?int channel_post:flags.2?int post_author:flags.3?string saved_from_peer:flags.4?Peer saved_from_msg_id:flags.4?int psa_type:flags.6?string = MessageFwdHeader;
auth.codeTypeSms#72a3158c = auth.CodeType;
auth.codeTypeCall#741cd3e3 = auth.CodeType;
@@ -692,8 +692,8 @@ contacts.topPeersDisabled#b52c939d = contacts.TopPeers;
draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage;
draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector<MessageEntity> date:int = DraftMessage;
messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers;
messages.featuredStickers#f89d88e5 hash:int sets:Vector<StickerSetCovered> unread:Vector<long> = messages.FeaturedStickers;
messages.featuredStickersNotModified#c6dc0c66 count:int = messages.FeaturedStickers;
messages.featuredStickers#b6abc341 hash:int count:int sets:Vector<StickerSetCovered> unread:Vector<long> = messages.FeaturedStickers;
messages.recentStickersNotModified#b17f890 = messages.RecentStickers;
messages.recentStickers#22f3afb3 hash:int packs:Vector<StickerPack> stickers:Vector<Document> dates:Vector<int> = messages.RecentStickers;
@@ -912,9 +912,6 @@ fileHash#6242c773 offset:int limit:int hash:bytes = FileHash;
inputClientProxy#75588b3f address:string port:int = InputClientProxy;
help.proxyDataEmpty#e09e1fb8 expires:int = help.ProxyData;
help.proxyDataPromo#2bf7ee23 expires:int peer:Peer chats:Vector<Chat> users:Vector<User> = help.ProxyData;
help.termsOfServiceUpdateEmpty#e3309f7f expires:int = help.TermsOfServiceUpdate;
help.termsOfServiceUpdate#28ecf961 expires:int terms_of_service:help.TermsOfService = help.TermsOfServiceUpdate;
@@ -1024,11 +1021,11 @@ help.userInfo#1eb3758 message:string entities:Vector<MessageEntity> author:strin
pollAnswer#6ca9c2e9 text:string option:bytes = PollAnswer;
poll#d5529d06 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:string answers:Vector<PollAnswer> = Poll;
poll#86e18161 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:string answers:Vector<PollAnswer> close_period:flags.4?int close_date:flags.5?int = Poll;
pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:int = PollAnswerVoters;
pollResults#c87024a2 flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<int> = PollResults;
pollResults#badcc1a3 flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<int> solution:flags.4?string solution_entities:flags.4?Vector<MessageEntity> = PollResults;
chatOnlines#f041e250 onlines:int = ChatOnlines;
@@ -1140,11 +1137,14 @@ messageInteractionCounters#ad4fc9bd msg_id:int views:int forwards:int = MessageI
stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueAndPrev views_per_post:StatsAbsValueAndPrev shares_per_post:StatsAbsValueAndPrev enabled_notifications:StatsPercentValue growth_graph:StatsGraph followers_graph:StatsGraph mute_graph:StatsGraph top_hours_graph:StatsGraph interactions_graph:StatsGraph iv_interactions_graph:StatsGraph views_by_source_graph:StatsGraph new_followers_by_source_graph:StatsGraph languages_graph:StatsGraph recent_message_interactions:Vector<MessageInteractionCounters> = stats.BroadcastStats;
help.promoDataEmpty#98f6ac75 expires:int = help.PromoData;
help.promoData#8c39793f flags:# proxy:flags.0?true expires:int peer:Peer chats:Vector<Chat> users:Vector<User> psa_type:flags.1?string psa_message:flags.2?string = help.PromoData;
---functions---
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X;
initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy query:!X = X;
initConnection#c1cd5ea9 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X;
invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;
invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X;
invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X;
@@ -1382,6 +1382,7 @@ messages.getDialogFilters#f19ed96d = Vector<DialogFilter>;
messages.getSuggestedDialogFilters#a29cd42c = Vector<DialogFilterSuggested>;
messages.updateDialogFilter#1ad4a04a flags:# id:int filter:flags.0?DialogFilter = Bool;
messages.updateDialogFiltersOrder#c563c1e4 order:Vector<int> = Bool;
messages.getOldFeaturedStickers#5fe7025b offset:int limit:int hash:int = messages.FeaturedStickers;
updates.getState#edd4882a = updates.State;
updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
@@ -1410,7 +1411,6 @@ help.getAppChangelog#9010ef6f prev_app_version:string = Updates;
help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool;
help.getCdnConfig#52029342 = CdnConfig;
help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls;
help.getProxyData#3d7758e1 = help.ProxyData;
help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate;
help.acceptTermsOfService#ee72f79a id:DataJSON = Bool;
help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo;
@@ -1420,6 +1420,8 @@ help.getPassportConfig#c661ad08 hash:int = help.PassportConfig;
help.getSupportName#d360e72c = help.SupportName;
help.getUserInfo#38a08d3 user_id:InputUser = help.UserInfo;
help.editUserInfo#66b91b70 user_id:InputUser message:string entities:Vector<MessageEntity> = help.UserInfo;
help.getPromoData#c0977421 = help.PromoData;
help.hidePromoData#1e251c95 peer:InputPeer = Bool;
channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;
@@ -1459,6 +1461,7 @@ channels.getInactiveChannels#11e831ee = messages.InactiveChats;
bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;
bots.setBotCommands#805d46f6 commands:Vector<BotCommand> = Bool;
payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm;
payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt;
@@ -1468,10 +1471,11 @@ payments.getSavedInfo#227d824b = payments.SavedInfo;
payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool;
payments.getBankCardData#2e79d779 number:string = payments.BankCardData;
stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector<InputStickerSetItem> = messages.StickerSet;
stickers.createStickerSet#f1036780 flags:# masks:flags.0?true animated:flags.1?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector<InputStickerSetItem> = messages.StickerSet;
stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet;
stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet;
stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet;
stickers.setStickerSetThumb#9a364e30 stickerset:InputStickerSet thumb:InputDocument = messages.StickerSet;
phone.getCallConfig#55451fa9 = DataJSON;
phone.requestCall#42ff96ed flags:# video:flags.0?true user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall;
@@ -1494,4 +1498,4 @@ folders.deleteFolder#1c295881 folder_id:int = Updates;
stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats;
stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;
// LAYER 111
// LAYER 113

View File

@@ -9,7 +9,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="2.0.0.0" />
Version="2.1.6.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram FZ-LLC</PublisherDisplayName>

View File

@@ -6,7 +6,18 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
#if defined(__MINGW64__) || defined(__MINGW32__)
// MinGW-w64, MinGW
#if defined(__has_include) && __has_include(<winres.h>)
#include <winres.h>
#else
#include <afxres.h>
#include <winresrc.h>
#endif
#else
// MSVC, Windows SDK
#include <winres.h>
#endif
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -33,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,0,0,0
PRODUCTVERSION 2,0,0,0
FILEVERSION 2,1,6,0
PRODUCTVERSION 2,1,6,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -51,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "2.0.0.0"
VALUE "FileVersion", "2.1.6.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2020"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "2.0.0.0"
VALUE "ProductVersion", "2.1.6.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -6,7 +6,18 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
#if defined(__MINGW64__) || defined(__MINGW32__)
// MinGW-w64, MinGW
#if defined(__has_include) && __has_include(<winres.h>)
#include <winres.h>
#else
#include <afxres.h>
#include <winresrc.h>
#endif
#else
// MSVC, Windows SDK
#include <winres.h>
#endif
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -24,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,0,0,0
PRODUCTVERSION 2,0,0,0
FILEVERSION 2,1,6,0
PRODUCTVERSION 2,1,6,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -42,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "2.0.0.0"
VALUE "FileVersion", "2.1.6.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2020"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "2.0.0.0"
VALUE "ProductVersion", "2.1.6.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -268,7 +268,7 @@ int main(int argc, char *argv[])
cout << "Compression start, size: " << resultSize << "\n";
QByteArray compressed, resultCheck;
#ifdef Q_OS_WIN // use Lzma SDK for win
#if defined Q_OS_WIN && !defined DESKTOP_APP_USE_PACKAGED // use Lzma SDK for win
const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header
compressed.resize(hSize + resultSize + 1024 * 1024); // rsa signature + sha1 + lzma props + max compressed size

View File

@@ -27,7 +27,7 @@ extern "C" {
#include <openssl/evp.h>
} // extern "C"
#ifdef Q_OS_WIN // use Lzma SDK for win
#if defined Q_OS_WIN && !defined DESKTOP_APP_USE_PACKAGED // use Lzma SDK for win
#include <LzmaLib.h>
#else
#include <lzma.h>

View File

@@ -21,6 +21,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "chat_helpers/message_field.h" // ConvertTextTagsToEntities.
#include "ui/text/text_entity.h" // TextWithEntities.
#include "main/main_session.h"
#include "main/main_account.h"
#include "main/main_app_config.h"
#include "mainwidget.h"
#include "apiwrap.h"
#include "app.h"
@@ -199,8 +201,23 @@ void SendExistingPhoto(
}
bool SendDice(Api::MessageToSend &message) {
static const auto kDiceString = QString::fromUtf8("\xF0\x9F\x8E\xB2");
if (message.textWithTags.text != kDiceString) {
const auto full = message.textWithTags.text.midRef(0).trimmed();
auto length = 0;
if (!Ui::Emoji::Find(full.data(), full.data() + full.size(), &length)
|| length != full.size()) {
return false;
}
auto &account = message.action.history->session().account();
auto &config = account.appConfig();
static const auto hardcoded = std::vector<QString>{
QString::fromUtf8("\xF0\x9F\x8E\xB2"),
QString::fromUtf8("\xF0\x9F\x8E\xAF")
};
const auto list = config.get<std::vector<QString>>(
"emojies_send_dice",
hardcoded);
const auto emoji = full.toString();
if (!ranges::contains(list, emoji)) {
return false;
}
const auto history = message.action.history;
@@ -266,7 +283,7 @@ bool SendDice(Api::MessageToSend &message) {
MTP_int(HistoryItem::NewMessageDate(
message.action.options.scheduled)),
MTP_string(),
MTP_messageMediaDice(MTP_int(0)),
MTP_messageMediaDice(MTP_int(0), MTP_string(emoji)),
MTPReplyMarkup(),
MTP_vector<MTPMessageEntity>(),
MTP_int(1),
@@ -284,7 +301,7 @@ bool SendDice(Api::MessageToSend &message) {
MTP_flags(sendFlags),
peer->input,
MTP_int(replyTo),
MTP_inputMediaDice(),
MTP_inputMediaDice(MTP_string(emoji)),
MTP_string(),
MTP_long(randomId),
MTPReplyMarkup(),

View File

@@ -23,6 +23,6 @@ void SendExistingPhoto(
Api::MessageToSend &&message,
not_null<PhotoData*> photo);
[[nodiscard]] bool SendDice(Api::MessageToSend &message);
bool SendDice(Api::MessageToSend &message);
} // namespace Api

View File

@@ -82,6 +82,7 @@ MTPVector<MTPMessageEntity> EntitiesToMTP(
if (entity.length() <= 0) continue;
if (option == ConvertOption::SkipLocal
&& entity.type() != EntityType::Bold
//&& entity.type() != EntityType::Semibold // Not in API.
&& entity.type() != EntityType::Italic
&& entity.type() != EntityType::Underline
&& entity.type() != EntityType::StrikeOut

View File

@@ -88,8 +88,8 @@ constexpr auto kMaxUsersPerInvite = 100;
// that was added to this chat.
constexpr auto kForwardMessagesOnAdd = 100;
constexpr auto kProxyPromotionInterval = TimeId(60 * 60);
constexpr auto kProxyPromotionMinDelay = TimeId(10);
constexpr auto kTopPromotionInterval = TimeId(60 * 60);
constexpr auto kTopPromotionMinDelay = TimeId(10);
constexpr auto kSmallDelayMs = 5;
constexpr auto kUnreadMentionsPreloadIfLess = 5;
constexpr auto kUnreadMentionsFirstRequestLimit = 10;
@@ -237,7 +237,7 @@ ApiWrap::ApiWrap(not_null<Main::Session*> session)
, _dialogsLoadState(std::make_unique<DialogsLoadState>())
, _fileLoader(std::make_unique<TaskQueue>(kFileLoaderQueueStopTimeout))
//, _feedReadTimer([=] { readFeeds(); }) // #feed
, _proxyPromotionTimer([=] { refreshProxyPromotion(); })
, _topPromotionTimer([=] { refreshTopPromotion(); })
, _updateNotifySettingsTimer([=] { sendNotifySettingsUpdates(); })
, _selfDestruct(std::make_unique<Api::SelfDestruct>(this))
, _sensitiveContent(std::make_unique<Api::SensitiveContent>(this)) {
@@ -288,13 +288,13 @@ void ApiWrap::requestChangelog(
).send();
}
void ApiWrap::refreshProxyPromotion() {
void ApiWrap::refreshTopPromotion() {
const auto now = base::unixtime::now();
const auto next = (_proxyPromotionNextRequestTime != 0)
? _proxyPromotionNextRequestTime
const auto next = (_topPromotionNextRequestTime != 0)
? _topPromotionNextRequestTime
: now;
if (_proxyPromotionRequestId) {
getProxyPromotionDelayed(now, next);
if (_topPromotionRequestId) {
getTopPromotionDelayed(now, next);
return;
}
const auto key = [&]() -> std::pair<QString, uint32> {
@@ -307,51 +307,51 @@ void ApiWrap::refreshProxyPromotion() {
}
return { proxy.host, proxy.port };
}();
if (_proxyPromotionKey == key && now < next) {
getProxyPromotionDelayed(now, next);
if (_topPromotionKey == key && now < next) {
getTopPromotionDelayed(now, next);
return;
}
_proxyPromotionKey = key;
if (key.first.isEmpty() || !key.second) {
proxyPromotionDone(MTP_help_proxyDataEmpty(
MTP_int(base::unixtime::now() + kProxyPromotionInterval)));
return;
}
_proxyPromotionRequestId = request(MTPhelp_GetProxyData(
)).done([=](const MTPhelp_ProxyData &result) {
_proxyPromotionRequestId = 0;
proxyPromotionDone(result);
_topPromotionKey = key;
_topPromotionRequestId = request(MTPhelp_GetPromoData(
)).done([=](const MTPhelp_PromoData &result) {
_topPromotionRequestId = 0;
topPromotionDone(result);
}).fail([=](const RPCError &error) {
_proxyPromotionRequestId = 0;
_topPromotionRequestId = 0;
const auto now = base::unixtime::now();
const auto next = _proxyPromotionNextRequestTime = now
+ kProxyPromotionInterval;
if (!_proxyPromotionTimer.isActive()) {
getProxyPromotionDelayed(now, next);
const auto next = _topPromotionNextRequestTime = now
+ kTopPromotionInterval;
if (!_topPromotionTimer.isActive()) {
getTopPromotionDelayed(now, next);
}
}).send();
}
void ApiWrap::getProxyPromotionDelayed(TimeId now, TimeId next) {
_proxyPromotionTimer.callOnce(std::min(
std::max(next - now, kProxyPromotionMinDelay),
kProxyPromotionInterval) * crl::time(1000));
void ApiWrap::getTopPromotionDelayed(TimeId now, TimeId next) {
_topPromotionTimer.callOnce(std::min(
std::max(next - now, kTopPromotionMinDelay),
kTopPromotionInterval) * crl::time(1000));
};
void ApiWrap::proxyPromotionDone(const MTPhelp_ProxyData &proxy) {
_proxyPromotionNextRequestTime = proxy.match([&](const auto &data) {
void ApiWrap::topPromotionDone(const MTPhelp_PromoData &proxy) {
_topPromotionNextRequestTime = proxy.match([&](const auto &data) {
return data.vexpires().v;
});
getProxyPromotionDelayed(base::unixtime::now(), _proxyPromotionNextRequestTime);
getTopPromotionDelayed(
base::unixtime::now(),
_topPromotionNextRequestTime);
proxy.match([&](const MTPDhelp_proxyDataEmpty &data) {
_session->data().setProxyPromoted(nullptr);
}, [&](const MTPDhelp_proxyDataPromo &data) {
proxy.match([&](const MTPDhelp_promoDataEmpty &data) {
_session->data().setTopPromoted(nullptr, QString(), QString());
}, [&](const MTPDhelp_promoData &data) {
_session->data().processChats(data.vchats());
_session->data().processUsers(data.vusers());
const auto peerId = peerFromMTP(data.vpeer());
const auto peer = _session->data().peer(peerId);
_session->data().setProxyPromoted(peer);
_session->data().setTopPromoted(
peer,
data.vpsa_type().value_or_empty(),
data.vpsa_message().value_or_empty());
if (const auto history = _session->data().historyLoaded(peer)) {
history->owner().histories().requestDialogEntry(history);
}
@@ -5754,16 +5754,6 @@ void ApiWrap::createPoll(
if (action.options.scheduled) {
sendFlags |= MTPmessages_SendMedia::Flag::f_schedule_date;
}
const auto inputFlags = data.quiz()
? MTPDinputMediaPoll::Flag::f_correct_answers
: MTPDinputMediaPoll::Flag(0);
auto correct = QVector<MTPbytes>();
for (const auto &answer : data.answers) {
if (answer.correct) {
correct.push_back(MTP_bytes(answer.option));
}
}
auto &histories = history->owner().histories();
const auto requestType = Data::Histories::RequestType::Send;
histories.sendRequest(history, requestType, [=](Fn<void()> finish) {
@@ -5772,10 +5762,7 @@ void ApiWrap::createPoll(
MTP_flags(sendFlags),
peer->input,
MTP_int(replyTo),
MTP_inputMediaPoll(
MTP_flags(inputFlags),
PollDataToMTP(&data),
MTP_vector<MTPbytes>(correct)),
PollDataToInputMedia(&data),
MTP_string(),
MTP_long(rand_value<uint64>()),
MTPReplyMarkup(),
@@ -5852,25 +5839,12 @@ void ApiWrap::closePoll(not_null<HistoryItem*> item) {
if (!poll) {
return;
}
const auto inputFlags = poll->quiz()
? MTPDinputMediaPoll::Flag::f_correct_answers
: MTPDinputMediaPoll::Flag(0);
auto correct = QVector<MTPbytes>();
for (const auto &answer : poll->answers) {
if (answer.correct) {
correct.push_back(MTP_bytes(answer.option));
}
}
const auto requestId = request(MTPmessages_EditMessage(
MTP_flags(MTPmessages_EditMessage::Flag::f_media),
item->history()->peer->input,
MTP_int(item->id),
MTPstring(),
MTP_inputMediaPoll(
MTP_flags(inputFlags),
PollDataToMTP(poll, true),
MTP_vector<MTPbytes>(correct)),
PollDataToInputMedia(poll, true),
MTPReplyMarkup(),
MTPVector<MTPMessageEntity>(),
MTP_int(0) // schedule_date

View File

@@ -208,7 +208,7 @@ public:
void requestChangelog(
const QString &sinceVersion,
Fn<void(const MTPUpdates &result)> callback);
void refreshProxyPromotion();
void refreshTopPromotion();
void requestDeepLinkInfo(
const QString &path,
Fn<void(const MTPDhelp_deepLinkInfo &result)> callback);
@@ -646,8 +646,8 @@ private:
//void readFeeds(); // #feed
void getProxyPromotionDelayed(TimeId now, TimeId next);
void proxyPromotionDone(const MTPhelp_ProxyData &proxy);
void getTopPromotionDelayed(TimeId now, TimeId next);
void topPromotionDone(const MTPhelp_PromoData &proxy);
void sendNotifySettingsUpdates();
@@ -787,10 +787,10 @@ private:
//base::flat_map<not_null<Data::Feed*>, mtpRequestId> _feedReadRequests;
//base::Timer _feedReadTimer;
mtpRequestId _proxyPromotionRequestId = 0;
std::pair<QString, uint32> _proxyPromotionKey;
TimeId _proxyPromotionNextRequestTime = TimeId(0);
base::Timer _proxyPromotionTimer;
mtpRequestId _topPromotionRequestId = 0;
std::pair<QString, uint32> _topPromotionKey;
TimeId _topPromotionNextRequestTime = TimeId(0);
base::Timer _topPromotionTimer;
base::flat_set<not_null<const PeerData*>> _updateNotifySettingsPeers;
base::Timer _updateNotifySettingsTimer;

View File

@@ -57,7 +57,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace {
constexpr auto kImageAreaLimit = 6'016 * 3'384;
constexpr auto kImageAreaLimit = 12'032 * 9'024;
App::LaunchState _launchState = App::Launched;

View File

@@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/buttons.h"
#include "ui/widgets/labels.h"
#include "ui/text/text_utilities.h"
#include "platform/platform_file_utilities.h"
#include "core/file_utilities.h"
#include "base/platform/base_platform_info.h"
#include "core/click_handler_types.h"
#include "core/update_checker.h"
@@ -23,7 +23,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtGui/QGuiApplication>
#include <QtGui/QClipboard>
#include <QtGui/QDesktopServices>
namespace {
@@ -109,7 +108,7 @@ void AboutBox::showVersionHistory() {
Ui::show(Box<InformBox>("The link to the current private alpha version of Telegram Desktop was copied to the clipboard."));
} else {
QDesktopServices::openUrl(qsl("https://desktop.telegram.org/changelog"));
File::OpenUrl(qsl("https://desktop.telegram.org/changelog"));
}
}

View File

@@ -252,7 +252,7 @@ peerListBox: PeerList(defaultPeerList) {
}
localStorageRowHeight: 50px;
localStorageRowPadding: margins(23px, 5px, 20px, 5px);
localStorageRowPadding: margins(22px, 5px, 20px, 5px);
localStorageRowTitle: FlatLabel(defaultFlatLabel) {
textFg: windowBoldFg;
maxHeight: 20px;
@@ -275,11 +275,11 @@ localStorageClear: defaultBoxButton;
localStorageLimitLabel: LabelSimple(defaultLabelSimple) {
font: boxTextFont;
}
localStorageLimitLabelMargin: margins(23px, 10px, 20px, 5px);
localStorageLimitLabelMargin: margins(22px, 10px, 20px, 5px);
localStorageLimitSlider: MediaSlider(defaultContinuousSlider) {
seekSize: size(15px, 15px);
}
localStorageLimitMargin: margins(23px, 5px, 20px, 10px);
localStorageLimitMargin: margins(22px, 5px, 20px, 10px);
shareRowsTop: 12px;
shareRowHeight: 108px;
@@ -340,7 +340,7 @@ sessionsHeight: 350px;
sessionHeight: 70px;
sessionCurrentPadding: margins(0px, 7px, 0px, 4px);
sessionCurrentHeight: 118px;
sessionPadding: margins(23px, 10px, 23px, 0px);
sessionPadding: margins(22px, 10px, 22px, 0px);
sessionNameFont: msgNameFont;
sessionNameFg: boxTextFg;
sessionWhenFont: msgDateFont;
@@ -428,7 +428,7 @@ aboutLabel: FlatLabel(defaultFlatLabel) {
}
autoDownloadTopDelta: 10px;
autoDownloadTitlePosition: point(23px, 18px);
autoDownloadTitlePosition: point(22px, 18px);
autoDownloadTitleFont: font(15px semibold);
autoDownloadLimitSlider: MediaSlider(defaultContinuousSlider) {
seekSize: size(15px, 15px);
@@ -562,7 +562,7 @@ passcodeTextStyle: TextStyle(defaultTextStyle) {
lineHeight: 20px;
}
usernamePadding: margins(23px, 6px, 21px, 12px);
usernamePadding: margins(22px, 6px, 21px, 12px);
usernameSkip: 49px;
usernameTextStyle: TextStyle(boxTextStyle, passcodeTextStyle) {
}
@@ -642,9 +642,9 @@ rightsToggle: Toggle(defaultToggle) {
}
rightsDividerHeight: boxDividerHeight;
rightsDividerMargin: margins(0px, 0px, 0px, 20px);
rightsHeaderMargin: margins(23px, 0px, 23px, 8px);
rightsToggleMargin: margins(23px, 8px, 23px, 8px);
rightsAboutMargin: margins(23px, 8px, 23px, 8px);
rightsHeaderMargin: margins(22px, 0px, 22px, 8px);
rightsToggleMargin: margins(22px, 8px, 22px, 8px);
rightsAboutMargin: margins(22px, 8px, 22px, 8px);
rightsPhotoButton: UserpicButton(defaultUserpicButton) {
size: size(60px, 60px);
photoSize: 60px;
@@ -773,8 +773,8 @@ markdownLinkFieldPadding: margins(22px, 0px, 22px, 10px);
termsContent: FlatLabel(defaultFlatLabel) {
minWidth: 285px;
}
termsPadding: margins(23px, 4px, 16px, 16px);
termsAgePadding: margins(23px, 16px, 16px, 0px);
termsPadding: margins(22px, 4px, 16px, 16px);
termsAgePadding: margins(22px, 16px, 16px, 0px);
themesSmallSkip: 10px;
themesBackgroundSize: 120px;
@@ -800,7 +800,7 @@ themesMenuPosition: point(-2px, 25px);
createPollField: InputField(defaultInputField) {
font: boxTextFont;
textMargins: margins(0px, 0px, 0px, 0px);
textMargins: margins(0px, 4px, 0px, 4px);
textAlign: align(left);
heightMin: 36px;
heightMax: 86px;
@@ -822,6 +822,11 @@ createPollOptionField: InputField(createPollField) {
placeholderMargins: margins(2px, 0px, 2px, 0px);
heightMax: 68px;
}
createPollSolutionField: InputField(createPollField) {
textMargins: margins(0px, 4px, 0px, 4px);
border: 1px;
borderActive: 2px;
}
createPollLimitLabel: FlatLabel(defaultFlatLabel) {
minWidth: 274px;
align: align(topleft);
@@ -855,7 +860,7 @@ createPollWarning: FlatLabel(defaultFlatLabel) {
}
}
createPollWarningPosition: point(16px, 6px);
createPollCheckboxMargin: margins(23px, 10px, 23px, 10px);
createPollCheckboxMargin: margins(22px, 10px, 22px, 10px);
createPollFieldTitlePadding: margins(22px, 7px, 10px, 6px);
callSettingsButton: IconButton {
@@ -910,7 +915,7 @@ blockUserConfirmation: FlatLabel(boxLabel) {
minWidth: 240px;
}
transferCheckWidth: 300px;
transferCheckWidth: 320px;
slowmodeLabelsMargin: margins(0px, 5px, 0px, 0px);
slowmodeLabel: LabelSimple(defaultLabelSimple) {

View File

@@ -38,6 +38,8 @@ constexpr auto kMaxOptionsCount = PollData::kMaxOptions;
constexpr auto kOptionLimit = 100;
constexpr auto kWarnQuestionLimit = 80;
constexpr auto kWarnOptionLimit = 30;
constexpr auto kSolutionLimit = 200;
constexpr auto kWarnSolutionLimit = 60;
constexpr auto kErrorLimit = 99;
class Options {
@@ -59,6 +61,7 @@ public:
[[nodiscard]] rpl::producer<int> usedCount() const;
[[nodiscard]] rpl::producer<not_null<QWidget*>> scrollToWidget() const;
[[nodiscard]] rpl::producer<> backspaceInFront() const;
[[nodiscard]] rpl::producer<> tabbed() const;
private:
class Option {
@@ -80,7 +83,7 @@ private:
void show(anim::type animated);
void destroy(FnMut<void()> done);
[[nodisacrd]] bool hasShadow() const;
[[nodiscard]] bool hasShadow() const;
void createShadow();
void destroyShadow();
@@ -146,6 +149,7 @@ private:
bool _hasCorrect = false;
rpl::event_stream<not_null<QWidget*>> _scrollToWidget;
rpl::event_stream<> _backspaceInFront;
rpl::event_stream<> _tabbed;
};
@@ -217,6 +221,7 @@ Options::Option::Option(
InitField(outer, _field, session);
_field->setMaxLength(kOptionLimit + kErrorLimit);
_field->show();
_field->customTab(true);
_wrap->hide(anim::type::instant);
@@ -497,6 +502,10 @@ rpl::producer<> Options::backspaceInFront() const {
return _backspaceInFront.events();
}
rpl::producer<> Options::tabbed() const {
return _tabbed.events();
}
void Options::Option::show(anim::type animated) {
_wrap->show(animated);
}
@@ -647,6 +656,14 @@ void Options::addEmptyOption() {
QObject::connect(field, &Ui::InputField::focused, [=] {
_scrollToWidget.fire_copy(field);
});
QObject::connect(field, &Ui::InputField::tabbed, [=] {
const auto index = findField(field);
if (index + 1 < _list.size()) {
_list[index + 1]->setFocus();
} else {
_tabbed.fire({});
}
});
base::install_event_filter(field, [=](not_null<QEvent*> event) {
if (event->type() != QEvent::KeyPress
|| !field->getLastText().isEmpty()) {
@@ -768,6 +785,7 @@ not_null<Ui::InputField*> CreatePollBox::setupQuestion(
InitField(getDelegate()->outerContainer(), question, _session);
question->setMaxLength(kQuestionLimit + kErrorLimit);
question->setSubmitSettings(Ui::InputField::SubmitSettings::Both);
question->customTab(true);
const auto warning = CreateWarningLabel(
container,
@@ -794,6 +812,69 @@ not_null<Ui::InputField*> CreatePollBox::setupQuestion(
return question;
}
not_null<Ui::InputField*> CreatePollBox::setupSolution(
not_null<Ui::VerticalLayout*> container,
rpl::producer<bool> shown) {
using namespace Settings;
const auto outer = container->add(
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
container,
object_ptr<Ui::VerticalLayout>(container))
)->setDuration(0)->toggleOn(std::move(shown));
const auto inner = outer->entity();
AddSkip(inner);
AddSubsectionTitle(inner, tr::lng_polls_solution_title());
const auto solution = inner->add(
object_ptr<Ui::InputField>(
inner,
st::createPollSolutionField,
Ui::InputField::Mode::MultiLine,
tr::lng_polls_solution_placeholder()),
st::createPollFieldPadding);
InitField(getDelegate()->outerContainer(), solution, _session);
solution->setMaxLength(kSolutionLimit + kErrorLimit);
solution->setInstantReplaces(Ui::InstantReplaces::Default());
solution->setInstantReplacesEnabled(
_session->settings().replaceEmojiValue());
solution->setMarkdownReplacesEnabled(rpl::single(true));
solution->setEditLinkCallback(
DefaultEditLinkCallback(_session, solution));
solution->customTab(true);
const auto warning = CreateWarningLabel(
inner,
solution,
kSolutionLimit,
kWarnSolutionLimit);
rpl::combine(
solution->geometryValue(),
warning->sizeValue()
) | rpl::start_with_next([=](QRect geometry, QSize label) {
warning->moveToLeft(
(inner->width()
- label.width()
- st::createPollWarningPosition.x()),
(geometry.y()
- st::createPollFieldPadding.top()
- st::settingsSubsectionTitlePadding.bottom()
- st::settingsSubsectionTitle.style.font->height
+ st::settingsSubsectionTitle.style.font->ascent
- st::createPollWarning.style.font->ascent),
geometry.width());
}, warning->lifetime());
inner->add(
object_ptr<Ui::FlatLabel>(
inner,
tr::lng_polls_solution_about(),
st::boxDividerLabel),
st::createPollFieldTitlePadding);
return solution;
}
object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
using namespace Settings;
@@ -836,6 +917,10 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
st::boxDividerLabel),
st::createPollLimitPadding));
connect(question, &Ui::InputField::tabbed, [=] {
options->focusFirst();
});
AddSkip(container);
AddSubsectionTitle(container, tr::lng_polls_create_settings());
@@ -866,6 +951,24 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
(_chosen & PollData::Flag::Quiz),
st::defaultCheckbox),
st::createPollCheckboxMargin);
const auto solution = setupSolution(
container,
rpl::single(quiz->checked()) | rpl::then(quiz->checkedChanges()));
options->tabbed(
) | rpl::start_with_next([=] {
if (quiz->checked()) {
solution->setFocus();
} else {
question->setFocus();
}
}, question->lifetime());
connect(solution, &Ui::InputField::tabbed, [=] {
question->setFocus();
});
quiz->setDisabled(_disabled & PollData::Flag::Quiz);
if (multiple) {
multiple->setDisabled((_disabled & PollData::Flag::MultiChoice)
@@ -911,6 +1014,13 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
auto result = PollData(&_session->data(), id);
result.question = question->getLastText().trimmed();
result.answers = options->toPollAnswers();
const auto solutionWithTags = quiz->checked()
? solution->getTextWithAppliedMarkdown()
: TextWithTags();
result.solution = TextWithEntities{
solutionWithTags.text,
TextUtilities::ConvertTextTagsToEntities(solutionWithTags.tags)
};
const auto publicVotes = (anonymous && !anonymous->checked());
const auto multiChoice = (multiple && multiple->checked());
result.setFlags(Flag(0)
@@ -937,6 +1047,12 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
} else {
*error &= ~Error::Correct;
}
if (quiz->checked()
&& solution->getLastText().trimmed().size() > kSolutionLimit) {
*error |= Error::Solution;
} else {
*error &= ~Error::Solution;
}
};
const auto showError = [=](const QString &text) {
Ui::Toast::Show(text);
@@ -951,6 +1067,8 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
options->focusFirst();
} else if (*error & Error::Correct) {
showError(tr::lng_polls_choose_correct(tr::now));
} else if (*error & Error::Solution) {
solution->showError();
} else if (!*error) {
_submitRequests.fire({ collectResult(), sendOptions });
}

View File

@@ -36,7 +36,7 @@ public:
PollData::Flags disabled,
Api::SendType sendType);
rpl::producer<Result> submitRequests() const;
[[nodiscard]] rpl::producer<Result> submitRequests() const;
void submitFailed(const QString &error);
void setInnerFocus() override;
@@ -50,13 +50,17 @@ private:
Options = 0x02,
Correct = 0x04,
Other = 0x08,
Solution = 0x10,
};
friend constexpr inline bool is_flag_type(Error) { return true; }
using Errors = base::flags<Error>;
object_ptr<Ui::RpWidget> setupContent();
not_null<Ui::InputField*> setupQuestion(
[[nodiscard]] object_ptr<Ui::RpWidget> setupContent();
[[nodiscard]] not_null<Ui::InputField*> setupQuestion(
not_null<Ui::VerticalLayout*> container);
[[nodiscard]] not_null<Ui::InputField*> setupSolution(
not_null<Ui::VerticalLayout*> container,
rpl::producer<bool> shown);
const not_null<Main::Session*> _session;
const PollData::Flags _chosen = PollData::Flags();

View File

@@ -548,14 +548,9 @@ void EditCaptionBox::prepare() {
if (action == Ui::InputField::MimeAction::Check) {
if (!data->hasText() && !_isAllowedEditMedia) {
return false;
}
if (data->hasImage()) {
const auto image = qvariant_cast<QImage>(data->imageData());
if (!image.isNull()) {
return true;
}
}
if (const auto urls = data->urls(); !urls.empty()) {
} else if (data->hasImage()) {
return true;
} else if (const auto urls = data->urls(); !urls.empty()) {
if (ranges::find_if(
urls,
[](const QUrl &url) { return !url.isLocalFile(); }

View File

@@ -130,7 +130,7 @@ public:
LastSeen,
Custom,
};
void refreshStatus();
virtual void refreshStatus();
crl::time refreshStatusTime() const;
void setAbsoluteIndex(int index) {

View File

@@ -584,5 +584,9 @@ void ChooseRecipientBoxController::rowClicked(not_null<PeerListRow*> row) {
auto ChooseRecipientBoxController::createRow(
not_null<History*> history) -> std::unique_ptr<Row> {
return std::make_unique<Row>(history);
const auto peer = history->peer;
const auto skip = peer->isChannel()
&& !peer->isMegagroup()
&& !peer->canWrite();
return skip ? nullptr : std::make_unique<Row>(history);
}

View File

@@ -1056,7 +1056,9 @@ void ParticipantsBoxController::prepare() {
switch (_role) {
case Role::Admins: return tr::lng_channel_admins();
case Role::Profile:
case Role::Members: return tr::lng_profile_participants_section();
case Role::Members: return (_peer->isChannel() && !_peer->isMegagroup()
? tr::lng_profile_subscribers_section()
: tr::lng_profile_participants_section());
case Role::Restricted: return tr::lng_exceptions_list_title();
case Role::Kicked: return tr::lng_removed_list_title();
}
@@ -1786,6 +1788,12 @@ std::unique_ptr<PeerListRow> ParticipantsBoxController::createRow(
|| _additional.canEditAdmin(user))) {
row->setActionLink(tr::lng_profile_kick(tr::now));
}
if (_role == Role::Members && user->isBot()) {
auto seesAllMessages = (user->botInfo->readsAllHistory || _additional.adminRights(user).has_value());
row->setCustomStatus(seesAllMessages
? tr::lng_status_bot_reads_all(tr::now)
: tr::lng_status_bot_not_reads_all(tr::now));
}
}
return row;
}

View File

@@ -967,7 +967,7 @@ void Controller::fillManageSection() {
if (canViewMembers) {
AddButtonWithCount(
_controls.buttonsLayout,
tr::lng_manage_peer_members(),
(_isGroup ? tr::lng_manage_peer_members() : tr::lng_manage_peer_subscribers()),
Info::Profile::MigratedOrMeValue(
_peer
) | rpl::map(

View File

@@ -1934,6 +1934,7 @@ void SendFilesBox::initSendWay() {
if (_albumPreview) {
_albumPreview->setSendWay(value);
}
updateEmojiPanelGeometry();
setInnerFocus();
});
}

View File

@@ -109,7 +109,7 @@ public:
bool actionSelected) override;
private:
void refreshStatus();
void refreshStatus() override;
static Type ComputeType(not_null<const HistoryItem*> item);
std::vector<not_null<HistoryItem*>> _items;

View File

@@ -463,6 +463,8 @@ void Panel::toggleOpacityAnimation(bool visible) {
_visible ? 1. : 0.,
st::callPanelDuration,
_visible ? anim::easeOutCirc : anim::easeInCirc);
} else if (!isHidden() && !_visible) {
hide();
}
if (isHidden() && _visible) {
show();

View File

@@ -89,11 +89,16 @@ stickersRowDisabledOpacity: 0.4;
stickersRowDuration: 200;
stickersSettings: icon {{ "emoji_settings", emojiIconFg }};
stickersTrending: icon {{ "emoji_trending", emojiIconFg }};
stickersTrending: icon {{ "stickers_add", emojiIconFg }};
stickersTrendingUnread: icon {
{ "stickers_add_unread", emojiIconFg },
{ "stickers_add_dot", dialogsUnreadBg }
};
stickersRecent: icon {{ "stickers_recent", emojiIconFg }};
stickersSearch: icon {{ "stickers_search", emojiIconFg, point(0px, 1px) }};
stickersSettingsUnreadSize: 17px;
stickersSettingsUnreadPosition: point(4px, 5px);
stickersSettingsUnreadSize: 6px;
stickersSettingsUnreadPosition: point(6px, 10px);
filtersRemove: IconButton(stickersRemove) {
ripple: defaultRippleAnimation;
@@ -213,8 +218,11 @@ stickerGroupCategoryAbout: defaultTextStyle;
stickerGroupCategoryAddMargin: margins(0px, 10px, 0px, 5px);
stickerGroupCategoryAdd: stickersTrendingAdd;
stickersToastMaxWidth: 340px;
stickersToastPadding: margins(16px, 13px, 16px, 12px);
stickersToast: Toast(defaultToast) {
minWidth: 340px;
maxWidth: 340px;
padding: margins(16px, 13px, 16px, 12px);
}
stickersEmpty: icon {{ "stickers_empty", windowSubTextFg }};
@@ -266,7 +274,7 @@ autocompleteRowAnswer: defaultTextStyle;
manageEmojiPreview: 22px;
manageEmojiPreviewWidth: 48px;
manageEmojiPreviewHeight: 48px;
manageEmojiPreviewPadding: margins(23px, 9px, 19px, 9px);
manageEmojiPreviewPadding: margins(22px, 9px, 19px, 9px);
manageEmojiMarginRight: 21px;
manageEmojiNameTop: 3px;
manageEmojiStatusTop: 25px;

View File

@@ -40,15 +40,15 @@ inline auto PreviewPath(int i) {
const auto kSets = {
Set{ {0, 0, 0, "Mac"}, PreviewPath(0) },
Set{ {1, 246, 7'336'383, "Android"}, PreviewPath(1) },
Set{ {2, 206, 5'038'738, "Twemoji"}, PreviewPath(2) },
Set{ {3, 238, 6'992'260, "JoyPixels"}, PreviewPath(3) },
Set{ {1, 713, 7'313'166, "Android"}, PreviewPath(1) },
Set{ {2, 714, 4'690'333, "Twemoji"}, PreviewPath(2) },
Set{ {3, 716, 5'968'021, "JoyPixels"}, PreviewPath(3) },
};
using Loading = MTP::DedicatedLoader::Progress;
using SetState = BlobState;
class Loader : public BlobLoader {
class Loader final : public BlobLoader {
public:
Loader(
QObject *parent,
@@ -60,6 +60,9 @@ public:
void destroy() override;
void unpack(const QString &path) override;
private:
void fail() override;
};
class Inner : public Ui::RpWidget {
@@ -155,12 +158,14 @@ bool UnpackSet(const QString &path, const QString &folder) {
return UnpackBlob(path, folder, GoodSetPartName);
}
Loader::Loader(
QObject *parent,
int id,
MTP::DedicatedLoader::Location location,
const QString &folder,
int size) : BlobLoader(parent, id, location, folder, size) {
int size)
: BlobLoader(parent, id, location, folder, size) {
}
void Loader::unpack(const QString &path) {
@@ -190,6 +195,11 @@ void Loader::destroy() {
SetGlobalLoader(nullptr);
}
void Loader::fail() {
ClearNeedSwitchToId();
BlobLoader::fail();
}
Inner::Inner(QWidget *parent) : RpWidget(parent) {
setupContent();
}
@@ -401,12 +411,7 @@ void Row::setupHandler() {
}
void Row::load() {
SetGlobalLoader(base::make_unique_q<Loader>(
App::main(),
_id,
GetDownloadLocation(_id),
internal::SetDataPath(_id),
GetDownloadSize(_id)));
LoadAndSwitchTo(_id);
}
void Row::setupLabels(const Set &set) {
@@ -538,5 +543,20 @@ void ManageSetsBox::prepare() {
setDimensionsToContent(st::boxWidth, inner);
}
void LoadAndSwitchTo(int id) {
Expects(App::main() != nullptr);
if (!ranges::contains(kSets, id, &Set::id)) {
ClearNeedSwitchToId();
return;
}
SetGlobalLoader(base::make_unique_q<Loader>(
App::main(),
id,
GetDownloadLocation(id),
internal::SetDataPath(id),
GetDownloadSize(id)));
}
} // namespace Emoji
} // namespace Ui

View File

@@ -21,5 +21,7 @@ protected:
};
void LoadAndSwitchTo(int id);
} // namespace Emoji
} // namespace Ui

View File

@@ -20,9 +20,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/scroll_area.h"
#include "ui/image/image.h"
#include "ui/ui_utility.h"
#include "main/main_session.h"
#include "chat_helpers/stickers.h"
#include "base/unixtime.h"
#include "window/window_session_controller.h"
#include "facades.h"
#include "app.h"
#include "styles/style_history.h"
@@ -33,14 +33,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
FieldAutocomplete::FieldAutocomplete(
QWidget *parent,
not_null<Main::Session*> session)
not_null<Window::SessionController*> controller)
: RpWidget(parent)
, _session(session)
, _controller(controller)
, _scroll(this, st::mentionScroll) {
_scroll->setGeometry(rect());
_inner = _scroll->setOwnedWidget(
object_ptr<internal::FieldAutocompleteInner>(
_controller,
this,
&_mrows,
&_hrows,
@@ -169,7 +170,7 @@ inline int indexOfInFirstN(const T &v, const U &elem, int last) {
internal::StickerRows FieldAutocomplete::getStickerSuggestions() {
const auto list = Stickers::GetListByEmoji(
_session,
&_controller->session(),
_emoji,
_stickersSeed
);
@@ -584,12 +585,14 @@ bool FieldAutocomplete::eventFilter(QObject *obj, QEvent *e) {
namespace internal {
FieldAutocompleteInner::FieldAutocompleteInner(
not_null<Window::SessionController*> controller,
not_null<FieldAutocomplete*> parent,
not_null<MentionRows*> mrows,
not_null<HashtagRows*> hrows,
not_null<BotCommandRows*> brows,
not_null<StickerRows*> srows)
: _parent(parent)
: _controller(controller)
, _parent(parent)
, _mrows(mrows)
, _hrows(hrows)
, _brows(brows)
@@ -665,7 +668,6 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
}
if (sticker.animated && sticker.animated->ready()) {
const auto frame = sticker.animated->frame();
sticker.animated->markFrameShown();
const auto size = frame.size() / cIntRetinaFactor();
const auto ppos = pos + QPoint(
(st::stickerPanSize.width() - size.width()) / 2,
@@ -673,6 +675,11 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
p.drawImage(
QRect(ppos, size),
frame);
const auto paused = _controller->isGifPausedAtLeastFor(
Window::GifPauseReason::SavedGifs);
if (!paused) {
sticker.animated->markFrameShown();
}
} else if (const auto image = document->getStickerSmall()) {
QPoint ppos = pos + QPoint((st::stickerPanSize.width() - w) / 2, (st::stickerPanSize.height() - h) / 2);
p.drawPixmapLeft(ppos, width(), image->pix(document->stickerSetOrigin(), w, h));

View File

@@ -22,9 +22,9 @@ class SinglePlayer;
class FrameRenderer;
} // namespace Lottie;
namespace Main {
class Session;
} // namespace Main
namespace Window {
class SessionController;
} // namespace Window
namespace internal {
@@ -46,7 +46,9 @@ class FieldAutocomplete final : public Ui::RpWidget {
Q_OBJECT
public:
FieldAutocomplete(QWidget *parent, not_null<Main::Session*> session);
FieldAutocomplete(
QWidget *parent,
not_null<Window::SessionController*> controller);
~FieldAutocomplete();
bool clearFilteredBotCommands();
@@ -109,7 +111,7 @@ private:
void recount(bool resetScroll = false);
internal::StickerRows getStickerSuggestions();
const not_null<Main::Session*> _session;
const not_null<Window::SessionController*> _controller;
QPixmap _cache;
internal::MentionRows _mrows;
internal::HashtagRows _hrows;
@@ -160,6 +162,7 @@ class FieldAutocompleteInner final
public:
FieldAutocompleteInner(
not_null<Window::SessionController*> controller,
not_null<FieldAutocomplete*> parent,
not_null<MentionRows*> mrows,
not_null<HashtagRows*> hrows,
@@ -204,11 +207,12 @@ private:
void repaintSticker(not_null<DocumentData*> document);
std::shared_ptr<Lottie::FrameRenderer> getLottieRenderer();
not_null<FieldAutocomplete*> _parent;
not_null<MentionRows*> _mrows;
not_null<HashtagRows*> _hrows;
not_null<BotCommandRows*> _brows;
not_null<StickerRows*> _srows;
const not_null<Window::SessionController*> _controller;
const not_null<FieldAutocomplete*> _parent;
const not_null<MentionRows*> _mrows;
const not_null<HashtagRows*> _hrows;
const not_null<BotCommandRows*> _brows;
const not_null<StickerRows*> _srows;
rpl::lifetime _stickersLifetime;
std::weak_ptr<Lottie::FrameRenderer> _lottieRenderer;
int _stickersPerRow = 1;

View File

@@ -77,12 +77,11 @@ void ApplyArchivedResult(const MTPDmessages_stickerSetInstallResultArchive &d) {
Local::writeInstalledStickers();
Local::writeArchivedStickers();
auto toast = Ui::Toast::Config();
toast.text = tr::lng_stickers_packs_archived(tr::now);
toast.maxWidth = toast.minWidth = st::stickersToastMaxWidth;
toast.multiline = true;
toast.padding = st::stickersToastPadding;
Ui::Toast::Show(toast);
Ui::Toast::Show(Ui::Toast::Config{
.text = { tr::lng_stickers_packs_archived(tr::now) },
.st = &st::stickersToast,
.multiline = true,
});
// Ui::show(Box<StickersBox>(archived, &Auth()), Ui::LayerOption::KeepOther);
Auth().data().notifyStickersUpdated();

View File

@@ -24,8 +24,9 @@ constexpr auto kZeroDiceDocumentId = 0xa3b83c9f84fa9e83ULL;
} // namespace
DicePack::DicePack(not_null<Main::Session*> session)
: _session(session) {
DicePack::DicePack(not_null<Main::Session*> session, const QString &emoji)
: _session(session)
, _emoji(emoji) {
}
DicePack::~DicePack() = default;
@@ -34,10 +35,7 @@ DocumentData *DicePack::lookup(int value) {
if (!_requestId) {
load();
}
if (!value) {
ensureZeroGenerated();
return _zero;
}
tryGenerateLocalZero();
const auto i = _map.find(value);
return (i != end(_map)) ? i->second.get() : nullptr;
}
@@ -47,7 +45,7 @@ void DicePack::load() {
return;
}
_requestId = _session->api().request(MTPmessages_GetStickerSet(
MTP_inputStickerSetDice()
MTP_inputStickerSetDice(MTP_string(_emoji))
)).done([=](const MTPmessages_StickerSet &result) {
result.match([&](const MTPDmessages_stickerSet &data) {
applySet(data);
@@ -58,22 +56,50 @@ void DicePack::load() {
}
void DicePack::applySet(const MTPDmessages_stickerSet &data) {
auto index = 0;
_map.clear();
auto documents = base::flat_map<DocumentId, not_null<DocumentData*>>();
for (const auto &sticker : data.vdocuments().v) {
const auto document = _session->data().processDocument(
sticker);
if (document->sticker()) {
_map.emplace(++index, document);
documents.emplace(document->id, document);
}
}
for (const auto pack : data.vpacks().v) {
pack.match([&](const MTPDstickerPack &data) {
const auto emoji = qs(data.vemoticon());
if (emoji.isEmpty()) {
return;
}
const auto ch = int(emoji[0].unicode());
const auto index = (ch == '#') ? 0 : (ch + 1 - '1');
if (index < 0 || index > 6) {
return;
}
for (const auto id : data.vdocuments().v) {
if (const auto document = documents.take(id.v)) {
_map.emplace(index, *document);
}
}
});
}
}
void DicePack::ensureZeroGenerated() {
if (_zero) {
void DicePack::tryGenerateLocalZero() {
if (!_map.empty()) {
return;
}
const auto path = qsl(":/gui/art/dice_idle.tgs");
static const auto kDiceString = QString::fromUtf8("\xF0\x9F\x8E\xB2");
static const auto kDartString = QString::fromUtf8("\xF0\x9F\x8E\xAF");
const auto path = (_emoji == kDiceString)
? qsl(":/gui/art/dice_idle.tgs")
: (_emoji == kDartString)
? qsl(":/gui/art/dart_idle.tgs")
: QString();
if (path.isEmpty()) {
return;
}
auto task = FileLoadTask(
path,
QByteArray(),
@@ -84,13 +110,29 @@ void DicePack::ensureZeroGenerated() {
task.process();
const auto result = task.peekResult();
Assert(result != nullptr);
_zero = _session->data().processDocument(
const auto document = _session->data().processDocument(
result->document,
std::move(result->thumb));
_zero->setLocation(FileLocation(path));
document->setLocation(FileLocation(path));
Ensures(_zero->sticker());
Ensures(_zero->sticker()->animated);
_map.emplace(0, document);
Ensures(document->sticker());
Ensures(document->sticker()->animated);
}
DicePacks::DicePacks(not_null<Main::Session*> session) : _session(session) {
}
DocumentData *DicePacks::lookup(const QString &emoji, int value) {
const auto i = _packs.find(emoji);
if (i != end(_packs)) {
return i->second->lookup(value);
}
return _packs.emplace(
emoji,
std::make_unique<DicePack>(_session, emoji)
).first->second->lookup(value);
}
} // namespace Stickers

View File

@@ -1,4 +1,5 @@
/*
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
@@ -17,7 +18,7 @@ namespace Stickers {
class DicePack final {
public:
explicit DicePack(not_null<Main::Session*> session);
DicePack(not_null<Main::Session*> session, const QString &emoji);
~DicePack();
DocumentData *lookup(int value);
@@ -25,13 +26,26 @@ public:
private:
void load();
void applySet(const MTPDmessages_stickerSet &data);
void ensureZeroGenerated();
void tryGenerateLocalZero();
not_null<Main::Session*> _session;
const not_null<Main::Session*> _session;
QString _emoji;
base::flat_map<int, not_null<DocumentData*>> _map;
DocumentData *_zero = nullptr;
mtpRequestId _requestId = 0;
};
class DicePacks final {
public:
explicit DicePacks(not_null<Main::Session*> session);
DocumentData *lookup(const QString &emoji, int value);
private:
const not_null<Main::Session*> _session;
base::flat_map<QString, std::unique_ptr<DicePack>> _packs;
};
} // namespace Stickers

View File

@@ -44,6 +44,8 @@ namespace {
constexpr auto kInlineItemsMaxPerRow = 5;
constexpr auto kSearchRequestDelay = 400;
constexpr auto kRecentDisplayLimit = 20;
constexpr auto kPreloadOfficialPages = 4;
constexpr auto kOfficialLoadLimit = 40;
bool SetInMyList(MTPDstickerSet::Flags flags) {
return (flags & MTPDstickerSet::Flag::f_installed_date)
@@ -138,7 +140,6 @@ private:
void finishDragging();
void paintStickerSettingsIcon(Painter &p) const;
void paintSearchIcon(Painter &p) const;
void paintFeaturedStickerSetsBadge(Painter &p, int iconLeft) const;
void paintSetIcon(Painter &p, const StickerIcon &icon, int x) const;
void paintSelectionBar(Painter &p) const;
void paintLeftRightFading(Painter &p) const;
@@ -694,18 +695,6 @@ void StickersListWidget::Footer::paintSearchIcon(Painter &p) const {
st::stickersSearch.paint(p, searchLeft + (st::stickerIconWidth - st::stickersSearch.width()) / 2, _iconsTop + st::emojiCategory.iconPosition.y(), width());
}
void StickersListWidget::Footer::paintFeaturedStickerSetsBadge(Painter &p, int iconLeft) const {
if (const auto unread = _pan->session().data().featuredStickerSetsUnreadCount()) {
Dialogs::Layout::UnreadBadgeStyle unreadSt;
unreadSt.sizeId = Dialogs::Layout::UnreadBadgeInStickersPanel;
unreadSt.size = st::stickersSettingsUnreadSize;
int unreadRight = iconLeft + st::stickerIconWidth - st::stickersSettingsUnreadPosition.x();
if (rtl()) unreadRight = width() - unreadRight;
int unreadTop = _iconsTop + st::stickersSettingsUnreadPosition.y();
Dialogs::Layout::paintUnreadCount(p, QString::number(unread), unreadRight, unreadTop, unreadSt);
}
}
void StickersListWidget::Footer::validateIconLottieAnimation(
const StickerIcon &icon) {
if (icon.lottie
@@ -788,19 +777,22 @@ void StickersListWidget::Footer::paintSetIcon(
} else if (icon.megagroup) {
icon.megagroup->paintUserpicLeft(p, x + (st::stickerIconWidth - st::stickerGroupCategorySize) / 2, _iconsTop + (st::emojiFooterHeight - st::stickerGroupCategorySize) / 2, width(), st::stickerGroupCategorySize);
} else {
auto getSpecialSetIcon = [](uint64 setId) {
if (setId == Stickers::FeaturedSetId) {
return &st::stickersTrending;
const auto paintedIcon = [&] {
if (icon.setId == Stickers::FeaturedSetId) {
const auto session = &_pan->session();
return session->data().featuredStickerSetsUnreadCount()
? &st::stickersTrendingUnread
: &st::stickersTrending;
//} else if (setId == Stickers::FavedSetId) {
// return &st::stickersFaved;
}
return &st::emojiRecent;
};
auto paintedIcon = getSpecialSetIcon(icon.setId);
paintedIcon->paint(p, x + (st::stickerIconWidth - paintedIcon->width()) / 2, _iconsTop + st::emojiCategory.iconPosition.y(), width());
if (icon.setId == Stickers::FeaturedSetId) {
paintFeaturedStickerSetsBadge(p, x);
}
return &st::stickersRecent;
}();
paintedIcon->paint(
p,
x + (st::stickerIconWidth - paintedIcon->width()) / 2,
_iconsTop + (st::emojiFooterHeight - paintedIcon->height()) / 2,
width());
}
}
@@ -901,25 +893,86 @@ void StickersListWidget::checkVisibleFeatured(
readVisibleFeatured(visibleTop, visibleBottom);
const auto visibleHeight = visibleBottom - visibleTop;
if (visibleBottom > height() - visibleHeight * kPreloadOfficialPages) {
preloadMoreOfficial();
}
const auto rowHeight = featuredRowHeight();
const auto destroyAbove = floorclamp(visibleTop - visibleHeight, rowHeight, 0, _featuredSets.size());
const auto destroyBelow = ceilclamp(visibleBottom + visibleHeight, rowHeight, 0, _featuredSets.size());
const auto destroyAbove = floorclamp(visibleTop - visibleHeight, rowHeight, 0, _officialSets.size());
const auto destroyBelow = ceilclamp(visibleBottom + visibleHeight, rowHeight, 0, _officialSets.size());
for (auto i = 0; i != destroyAbove; ++i) {
destroyLottieIn(_featuredSets[i]);
destroyLottieIn(_officialSets[i]);
}
for (auto i = destroyBelow; i != _featuredSets.size(); ++i) {
destroyLottieIn(_featuredSets[i]);
for (auto i = destroyBelow; i != _officialSets.size(); ++i) {
destroyLottieIn(_officialSets[i]);
}
}
void StickersListWidget::preloadMoreOfficial() {
if (_officialRequestId) {
return;
}
_officialRequestId = _api.request(MTPmessages_GetOldFeaturedStickers(
MTP_int(_officialOffset),
MTP_int(kOfficialLoadLimit),
MTP_int(0)
)).done([=](const MTPmessages_FeaturedStickers &result) {
_officialRequestId = 0;
result.match([&](const MTPDmessages_featuredStickersNotModified &d) {
LOG(("Api Error: messages.featuredStickersNotModified."));
}, [&](const MTPDmessages_featuredStickers &data) {
const auto &list = data.vsets().v;
_officialOffset += list.size();
for (int i = 0, l = list.size(); i != l; ++i) {
auto &data = list[i];
const auto setData = data.match([&](const auto &data) {
return data.vset().match([](const MTPDstickerSet &data) {
return &data;
});
});
const auto covers = data.match([](const MTPDstickerSetCovered &) {
return Stickers::Pack();
}, [&](const MTPDstickerSetMultiCovered &data) {
auto result = Stickers::Pack();
for (const auto &cover : data.vcovers().v) {
const auto document = session().data().processDocument(cover);
if (document->sticker()) {
result.push_back(document);
}
}
return result;
});
if (const auto set = Stickers::FeedSet(*setData)) {
if (!covers.empty()) {
set->covers = covers;
}
if (set->stickers.empty() && set->covers.empty()) {
continue;
}
const auto externalLayout = true;
appendSet(
_officialSets,
set->id,
externalLayout,
AppendSkip::Installed);
}
}
});
resizeToWidth(width());
update();
}).fail([=](const RPCError &error) {
}).send();
}
void StickersListWidget::readVisibleFeatured(
int visibleTop,
int visibleBottom) {
const auto rowHeight = featuredRowHeight();
const auto rowFrom = floorclamp(visibleTop, rowHeight, 0, _featuredSets.size());
const auto rowTo = ceilclamp(visibleBottom, rowHeight, 0, _featuredSets.size());
const auto rowFrom = floorclamp(visibleTop, rowHeight, 0, _featuredSetsCount);
const auto rowTo = ceilclamp(visibleBottom, rowHeight, 0, _featuredSetsCount);
for (auto i = rowFrom; i < rowTo; ++i) {
auto &set = _featuredSets[i];
auto &set = _officialSets[i];
if (!(set.flags & MTPDstickerSet_ClientFlag::f_unread)) {
continue;
}
@@ -935,7 +988,7 @@ void StickersListWidget::readVisibleFeatured(
++loaded;
}
}
if (loaded == count) {
if (count > 0 && loaded == count) {
session().api().readFeaturedSetDelayed(set.id);
}
}
@@ -1227,7 +1280,7 @@ void StickersListWidget::addSearchRow(not_null<const Stickers::Set*> set) {
auto StickersListWidget::shownSets() const -> const std::vector<Set> & {
switch (_section) {
case Section::Featured: return _featuredSets;
case Section::Featured: return _officialSets;
case Section::Search: return _searchSets;
case Section::Stickers: return _mySets;
}
@@ -1236,7 +1289,7 @@ auto StickersListWidget::shownSets() const -> const std::vector<Set> & {
auto StickersListWidget::shownSets() -> std::vector<Set> & {
switch (_section) {
case Section::Featured: return _featuredSets;
case Section::Featured: return _officialSets;
case Section::Search: return _searchSets;
case Section::Stickers: return _mySets;
}
@@ -1349,10 +1402,11 @@ void StickersListWidget::paintStickers(Painter &p, QRect clip) {
}
auto &set = sets[info.section];
if (set.externalLayout) {
const auto size = (set.flags
const auto loadedCount = int(set.stickers.size());
const auto count = (set.flags
& MTPDstickerSet_ClientFlag::f_not_loaded)
? set.count
: int(set.stickers.size());
: loadedCount;
auto widthForTitle = stickersRight() - (st::emojiPanHeaderLeft - st::buttonRadius);
if (featuredHasAddButton(info.section)) {
@@ -1402,7 +1456,7 @@ void StickersListWidget::paintStickers(Painter &p, QRect clip) {
}
}
auto statusText = (size > 0) ? tr::lng_stickers_count(tr::now, lt_count, size) : tr::lng_contacts_loading(tr::now);
auto statusText = (count > 0) ? tr::lng_stickers_count(tr::now, lt_count, count) : tr::lng_contacts_loading(tr::now);
p.setFont(st::stickersTrendingSubheaderFont);
p.setPen(st::stickersTrendingSubheaderFg);
p.drawTextLeft(st::emojiPanHeaderLeft - st::buttonRadius, info.top + st::stickersTrendingSubheaderTop, width(), statusText);
@@ -1413,7 +1467,7 @@ void StickersListWidget::paintStickers(Painter &p, QRect clip) {
for (int j = fromColumn; j < toColumn; ++j) {
int index = j;
if (index >= size) break;
if (index >= loadedCount) break;
auto selected = selectedSticker ? (selectedSticker->section == info.section && selectedSticker->index == index) : false;
auto deleteSelected = false;
@@ -2116,12 +2170,33 @@ void StickersListWidget::refreshMySets() {
}
void StickersListWidget::refreshFeaturedSets() {
_featuredSets.clear();
_featuredSets.reserve(session().data().featuredStickerSetsOrder().size());
auto wasFeaturedSetsCount = base::take(_featuredSetsCount);
auto wereOfficial = base::take(_officialSets);
_officialSets.reserve(
session().data().featuredStickerSetsOrder().size()
+ wereOfficial.size()
- wasFeaturedSetsCount);
for (const auto setId : session().data().featuredStickerSetsOrder()) {
const auto externalLayout = true;
appendSet(_featuredSets, setId, externalLayout, AppendSkip::Installed);
appendSet(_officialSets, setId, externalLayout, AppendSkip::Installed);
}
_featuredSetsCount = _officialSets.size();
if (wereOfficial.size() > wasFeaturedSetsCount) {
auto &sets = session().data().stickerSets();
const auto from = begin(wereOfficial) + wasFeaturedSetsCount;
const auto till = end(wereOfficial);
for (auto i = from; i != till; ++i) {
auto &set = *i;
auto it = sets.constFind(set.id);
if (it == sets.cend()
|| ((it->flags & MTPDstickerSet::Flag::f_installed_date)
&& !(it->flags & MTPDstickerSet::Flag::f_archived)
&& !_installedLocallySets.contains(set.id))) {
continue;
}
set.flags = it->flags;
_officialSets.push_back(std::move(set));
}
}
}
@@ -2247,28 +2322,27 @@ uint64 StickersListWidget::currentSet(int yOffset) const {
: sets[sectionInfoByOffset(yOffset).section].id;
}
void StickersListWidget::appendSet(
bool StickersListWidget::appendSet(
std::vector<Set> &to,
uint64 setId,
bool externalLayout,
AppendSkip skip) {
auto &sets = session().data().stickerSets();
auto it = sets.constFind(setId);
if (it == sets.cend() || it->stickers.isEmpty()) {
return;
if (it == sets.cend() || (!externalLayout && it->stickers.isEmpty())) {
return false;
}
if ((skip == AppendSkip::Archived)
&& (it->flags & MTPDstickerSet::Flag::f_archived)) {
return;
return false;
}
if ((skip == AppendSkip::Installed)
&& (it->flags & MTPDstickerSet::Flag::f_installed_date)
&& !(it->flags & MTPDstickerSet::Flag::f_archived)) {
if (!_installedLocallySets.contains(setId)) {
return;
return false;
}
}
to.emplace_back(
it->id,
it->flags,
@@ -2277,7 +2351,10 @@ void StickersListWidget::appendSet(
it->thumbnail,
externalLayout,
it->count,
PrepareStickers(it->stickers));
PrepareStickers((it->stickers.empty() && externalLayout)
? it->covers
: it->stickers));
return true;
}
void StickersListWidget::refreshRecent() {
@@ -2487,8 +2564,7 @@ void StickersListWidget::refreshMegagroupStickers(GroupStickersPlace place) {
void StickersListWidget::fillIcons(QList<StickerIcon> &icons) {
icons.clear();
icons.reserve(_mySets.size() + 1);
if (session().data().featuredStickerSetsUnreadCount()
&& !_featuredSets.empty()) {
if (!_officialSets.empty()) {
icons.push_back(StickerIcon(Stickers::FeaturedSetId));
}
@@ -2535,11 +2611,6 @@ void StickersListWidget::fillIcons(QList<StickerIcon> &icons) {
pixw,
pixh));
}
if (!session().data().featuredStickerSetsUnreadCount()
&& !_featuredSets.empty()) {
icons.push_back(StickerIcon(Stickers::FeaturedSetId));
}
}
bool StickersListWidget::preventAutoHide() {

View File

@@ -179,6 +179,11 @@ private:
bool externalLayout = false;
int count = 0;
};
struct FeaturedSet {
uint64 id = 0;
MTPDstickerSet::Flags flags = MTPDstickerSet::Flags();
std::vector<Sticker> stickers;
};
struct LottieSet {
struct Item {
not_null<Lottie::Animation*> animation;
@@ -192,6 +197,7 @@ private:
static std::vector<Sticker> PrepareStickers(const Stickers::Pack &pack);
void preloadMoreOfficial();
QSize boundingBoxSize() const;
template <typename Callback>
@@ -273,7 +279,7 @@ private:
Archived,
Installed,
};
void appendSet(
bool appendSet(
std::vector<Set> &to,
uint64 setId,
bool externalLayout,
@@ -303,13 +309,17 @@ private:
ChannelData *_megagroupSet = nullptr;
uint64 _megagroupSetIdRequested = 0;
std::vector<Set> _mySets;
std::vector<Set> _featuredSets;
std::vector<Set> _officialSets;
std::vector<Set> _searchSets;
int _featuredSetsCount = 0;
base::flat_set<uint64> _installedLocallySets;
std::vector<bool> _custom;
base::flat_set<not_null<DocumentData*>> _favedStickersMap;
std::weak_ptr<Lottie::FrameRenderer> _lottieRenderer;
mtpRequestId _officialRequestId = 0;
int _officialOffset = 0;
Section _section = Section::Stickers;
bool _displayingSet = false;

View File

@@ -36,6 +36,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "observer_peer.h"
#include "storage/storage_databases.h"
#include "mainwidget.h"
#include "core/file_utilities.h"
#include "main/main_account.h"
#include "media/view/media_view_overlay_widget.h"
#include "mtproto/dc_options.h"
@@ -300,7 +301,7 @@ void Application::showDocument(not_null<DocumentData*> document, HistoryItem *it
if (cUseExternalVideoPlayer()
&& document->isVideoFile()
&& document->loaded()) {
QDesktopServices::openUrl(QUrl("file:///" + document->location(false).fname));
File::Launch(document->location(false).fname);
} else {
_mediaView->showDocument(document, item);
_mediaView->activateWindow();
@@ -517,6 +518,21 @@ void Application::switchTestMode() {
App::restart();
}
void Application::switchFreeType() {
if (cUseFreeType()) {
QFile(cWorkingDir() + qsl("tdata/withfreetype")).remove();
cSetUseFreeType(false);
} else {
QFile f(cWorkingDir() + qsl("tdata/withfreetype"));
if (f.open(QIODevice::WriteOnly)) {
f.write("1");
f.close();
}
cSetUseFreeType(true);
}
App::restart();
}
void Application::writeInstallBetaVersionsSetting() {
_launcher->writeInstallBetaVersionsSetting();
}

View File

@@ -215,6 +215,7 @@ public:
void switchDebugMode();
void switchTestMode();
void switchFreeType();
void writeInstallBetaVersionsSetting();
void call_handleUnreadCounterUpdate();

View File

@@ -54,6 +54,15 @@ std::map<int, const char*> BetaLogs() {
1009022,
"\xE2\x80\xA2 Organize chats into Chat Folders "
"if you have too many chats.\n"
},
{
2000001,
"\xE2\x80\xA2 Switch between folders using Ctrl+1, ..., Ctrl+8.\n"
"\xE2\x80\xA2 Fix crash when a pinned in folder chat "
"was added to archive.\n"
"\xE2\x80\xA2 Fix font issues in Linux version."
}
};
};

View File

@@ -22,7 +22,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "facades.h"
#include "app.h"
#include <QtGui/QDesktopServices>
#include <QtGui/QGuiApplication>
namespace {
@@ -51,9 +50,14 @@ void HiddenUrlClickHandler::Open(QString url, QVariant context) {
if (UrlRequiresConfirmation(url)
&& QGuiApplication::keyboardModifiers() != Qt::ControlModifier) {
Core::App().hideMediaView();
const auto displayUrl = parsedUrl.isValid()
const auto displayed = parsedUrl.isValid()
? parsedUrl.toDisplayString()
: url;
const auto displayUrl = !IsSuspicious(displayed)
? displayed
: parsedUrl.isValid()
? QString::fromUtf8(parsedUrl.toEncoded())
: ShowEncoded(displayed);
Ui::show(
Box<ConfirmBox>(
(tr::lng_open_this_link(tr::now)

View File

@@ -74,7 +74,7 @@ PreLaunchWindow::~PreLaunchWindow() {
PreLaunchLabel::PreLaunchLabel(QWidget *parent) : QLabel(parent) {
QFont labelFont(font());
labelFont.setFamily(style::internal::GetFontOverride(qsl("Open Sans Semibold")));
labelFont.setFamily(style::internal::GetFontOverride(style::internal::FontSemibold));
labelFont.setPixelSize(static_cast<PreLaunchWindow*>(parent)->basicSize());
setFont(labelFont);
@@ -92,7 +92,7 @@ void PreLaunchLabel::setText(const QString &text) {
PreLaunchInput::PreLaunchInput(QWidget *parent, bool password) : QLineEdit(parent) {
QFont logFont(font());
logFont.setFamily(style::internal::GetFontOverride(qsl("Open Sans")));
logFont.setFamily(style::internal::GetFontOverride());
logFont.setPixelSize(static_cast<PreLaunchWindow*>(parent)->basicSize());
setFont(logFont);
@@ -110,7 +110,7 @@ PreLaunchInput::PreLaunchInput(QWidget *parent, bool password) : QLineEdit(paren
PreLaunchLog::PreLaunchLog(QWidget *parent) : QTextEdit(parent) {
QFont logFont(font());
logFont.setFamily(style::internal::GetFontOverride(qsl("Open Sans")));
logFont.setFamily(style::internal::GetFontOverride());
logFont.setPixelSize(static_cast<PreLaunchWindow*>(parent)->basicSize());
setFont(logFont);
@@ -132,7 +132,7 @@ PreLaunchButton::PreLaunchButton(QWidget *parent, bool confirm) : QPushButton(pa
setObjectName(confirm ? "confirm" : "cancel");
QFont closeFont(font());
closeFont.setFamily(style::internal::GetFontOverride(qsl("Open Sans Semibold")));
closeFont.setFamily(style::internal::GetFontOverride(style::internal::FontSemibold));
closeFont.setPixelSize(static_cast<PreLaunchWindow*>(parent)->basicSize());
setFont(closeFont);
@@ -151,7 +151,7 @@ PreLaunchCheckbox::PreLaunchCheckbox(QWidget *parent) : QCheckBox(parent) {
setCheckState(Qt::Checked);
QFont closeFont(font());
closeFont.setFamily(style::internal::GetFontOverride(qsl("Open Sans Semibold")));
closeFont.setFamily(style::internal::GetFontOverride(style::internal::FontSemibold));
closeFont.setPixelSize(static_cast<PreLaunchWindow*>(parent)->basicSize());
setFont(closeFont);

View File

@@ -118,6 +118,13 @@ QString filedialogNextFilename(
namespace File {
void OpenUrl(const QString &url) {
crl::on_main([=] {
Ui::PreventDelayedActivation();
Platform::File::UnsafeOpenUrl(url);
});
}
void OpenEmailLink(const QString &email) {
crl::on_main([=] {
Ui::PreventDelayedActivation();
@@ -162,6 +169,10 @@ QString DefaultDownloadPath() {
namespace internal {
void UnsafeOpenUrlDefault(const QString &url) {
QDesktopServices::openUrl(url);
}
void UnsafeOpenEmailLinkDefault(const QString &email) {
auto url = QUrl(qstr("mailto:") + email);
QDesktopServices::openUrl(url);

View File

@@ -30,6 +30,7 @@ QString filedialogNextFilename(
namespace File {
// Those functions are async wrappers to Platform::File::Unsafe* calls.
void OpenUrl(const QString &url);
void OpenEmailLink(const QString &email);
void OpenWith(const QString &filepath, QPoint menuPosition);
void Launch(const QString &filepath);
@@ -43,6 +44,7 @@ inline QString UrlToLocalDefault(const QUrl &url) {
return url.toLocalFile();
}
void UnsafeOpenUrlDefault(const QString &url);
void UnsafeOpenEmailLinkDefault(const QString &email);
void UnsafeLaunchDefault(const QString &filepath);

View File

@@ -34,26 +34,47 @@ private:
static constexpr auto kForwardArgumentCount = 1;
int _count = 0;
char *_arguments[kForwardArgumentCount + 1] = { nullptr };
std::vector<QByteArray> _owned;
std::vector<char*> _arguments;
void pushArgument(const char *text);
};
FilteredCommandLineArguments::FilteredCommandLineArguments(
int argc,
char **argv)
: _count(std::clamp(argc, 0, kForwardArgumentCount)) {
char **argv) {
// For now just pass only the first argument, the executable path.
for (auto i = 0; i != _count; ++i) {
_arguments[i] = argv[i];
for (auto i = 0; i != kForwardArgumentCount; ++i) {
pushArgument(argv[i]);
}
#if defined Q_OS_WIN || defined Q_OS_MAC
if (cUseFreeType()) {
pushArgument("-platform");
#ifdef Q_OS_WIN
pushArgument("windows:fontengine=freetype");
#else // Q_OS_WIN
pushArgument("cocoa:fontengine=freetype");
#endif // !Q_OS_WIN
}
#endif // Q_OS_WIN || Q_OS_MAC
pushArgument(nullptr);
}
int &FilteredCommandLineArguments::count() {
_count = _arguments.size() - 1;
return _count;
}
char **FilteredCommandLineArguments::values() {
return _arguments;
return _arguments.data();
}
void FilteredCommandLineArguments::pushArgument(const char *text) {
_owned.emplace_back(text);
_arguments.push_back(_owned.back().data());
}
QString DebugModeSettingPath() {
@@ -82,6 +103,12 @@ void ComputeTestMode() {
}
}
void ComputeFreeType() {
if (QFile(cWorkingDir() + qsl("tdata/withfreetype")).exists()) {
cSetUseFreeType(true);
}
}
QString InstallBetaVersionsSettingPath() {
return cWorkingDir() + qsl("tdata/devversion");
}
@@ -301,6 +328,7 @@ void Launcher::workingFolderReady() {
ComputeTestMode();
ComputeDebugMode();
ComputeFreeType();
ComputeInstallBetaVersions();
ComputeInstallationTag();
}
@@ -382,6 +410,7 @@ void Launcher::processArguments() {
auto parseMap = std::map<QByteArray, KeyFormat> {
{ "-testmode" , KeyFormat::NoValues },
{ "-debug" , KeyFormat::NoValues },
{ "-freetype" , KeyFormat::NoValues },
{ "-many" , KeyFormat::NoValues },
{ "-key" , KeyFormat::OneValue },
{ "-autostart" , KeyFormat::NoValues },
@@ -423,6 +452,7 @@ void Launcher::processArguments() {
SetUpdaterDisabledAtStartup();
}
gTestMode = parseResult.contains("-testmode");
gUseFreeType = parseResult.contains("-freetype");
Logs::SetDebugEnabled(parseResult.contains("-debug"));
gManyInstance = parseResult.contains("-many");
gKeyFile = parseResult.value("-key", {}).join(QString()).toLower();

View File

@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/connection_box.h"
#include "boxes/sticker_set_box.h"
#include "boxes/sessions_box.h"
#include "boxes/language_box.h"
#include "passport/passport_form_controller.h"
#include "window/window_session_controller.h"
#include "data/data_session.h"
@@ -101,12 +102,21 @@ bool ShowTheme(
return true;
}
void ShowLanguagesBox() {
static auto Guard = base::binary_guard();
Guard = LanguageBox::Show();
}
bool SetLanguage(
Main::Session *session,
const Match &match,
const QVariant &context) {
const auto languageId = match->captured(1);
Lang::CurrentCloudManager().switchWithWarning(languageId);
if (match->capturedRef(1).isEmpty()) {
ShowLanguagesBox();
} else {
const auto languageId = match->captured(2);
Lang::CurrentCloudManager().switchWithWarning(languageId);
}
return true;
}
@@ -351,6 +361,9 @@ bool ResolveSettings(
if (section == qstr("devices")) {
Ui::show(Box<SessionsBox>(session));
return true;
} else if (section == qstr("language")) {
ShowLanguagesBox();
return true;
}
const auto type = (section == qstr("folders"))
? ::Settings::Type::Folders
@@ -441,7 +454,7 @@ const std::vector<LocalUrlHandler> &LocalUrlHandlers() {
ShowTheme
},
{
qsl("^setlanguage/?\\?lang=([a-zA-Z0-9\\.\\_\\-]+)(&|$)"),
qsl("^setlanguage/?(\\?lang=([a-zA-Z0-9\\.\\_\\-]+))?(&|$)"),
SetLanguage
},
{
@@ -481,7 +494,7 @@ const std::vector<LocalUrlHandler> &LocalUrlHandlers() {
ResolvePrivatePost
},
{
qsl("^settings(/folders|/devices)?$"),
qsl("^settings(/folders|/devices|/language)?$"),
ResolveSettings
},
{

View File

@@ -373,11 +373,8 @@ void Sandbox::readClients() {
toSend.append(_escapeFrom7bit(cmds.mid(from + 5, to - from - 5)));
}
} else if (cmd.startsWith(qsl("OPEN:"))) {
auto activateRequired = true;
if (cStartUrl().isEmpty()) {
startUrl = _escapeFrom7bit(cmds.mid(from + 5, to - from - 5)).mid(0, 8192);
activateRequired = StartUrlRequiresActivate(startUrl);
}
startUrl = _escapeFrom7bit(cmds.mid(from + 5, to - from - 5)).mid(0, 8192);
auto activateRequired = StartUrlRequiresActivate(startUrl);
if (activateRequired) {
execExternal("show");
}

View File

@@ -55,57 +55,81 @@ const auto SupportCommands = base::flat_set<Command>{
};
const auto CommandByName = base::flat_map<QString, Command>{
{ qsl("close_telegram") , Command::Close },
{ qsl("lock_telegram") , Command::Lock },
{ qsl("minimize_telegram"), Command::Minimize },
{ qsl("quit_telegram") , Command::Quit },
{ qsl("close_telegram") , Command::Close },
{ qsl("lock_telegram") , Command::Lock },
{ qsl("minimize_telegram") , Command::Minimize },
{ qsl("quit_telegram") , Command::Quit },
{ qsl("media_play") , Command::MediaPlay },
{ qsl("media_pause") , Command::MediaPause },
{ qsl("media_playpause") , Command::MediaPlayPause },
{ qsl("media_stop") , Command::MediaStop },
{ qsl("media_previous") , Command::MediaPrevious },
{ qsl("media_next") , Command::MediaNext },
{ qsl("media_play") , Command::MediaPlay },
{ qsl("media_pause") , Command::MediaPause },
{ qsl("media_playpause") , Command::MediaPlayPause },
{ qsl("media_stop") , Command::MediaStop },
{ qsl("media_previous") , Command::MediaPrevious },
{ qsl("media_next") , Command::MediaNext },
{ qsl("search") , Command::Search },
{ qsl("search") , Command::Search },
{ qsl("previous_chat") , Command::ChatPrevious },
{ qsl("next_chat") , Command::ChatNext },
{ qsl("first_chat") , Command::ChatFirst },
{ qsl("last_chat") , Command::ChatLast },
{ qsl("self_chat") , Command::ChatSelf },
{ qsl("previous_chat") , Command::ChatPrevious },
{ qsl("next_chat") , Command::ChatNext },
{ qsl("first_chat") , Command::ChatFirst },
{ qsl("last_chat") , Command::ChatLast },
{ qsl("self_chat") , Command::ChatSelf },
{ qsl("previous_folder") , Command::FolderPrevious },
{ qsl("next_folder") , Command::FolderNext },
{ qsl("all_chats") , Command::ShowAllChats },
{ qsl("folder1") , Command::ShowFolder1 },
{ qsl("folder2") , Command::ShowFolder2 },
{ qsl("folder3") , Command::ShowFolder3 },
{ qsl("folder4") , Command::ShowFolder4 },
{ qsl("folder5") , Command::ShowFolder5 },
{ qsl("folder6") , Command::ShowFolder6 },
{ qsl("last_folder") , Command::ShowFolderLast },
{ qsl("show_archive") , Command::ShowArchive },
{ qsl("show_archive") , Command::ShowArchive },
// Shortcuts that have no default values.
{ qsl("message") , Command::JustSendMessage },
{ qsl("message_silently") , Command::SendSilentMessage },
{ qsl("message_scheduled"), Command::ScheduleMessage },
{ qsl("message") , Command::JustSendMessage },
{ qsl("message_silently") , Command::SendSilentMessage },
{ qsl("message_scheduled") , Command::ScheduleMessage },
//
};
const auto CommandNames = base::flat_map<Command, QString>{
{ Command::Close , qsl("close_telegram") },
{ Command::Lock , qsl("lock_telegram") },
{ Command::Minimize , qsl("minimize_telegram") },
{ Command::Quit , qsl("quit_telegram") },
{ Command::Close , qsl("close_telegram") },
{ Command::Lock , qsl("lock_telegram") },
{ Command::Minimize , qsl("minimize_telegram") },
{ Command::Quit , qsl("quit_telegram") },
{ Command::MediaPlay , qsl("media_play") },
{ Command::MediaPause , qsl("media_pause") },
{ Command::MediaPlayPause, qsl("media_playpause") },
{ Command::MediaStop , qsl("media_stop") },
{ Command::MediaPrevious , qsl("media_previous") },
{ Command::MediaNext , qsl("media_next") },
{ Command::MediaPlay , qsl("media_play") },
{ Command::MediaPause , qsl("media_pause") },
{ Command::MediaPlayPause , qsl("media_playpause") },
{ Command::MediaStop , qsl("media_stop") },
{ Command::MediaPrevious , qsl("media_previous") },
{ Command::MediaNext , qsl("media_next") },
{ Command::Search , qsl("search") },
{ Command::Search , qsl("search") },
{ Command::ChatPrevious , qsl("previous_chat") },
{ Command::ChatNext , qsl("next_chat") },
{ Command::ChatFirst , qsl("first_chat") },
{ Command::ChatLast , qsl("last_chat") },
{ Command::ChatSelf , qsl("self_chat") },
{ Command::ChatPrevious , qsl("previous_chat") },
{ Command::ChatNext , qsl("next_chat") },
{ Command::ChatFirst , qsl("first_chat") },
{ Command::ChatLast , qsl("last_chat") },
{ Command::ChatSelf , qsl("self_chat") },
{ Command::FolderPrevious , qsl("previous_folder") },
{ Command::FolderNext , qsl("next_folder") },
{ Command::ShowAllChats , qsl("all_chats") },
{ Command::ShowFolder1 , qsl("folder1") },
{ Command::ShowFolder2 , qsl("folder2") },
{ Command::ShowFolder3 , qsl("folder3") },
{ Command::ShowFolder4 , qsl("folder4") },
{ Command::ShowFolder5 , qsl("folder5") },
{ Command::ShowFolder6 , qsl("folder6") },
{ Command::ShowFolderLast , qsl("last_folder") },
{ Command::ShowArchive , qsl("show_archive") },
{ Command::ShowArchive , qsl("show_archive") },
};
class Manager {
@@ -113,7 +137,7 @@ public:
void fill();
void clear();
std::optional<Command> lookup(int shortcutId) const;
[[nodiscard]] std::vector<Command> lookup(int shortcutId) const;
void toggleMedia(bool toggled);
void toggleSupport(bool toggled);
@@ -124,14 +148,14 @@ private:
void writeDefaultFile();
bool readCustomFile();
void set(const QString &keys, Command command);
void set(const QString &keys, Command command, bool replace = false);
void remove(const QString &keys);
void unregister(base::unique_qptr<QShortcut> shortcut);
QStringList _errors;
base::flat_map<QKeySequence, base::unique_qptr<QShortcut>> _shortcuts;
base::flat_map<int, Command> _commandByShortcutId;
base::flat_multi_map<int, Command> _commandByShortcutId;
base::flat_set<QShortcut*> _mediaShortcuts;
base::flat_set<QShortcut*> _supportShortcuts;
@@ -206,11 +230,14 @@ const QStringList &Manager::errors() const {
return _errors;
}
std::optional<Command> Manager::lookup(int shortcutId) const {
const auto i = _commandByShortcutId.find(shortcutId);
return (i != end(_commandByShortcutId))
? base::make_optional(i->second)
: std::nullopt;
std::vector<Command> Manager::lookup(int shortcutId) const {
auto result = std::vector<Command>();
auto i = _commandByShortcutId.findFirst(shortcutId);
const auto end = _commandByShortcutId.end();
for (; i != end && (i->first == shortcutId); ++i) {
result.push_back(i->second);
}
return result;
}
void Manager::toggleMedia(bool toggled) {
@@ -278,7 +305,7 @@ bool Manager::readCustomFile() {
const auto name = (*command).toString();
const auto i = CommandByName.find(name);
if (i != end(CommandByName)) {
set((*keys).toString(), i->second);
set((*keys).toString(), i->second, true);
} else {
LOG(("Shortcut Warning: "
"could not find shortcut command handler '%1'"
@@ -343,7 +370,7 @@ void Manager::fillDefaults() {
ranges::view::ints(1, ranges::unreachable));
for (const auto [command, index] : folders) {
set(qsl("%1+shift+%2").arg(ctrl).arg(index > 9 ? 0 : index), command);
set(qsl("%1+%2").arg(ctrl).arg(index), command);
}
set(qsl("%1+shift+down").arg(ctrl), Command::FolderNext);
@@ -373,10 +400,12 @@ void Manager::writeDefaultFile() {
shortcuts.push_back(version);
for (const auto &[sequence, shortcut] : _shortcuts) {
const auto i = _commandByShortcutId.find(shortcut->id());
if (i != end(_commandByShortcutId)) {
const auto shortcutId = shortcut->id();
auto i = _commandByShortcutId.findFirst(shortcutId);
const auto end = _commandByShortcutId.end();
for (; i != end && i->first == shortcutId; ++i) {
const auto j = CommandNames.find(i->second);
if (j != end(CommandNames)) {
if (j != CommandNames.end()) {
QJsonObject entry;
entry.insert(qsl("keys"), sequence.toString().toLower());
entry.insert(qsl("command"), j->second);
@@ -390,7 +419,7 @@ void Manager::writeDefaultFile() {
file.write(document.toJson(QJsonDocument::Indented));
}
void Manager::set(const QString &keys, Command command) {
void Manager::set(const QString &keys, Command command, bool replace) {
if (keys.isEmpty()) {
return;
}
@@ -415,22 +444,24 @@ void Manager::set(const QString &keys, Command command) {
if (isMediaShortcut || isSupportShortcut) {
shortcut->setEnabled(false);
}
const auto id = shortcut->id();
auto id = shortcut->id();
auto i = _shortcuts.find(result);
if (i == end(_shortcuts)) {
i = _shortcuts.emplace(result, std::move(shortcut)).first;
} else if (replace) {
unregister(std::exchange(i->second, std::move(shortcut)));
} else {
id = i->second->id();
}
if (!id) {
_errors.push_back(qsl("Could not create shortcut '%1'!").arg(keys));
return;
}
auto i = _shortcuts.find(result);
if (i == end(_shortcuts)) {
i = _shortcuts.emplace(result, std::move(shortcut)).first;
} else {
unregister(std::exchange(i->second, std::move(shortcut)));
}
_commandByShortcutId.emplace(id, command);
if (isMediaShortcut) {
if (!shortcut && isMediaShortcut) {
_mediaShortcuts.emplace(i->second.get());
}
if (isSupportShortcut) {
if (!shortcut && isSupportShortcut) {
_supportShortcuts.emplace(i->second.get());
}
}
@@ -465,11 +496,13 @@ Manager Data;
} // namespace
Request::Request(Command command) : _command(command) {
Request::Request(std::vector<Command> commands)
: _commands(std::move(commands)) {
}
bool Request::check(Command command, int priority) {
if (_command == command && priority > _handlerPriority) {
if (ranges::contains(_commands, command)
&& priority > _handlerPriority) {
_handlerPriority = priority;
return true;
}
@@ -481,12 +514,16 @@ bool Request::handle(FnMut<bool()> handler) {
return true;
}
FnMut<bool()> RequestHandler(Command command) {
auto request = Request(command);
FnMut<bool()> RequestHandler(std::vector<Command> commands) {
auto request = Request(std::move(commands));
RequestsStream.fire(&request);
return std::move(request._handler);
}
FnMut<bool()> RequestHandler(Command command) {
return RequestHandler(std::vector<Command>{ command });
}
bool Launch(Command command) {
if (auto handler = RequestHandler(command)) {
return handler();
@@ -494,6 +531,13 @@ bool Launch(Command command) {
return false;
}
bool Launch(std::vector<Command> commands) {
if (auto handler = RequestHandler(std::move(commands))) {
return handler();
}
return false;
}
rpl::producer<not_null<Request*>> Requests() {
return RequestsStream.events();
}
@@ -509,10 +553,7 @@ const QStringList &Errors() {
}
bool HandleEvent(not_null<QShortcutEvent*> event) {
if (const auto command = Data.lookup(event->shortcutId())) {
return Launch(*command);
}
return false;
return Launch(Data.lookup(event->shortcutId()));
}
void ToggleMediaShortcuts(bool toggled) {

View File

@@ -35,16 +35,14 @@ enum class Command {
ChatPinned4,
ChatPinned5,
ShowAllChats,
ShowFolder1,
ShowFolder2,
ShowFolder3,
ShowFolder4,
ShowFolder5,
ShowFolder6,
ShowFolder7,
ShowFolder8,
ShowFolder9,
ShowFolder10,
ShowFolderLast,
FolderNext,
FolderPrevious,
@@ -63,16 +61,14 @@ enum class Command {
};
constexpr auto kShowFolder = {
Command::ShowAllChats,
Command::ShowFolder1,
Command::ShowFolder2,
Command::ShowFolder3,
Command::ShowFolder4,
Command::ShowFolder5,
Command::ShowFolder6,
Command::ShowFolder7,
Command::ShowFolder8,
Command::ShowFolder9,
Command::ShowFolder10,
Command::ShowFolderLast,
};
[[nodiscard]] FnMut<bool()> RequestHandler(Command command);
@@ -83,13 +79,13 @@ public:
bool handle(FnMut<bool()> handler);
private:
explicit Request(Command command);
explicit Request(std::vector<Command> commands);
Command _command;
std::vector<Command> _commands;
int _handlerPriority = -1;
FnMut<bool()> _handler;
friend FnMut<bool()> RequestHandler(Command command);
friend FnMut<bool()> RequestHandler(std::vector<Command> commands);
};

View File

@@ -66,6 +66,11 @@ std::shared_ptr<ClickHandler> UiIntegration::createLinkHandler(
const QString &data,
const TextParseOptions &options) {
switch (type) {
case EntityType::Url:
return (!data.isEmpty() && UrlClickHandler::IsSuspicious(data))
? std::make_shared<HiddenUrlClickHandler>(data)
: nullptr;
case EntityType::CustomUrl:
return !data.isEmpty()
? std::make_shared<HiddenUrlClickHandler>(data)
@@ -138,7 +143,9 @@ bool UiIntegration::handleUrlClick(
Core::App().openInternalUrl(local, context);
return true;
}
return false;
File::OpenUrl(url);
return true;
}

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