Compare commits

..

77 Commits
v6.3.8 ... ci

Author SHA1 Message Date
23rd
ff0e515361 Returned kick button to list of members but only for inaccessible users.
Related commits: d7bf9e285c and 490f6f7e50.
2025-12-25 18:52:28 +03:00
Ilya Fedin
bece15eaac Ensure patches aren't cleared up in actions
They're used by following steps
2025-12-23 04:52:00 +03:00
John Preston
e762ec4631 Beta version 3.6.10.
- Fix user info showing from large group messages.
- Fix sent state of outgoing messages in forums.
- Show who sent your unique collectible gifts.
- Update Qt on all platforms.
2025-12-22 22:29:56 +04:00
23rd
7341c05d36 Added initial ability to translate admin log entries. 2025-12-22 22:29:38 +04:00
23rd
b1bf68b830 Added simple tooltip to fromPhoto element in view messages.
Fixed #773.
2025-12-22 22:29:38 +04:00
Ilya Fedin
1a071c5c6b Ensure prepare.py cache keys aren't cleared in actions 2025-12-22 22:01:39 +04:00
Ilya Fedin
6de7e7f4a8 Cherry-pick a jpegli fix for DHT marker 2025-12-22 18:37:54 +04:00
John Preston
632a14e65a Update lib_ui for updated Qt. 2025-12-22 17:57:40 +04:00
John Preston
321576658f Show gift sender badge. 2025-12-22 17:56:56 +04:00
John Preston
fac241b87e Return some of getDifference on unknown peers. 2025-12-22 17:56:56 +04:00
John Preston
39bd52c1e2 Fix crash in bot chat userpic right click. 2025-12-22 17:56:56 +04:00
John Preston
e55f394db5 Fix updating access hash, fix userpic loading. 2025-12-22 17:56:56 +04:00
John Preston
00d7eeb742 Fix chat row update when message is sent. 2025-12-22 17:56:55 +04:00
John Preston
bcfa106959 Show max 3 joined by invite link. 2025-12-22 17:56:55 +04:00
John Preston
fe3c545455 Fix controls disappearing in group calls. 2025-12-22 17:56:55 +04:00
John Preston
885d431d65 Fix text selection in topic webpage/collapsed-quote. 2025-12-22 17:56:55 +04:00
John Preston
a103047e03 Attempt to fix topic draft saving. 2025-12-22 17:56:55 +04:00
John Preston
b04866a2fc Fix video metadata rotation reading. 2025-12-22 17:56:55 +04:00
John Preston
28434f4bee Full support and build fix. 2025-12-22 17:56:55 +04:00
John Preston
53324d5494 Initial support for min-user-from-message request. 2025-12-22 17:56:55 +04:00
23rd
66645ce523 Fixed local storage of user photos when previous userpic set as main. 2025-12-22 17:56:55 +04:00
23rd
06caf65a6a Fixed local storage of user photos when userpic was uploaded. 2025-12-22 17:56:55 +04:00
23rd
5026b07626 Added ability to replace user photo entry in storage. 2025-12-22 17:56:55 +04:00
23rd
8cfa722966 Fixed local storage of user photos when self userpic was deleted. 2025-12-22 17:56:55 +04:00
23rd
f31337ecb5 Improved style of box for denied unconfirmed authentications. 2025-12-22 17:56:55 +04:00
23rd
f468666973 Moved out creation of lottie icon in circle to single place. 2025-12-22 17:56:55 +04:00
23rd
590421daaa Added name of single passkey to right label in privacy settings. 2025-12-22 17:56:55 +04:00
23rd
e1248ba0b2 Fixed left padding of text in resolving phone menu item. 2025-12-22 17:56:55 +04:00
23rd
89b15142ef Returned button for topics list to profile info. 2025-12-22 17:56:55 +04:00
23rd
57b22d2ad2 Added accounts list to dock menu on macOS. 2025-12-22 17:56:54 +04:00
23rd
d51dd1cdb5 Fixed verified icon and gift status together in profile top bar. 2025-12-22 17:56:54 +04:00
23rd
6418af0ada Improved division by zero in photo editor stroke rendering calculations. 2025-12-22 17:56:54 +04:00
Ilya Fedin
08d6e8c7eb Update Qt
6.10.0 -> 6.10.1
6.2.12 -> 6.2.13
5.15.17 -> 5.15.18
2025-12-22 17:53:10 +04:00
dependabot[bot]
cf7ae1adf2 Bump actions/upload-artifact from 5 to 6
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-22 15:10:45 +04:00
dependabot[bot]
691f796df6 Bump actions/cache from 4 to 5
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-22 15:09:52 +04:00
dependabot[bot]
2775074113 Bump dessant/lock-threads from 5 to 6
Bumps [dessant/lock-threads](https://github.com/dessant/lock-threads) from 5 to 6.
- [Release notes](https://github.com/dessant/lock-threads/releases)
- [Changelog](https://github.com/dessant/lock-threads/blob/main/CHANGELOG.md)
- [Commits](https://github.com/dessant/lock-threads/compare/v5...v6)

---
updated-dependencies:
- dependency-name: dessant/lock-threads
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-22 15:08:55 +04:00
Ilya Fedin
bf9014342c More aggressive libraries clean up in macOS action 2025-12-22 14:00:18 +04:00
Ilya Fedin
fb9a456b59 More aggressive libraries clean up in Windows action 2025-12-22 14:00:18 +04:00
Ilya Fedin
e36e52fd9e Disable debug symbols in Windows action 2025-12-22 14:00:18 +04:00
Ilya Fedin
f076793fa6 Revert "Keep only one Windows action run"
This reverts commit 0116f098f8.
2025-12-22 14:00:18 +04:00
Ilya Fedin
0116f098f8 Keep only one Windows action run
This decreases the queue and fits cache in 10 GB
2025-12-18 22:16:53 +04:00
Ilya Fedin
fc728e7a13 Disable debug symbols in macOS action 2025-12-18 22:16:53 +04:00
Ilya Fedin
5114c9a58e Revert "Free more disk space in mac action"
This reverts commit ccf6a3fb97.
2025-12-18 22:16:53 +04:00
Ilya Fedin
3bd896b8fa Authorize getting WebRTC version in macOS packaged action
It gets rate limited otherwise...
2025-12-18 22:16:53 +04:00
Ilya Fedin
dddefc3904 Move WebRTC version before general cache key
That's more logical
2025-12-18 22:16:53 +04:00
Ilya Fedin
fc0cbaadd5 Separate action artifact flavor with space 2025-12-18 22:16:53 +04:00
John Preston
6b862688cb Show all variants when clicking on percents. 2025-12-18 21:17:07 +04:00
John Preston
767eedaa76 Fix the cover in unique variants previews. 2025-12-18 21:17:07 +04:00
John Preston
1578c3c09d Fix glitching unique variants previews. 2025-12-18 21:17:07 +04:00
John Preston
9496ebd19e Remove AddFullWidthButton helper. 2025-12-18 21:17:07 +04:00
John Preston
1ea2d936b5 Fix crash in Settings in Windows on ARM. 2025-12-17 13:01:54 +04:00
23rd
6ce7641971 Replaced WebAuthn dll loading with SafeLoadLibrary on Windows. 2025-12-16 17:09:13 +03:00
23rd
98f5247126 Fixed full recreation of pattern bg while scroll reactions settings. 2025-12-16 14:31:34 +03:00
23rd
bf36718c93 Fixed full recreation of pattern bg while scroll notifications settings. 2025-12-16 14:29:28 +03:00
23rd
11c193b699 Improved cache quality of animated emoji in reactions settings box. 2025-12-16 12:35:05 +03:00
23rd
5c1604fc53 Fixed cache of graphs in chart widgets on retina. 2025-12-16 11:46:36 +03:00
23rd
4c545181ad Fixed display of resolving phone menu item with increased round radius. 2025-12-16 11:17:42 +03:00
23rd
5ee8100274 Added date of saved forwards to tooltip. 2025-12-16 11:17:42 +03:00
23rd
86351f48d6 Fixed display of forwarded messages from self to self. 2025-12-16 11:17:42 +03:00
23rd
6996e410d5 Fixed empty userpic in history top bar for sublist with hidden author. 2025-12-16 11:17:42 +03:00
23rd
5d6994f170 Removed outdated 1000-member limit for channel deletion. 2025-12-16 04:26:32 +03:00
John Preston
beb4fafdf3 Version 6.3.9.
- Fix possible crash in audio playback speed menu.
- Fix possible crash in forum or bot topic deletion.
2025-12-15 22:51:14 +04:00
John Preston
3e22cb6d0a Fix crash in media playback speed dropdown.
Fixes #30111.
2025-12-15 21:40:55 +04:00
John Preston
849def7e75 Don't disable dice/slots animation. 2025-12-15 21:40:54 +04:00
John Preston
1a4195f7e2 Fix possible crash on topic deletion. 2025-12-15 21:40:54 +04:00
John Preston
0b4a718afe Don't re-create topic when clearing its messages. 2025-12-15 21:40:54 +04:00
John Preston
b53ca51d37 Fix crash on topic icon emoji without title. 2025-12-15 21:40:54 +04:00
John Preston
60c9707a64 Fix incorrect reporting of gift as channel's. 2025-12-15 21:40:54 +04:00
John Preston
08a979e638 Use more simple tr::... text helpers. 2025-12-15 21:40:54 +04:00
John Preston
629158fedb Fix crash in bad attach bots parsing. 2025-12-15 21:40:54 +04:00
John Preston
f15e99ce1d Don't check payment when editing a message. 2025-12-15 21:40:53 +04:00
23rd
18f9c040e0 Removed obsolete code that prevented menu from inactive window on macOS. 2025-12-15 21:40:53 +04:00
23rd
7f6baa0fdc Added right press-move-release gesture to menu on Unix systems.
Fixed #29826.
Fixed #10366.
2025-12-15 21:40:53 +04:00
23rd
bb9a112677 Fixed unnecessary recreation of fireworks in history view todo list. 2025-12-15 21:40:53 +04:00
23rd
7952d2688e Slightly improved animation of personal channel when it is removed. 2025-12-15 21:40:53 +04:00
23rd
0f41fd1356 Added ability to remove personal channel from your profile section. 2025-12-15 21:40:53 +04:00
23rd
8c3a8a7d20 Added ability set currently opened channel as personal from info menu. 2025-12-15 21:40:53 +04:00
358 changed files with 3567 additions and 2784 deletions

View File

@@ -82,7 +82,7 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Libraries cache.
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{ runner.temp }}/.buildx-cache
key: ${{ runner.OS }}-libs-${{ hashFiles('Telegram/build/docker/centos_env/**') }}
@@ -109,7 +109,7 @@ jobs:
if [ -n "${{ matrix.defines }}" ]; then
DEFINE="-D ${{ matrix.defines }}=ON"
echo Define from matrix: $DEFINE
echo "ARTIFACT_NAME=Telegram_${{ matrix.defines }}" >> $GITHUB_ENV
echo "ARTIFACT_NAME=Telegram ${{ matrix.defines }}" >> $GITHUB_ENV
else
echo "ARTIFACT_NAME=Telegram" >> $GITHUB_ENV
fi
@@ -149,7 +149,7 @@ jobs:
cd out/Debug
mkdir artifact
mv {Telegram,Updater} artifact/
- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v6
if: env.UPLOAD_ARTIFACT == 'true'
name: Upload artifact.
with:

View File

@@ -8,7 +8,7 @@ jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v5
- uses: dessant/lock-threads@v6
with:
github-token: ${{ github.token }}
issue-inactive-days: 45

View File

@@ -74,18 +74,11 @@ jobs:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
- name: Free up some disk space.
uses: hugoalh/disk-space-optimizer-ghaction@271735125a1b35180620eae7e45c2e9d470c31b0
with:
general_include: ".+"
homebrew_prune: "True"
homebrew_clean: "True"
npm_prune: "True"
npm_clean: "True"
sudo sed -i '' '/CMAKE_${lang}_FLAGS_DEBUG_INIT/s/ -g//' /opt/homebrew/share/cmake/Modules/Compiler/GNU.cmake
- name: ThirdParty cache.
id: cache-third-party
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ThirdParty
key: ${{ runner.OS }}-third-party-${{ hashFiles(format('{0}/{1}', env.REPO_NAME, env.PREPARE_PATH)) }}
@@ -93,7 +86,7 @@ jobs:
- name: Libraries cache.
id: cache-libs
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: Libraries
key: ${{ runner.OS }}-libs-${{ hashFiles(format('{0}/{1}', env.REPO_NAME, env.PREPARE_PATH)) }}
@@ -104,7 +97,7 @@ jobs:
./$REPO_NAME/Telegram/build/prepare/mac.sh skip-release silent
- name: Free up some disk space.
run: find Libraries -iwholename "*.dir/*" -delete
run: find Libraries '(' '(' ! '(' -name '*.a' -o -name '*.h' -o -name '*.hpp' -o -name '*.inc' -o -name '*.cmake' -o -path '*/include/*' -o -path '*/objects-*' -o -path '*/cache_keys/*' -o -path '*/patches/*' -o -perm +111 ')' -type f ')' -o -empty ')' -delete
- name: Telegram Desktop build.
if: env.ONLY_CACHE == 'false'
@@ -115,7 +108,7 @@ jobs:
if [ -n "${{ matrix.defines }}" ]; then
DEFINE="-D ${{ matrix.defines }}=ON"
echo Define from matrix: $DEFINE
echo "ARTIFACT_NAME=Telegram_${{ matrix.defines }}" >> $GITHUB_ENV
echo "ARTIFACT_NAME=Telegram ${{ matrix.defines }}" >> $GITHUB_ENV
else
echo "ARTIFACT_NAME=Telegram" >> $GITHUB_ENV
fi
@@ -138,7 +131,7 @@ jobs:
mkdir artifact
mv Telegram.app artifact/
mv Updater artifact/
- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v6
if: env.UPLOAD_ARTIFACT == 'true'
name: Upload artifact.
with:

View File

@@ -85,7 +85,7 @@ jobs:
echo "MACOSX_DEPLOYMENT_TARGET=$(grep 'set(QT_SUPPORTED_MIN_MACOS_VERSION' /opt/homebrew/Cellar/qtbase/*/lib/cmake/Qt6/Qt6ConfigExtras.cmake | sed -E 's/^.*"(.*)"\)$/\1/')" >> $GITHUB_ENV
echo "LibrariesPath=`pwd`" >> $GITHUB_ENV
echo "WEBRTC=`curl -sSL https://api.github.com/repos/desktop-app/tg_owt/git/refs/heads/master | jq -r .object.sha`" >> $GITHUB_ENV
echo "WEBRTC=`curl -sSL --header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/desktop-app/tg_owt/git/refs/heads/master | jq -r .object.sha`" >> $GITHUB_ENV
- name: RNNoise.
run: |
@@ -100,10 +100,10 @@ jobs:
- name: WebRTC cache.
id: cache-webrtc
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{ env.LibrariesPath }}/tg_owt
key: ${{ runner.OS }}-webrtc-${{ env.CACHE_KEY }}-${{ env.WEBRTC }}
key: ${{ runner.OS }}-webrtc-${{ env.WEBRTC }}-${{ env.CACHE_KEY }}
- name: WebRTC.
if: steps.cache-webrtc.outputs.cache-hit != 'true'
run: |
@@ -122,7 +122,7 @@ jobs:
- name: TDE2E cache.
id: cache-tde2e
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{ env.LibrariesPath }}/tde2e
key: ${{ runner.OS }}-tde2e-${{ env.CACHE_KEY }}
@@ -159,7 +159,7 @@ jobs:
if [ -n "${{ matrix.defines }}" ]; then
DEFINE="-D ${{ matrix.defines }}=ON"
echo Define from matrix: $DEFINE
echo "ARTIFACT_NAME=Telegram_${{ matrix.defines }}" >> $GITHUB_ENV
echo "ARTIFACT_NAME=Telegram ${{ matrix.defines }}" >> $GITHUB_ENV
else
echo "ARTIFACT_NAME=Telegram" >> $GITHUB_ENV
fi
@@ -187,7 +187,7 @@ jobs:
cd $REPO_NAME/build
mkdir artifact
mv Telegram.dmg artifact/
- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v6
if: env.UPLOAD_ARTIFACT == 'true'
name: Upload artifact.
with:

View File

@@ -79,7 +79,7 @@ jobs:
mkdir artifact
mv $artifact_name artifact
- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v6
if: env.UPLOAD_ARTIFACT == 'true'
name: Upload artifact.
with:

View File

@@ -85,6 +85,8 @@ jobs:
SDK="$(grep "SDK version" $DOCPATH | sed -r 's/.*\*\*(.*)\*\* SDK version.*/\1/')"
echo "SDK=$SDK" >> $GITHUB_ENV
sed -i '/CMAKE_${lang}_FLAGS_DEBUG_INIT/s/${_Zi}//' "$PROGRAMFILES"/CMake/share/cmake*/Modules/Platform/Windows-MSVC.cmake
echo "$(sha256sum $TBUILD/$REPO_NAME/$PREPARE_PATH | awk '{ print $1 }')" >> CACHE_KEY.txt
echo "$SDK" >> CACHE_KEY.txt
echo "CACHE_KEY=$(sha256sum CACHE_KEY.txt | awk '{ print $1 }')" >> $GITHUB_ENV
@@ -106,7 +108,7 @@ jobs:
- name: ThirdParty cache.
id: cache-third-party
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{ env.TBUILD }}\ThirdParty
key: ${{ runner.OS }}-${{ matrix.arch }}-third-party-${{ env.CACHE_KEY }}
@@ -114,7 +116,7 @@ jobs:
- name: Libraries cache.
id: cache-libs
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ${{ env.TBUILD }}\Libraries
key: ${{ runner.OS }}-${{ matrix.arch }}-libs-${{ env.CACHE_KEY }}
@@ -140,14 +142,14 @@ jobs:
*) ARCH="${{ matrix.arch }}";;
esac
echo "Architecture from matrix: $ARCH"
ARTIFACT_NAME="${ARTIFACT_NAME}_${{ matrix.arch }}"
ARTIFACT_NAME="${ARTIFACT_NAME} ${{ matrix.arch }}"
fi
GENERATOR=""
if [ -n "${{ matrix.generator }}" ]; then
GENERATOR="-G \"${{ matrix.generator }}\""
echo "Generator from matrix: $GENERATOR"
ARTIFACT_NAME="${ARTIFACT_NAME}_${{ matrix.generator }}"
ARTIFACT_NAME="${ARTIFACT_NAME} ${{ matrix.generator }}"
fi
echo "TDESKTOP_BUILD_GENERATOR=$GENERATOR" >> $GITHUB_ENV
@@ -158,7 +160,7 @@ jobs:
if [ -n "${{ matrix.defines }}" ]; then
DEFINE="-D ${{ matrix.defines }}=ON"
echo "Define from matrix: $DEFINE"
ARTIFACT_NAME="${ARTIFACT_NAME}_${{ matrix.defines }}"
ARTIFACT_NAME="${ARTIFACT_NAME} ${{ matrix.defines }}"
fi
echo "TDESKTOP_BUILD_DEFINE=$DEFINE" >> $GITHUB_ENV
@@ -172,11 +174,8 @@ jobs:
echo "TDESKTOP_BUILD_API=$API" >> $GITHUB_ENV
- name: Free up some disk space.
run: |
cd %TBUILD%
del /S Libraries\*.pdb
del /S Libraries\*.pch
del /S Libraries\*.obj
shell: bash
run: find TBuild/Libraries '(' '(' ! '(' -name '*.lib' -o -name '*.a' -o -name '*.exe' -o -name '*.h' -o -name '*.hpp' -o -name '*.inc' -o -name '*.cmake' -o -path '*/include/*' -o -path '*/objects-*' -o -path '*/cache_keys/*' -o -path '*/patches/*' ')' -type f ')' -o -empty ')' -delete
- name: Telegram Desktop build.
if: env.ONLY_CACHE == 'false'
@@ -203,7 +202,7 @@ jobs:
mkdir artifact
move %OUT%\Telegram.exe artifact/
move %OUT%\Updater.exe artifact/
- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v6
name: Upload artifact.
if: (env.UPLOAD_ARTIFACT == 'true') || (github.ref == 'refs/heads/nightly')
with:

Binary file not shown.

View File

@@ -797,6 +797,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_settings_channel_label" = "Personal channel";
"lng_settings_channel_add" = "Add";
"lng_settings_channel_remove" = "Remove";
"lng_settings_channel_menu_remove" = "Remove Personal Channel";
"lng_settings_channel_no_yet" = "You don't have any public channels yet.";
"lng_settings_channel_start" = "Start a Channel";
"lng_settings_channel_saved" = "Your personal channel was updated.";
@@ -2662,6 +2663,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_forwarded_story" = "Story from {user}";
"lng_forwarded_story_expired" = "This story has expired.";
"lng_forwarded_date" = "Original: {date}";
"lng_forwarded_saved_date" = "Saved date: {date}";
"lng_forwarded_channel" = "Forwarded from {channel}";
"lng_forwarded_psa_default" = "Forwarded from {channel}";
"lng_forwarded_via" = "Forwarded from {user} via {inline_bot}";
@@ -3834,6 +3836,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_gift_unique_backdrop" = "Backdrop";
"lng_gift_unique_symbol" = "Symbol";
"lng_gift_unique_rarity" = "Only {percent} of such collectibles have this attribute.";
"lng_gift_unique_sender" = "{from} sent you this gift on {date}";
"lng_gift_unique_sender_you" = "You bought this gift on {date}";
"lng_gift_unique_availability_label" = "Quantity";
"lng_gift_unique_availability#one" = "{count} of {amount} issued";
"lng_gift_unique_availability#other" = "{count} of {amount} issued";
@@ -5178,6 +5182,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_edit_channel_status_about" = "Choose a status that will be shown next to the channel's name.";
"lng_edit_channel_status_group" = "Set Group Emoji Status";
"lng_edit_channel_status_about_group" = "Choose a status that will be shown next to the group's name.";
"lng_edit_channel_personal_channel" = "Set as Personal Channel";
"lng_edit_self_title" = "Edit your name";
"lng_confirm_contact_data" = "New Contact";
"lng_add_contact" = "Create";
@@ -7430,6 +7435,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_mac_menu_player_resume" = "Resume";
"lng_mac_menu_player_next" = "Next";
"lng_mac_menu_player_previous" = "Previous";
"lng_mac_menu_profiles" = "Profiles";
"lng_mac_touchbar_favorite_stickers" = "Favorite stickers";

View File

@@ -51,6 +51,7 @@
<file alias="show_or_premium_lastseen.tgs">../../animations/show_or_premium_lastseen.tgs</file>
<file alias="show_or_premium_readtime.tgs">../../animations/show_or_premium_readtime.tgs</file>
<file alias="passkeys.tgs">../../animations/passkeys.tgs</file>
<file alias="ban.tgs">../../animations/ban.tgs</file>
<file alias="profile_muting.tgs">../../animations/profile/profile_muting.tgs</file>
<file alias="profile_unmuting.tgs">../../animations/profile/profile_unmuting.tgs</file>

View File

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

View File

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

View File

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

View File

@@ -83,7 +83,7 @@ void BlockedPeers::block(not_null<PeerData*> peer) {
}
const auto requestId = _api.request(MTPcontacts_Block(
MTP_flags(0),
peer->input
peer->input()
)).done([=] {
const auto data = _blockRequests.take(peer);
peer->setIsBlocked(true);
@@ -127,7 +127,7 @@ void BlockedPeers::unblock(
}
const auto requestId = _api.request(MTPcontacts_Unblock(
MTP_flags(0),
peer->input
peer->input()
)).done([=] {
const auto data = _blockRequests.take(peer);
peer->setIsBlocked(false);

View File

@@ -91,7 +91,7 @@ void SendBotCallbackData(
const auto show = controller->uiShow();
button->requestId = api->request(MTPmessages_GetBotCallbackAnswer(
MTP_flags(flags),
history->peer->input,
history->peer->input(),
MTP_int(item->id),
MTP_bytes(sendData),
password ? password->result : MTP_inputCheckPasswordEmpty()
@@ -218,7 +218,7 @@ void SendBotCallbackDataWithPassword(
session,
tr::lng_bots_password_confirm_check_about(
tr::now,
Ui::Text::WithEntities));
tr::marked));
if (box) {
show->showBox(std::move(box), Ui::LayerOption::CloseOther);
} else {
@@ -421,13 +421,13 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) {
const auto id = int32(button->buttonId);
const auto chosen = [=](std::vector<not_null<PeerData*>> result) {
peer->session().api().request(MTPmessages_SendBotRequestedPeer(
peer->input,
peer->input(),
MTP_int(itemId),
MTP_int(id),
MTP_vector_from_range(
result | ranges::views::transform([](
not_null<PeerData*> peer) {
return MTPInputPeer(peer->input);
return MTPInputPeer(peer->input());
}))
)).done([=](const MTPUpdates &result) {
peer->session().api().applyUpdates(result);

View File

@@ -116,24 +116,24 @@ private:
tr::now,
lt_folder,
std::move(boldTitle),
Ui::Text::WithEntities)
tr::marked)
: (type == Type::AddingChats)
? tr::lng_filters_by_link_more_sure(
tr::now,
lt_folder,
std::move(boldTitle),
Ui::Text::WithEntities)
tr::marked)
: (type == Type::AllAdded)
? tr::lng_filters_by_link_already_about(
tr::now,
lt_folder,
std::move(boldTitle),
Ui::Text::WithEntities)
tr::marked)
: tr::lng_filters_by_link_remove_sure(
tr::now,
lt_folder,
std::move(boldTitle),
Ui::Text::WithEntities);
tr::marked);
}
void InitFilterLinkHeader(
@@ -237,7 +237,7 @@ void ImportInvite(
fail(error.type());
};
auto inputs = peers | ranges::views::transform([](auto peer) {
return MTPInputPeer(peer->input);
return MTPInputPeer(peer->input());
}) | ranges::to<QVector<MTPInputPeer>>();
if (!slug.isEmpty()) {
api->request(MTPchatlists_JoinChatlistInvite(
@@ -547,7 +547,7 @@ void ShowImportToast(
? tr::lng_filters_added_title
: tr::lng_filters_updated_title;
auto text = Ui::Text::Wrapped(
phrase(tr::now, lt_folder, title.text, Ui::Text::WithEntities),
phrase(tr::now, lt_folder, title.text, tr::marked),
EntityType::Bold);
if (added > 0) {
const auto phrase = created

View File

@@ -44,7 +44,7 @@ void RemoveChatFilter(
MTP_vector<MTPInputPeer>(ranges::views::all(
leave
) | ranges::views::transform([](not_null<PeerData*> peer) {
return MTPInputPeer(peer->input);
return MTPInputPeer(peer->input());
}) | ranges::to<QVector<MTPInputPeer>>())
)).done([=](const MTPUpdates &result) {
api->applyUpdates(result);

View File

@@ -224,13 +224,13 @@ void ConfirmSubscriptionBox(
box,
tr::lng_channel_invite_subscription_about(
lt_channel,
rpl::single(Ui::Text::Bold(name)),
rpl::single(tr::bold(name)),
lt_price,
tr::lng_credits_summary_options_credits(
lt_count,
rpl::single(amount) | tr::to_count(),
Ui::Text::Bold),
Ui::Text::WithEntities),
tr::bold),
tr::marked),
st::inviteLinkSubscribeBoxAbout),
style::al_top);
Ui::AddSkip(content);
@@ -243,9 +243,9 @@ void ConfirmSubscriptionBox(
tr::lng_paid_react_agree_link(),
tr::lng_group_invite_subscription_about_url()
) | rpl::map([](const QString &text, const QString &url) {
return Ui::Text::Link(text, url);
return tr::link(text, url);
}),
Ui::Text::RichLangValue),
tr::rich),
st::inviteLinkSubscribeBoxTerms),
style::al_top);

View File

@@ -422,7 +422,7 @@ void ChatParticipants::requestForAdd(
_forAdd.channel = channel;
_forAdd.requestId = _api.request(MTPchannels_GetParticipants(
channel->inputChannel,
channel->inputChannel(),
MTP_channelParticipantsRecent(),
MTP_int(offset),
MTP_int(channel->session().serverConfig().chatSizeMax),
@@ -450,7 +450,7 @@ void ChatParticipants::requestLast(not_null<ChannelData*> channel) {
const auto offset = 0;
const auto participantsHash = uint64(0);
const auto requestId = _api.request(MTPchannels_GetParticipants(
channel->inputChannel,
channel->inputChannel(),
MTP_channelParticipantsRecent(),
MTP_int(offset),
MTP_int(channel->session().serverConfig().chatSizeMax),
@@ -480,7 +480,7 @@ void ChatParticipants::requestBots(not_null<ChannelData*> channel) {
const auto offset = 0;
const auto participantsHash = uint64(0);
const auto requestId = _api.request(MTPchannels_GetParticipants(
channel->inputChannel,
channel->inputChannel(),
MTP_channelParticipantsBots(),
MTP_int(offset),
MTP_int(channel->session().serverConfig().chatSizeMax),
@@ -516,7 +516,7 @@ void ChatParticipants::requestAdmins(not_null<ChannelData*> channel) {
const auto offset = 0;
const auto participantsHash = uint64(0);
const auto requestId = _api.request(MTPchannels_GetParticipants(
channel->inputChannel,
channel->inputChannel(),
MTP_channelParticipantsAdmins(),
MTP_int(offset),
MTP_int(channel->session().serverConfig().chatSizeMax),
@@ -555,8 +555,8 @@ void ChatParticipants::add(
if (const auto chat = peer->asChat()) {
for (const auto &user : users) {
_api.request(MTPmessages_AddChatUser(
chat->inputChat,
user->inputUser,
chat->inputChat(),
user->inputUser(),
MTP_int(passGroupHistory ? kForwardMessagesOnAdd : 0)
)).done([=](const MTPmessages_InvitedUsers &result) {
const auto &data = result.data();
@@ -587,7 +587,7 @@ void ChatParticipants::add(
const auto send = [&] {
const auto callback = base::take(done);
_api.request(MTPchannels_InviteToChannel(
channel->inputChannel,
channel->inputChannel(),
MTP_vector<MTPInputUser>(list)
)).done([=](const MTPmessages_InvitedUsers &result) {
const auto &data = result.data();
@@ -606,7 +606,7 @@ void ChatParticipants::add(
}).afterDelay(kSmallDelayMs).send();
};
for (const auto &user : users) {
list.push_back(user->inputUser);
list.push_back(user->inputUser());
if (list.size() == kMaxUsersPerInvite) {
send();
list.clear();
@@ -653,8 +653,8 @@ void ChatParticipants::Restrict(
Fn<void()> onDone,
Fn<void()> onFail) {
channel->session().api().request(MTPchannels_EditBanned(
channel->inputChannel,
participant->input,
channel->inputChannel(),
participant->input(),
RestrictionsToMTP(newRights)
)).done([=](const MTPUpdates &result) {
channel->session().api().applyUpdates(result);
@@ -692,7 +692,7 @@ void ChatParticipants::requestSelf(not_null<ChannelData*> channel) {
};
_selfParticipantRequests.emplace(channel);
_api.request(MTPchannels_GetParticipant(
channel->inputChannel,
channel->inputChannel(),
MTP_inputPeerSelf()
)).done([=](const MTPchannels_ChannelParticipant &result) {
_selfParticipantRequests.erase(channel);
@@ -742,8 +742,8 @@ void ChatParticipants::kick(
_api.request(MTPmessages_DeleteChatUser(
MTP_flags(0),
chat->inputChat,
participant->asUser()->inputUser
chat->inputChat(),
participant->asUser()->inputUser()
)).done([=](const MTPUpdates &result) {
chat->session().api().applyUpdates(result);
}).send();
@@ -758,8 +758,8 @@ void ChatParticipants::kick(
const auto rights = ChannelData::KickedRestrictedRights(participant);
const auto requestId = _api.request(MTPchannels_EditBanned(
channel->inputChannel,
participant->input,
channel->inputChannel(),
participant->input(),
RestrictionsToMTP(rights)
)).done([=](const MTPUpdates &result) {
channel->session().api().applyUpdates(result);
@@ -782,8 +782,8 @@ void ChatParticipants::unblock(
}
const auto requestId = _api.request(MTPchannels_EditBanned(
channel->inputChannel,
participant->input,
channel->inputChannel(),
participant->input(),
MTP_chatBannedRights(MTP_flags(0), MTP_int(0))
)).done([=](const MTPUpdates &result) {
channel->session().api().applyUpdates(result);
@@ -814,7 +814,7 @@ void ChatParticipants::loadSimilarPeers(not_null<PeerData*> peer) {
_similar[peer].requestId = _api.request(
MTPchannels_GetChannelRecommendations(
MTP_flags(Flag::f_channel),
channel->inputChannel)
channel->inputChannel())
).done([=](const MTPmessages_Chats &result) {
auto &similar = _similar[channel];
similar.requestId = 0;
@@ -832,7 +832,7 @@ void ChatParticipants::loadSimilarPeers(not_null<PeerData*> peer) {
}).send();
} else if (const auto bot = peer->asBot()) {
_similar[peer].requestId = _api.request(
MTPbots_GetBotRecommendations(bot->inputUser)
MTPbots_GetBotRecommendations(bot->inputUser())
).done([=](const MTPusers_Users &result) {
auto &similar = _similar[peer];
similar.requestId = 0;

View File

@@ -131,7 +131,7 @@ rpl::producer<rpl::no_value, QString> CreditsTopupOptions::request() {
using TLOption = MTPStarsGiftOption;
_api.request(MTPpayments_GetStarsGiftOptions(
MTP_flags(MTPpayments_GetStarsGiftOptions::Flag::f_user_id),
user->inputUser
user->inputUser()
)).done([=](const MTPVector<TLOption> &result) {
_options = optionsFromTL(result.v);
consumer.put_done();
@@ -162,7 +162,7 @@ void CreditsStatus::request(
_requestId = _api.request(MTPpayments_GetStarsStatus(
MTP_flags(0),
_peer->isSelf() ? MTP_inputPeerSelf() : _peer->input
_peer->isSelf() ? MTP_inputPeerSelf() : _peer->input()
)).done([=](const TLResult &result) {
_requestId = 0;
const auto &balance = result.data().vbalance();
@@ -204,7 +204,7 @@ void CreditsHistory::request(
_requestId = _api.request(MTPpayments_GetStarsTransactions(
MTP_flags(_flags),
MTPstring(), // subscription_id
_peer->isSelf() ? MTP_inputPeerSelf() : _peer->input,
_peer->isSelf() ? MTP_inputPeerSelf() : _peer->input(),
MTP_string(token),
MTP_int(kTransactionsLimit)
)).done([=](const MTPpayments_StarsStatus &result) {
@@ -227,7 +227,7 @@ void CreditsHistory::requestSubscriptions(
MTP_flags(missingBalance
? MTPpayments_getStarsSubscriptions::Flag::f_missing_balance
: MTPpayments_getStarsSubscriptions::Flags(0)),
_peer->isSelf() ? MTP_inputPeerSelf() : _peer->input,
_peer->isSelf() ? MTP_inputPeerSelf() : _peer->input(),
MTP_string(token)
)).done([=](const MTPpayments_StarsStatus &result) {
_requestId = 0;
@@ -285,7 +285,7 @@ rpl::producer<rpl::no_value, QString> CreditsEarnStatistics::request() {
const auto finish = [=](const QString &url) {
api().request(MTPpayments_GetStarsRevenueStats(
MTP_flags(0),
(_isUser ? user()->input : channel()->input)
(_isUser ? user()->input() : channel()->input())
)).done([=](const MTPpayments_StarsRevenueStats &result) {
const auto &data = result.data();
const auto &status = data.vstatus().data();
@@ -315,7 +315,7 @@ rpl::producer<rpl::no_value, QString> CreditsEarnStatistics::request() {
api().request(
MTPpayments_GetStarsRevenueAdsAccountUrl(
(_isUser ? user()->input : channel()->input))
(_isUser ? user()->input() : channel()->input()))
).done([=](const MTPpayments_StarsRevenueAdsAccountUrl &result) {
finish(qs(result.data().vurl()));
}).fail([=](const MTP::Error &error) {
@@ -408,7 +408,7 @@ MTPInputSavedStarGift InputSavedStarGiftId(
: id.isUser()
? MTP_inputSavedStarGiftUser(MTP_int(id.userMessageId().bare))
: MTP_inputSavedStarGiftChat(
id.chat()->input,
id.chat()->input(),
MTP_long(id.chatSavedId()));
}

View File

@@ -25,7 +25,7 @@ void RestrictSponsored(
bool restricted,
Fn<void(QString)> failed) {
channel->session().api().request(MTPchannels_RestrictSponsoredMessages(
channel->inputChannel,
channel->inputChannel(),
MTP_bool(restricted))
).done([=](const MTPUpdates &updates) {
channel->session().api().applyUpdates(updates);
@@ -105,8 +105,8 @@ void HandleWithdrawalButton(
? F::f_ton
: F::f_amount),
currencyReceiver
? currencyReceiver->input
: creditsReceiver->input,
? currencyReceiver->input()
: creditsReceiver->input(),
MTP_long(creditsReceiver
? receiver.creditsAmount()
: 0),
@@ -145,8 +145,8 @@ void HandleWithdrawalButton(
? F::f_ton
: F::f_amount),
currencyReceiver
? currencyReceiver->input
: creditsReceiver->input,
? currencyReceiver->input()
: creditsReceiver->input(),
MTP_long(creditsReceiver
? receiver.creditsAmount()
: 0),

View File

@@ -146,7 +146,7 @@ mtpRequestId SuggestMedia(
const auto randomId = base::RandomValue<uint64>();
return api->request(MTPmessages_SendMedia(
MTP_flags(flags),
item->history()->peer->input,
item->history()->peer->input(),
ReplyToForMTP(item->history(), replyTo),
inputMedia.value_or(Data::WebPageForMTP(webpage, text.isEmpty())),
MTP_string(text),
@@ -310,7 +310,7 @@ mtpRequestId EditMessage(
: item->id;
return api->request(MTPmessages_EditMessage(
MTP_flags(flags),
item->history()->peer->input,
item->history()->peer->input(),
MTP_int(id),
MTP_string(text),
inputMedia.value_or(Data::WebPageForMTP(webpage, text.isEmpty())),

View File

@@ -101,7 +101,7 @@ void InviteLinks::performCreate(
: Flag(0))
| (requestApproval ? Flag::f_request_needed : Flag(0))
| (args.subscription ? Flag::f_subscription_pricing : Flag(0))),
args.peer->input,
args.peer->input(),
MTP_int(args.expireDate),
MTP_int(args.usageLimit),
MTP_string(args.label),
@@ -270,7 +270,7 @@ void InviteLinks::performEdit(
: Flag(0));
_api->request(MTPmessages_EditExportedChatInvite(
MTP_flags(editOnlyTitle ? Flag::f_title : flags),
peer->input,
peer->input(),
MTP_string(link),
MTP_int(expireDate),
MTP_int(usageLimit),
@@ -365,7 +365,7 @@ void InviteLinks::destroy(
callbacks.push_back(std::move(done));
}
_api->request(MTPmessages_DeleteExportedChatInvite(
peer->input,
peer->input(),
MTP_string(link)
)).done([=] {
const auto callbacks = _deleteCallbacks.take(key);
@@ -400,8 +400,8 @@ void InviteLinks::destroyAllRevoked(
callbacks.push_back(std::move(done));
}
_api->request(MTPmessages_DeleteRevokedExportedChatInvites(
peer->input,
admin->inputUser
peer->input(),
admin->inputUser()
)).done([=] {
if (const auto callbacks = _deleteRevokedCallbacks.take(peer)) {
for (const auto &callback : *callbacks) {
@@ -418,7 +418,7 @@ void InviteLinks::requestMyLinks(not_null<PeerData*> peer) {
}
const auto requestId = _api->request(MTPmessages_GetExportedChatInvites(
MTP_flags(0),
peer->input,
peer->input(),
MTP_inputUserSelf(),
MTPint(), // offset_date
MTPstring(), // offset_link
@@ -471,8 +471,8 @@ void InviteLinks::processRequest(
using Flag = MTPmessages_HideChatJoinRequest::Flag;
_api->request(MTPmessages_HideChatJoinRequest(
MTP_flags(approved ? Flag::f_approved : Flag(0)),
peer->input,
user->inputUser
peer->input(),
user->inputUser()
)).done([=](const MTPUpdates &result) {
if (const auto chat = peer->asChat()) {
if (chat->count > 0) {
@@ -601,7 +601,7 @@ void InviteLinks::requestJoinedFirstSlice(LinkKey key) {
}
const auto requestId = _api->request(MTPmessages_GetChatInviteImporters(
MTP_flags(MTPmessages_GetChatInviteImporters::Flag::f_link),
key.peer->input,
key.peer->input(),
MTP_string(key.link),
MTPstring(), // q
MTP_int(0), // offset_date
@@ -780,8 +780,8 @@ void InviteLinks::requestMoreLinks(
_api->request(MTPmessages_GetExportedChatInvites(
MTP_flags(Flag::f_offset_link
| (revoked ? Flag::f_revoked : Flag(0))),
peer->input,
admin->inputUser,
peer->input(),
admin->inputUser(),
MTP_int(lastDate),
MTP_string(lastLink),
MTP_int(kPerPage)

View File

@@ -105,10 +105,10 @@ void MessagesSearch::searchRequest() {
| (savedPeer ? Flag::f_saved_peer_id : Flag())
| (_request.topMsgId ? Flag::f_top_msg_id : Flag())
| (_request.tags.empty() ? Flag() : Flag::f_saved_reaction)),
_history->peer->input,
_history->peer->input(),
MTP_string(_request.query),
(fromPeer ? fromPeer->input : MTP_inputPeerEmpty()),
(savedPeer ? savedPeer->input : MTP_inputPeerEmpty()),
(fromPeer ? fromPeer->input() : MTP_inputPeerEmpty()),
(savedPeer ? savedPeer->input() : MTP_inputPeerEmpty()),
MTP_vector_from_range(_request.tags | ranges::views::transform(
Data::ReactionToMTP
)),

View File

@@ -243,12 +243,16 @@ void PeerPhoto::suggest(not_null<PeerData*> peer, UserPhoto &&photo) {
void PeerPhoto::clear(not_null<PhotoData*> photo) {
const auto self = _session->user();
if (self->userpicPhotoId() == photo->id) {
const auto photoId = photo->id;
const auto peerId = self->id;
_api.request(MTPphotos_UpdateProfilePhoto(
MTP_flags(0),
MTPInputUser(), // bot
MTP_inputPhotoEmpty()
)).done([=](const MTPphotos_Photo &result) {
self->setPhoto(MTP_userProfilePhotoEmpty());
_session->storage().remove(
Storage::UserPhotosRemoveOne(peerToUser(peerId), photoId));
}).send();
} else if (photo->peer && photo->peer->userpicPhotoId() == photo->id) {
const auto applier = [=](const MTPUpdates &result) {
@@ -256,12 +260,12 @@ void PeerPhoto::clear(not_null<PhotoData*> photo) {
};
if (const auto chat = photo->peer->asChat()) {
_api.request(MTPmessages_EditChatPhoto(
chat->inputChat,
chat->inputChat(),
MTP_inputChatPhotoEmpty()
)).done(applier).send();
} else if (const auto channel = photo->peer->asChannel()) {
_api.request(MTPchannels_EditPhoto(
channel->inputChannel,
channel->inputChannel(),
MTP_inputChatPhotoEmpty()
)).done(applier).send();
}
@@ -290,7 +294,7 @@ void PeerPhoto::clear(not_null<PhotoData*> photo) {
void PeerPhoto::clearPersonal(not_null<UserData*> user) {
_api.request(MTPphotos_UploadContactProfilePhoto(
MTP_flags(MTPphotos_UploadContactProfilePhoto::Flag::f_save),
user->inputUser,
user->inputUser(),
MTPInputFile(),
MTPInputFile(), // video
MTPdouble(), // video_start_ts
@@ -314,15 +318,20 @@ void PeerPhoto::set(not_null<PeerData*> peer, not_null<PhotoData*> photo) {
return;
}
if (peer == _session->user()) {
const auto photoId = photo->id;
const auto peerId = peer->id;
_api.request(MTPphotos_UpdateProfilePhoto(
MTP_flags(0),
MTPInputUser(), // bot
photo->mtpInput()
)).done([=](const MTPphotos_Photo &result) {
result.match([&](const MTPDphotos_photo &data) {
_session->data().processPhoto(data.vphoto());
_session->data().processUsers(data.vusers());
});
const auto newPhoto = _session->data().processPhoto(
result.data().vphoto());
_session->data().processUsers(result.data().vusers());
_session->storage().replace(Storage::UserPhotosReplace(
peerToUser(peerId),
photoId,
newPhoto->id));
}).send();
} else {
const auto applier = [=](const MTPUpdates &result) {
@@ -330,12 +339,12 @@ void PeerPhoto::set(not_null<PeerData*> peer, not_null<PhotoData*> photo) {
};
if (const auto chat = peer->asChat()) {
_api.request(MTPmessages_EditChatPhoto(
chat->inputChat,
chat->inputChat(),
MTP_inputChatPhoto(photo->mtpInput())
)).done(applier).send();
} else if (const auto channel = peer->asChannel()) {
_api.request(MTPchannels_EditPhoto(
channel->inputChannel,
channel->inputChannel(),
MTP_inputChatPhoto(photo->mtpInput())
)).done(applier).send();
}
@@ -362,7 +371,7 @@ void PeerPhoto::ready(
const auto botUserInput = [&] {
const auto user = peer->asUser();
return (user && user->botInfo && user->botInfo->canEditInformation)
? std::make_optional<MTPInputUser>(user->inputUser)
? std::make_optional<MTPInputUser>(user->inputUser())
: std::nullopt;
}();
if (peer->isSelf() || botUserInput) {
@@ -386,6 +395,10 @@ void PeerPhoto::ready(
_session->storage().add(Storage::UserPhotosSetBack(
peerToUser(peer->id),
photoId));
} else {
_session->storage().add(Storage::UserPhotosAddNew(
peerToUser(peer->id),
photoId));
}
if (done) {
done();
@@ -396,7 +409,7 @@ void PeerPhoto::ready(
using Flag = MTPDinputChatUploadedPhoto::Flag;
const auto none = MTPDinputChatUploadedPhoto::Flags(0);
history->sendRequestId = _api.request(MTPmessages_EditChatPhoto(
chat->inputChat,
chat->inputChat(),
MTP_inputChatUploadedPhoto(
MTP_flags((file ? Flag::f_file : none)
| (videoSize ? Flag::f_video_emoji_markup : none)),
@@ -410,7 +423,7 @@ void PeerPhoto::ready(
const auto none = MTPDinputChatUploadedPhoto::Flags(0);
const auto history = _session->data().history(channel);
history->sendRequestId = _api.request(MTPchannels_EditPhoto(
channel->inputChannel,
channel->inputChannel(),
MTP_inputChatUploadedPhoto(
MTP_flags((file ? Flag::f_file : none)
| (videoSize ? Flag::f_video_emoji_markup : none)),
@@ -428,7 +441,7 @@ void PeerPhoto::ready(
| ((type == UploadType::Suggestion)
? Flag::f_suggest
: Flag::f_save)),
user->inputUser,
user->inputUser(),
file ? (*file) : MTPInputFile(),
MTPInputFile(), // video
MTPdouble(), // video_start_ts
@@ -456,7 +469,7 @@ void PeerPhoto::requestUserPhotos(
}
const auto requestId = _api.request(MTPphotos_GetUserPhotos(
user->inputUser,
user->inputUser(),
MTP_int(0),
MTP_long(afterId),
MTP_int(kSharedMediaLimit)

View File

@@ -90,7 +90,7 @@ void Polls::create(
randomId,
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
MTP_flags(sendFlags),
peer->input,
peer->input(),
Data::Histories::ReplyToPlaceholder(),
PollDataToInputMedia(&data),
MTP_string(),
@@ -99,7 +99,7 @@ void Polls::create(
MTPVector<MTPMessageEntity>(),
MTP_int(action.options.scheduled),
MTP_int(action.options.scheduleRepeatPeriod),
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
Data::ShortcutIdToMTP(_session, action.options.shortcutId),
MTP_long(action.options.effectId),
MTP_long(starsPaid),
@@ -162,7 +162,7 @@ void Polls::sendVotes(
ranges::back_inserter(prepared),
[](const QByteArray &option) { return MTP_bytes(option); });
const auto requestId = _api.request(MTPmessages_SendVote(
item->history()->peer->input,
item->history()->peer->input(),
MTP_int(item->id),
MTP_vector<MTPbytes>(prepared)
)).done([=](const MTPUpdates &result) {
@@ -188,7 +188,7 @@ void Polls::close(not_null<HistoryItem*> item) {
}
const auto requestId = _api.request(MTPmessages_EditMessage(
MTP_flags(MTPmessages_EditMessage::Flag::f_media),
item->history()->peer->input,
item->history()->peer->input(),
MTP_int(item->id),
MTPstring(),
PollDataToInputMedia(poll, true),
@@ -212,7 +212,7 @@ void Polls::reloadResults(not_null<HistoryItem*> item) {
return;
}
const auto requestId = _api.request(MTPmessages_GetPollResults(
item->history()->peer->input,
item->history()->peer->input(),
MTP_int(item->id)
)).done([=](const MTPUpdates &result) {
_pollReloadRequestIds.erase(itemId);

View File

@@ -365,7 +365,7 @@ void Premium::resolveGiveawayInfo(
_giveawayInfoPeer = peer;
_giveawayInfoMessageId = messageId;
_giveawayInfoRequestId = _api.request(MTPpayments_GetGiveawayInfo(
_giveawayInfoPeer->input,
_giveawayInfoPeer->input(),
MTP_int(_giveawayInfoMessageId.bare)
)).done([=](const MTPpayments_GiveawayInfo &result) {
_giveawayInfoRequestId = 0;
@@ -500,7 +500,7 @@ rpl::producer<rpl::no_value, QString> PremiumGiftCodeOptions::request() {
MTP_flags(_peer->isChannel()
? MTPpayments_GetPremiumGiftCodeOptions::Flag::f_boost_peer
: MTPpayments_GetPremiumGiftCodeOptions::Flag(0)),
_peer->input
_peer->input()
)).done([=](const MTPVector<TLOption> &result) {
auto tlMapOptions = base::flat_map<Amount, QVector<TLOption>>();
for (const auto &tlOption : result.v) {
@@ -554,7 +554,7 @@ rpl::producer<rpl::no_value, QString> PremiumGiftCodeOptions::applyPrepaid(
}
_api.request(MTPpayments_LaunchPrepaidGiveaway(
_peer->input,
_peer->input(),
MTP_long(prepaidId),
invoice.giveawayCredits
? Payments::InvoiceCreditsGiveawayToTL(invoice)

View File

@@ -47,7 +47,7 @@ void SendPhotoReport(
const QString &comment,
not_null<PhotoData*> photo) {
peer->session().api().request(MTPaccount_ReportProfilePhoto(
peer->input,
peer->input(),
photo->mtpInput(),
ReasonToTL(reason),
MTP_string(comment)
@@ -125,7 +125,7 @@ auto CreateReportMessagesOrStoriesCallback(
if (!reportInput.stories.empty()) {
state->requestId = peer->session().api().request(
MTPstories_Report(
peer->input,
peer->input(),
MTP_vector<MTPint>(apiIds),
MTP_bytes(reportInput.optionId),
MTP_string(reportInput.comment))
@@ -133,7 +133,7 @@ auto CreateReportMessagesOrStoriesCallback(
} else {
state->requestId = peer->session().api().request(
MTPmessages_Report(
peer->input,
peer->input(),
MTP_vector<MTPint>(apiIds),
MTP_bytes(reportInput.optionId),
MTP_string(reportInput.comment))

View File

@@ -137,7 +137,7 @@ void SendProgressManager::send(const Key &key, int progress) {
MTP_flags(key.topMsgId
? MTPmessages_SetTyping::Flag::f_top_msg_id
: MTPmessages_SetTyping::Flag(0)),
key.history->peer->input,
key.history->peer->input(),
MTP_int(key.topMsgId),
action
)).done([=](const MTPBool &result, mtpRequestId requestId) {

View File

@@ -131,7 +131,7 @@ void SendSimpleMedia(SendAction action, MTPInputMedia inputMedia) {
randomId,
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
MTP_flags(sendFlags),
peer->input,
peer->input(),
Data::Histories::ReplyToPlaceholder(),
std::move(inputMedia),
MTPstring(),
@@ -140,7 +140,7 @@ void SendSimpleMedia(SendAction action, MTPInputMedia inputMedia) {
MTPvector<MTPMessageEntity>(),
MTP_int(action.options.scheduled),
MTP_int(action.options.scheduleRepeatPeriod),
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
Data::ShortcutIdToMTP(session, action.options.shortcutId),
MTP_long(action.options.effectId),
MTP_long(starsPaid),
@@ -259,7 +259,7 @@ void SendExistingMedia(
randomId,
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
MTP_flags(sendFlags),
peer->input,
peer->input(),
Data::Histories::ReplyToPlaceholder(),
inputMedia(),
MTP_string(captionText),
@@ -268,7 +268,7 @@ void SendExistingMedia(
sentEntities,
MTP_int(action.options.scheduled),
MTP_int(action.options.scheduleRepeatPeriod),
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
Data::ShortcutIdToMTP(session, action.options.shortcutId),
MTP_long(action.options.effectId),
MTP_long(starsPaid),
@@ -448,7 +448,7 @@ bool SendDice(MessageToSend &message) {
randomId,
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
MTP_flags(sendFlags),
peer->input,
peer->input(),
Data::Histories::ReplyToPlaceholder(),
MTP_inputMediaDice(MTP_string(emoji)),
MTP_string(),
@@ -457,7 +457,7 @@ bool SendDice(MessageToSend &message) {
MTP_vector<MTPMessageEntity>(),
MTP_int(action.options.scheduled),
MTP_int(action.options.scheduleRepeatPeriod),
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
Data::ShortcutIdToMTP(session, action.options.shortcutId),
MTP_long(action.options.effectId),
MTP_long(starsPaid),

View File

@@ -99,7 +99,7 @@ std::optional<HistoryItem*> SingleMessageSearch::performLookupByChannel(
ready();
};
_requestId = _session->api().request(MTPchannels_GetMessages(
channel->inputChannel,
channel->inputChannel(),
MTP_vector<MTPInputMessage>(1, MTP_inputMessageID(MTP_int(postId)))
)).done([=](const MTPmessages_Messages &result) {
const auto received = Api::ParseSearchResult(

View File

@@ -210,7 +210,7 @@ rpl::producer<rpl::no_value, QString> Statistics::request() {
if (!channel()->isMegagroup()) {
makeRequest(MTPstats_GetBroadcastStats(
MTP_flags(MTPstats_GetBroadcastStats::Flags(0)),
channel()->inputChannel
channel()->inputChannel()
)).done([=](const MTPstats_BroadcastStats &result) {
_channelStats = ChannelStatisticsFromTL(result.data());
consumer.put_done();
@@ -220,7 +220,7 @@ rpl::producer<rpl::no_value, QString> Statistics::request() {
} else {
makeRequest(MTPstats_GetMegagroupStats(
MTP_flags(MTPstats_GetMegagroupStats::Flags(0)),
channel()->inputChannel
channel()->inputChannel()
)).done([=](const MTPstats_MegagroupStats &result) {
const auto &data = result.data();
_supergroupStats = SupergroupStatisticsFromTL(data);
@@ -351,14 +351,14 @@ void PublicForwards::request(
constexpr auto kLimit = tl::make_int(100);
if (_fullId.messageId) {
_requestId = makeRequest(MTPstats_GetMessagePublicForwards(
channel->inputChannel,
channel->inputChannel(),
MTP_int(_fullId.messageId.msg),
MTP_string(token),
kLimit
)).done(processResult).fail(processFail).send();
} else if (_fullId.storyId) {
_requestId = makeRequest(MTPstats_GetStoryPublicForwards(
channel->input,
channel->input(),
MTP_int(_fullId.storyId.story),
MTP_string(token),
kLimit
@@ -413,7 +413,7 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {
const Data::StatisticalGraph &messageGraph,
const Data::StatisticalGraph &reactionsGraph) {
api().request(MTPchannels_GetMessages(
channel()->inputChannel,
channel()->inputChannel(),
MTP_vector<MTPInputMessage>(
1,
MTP_inputMessageID(MTP_int(_fullId.msg))))
@@ -468,7 +468,7 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {
const Data::StatisticalGraph &messageGraph,
const Data::StatisticalGraph &reactionsGraph) {
api().request(MTPstories_GetStoriesByID(
channel()->input,
channel()->input(),
MTP_vector<MTPint>(1, MTP_int(_storyId.story)))
).done([=](const MTPstories_Stories &result) {
const auto &storyItem = result.data().vstories().v.front();
@@ -499,7 +499,7 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {
if (_storyId) {
makeRequest(MTPstats_GetStoryStats(
MTP_flags(MTPstats_GetStoryStats::Flags(0)),
channel()->input,
channel()->input(),
MTP_int(_storyId.story)
)).done([=](const MTPstats_StoryStats &result) {
const auto &data = result.data();
@@ -512,7 +512,7 @@ void MessageStatistics::request(Fn<void(Data::MessageStatistics)> done) {
} else {
makeRequest(MTPstats_GetMessageStats(
MTP_flags(MTPstats_GetMessageStats::Flags(0)),
channel()->inputChannel,
channel()->inputChannel(),
MTP_int(_fullId.msg.bare)
)).done([=](const MTPstats_MessageStats &result) {
const auto &data = result.data();
@@ -539,7 +539,7 @@ rpl::producer<rpl::no_value, QString> Boosts::request() {
}
_api.request(MTPpremium_GetBoostsStatus(
_peer->input
_peer->input()
)).done([=](const MTPpremium_BoostsStatus &result) {
const auto &data = result.data();
channel->updateLevelHint(data.vlevel().v);
@@ -625,7 +625,7 @@ void Boosts::requestBoosts(
gifts
? MTP_flags(MTPpremium_GetBoostsList::Flag::f_gifts)
: MTP_flags(0),
_peer->input,
_peer->input(),
MTP_string(token.next),
token.next.isEmpty() ? kTlFirstSlice : kTlLimit
)).done([=](const MTPpremium_BoostsList &result) {
@@ -698,7 +698,7 @@ rpl::producer<rpl::no_value, QString> EarnStatistics::request() {
api().request(MTPpayments_GetStarsRevenueStats(
MTP_flags(MTPpayments_getStarsRevenueStats::Flag::f_ton),
(_isUser ? user()->input : channel()->input)
(_isUser ? user()->input() : channel()->input())
)).done([=](const MTPpayments_StarsRevenueStats &result) {
const auto &data = result.data();
const auto &balances = data.vstatus().data();
@@ -721,7 +721,7 @@ rpl::producer<rpl::no_value, QString> EarnStatistics::request() {
if (!_isUser) {
api().request(
MTPchannels_GetFullChannel(channel()->inputChannel)
MTPchannels_GetFullChannel(channel()->inputChannel())
).done([=](const MTPmessages_ChatFull &result) {
result.data().vfull_chat().match([&](
const MTPDchannelFull &d) {
@@ -757,7 +757,7 @@ void EarnStatistics::requestHistory(
_requestId = api().request(MTPpayments_GetStarsTransactions(
MTP_flags(MTPpayments_getStarsTransactions::Flag::f_ton),
MTP_string(), // Subscription ID.
(_isUser ? user()->input : channel()->input),
(_isUser ? user()->input() : channel()->input()),
MTP_string(token),
token.isEmpty() ? kTlFirstSlice : kTlLimit
)).done([=](const MTPpayments_StarsStatus &result) {

View File

@@ -66,7 +66,7 @@ void SendApproval(
suggestion->requestId = session->api().request(
MTPmessages_ToggleSuggestedPostApproval(
MTP_flags(scheduleDate ? Flag::f_schedule_date : Flag()),
item->history()->peer->input,
item->history()->peer->input(),
MTP_int(item->id.bare),
MTP_int(scheduleDate),
MTPstring()) // reject_comment
@@ -154,13 +154,13 @@ void ConfirmApproval(
? tr::lng_suggest_accept_text(
tr::now,
lt_from,
Ui::Text::Bold(item->from()->shortName()),
Ui::Text::WithEntities)
tr::bold(item->from()->shortName()),
tr::marked)
: tr::lng_suggest_accept_text_to(
tr::now,
lt_channel,
Ui::Text::Bold(channelName),
Ui::Text::WithEntities);
tr::bold(channelName),
tr::marked);
if (price) {
text.append("\n\n").append(admin
? (scheduleDate
@@ -171,12 +171,12 @@ void ConfirmApproval(
lt_count_decimal,
amount.value(),
lt_channel,
Ui::Text::Bold(channelName),
tr::bold(channelName),
lt_percent,
TextWithEntities{ commission },
lt_date,
Ui::Text::Bold(date),
Ui::Text::RichLangValue)
tr::bold(date),
tr::rich)
: (amount.stars()
? tr::lng_suggest_accept_receive_now_stars
: tr::lng_suggest_accept_receive_now_ton)(
@@ -184,10 +184,10 @@ void ConfirmApproval(
lt_count_decimal,
amount.value(),
lt_channel,
Ui::Text::Bold(channelName),
tr::bold(channelName),
lt_percent,
TextWithEntities{ commission },
Ui::Text::RichLangValue))
tr::rich))
: (scheduleDate
? (amount.stars()
? tr::lng_suggest_accept_pay_stars
@@ -196,25 +196,25 @@ void ConfirmApproval(
lt_count_decimal,
amount.value(),
lt_date,
Ui::Text::Bold(date),
Ui::Text::RichLangValue)
tr::bold(date),
tr::rich)
: (amount.stars()
? tr::lng_suggest_accept_pay_now_stars
: tr::lng_suggest_accept_pay_now_ton)(
tr::now,
lt_count_decimal,
amount.value(),
Ui::Text::RichLangValue)));
tr::rich)));
if (admin) {
text.append(' ').append(
tr::lng_suggest_accept_receive_if(
tr::now,
Ui::Text::RichLangValue));
tr::rich));
if (price.stars()) {
text.append("\n\n").append(
tr::lng_suggest_options_stars_warning(
tr::now,
Ui::Text::RichLangValue));
tr::rich));
}
}
}
@@ -267,7 +267,7 @@ void SendDecline(
MTPmessages_ToggleSuggestedPostApproval(
MTP_flags(Flag::f_reject
| (comment.isEmpty() ? Flag() : Flag::f_reject_comment)),
item->history()->peer->input,
item->history()->peer->input(),
MTP_int(item->id.bare),
MTPint(), // schedule_date
MTP_string(comment))
@@ -321,12 +321,12 @@ void RequestDeclineComment(
.text = (admin
? tr::lng_suggest_decline_text(
lt_from,
rpl::single(Ui::Text::Bold(item->from()->shortName())),
Ui::Text::WithEntities)
rpl::single(tr::bold(item->from()->shortName())),
tr::marked)
: tr::lng_suggest_decline_text_to(
lt_channel,
rpl::single(Ui::Text::Bold(channelName)),
Ui::Text::WithEntities)),
rpl::single(tr::bold(channelName)),
tr::marked)),
.confirmed = [=](Fn<void()> close) { (*callback)(); close(); },
.confirmText = tr::lng_suggest_action_decline(),
.confirmStyle = &st::attentionBoxButton,

View File

@@ -12,6 +12,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_user.h"
#include "data/stickers/data_custom_emoji.h"
#include "data/stickers/data_stickers_set.h"
#include "history/history.h"
#include "history/history_item.h"
#include "main/main_session.h"
namespace Api {
@@ -47,14 +49,23 @@ using namespace TextUtilities;
if (!parsed.userId || parsed.selfId != session->userId().bare) {
return {};
}
return MTP_inputMessageEntityMentionName(
offset,
length,
(parsed.userId == parsed.selfId
? MTP_inputUserSelf()
: MTP_inputUser(
MTP_long(parsed.userId),
MTP_long(parsed.accessHash))));
const auto user = session->data().user(UserId(parsed.userId));
const auto item = user->isLoaded()
? nullptr
: user->owner().messageWithPeer(user->id);
const auto input = item
? MTP_inputUserFromMessage(
item->history()->peer->input(),
MTP_int(item->id.bare),
MTP_long(parsed.userId))
: (parsed.userId == parsed.selfId)
? MTP_inputUserSelf()
: user->isLoaded()
? user->inputUser()
: MTP_inputUser(
MTP_long(parsed.userId),
MTP_long(parsed.accessHash));
return MTP_inputMessageEntityMentionName(offset, length, input);
}
} // namespace

View File

@@ -95,7 +95,7 @@ void TodoLists::create(
randomId,
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
MTP_flags(sendFlags),
peer->input,
peer->input(),
Data::Histories::ReplyToPlaceholder(),
TodoListDataToInputMedia(&data),
MTP_string(),
@@ -104,7 +104,7 @@ void TodoLists::create(
MTPVector<MTPMessageEntity>(),
MTP_int(action.options.scheduled),
MTP_int(action.options.scheduleRepeatPeriod),
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
Data::ShortcutIdToMTP(_session, action.options.shortcutId),
MTP_long(action.options.effectId),
MTP_long(starsPaid),
@@ -164,7 +164,7 @@ void TodoLists::add(
}
const auto session = _session;
_session->api().request(MTPmessages_AppendTodoList(
item->history()->peer->input,
item->history()->peer->input(),
MTP_int(item->id.bare),
TodoListItemsToMTP(&item->history()->session(), items)
)).done([=](const MTPUpdates &result) {
@@ -230,7 +230,7 @@ void TodoLists::send(FullMsgId itemId, Accumulated &entry) {
auto incompleted = entry.incompleted
| ranges::views::transform([](int id) { return MTP_int(id); });
entry.requestId = _api.request(MTPmessages_ToggleTodoCompleted(
item->history()->peer->input,
item->history()->peer->input(),
MTP_int(item->id),
MTP_vector_from_range(completed),
MTP_vector_from_range(incompleted)

View File

@@ -41,7 +41,7 @@ void Transcribes::rate(not_null<HistoryItem*> item, bool isGood) {
for (const auto &[transcribeId, id] : _ids) {
if (id == fullId) {
_api.request(MTPmessages_RateTranscribedAudio(
item->history()->peer->input,
item->history()->peer->input(),
MTP_int(item->id),
MTP_long(transcribeId),
MTP_bool(isGood))).send();
@@ -158,7 +158,7 @@ void Transcribes::load(not_null<HistoryItem*> item) {
};
const auto id = item->fullId();
const auto requestId = _api.request(MTPmessages_TranscribeAudio(
item->history()->peer->input,
item->history()->peer->input(),
MTP_int(item->id)
)).done([=](const MTPmessages_TranscribedAudio &result) {
const auto &data = result.data();

View File

@@ -111,7 +111,7 @@ void UnreadThings::requestMentions(
using Flag = MTPmessages_GetUnreadMentions::Flag;
const auto requestId = _api->request(MTPmessages_GetUnreadMentions(
MTP_flags(topic ? Flag::f_top_msg_id : Flag()),
history->peer->input,
history->peer->input(),
MTP_int(topic ? topic->rootId() : 0),
MTP_int(offsetId),
MTP_int(addOffset),
@@ -147,9 +147,9 @@ void UnreadThings::requestReactions(
const auto requestId = _api->request(MTPmessages_GetUnreadReactions(
MTP_flags((topic ? Flag::f_top_msg_id : Flag())
| (sublist ? Flag::f_saved_peer_id : Flag())),
history->peer->input,
history->peer->input(),
MTP_int(topic ? topic->rootId() : 0),
(sublist ? sublist->sublistPeer()->input : MTPInputPeer()),
(sublist ? sublist->sublistPeer()->input() : MTPInputPeer()),
MTP_int(offsetId),
MTP_int(addOffset),
MTP_int(limit),

View File

@@ -137,100 +137,6 @@ bool HasForceLogoutNotification(const MTPUpdates &updates) {
return false;
}
bool ForwardedInfoDataLoaded(
not_null<Main::Session*> session,
const MTPMessageFwdHeader &header) {
return header.match([&](const MTPDmessageFwdHeader &data) {
if (const auto fromId = data.vfrom_id()) {
// Fully loaded is required in this case.
if (!session->data().peerLoaded(peerFromMTP(*fromId))) {
return false;
}
}
return true;
});
}
bool MentionUsersLoaded(
not_null<Main::Session*> session,
const MTPVector<MTPMessageEntity> &entities) {
for (const auto &entity : entities.v) {
auto type = entity.type();
if (type == mtpc_messageEntityMentionName) {
if (!session->data().userLoaded(entity.c_messageEntityMentionName().vuser_id())) {
return false;
}
} else if (type == mtpc_inputMessageEntityMentionName) {
auto &inputUser = entity.c_inputMessageEntityMentionName().vuser_id();
if (inputUser.type() == mtpc_inputUser) {
if (!session->data().userLoaded(inputUser.c_inputUser().vuser_id())) {
return false;
}
}
}
}
return true;
}
DataIsLoadedResult AllDataLoadedForMessage(
not_null<Main::Session*> session,
const MTPMessage &message) {
return message.match([&](const MTPDmessage &message) {
if (const auto fromId = message.vfrom_id()) {
if (!message.is_post()
&& !session->data().peerLoaded(peerFromMTP(*fromId))) {
return DataIsLoadedResult::FromNotLoaded;
}
}
if (const auto viaBotId = message.vvia_bot_id()) {
if (!session->data().userLoaded(*viaBotId)) {
return DataIsLoadedResult::NotLoaded;
}
}
if (const auto fwd = message.vfwd_from()) {
if (!ForwardedInfoDataLoaded(session, *fwd)) {
return DataIsLoadedResult::NotLoaded;
}
}
if (const auto entities = message.ventities()) {
if (!MentionUsersLoaded(session, *entities)) {
return DataIsLoadedResult::MentionNotLoaded;
}
}
return DataIsLoadedResult::Ok;
}, [&](const MTPDmessageService &message) {
if (const auto fromId = message.vfrom_id()) {
if (!message.is_post()
&& !session->data().peerLoaded(peerFromMTP(*fromId))) {
return DataIsLoadedResult::FromNotLoaded;
}
}
return message.vaction().match(
[&](const MTPDmessageActionChatAddUser &action) {
for (const auto &userId : action.vusers().v) {
if (!session->data().userLoaded(userId)) {
return DataIsLoadedResult::NotLoaded;
}
}
return DataIsLoadedResult::Ok;
}, [&](const MTPDmessageActionChatJoinedByLink &action) {
if (!session->data().userLoaded(action.vinviter_id())) {
return DataIsLoadedResult::NotLoaded;
}
return DataIsLoadedResult::Ok;
}, [&](const MTPDmessageActionChatDeleteUser &action) {
if (!session->data().userLoaded(action.vuser_id())) {
return DataIsLoadedResult::NotLoaded;
}
return DataIsLoadedResult::Ok;
}, [](const auto &) {
return DataIsLoadedResult::Ok;
});
}, [](const MTPDmessageEmpty &message) {
return DataIsLoadedResult::Ok;
});
}
} // namespace
Updates::Updates(not_null<Main::Session*> session)
@@ -747,7 +653,7 @@ void Updates::getChannelDifference(
}
api().request(MTPupdates_GetChannelDifference(
MTP_flags(flags),
channel->inputChannel,
channel->inputChannel(),
filter,
MTP_int(channel->pts()),
MTP_int(kChannelGetDifferenceLimit)
@@ -826,7 +732,7 @@ void Updates::channelRangeDifferenceSend(
MTP_int(range.till - 1))));
const auto requestId = api().request(MTPupdates_GetChannelDifference(
MTP_flags(MTPupdates_GetChannelDifference::Flag::f_force),
channel->inputChannel,
channel->inputChannel(),
filter,
MTP_int(pts),
MTP_int(limit)
@@ -1513,18 +1419,13 @@ void Updates::applyUpdates(
case mtpc_updateShortMessage: {
auto &d = updates.c_updateShortMessage();
const auto viaBotId = d.vvia_bot_id();
const auto entities = d.ventities();
const auto fwd = d.vfwd_from();
if (!session().data().userLoaded(d.vuser_id())
|| (viaBotId && !session().data().userLoaded(*viaBotId))
|| (entities && !MentionUsersLoaded(&session(), *entities))
|| (fwd && !ForwardedInfoDataLoaded(&session(), *fwd))) {
if (!session().data().userLoaded(d.vuser_id())) {
MTP_LOG(0, ("getDifference "
"{ good - getting user for updateShortMessage }%1"
).arg(_session->mtp().isTestMode() ? " TESTMODE" : ""));
).arg(_session->mtp().isTestMode() ? " TESTMODE" : ""));
return getDifference();
}
_session->data().fillMessagePeers(d);
if (updateAndApply(d.vpts().v, d.vpts_count().v, updates)) {
// Update date as well.
setState(0, d.vdate().v, _updatesQts, _updatesSeq);
@@ -1533,24 +1434,14 @@ void Updates::applyUpdates(
case mtpc_updateShortChatMessage: {
auto &d = updates.c_updateShortChatMessage();
const auto noFrom = !session().data().userLoaded(d.vfrom_id());
const auto chat = session().data().chatLoaded(d.vchat_id());
const auto viaBotId = d.vvia_bot_id();
const auto entities = d.ventities();
const auto fwd = d.vfwd_from();
if (!chat
|| noFrom
|| (viaBotId && !session().data().userLoaded(*viaBotId))
|| (entities && !MentionUsersLoaded(&session(), *entities))
|| (fwd && !ForwardedInfoDataLoaded(&session(), *fwd))) {
if (!chat) {
MTP_LOG(0, ("getDifference "
"{ good - getting user for updateShortChatMessage }%1"
).arg(_session->mtp().isTestMode() ? " TESTMODE" : ""));
if (chat && noFrom) {
session().api().requestFullPeer(chat);
}
"{ good - getting chat for updateShortChatMessage }%1"
).arg(_session->mtp().isTestMode() ? " TESTMODE" : ""));
return getDifference();
}
_session->data().fillMessagePeers(d);
if (updateAndApply(d.vpts().v, d.vpts_count().v, updates)) {
// Update date as well.
setState(0, d.vdate().v, _updatesQts, _updatesSeq);
@@ -1580,13 +1471,7 @@ void Updates::applyUpdates(
const auto wasAlready = (lookupMessage() != nullptr);
feedUpdate(MTP_updateMessageID(d.vid(), MTP_long(randomId))); // ignore real date
if (const auto item = lookupMessage()) {
const auto list = d.ventities();
if (list && !MentionUsersLoaded(&session(), *list)) {
session().api().requestMessageData(
item->history()->peer,
item->id,
nullptr);
}
_session->data().fillMessagePeers(item->fullId(), d);
item->applySentMessage(sent.text, d, wasAlready);
}
}
@@ -1613,25 +1498,22 @@ void Updates::feedUpdate(const MTPUpdate &update) {
// New messages.
case mtpc_updateNewMessage: {
auto &d = update.c_updateNewMessage();
const auto isDataLoaded = AllDataLoadedForMessage(&session(), d.vmessage());
if (!requestingDifference() && isDataLoaded != DataIsLoadedResult::Ok) {
MTP_LOG(0, ("getDifference "
"{ good - after not all data loaded in updateNewMessage }%1"
if (!requestingDifference()) {
const auto peerId = PeerFromMessage(d.vmessage());
const auto peer = session().data().peerLoaded(peerId);
if (peerId && !peer) {
MTP_LOG(0, ("getDifference "
"{ good - getting peer for updateNewMessage }%1"
).arg(_session->mtp().isTestMode() ? " TESTMODE" : ""));
// This can be if this update was created by grouping
// some short message update into an updates vector.
return getDifference();
return getDifference();
}
}
updateAndApply(d.vpts().v, d.vpts_count().v, update);
} break;
case mtpc_updateNewChannelMessage: {
auto &d = update.c_updateNewChannelMessage();
auto channel = session().data().channelLoaded(peerToChannel(PeerFromMessage(d.vmessage())));
const auto isDataLoaded = AllDataLoadedForMessage(&session(), d.vmessage());
{
// Todo delete.
const auto messageId = IdFromMessage(d.vmessage());
@@ -1643,22 +1525,10 @@ void Updates::feedUpdate(const MTPUpdate &update) {
}
}
}
if (!requestingDifference() && (!channel || isDataLoaded != DataIsLoadedResult::Ok)) {
if (!requestingDifference() && !channel) {
MTP_LOG(0, ("getDifference "
"{ good - after not all data loaded in updateNewChannelMessage }%1"
).arg(_session->mtp().isTestMode() ? " TESTMODE" : ""));
// Request last active supergroup participants if the 'from' user was not loaded yet.
// This will optimize similar getDifference() calls for almost all next messages.
if (isDataLoaded == DataIsLoadedResult::FromNotLoaded && channel && channel->isMegagroup()) {
if (channel->canViewMembers()
&& channel->mgInfo->lastParticipants.size() < _session->serverConfig().chatSizeMax
&& (channel->mgInfo->lastParticipants.empty()
|| channel->mgInfo->lastParticipants.size() < channel->membersCount())) {
session().api().chatParticipants().requestLast(channel);
}
}
if (!_byMinChannelTimer.isActive()) { // getDifference after timeout
_byMinChannelTimer.callOnce(PtsWaiter::kWaitForSkippedTimeout);
}

View File

@@ -28,7 +28,7 @@ namespace {
not_null<PeerData*> peer) {
const auto user = peer->asUser();
return (user && user->botInfo && user->botInfo->canEditInformation)
? std::make_optional<MTPInputUser>(user->inputUser)
? std::make_optional<MTPInputUser>(user->inputUser())
: std::nullopt;
}
@@ -98,9 +98,9 @@ rpl::producer<Data::Usernames> Usernames::loadUsernames(
if (peer->isSelf()) {
requestUser(MTP_inputUserSelf());
} else if (const auto user = peer->asUser()) {
requestUser(user->inputUser);
requestUser(user->inputUser());
} else if (const auto channel = peer->asChannel()) {
requestChannel(channel->inputChannel);
requestChannel(channel->inputChannel());
}
return lifetime;
};
@@ -163,7 +163,7 @@ rpl::producer<rpl::no_value, Usernames::Error> Usernames::toggle(
)).done(done).fail(fail).handleFloodErrors().send();
} else if (const auto channel = peer->asChannel()) {
_api.request(MTPchannels_ToggleUsername(
channel->inputChannel,
channel->inputChannel(),
MTP_string(username),
MTP_bool(active)
)).done(done).fail(fail).handleFloodErrors().send();
@@ -216,7 +216,7 @@ rpl::producer<> Usernames::reorder(
_reorderRequests.emplace(peerId, requestId);
} else if (const auto channel = peer->asChannel()) {
const auto requestId = _api.request(MTPchannels_ReorderUsernames(
channel->inputChannel,
channel->inputChannel(),
MTP_vector<MTPstring>(std::move(tlUsernames))
)).done(finish).fail(finish).send();
_reorderRequests.emplace(peerId, requestId);

View File

@@ -33,7 +33,7 @@ TLInputRules RulesToTL(const UserPrivacy::Rule &rule) {
result.reserve(peers.size());
for (const auto &peer : peers) {
if (const auto user = peer->asUser()) {
result.push_back(user->inputUser);
result.push_back(user->inputUser());
}
}
return result;

View File

@@ -95,7 +95,7 @@ void ViewsManager::viewsIncrement() {
ids.push_back(MTP_int(msgId));
}
const auto requestId = _api.request(MTPmessages_GetMessagesViews(
i->first->input,
i->first->input(),
MTP_vector<MTPint>(ids),
MTP_bool(true)
)).done([=](
@@ -183,7 +183,7 @@ void ViewsManager::sendPollRequests(
}
};
const auto requestId = _api.request(MTPmessages_GetExtendedMedia(
peer->input,
peer->input(),
MTP_vector<MTPint>(list)
)).done([=](const MTPUpdates &result, mtpRequestId id) {
_session->api().applyUpdates(result);

View File

@@ -252,7 +252,7 @@ struct State {
} else if (const auto user = item->history()->peer->asUser()) {
entry.requestId = session->api().request(
MTPmessages_GetOutboxReadDate(
user->input,
user->input(),
MTP_int(item->id)
)
).done([=](const MTPOutboxReadDate &result) {
@@ -282,7 +282,7 @@ struct State {
} else {
entry.requestId = session->api().request(
MTPmessages_GetMessageReadParticipants(
item->history()->peer->input,
item->history()->peer->input(),
MTP_int(item->id)
)
).done([=](const MTPVector<MTPReadParticipantDate> &result) {
@@ -340,7 +340,7 @@ struct State {
MTP_flags(reaction.empty()
? Flag(0)
: Flag::f_reaction),
item->history()->peer->input,
item->history()->peer->input(),
MTP_int(item->id),
ReactionToMTP(reaction),
MTPstring(), // offset

View File

@@ -367,7 +367,7 @@ void ApiWrap::savePinnedOrder(Data::Folder *folder) {
const auto &order = _session->data().pinnedChatsOrder(folder);
const auto input = [](Dialogs::Key key) {
if (const auto history = key.history()) {
return MTP_inputDialogPeer(history->peer->input);
return MTP_inputDialogPeer(history->peer->input());
} else if (const auto folder = key.folder()) {
return MTP_inputDialogPeerFolder(MTP_int(folder->id()));
}
@@ -402,7 +402,7 @@ void ApiWrap::savePinnedOrder(not_null<Data::Forum*> forum) {
input);
request(MTPmessages_ReorderPinnedForumTopics(
MTP_flags(MTPmessages_ReorderPinnedForumTopics::Flag::f_force),
forum->peer()->input,
forum->peer()->input(),
MTP_vector(topics)
)).done([=](const MTPUpdates &result) {
applyUpdates(result);
@@ -416,7 +416,7 @@ void ApiWrap::savePinnedOrder(not_null<Data::SavedMessages*> saved) {
const auto &order = _session->data().pinnedChatsOrder(saved);
const auto input = [](Dialogs::Key key) {
if (const auto sublist = key.sublist()) {
return MTP_inputDialogPeer(sublist->sublistPeer()->input);
return MTP_inputDialogPeer(sublist->sublistPeer()->input());
}
Unexpected("Key type in pinnedDialogsOrder().");
};
@@ -445,7 +445,7 @@ void ApiWrap::toggleHistoryArchived(
MTP_vector<MTPInputFolderPeer>(
1,
MTP_inputFolderPeer(
history->peer->input,
history->peer->input(),
MTP_int(archived ? archiveId : 0)))
)).done([=](const MTPUpdates &result) {
applyUpdates(result);
@@ -487,7 +487,7 @@ void ApiWrap::sendMessageFail(
PeerFloodErrorText(&session(), PeerFloodType::Send)),
Ui::LayerOption::CloseOther);
} else if (show && error == u"USER_BANNED_IN_CHANNEL"_q) {
const auto link = Ui::Text::Link(
const auto link = tr::link(
tr::lng_cant_more_info(tr::now),
session().createInternalLinkFull(u"spambot"_q));
show->showBox(
@@ -496,7 +496,7 @@ void ApiWrap::sendMessageFail(
tr::now,
lt_more_info,
link,
Ui::Text::WithEntities)),
tr::marked)),
Ui::LayerOption::CloseOther);
} else if (error.startsWith(u"SLOWMODE_WAIT_"_q)) {
const auto chop = u"SLOWMODE_WAIT_"_q.size();
@@ -641,7 +641,7 @@ void ApiWrap::resolveMessageDatas() {
if (!ids.isEmpty()) {
const auto channel = j->first;
const auto requestId = request(MTPchannels_GetMessages(
channel->inputChannel,
channel->inputChannel(),
MTP_vector<MTPInputMessage>(ids)
)).done([=](
const MTPmessages_Messages &result,
@@ -764,7 +764,7 @@ QString ApiWrap::exportDirectMessageLink(
MTP_flags(inRepliesContext
? MTPchannels_ExportMessageLink::Flag::f_thread
: MTPchannels_ExportMessageLink::Flag(0)),
channel->inputChannel,
channel->inputChannel(),
MTP_int(item->id)
)).done([=](const MTPExportedMessageLink &result) {
const auto link = qs(result.data().vlink());
@@ -798,7 +798,7 @@ QString ApiWrap::exportDirectStoryLink(not_null<Data::Story*> story) {
? i->second
: fallback();
request(MTPstories_ExportStoryLink(
peer->input,
peer->input(),
MTP_int(story->id())
)).done([=](const MTPExportedStoryLink &result) {
const auto link = qs(result.data().vlink());
@@ -865,7 +865,7 @@ void ApiWrap::requestMoreDialogs(Data::Folder *folder) {
MTP_int(state->offsetDate),
MTP_int(state->offsetId),
(state->offsetPeer
? state->offsetPeer->input
? state->offsetPeer->input()
: MTP_inputPeerEmpty()),
MTP_int(loadCount),
MTP_long(hash)
@@ -1130,7 +1130,7 @@ void ApiWrap::requestFullPeer(not_null<PeerData*> peer) {
_session->supportHelper().refreshInfo(user);
}
return request(MTPusers_GetFullUser(
user->inputUser
user->inputUser()
)).done([=](const MTPusers_UserFull &result) {
result.match([&](const MTPDusers_userFull &data) {
_session->data().processUsers(data.vusers());
@@ -1140,13 +1140,13 @@ void ApiWrap::requestFullPeer(not_null<PeerData*> peer) {
}).fail(failHandler).send();
} else if (const auto chat = peer->asChat()) {
return request(MTPmessages_GetFullChat(
chat->inputChat
chat->inputChat()
)).done([=](const MTPmessages_ChatFull &result) {
gotChatFull(peer, result);
}).fail(failHandler).send();
} else if (const auto channel = peer->asChannel()) {
return request(MTPchannels_GetFullChannel(
channel->inputChannel
channel->inputChannel()
)).done([=](const MTPmessages_ChatFull &result) {
gotChatFull(peer, result);
migrateDone(channel, channel);
@@ -1224,7 +1224,7 @@ void ApiWrap::requestPeerSettings(not_null<PeerData*> peer) {
return;
}
request(MTPmessages_GetPeerSettings(
peer->input
peer->input()
)).done([=](const MTPmessages_PeerSettings &result) {
result.match([&](const MTPDmessages_peerSettings &data) {
_session->data().processUsers(data.vusers());
@@ -1279,7 +1279,7 @@ void ApiWrap::migrateChat(
}
request(MTPmessages_MigrateChat(
chat->inputChat
chat->inputChat()
)).done([=](const MTPUpdates &result) {
applyUpdates(result);
session().changes().sendNotifications();
@@ -1351,7 +1351,7 @@ void ApiWrap::markContentsRead(
}
for (const auto &channelIds : channelMarkedIds) {
request(MTPchannels_ReadMessageContents(
channelIds.first->inputChannel,
channelIds.first->inputChannel(),
MTP_vector<MTPint>(channelIds.second)
)).send();
}
@@ -1364,7 +1364,7 @@ void ApiWrap::markContentsRead(not_null<HistoryItem*> item) {
const auto ids = MTP_vector<MTPint>(1, MTP_int(item->id));
if (const auto channel = item->history()->peer->asChannel()) {
request(MTPchannels_ReadMessageContents(
channel->inputChannel,
channel->inputChannel(),
ids
)).send();
} else {
@@ -1398,8 +1398,8 @@ void ApiWrap::deleteAllFromParticipantSend(
not_null<ChannelData*> channel,
not_null<PeerData*> from) {
request(MTPchannels_DeleteParticipantHistory(
channel->inputChannel,
from->input
channel->inputChannel(),
from->input()
)).done([=](const MTPmessages_AffectedHistory &result) {
const auto offset = applyAffectedHistory(channel, result);
if (offset > 0) {
@@ -1421,8 +1421,8 @@ void ApiWrap::deleteSublistHistorySend(
not_null<PeerData*> sublistPeer) {
request(MTPmessages_DeleteSavedHistory(
MTP_flags(MTPmessages_DeleteSavedHistory::Flag::f_parent_peer),
parentChat->input,
sublistPeer->input,
parentChat->input(),
sublistPeer->input(),
MTP_int(0), // max_id
MTP_int(0), // min_date
MTP_int(0) // max_date
@@ -1743,7 +1743,7 @@ void ApiWrap::joinChannel(not_null<ChannelData*> channel) {
Data::PeerUpdate::Flag::ChannelAmIn);
} else if (!_channelAmInRequests.contains(channel)) {
const auto requestId = request(MTPchannels_JoinChannel(
channel->inputChannel
channel->inputChannel()
)).done([=](const MTPUpdates &result) {
_channelAmInRequests.remove(channel);
applyUpdates(result);
@@ -1800,7 +1800,7 @@ void ApiWrap::leaveChannel(not_null<ChannelData*> channel) {
Data::PeerUpdate::Flag::ChannelAmIn);
} else if (!_channelAmInRequests.contains(channel)) {
auto requestId = request(MTPchannels_LeaveChannel(
channel->inputChannel
channel->inputChannel()
)).done([=](const MTPUpdates &result) {
_channelAmInRequests.remove(channel);
applyUpdates(result);
@@ -1926,14 +1926,14 @@ void ApiWrap::sendNotifySettingsUpdates() {
for (const auto topic : base::take(_updateNotifyTopics)) {
request(MTPaccount_UpdateNotifySettings(
MTP_inputNotifyForumTopic(
topic->peer()->input,
topic->peer()->input(),
MTP_int(topic->rootId())),
topic->notify().serialize()
)).afterDelay(kSmallDelayMs).send();
}
for (const auto peer : base::take(_updateNotifyPeers)) {
request(MTPaccount_UpdateNotifySettings(
MTP_inputNotifyPeer(peer->input),
MTP_inputNotifyPeer(peer->input()),
peer->notify().serialize()
)).afterDelay(kSmallDelayMs).send();
}
@@ -2012,8 +2012,8 @@ void ApiWrap::deleteConversation(not_null<PeerData*> peer, bool revoke) {
if (const auto chat = peer->asChat()) {
request(MTPmessages_DeleteChatUser(
MTP_flags(0),
chat->inputChat,
_session->user()->inputUser
chat->inputChat(),
_session->user()->inputUser()
)).done([=](const MTPUpdates &result) {
applyUpdates(result);
deleteHistory(peer, false, revoke);
@@ -2206,7 +2206,7 @@ void ApiWrap::saveDraftsToCloud() {
cloudDraft->saveRequestId = request(MTPmessages_SaveDraft(
MTP_flags(flags),
ReplyToForMTP(history, cloudDraft->reply),
history->peer->input,
history->peer->input(),
MTP_string(textWithTags.text),
entities,
Data::WebPageForMTP(
@@ -2382,7 +2382,7 @@ void ApiWrap::resolveWebPages() {
QVector<mtpRequestId> reqsByIndex(idsByChannel.size(), 0);
for (auto i = idsByChannel.cbegin(), e = idsByChannel.cend(); i != e; ++i) {
reqsByIndex[i->second.first] = request(MTPchannels_GetMessages(
i->first->inputChannel,
i->first->inputChannel(),
MTP_vector<MTPInputMessage>(i->second.second)
)).done([=, channel = i->first](
const MTPmessages_Messages &result,
@@ -2511,13 +2511,13 @@ void ApiWrap::refreshFileReference(
};
if (storyId) {
request(MTPstories_GetStoriesByID(
_session->data().peer(storyId.peer)->input,
_session->data().peer(storyId.peer)->input(),
MTP_vector<MTPint>(1, MTP_int(storyId.story))));
} else if (item->isScheduled()) {
const auto realId = _session->scheduledMessages().lookupId(
item);
request(MTPmessages_GetScheduledMessages(
item->history()->peer->input,
item->history()->peer->input(),
MTP_vector<MTPint>(1, MTP_int(realId))));
} else if (item->isSavedMusicItem()) {
const auto user = item->history()->peer->asUser();
@@ -2525,7 +2525,7 @@ void ApiWrap::refreshFileReference(
const auto document = media ? media->document() : nullptr;
if (user && document) {
request(MTPusers_GetSavedMusicByID(
user->inputUser,
user->inputUser(),
MTP_vector<MTPInputDocument>(1, document->mtpInput())));
} else {
fail();
@@ -2540,7 +2540,7 @@ void ApiWrap::refreshFileReference(
MTP_long(0)));
} else if (const auto channel = item->history()->peer->asChannel()) {
request(MTPchannels_GetMessages(
channel->inputChannel,
channel->inputChannel(),
MTP_vector<MTPInputMessage>(
1,
MTP_inputMessageID(MTP_int(item->id)))));
@@ -2556,7 +2556,7 @@ void ApiWrap::refreshFileReference(
}, [&](Data::FileOriginUserPhoto data) {
if (const auto user = _session->data().user(data.userId)) {
request(MTPphotos_GetUserPhotos(
user->inputUser,
user->inputUser(),
MTP_int(-1),
MTP_long(data.photoId),
MTP_int(1)));
@@ -2565,7 +2565,7 @@ void ApiWrap::refreshFileReference(
}
}, [&](Data::FileOriginFullUser data) {
if (const auto user = _session->data().user(data.userId)) {
request(MTPusers_GetFullUser(user->inputUser));
request(MTPusers_GetFullUser(user->inputUser()));
} else {
fail();
}
@@ -2634,7 +2634,7 @@ void ApiWrap::refreshFileReference(
MTP_int(0)));
}, [&](Data::FileOriginStory data) {
request(MTPstories_GetStoriesByID(
_session->data().peer(data.peer)->input,
_session->data().peer(data.peer)->input(),
MTP_vector<MTPint>(1, MTP_int(data.story))));
}, [&](v::null_t) {
fail();
@@ -2704,7 +2704,7 @@ void ApiWrap::setGroupStickerSet(
megagroup->mgInfo->stickerSet = set;
request(MTPchannels_SetStickers(
megagroup->inputChannel,
megagroup->inputChannel(),
Data::InputStickerSet(set)
)).send();
_session->data().stickers().notifyUpdated(Data::StickersType::Stickers);
@@ -2717,7 +2717,7 @@ void ApiWrap::setGroupEmojiSet(
megagroup->mgInfo->emojiSet = set;
request(MTPchannels_SetEmojiStickers(
megagroup->inputChannel,
megagroup->inputChannel(),
Data::InputStickerSet(set)
)).send();
_session->changes().peerUpdated(
@@ -3127,7 +3127,7 @@ void ApiWrap::requestMessageAfterDate(
};
if (topicRootId) {
send(MTPmessages_GetReplies(
peer->input,
peer->input(),
MTP_int(topicRootId),
MTP_int(offsetId),
MTP_int(offsetDate),
@@ -3139,8 +3139,8 @@ void ApiWrap::requestMessageAfterDate(
} else if (monoforumPeerId) {
send(MTPmessages_GetSavedHistory(
MTP_flags(MTPmessages_GetSavedHistory::Flag::f_parent_peer),
peer->input,
session().data().peer(monoforumPeerId)->input,
peer->input(),
session().data().peer(monoforumPeerId)->input(),
MTP_int(offsetId),
MTP_int(offsetDate),
MTP_int(addOffset),
@@ -3150,7 +3150,7 @@ void ApiWrap::requestMessageAfterDate(
MTP_long(historyHash)));
} else {
send(MTPmessages_GetHistory(
peer->input,
peer->input(),
MTP_int(offsetId),
MTP_int(offsetDate),
MTP_int(addOffset),
@@ -3537,19 +3537,19 @@ void ApiWrap::forwardMessages(
histories.sendRequest(history, requestType, [=](Fn<void()> finish) {
history->sendRequestId = request(MTPmessages_ForwardMessages(
MTP_flags(oneFlags),
forwardFrom->input,
forwardFrom->input(),
MTP_vector<MTPint>(ids),
MTP_vector<MTPlong>(randomIds),
peer->input,
peer->input(),
MTP_int(topMsgId),
(action.options.suggest
? ReplyToForMTP(history, action.replyTo)
: monoforumPeer
? MTP_inputReplyToMonoForum(monoforumPeer->input)
? MTP_inputReplyToMonoForum(monoforumPeer->input())
: MTPInputReplyTo()),
MTP_int(action.options.scheduled),
MTP_int(action.options.scheduleRepeatPeriod),
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
Data::ShortcutIdToMTP(_session, action.options.shortcutId),
MTP_long(action.options.effectId),
MTPint(), // video_timestamp
@@ -3925,7 +3925,7 @@ void ApiWrap::sendShortcutMessages(
auto ids = QVector<MTPint>();
auto randomIds = QVector<MTPlong>();
request(MTPmessages_SendQuickReplyMessages(
peer->input,
peer->input(),
MTP_int(id),
MTP_vector<MTPint>(ids),
MTP_vector<MTPlong>(randomIds)
@@ -4150,7 +4150,7 @@ void ApiWrap::sendMessage(
randomId,
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
MTP_flags(mediaFlags),
peer->input,
peer->input(),
Data::Histories::ReplyToPlaceholder(),
Data::WebPageForMTP(message.webPage, true),
msgText,
@@ -4159,7 +4159,7 @@ void ApiWrap::sendMessage(
sentEntities,
MTP_int(action.options.scheduled),
MTP_int(action.options.scheduleRepeatPeriod),
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
mtpShortcut,
MTP_long(action.options.effectId),
MTP_long(starsPaid),
@@ -4172,7 +4172,7 @@ void ApiWrap::sendMessage(
randomId,
Data::Histories::PrepareMessage<MTPmessages_SendMessage>(
MTP_flags(sendFlags),
peer->input,
peer->input(),
Data::Histories::ReplyToPlaceholder(),
msgText,
MTP_long(randomId),
@@ -4180,7 +4180,7 @@ void ApiWrap::sendMessage(
sentEntities,
MTP_int(action.options.scheduled),
MTP_int(action.options.scheduleRepeatPeriod),
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
mtpShortcut,
MTP_long(action.options.effectId),
MTP_long(starsPaid),
@@ -4224,8 +4224,8 @@ void ApiWrap::sendBotStart(
info->startToken = QString();
}
request(MTPmessages_StartBot(
bot->inputUser,
chat ? chat->input : MTP_inputPeerEmpty(),
bot->inputUser(),
chat ? chat->input() : MTP_inputPeerEmpty(),
MTP_long(randomId),
MTP_string(token)
)).done([=](const MTPUpdates &result) {
@@ -4320,13 +4320,13 @@ void ApiWrap::sendInlineResult(
randomId,
Data::Histories::PrepareMessage<MTPmessages_SendInlineBotResult>(
MTP_flags(sendFlags),
peer->input,
peer->input(),
Data::Histories::ReplyToPlaceholder(),
MTP_long(randomId),
MTP_long(data->getQueryId()),
MTP_string(data->getId()),
MTP_int(action.options.scheduled),
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
Data::ShortcutIdToMTP(_session, action.options.shortcutId),
MTP_long(starsPaid)
), [=](const MTPUpdates &result, const MTP::Response &response) {
@@ -4361,7 +4361,7 @@ void ApiWrap::uploadAlbumMedia(
request(MTPmessages_UploadMedia(
MTP_flags(0),
MTPstring(), // business_connection_id
item->history()->peer->input,
item->history()->peer->input(),
media
)).done([=](const MTPMessageMedia &result) {
const auto item = _session->data().message(localId);
@@ -4505,7 +4505,7 @@ void ApiWrap::sendMediaWithRandomId(
randomId,
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
MTP_flags(flags),
peer->input,
peer->input(),
Data::Histories::ReplyToPlaceholder(),
(options.price
? MTPInputMedia(MTP_inputMediaPaidMedia(
@@ -4520,7 +4520,7 @@ void ApiWrap::sendMediaWithRandomId(
sentEntities,
MTP_int(options.scheduled),
MTP_int(options.scheduleRepeatPeriod),
(options.sendAs ? options.sendAs->input : MTP_inputPeerEmpty()),
(options.sendAs ? options.sendAs->input() : MTP_inputPeerEmpty()),
Data::ShortcutIdToMTP(_session, options.shortcutId),
MTP_long(options.effectId),
MTP_long(starsPaid),
@@ -4595,7 +4595,7 @@ void ApiWrap::sendMultiPaidMedia(
randomId,
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
MTP_flags(flags),
peer->input,
peer->input(),
Data::Histories::ReplyToPlaceholder(),
MTP_inputMediaPaidMedia(
MTP_flags(0),
@@ -4608,7 +4608,7 @@ void ApiWrap::sendMultiPaidMedia(
sentEntities,
MTP_int(options.scheduled),
MTP_int(options.scheduleRepeatPeriod),
(options.sendAs ? options.sendAs->input : MTP_inputPeerEmpty()),
(options.sendAs ? options.sendAs->input() : MTP_inputPeerEmpty()),
Data::ShortcutIdToMTP(_session, options.shortcutId),
MTP_long(options.effectId),
MTP_long(starsPaid),
@@ -4734,12 +4734,12 @@ void ApiWrap::sendAlbumIfReady(not_null<SendingAlbum*> album) {
uint64(0), // randomId
Data::Histories::PrepareMessage<MTPmessages_SendMultiMedia>(
MTP_flags(flags),
peer->input,
peer->input(),
Data::Histories::ReplyToPlaceholder(),
MTP_vector<MTPInputSingleMedia>(medias),
MTP_int(album->options.scheduled),
//MTP_int(album->options.scheduleRepeatPeriod),
(sendAs ? sendAs->input : MTP_inputPeerEmpty()),
(sendAs ? sendAs->input() : MTP_inputPeerEmpty()),
Data::ShortcutIdToMTP(_session, album->options.shortcutId),
MTP_long(album->options.effectId),
MTP_long(starsPaid)
@@ -4821,7 +4821,7 @@ void ApiWrap::requestBotCommonGroups(
};
const auto limit = 100;
request(MTPmessages_GetCommonChats(
bot->inputUser,
bot->inputUser(),
MTP_long(0), // max_id
MTP_int(limit)
)).done([=](const MTPmessages_Chats &result) {

View File

@@ -36,29 +36,28 @@ namespace {
rpl::producer<TextWithEntities> Text1() {
return tr::lng_about_text1(
lt_api_link,
tr::lng_about_text1_api(
) | Ui::Text::ToLink("https://core.telegram.org/api"),
Ui::Text::WithEntities);
tr::lng_about_text1_api(tr::url(u"https://core.telegram.org/api"_q)),
tr::marked);
}
rpl::producer<TextWithEntities> Text2() {
return tr::lng_about_text2(
lt_gpl_link,
rpl::single(Ui::Text::Link(
rpl::single(tr::link(
"GNU GPL",
"https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE")),
lt_github_link,
rpl::single(Ui::Text::Link(
rpl::single(tr::link(
"GitHub",
"https://github.com/telegramdesktop/tdesktop")),
Ui::Text::WithEntities);
tr::marked);
}
rpl::producer<TextWithEntities> Text3() {
return tr::lng_about_text3(
lt_faq_link,
tr::lng_about_text3_faq() | Ui::Text::ToLink(telegramFaqLink()),
Ui::Text::WithEntities);
tr::lng_about_text3_faq(tr::url(telegramFaqLink())),
tr::marked);
}
} // namespace
@@ -217,11 +216,11 @@ void ArchiveHintBox(
lt_emoji,
rpl::single(
Ui::Text::IconEmoji(&st::textMoreIconEmoji)),
Ui::Text::RichLangValue
tr::rich
) | rpl::map([](TextWithEntities text) {
return Ui::Text::Link(std::move(text), 1);
return tr::link(std::move(text), 1);
}),
Ui::Text::RichLangValue),
tr::rich),
st::channelEarnHistoryRecipientLabel));
label->resizeToWidth(box->width()
- rect::m::sum::h(st::boxRowPadding));

View File

@@ -61,9 +61,9 @@ void AboutSponsoredBox(not_null<Ui::GenericBox*> box) {
tr::lng_sponsored_info_description1_link(),
tr::lng_sponsored_info_description1_url()
) | rpl::map([](const QString &text, const QString &url) {
return Ui::Text::Link(text, url);
return tr::link(text, url);
}),
Ui::Text::RichLangValue);
tr::rich);
box->addRow(object_ptr<FlatLabel>(box, std::move(text1), stLabel));
box->addSkip(st::sponsoredUrlButtonSkip);

View File

@@ -126,7 +126,7 @@ void ChatCreateDone(
void MustBePublicDestroy(not_null<ChannelData*> channel) {
const auto session = &channel->session();
session->api().request(MTPchannels_DeleteChannel(
channel->inputChannel
channel->inputChannel()
)).done([=](const MTPUpdates &result) {
session->api().applyUpdates(result);
}).send();
@@ -160,7 +160,7 @@ void MustBePublicFailed(
TextWithEntities PeerFloodErrorText(
not_null<Main::Session*> session,
PeerFloodType type) {
const auto link = Ui::Text::Link(
const auto link = tr::link(
tr::lng_cant_more_info(tr::now),
session->createInternalLinkFull(u"spambot"_q));
return ((type == PeerFloodType::InviteGroup)
@@ -169,7 +169,7 @@ TextWithEntities PeerFloodErrorText(
tr::now,
lt_more_info,
link,
Ui::Text::WithEntities);
tr::marked);
}
void ShowAddParticipantsError(
@@ -735,7 +735,7 @@ void GroupInfoBox::createGroup(
auto user = peer->asUser();
Assert(user != nullptr);
if (!user->isSelf()) {
inputs.push_back(user->inputUser);
inputs.push_back(user->inputUser());
}
}
_creationRequestId = _api.request(MTPmessages_CreateChat(
@@ -1034,7 +1034,7 @@ void SetupChannelBox::prepare() {
setMouseTracking(true);
_checkRequestId = _api.request(MTPchannels_CheckUsername(
_channel->inputChannel,
_channel->inputChannel(),
MTP_string("preston")
)).fail([=](const MTP::Error &error) {
_checkRequestId = 0;
@@ -1281,7 +1281,7 @@ void SetupChannelBox::save() {
const auto saveUsername = [&](const QString &link) {
_sentUsername = link;
_saveRequestId = _api.request(MTPchannels_UpdateUsername(
_channel->inputChannel,
_channel->inputChannel(),
MTP_string(_sentUsername)
)).done([=] {
const auto done = _done;
@@ -1365,7 +1365,7 @@ void SetupChannelBox::check() {
if (link.size() >= Ui::EditPeer::kMinUsernameLength) {
_checkUsername = link;
_checkRequestId = _api.request(MTPchannels_CheckUsername(
_channel->inputChannel,
_channel->inputChannel(),
MTP_string(link)
)).done([=](const MTPBool &result) {
_checkRequestId = 0;

View File

@@ -337,7 +337,7 @@ void BackgroundBox::resetForPeer() {
const auto api = &_controller->session().api();
api->request(MTPmessages_SetChatWallPaper(
MTP_flags(0),
_forPeer->input,
_forPeer->input(),
MTPInputWallPaper(),
MTPWallPaperSettings(),
MTPint()

View File

@@ -668,7 +668,7 @@ void BackgroundPreviewBox::setExistingForPeer(
| (_fromMessageId ? Flag() : Flag::f_wallpaper)
| (both ? Flag::f_for_both : Flag())
| Flag::f_settings),
_forPeer->input,
_forPeer->input(),
paper.mtpInput(&_controller->session()),
paper.mtpSettings(),
MTP_int(_fromMessageId.msg)

View File

@@ -22,7 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/filter_icons.h"
#include "ui/painter.h"
#include "ui/rect.h"
#include "ui/text/text_utilities.h" // Ui::Text::Bold
#include "ui/text/text_utilities.h" // tr::bold
#include "ui/toast/toast.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/menu/menu_action.h"
@@ -179,10 +179,10 @@ void ChangeFilterById(
: tr::lng_filters_toast_remove)(
tr::now,
lt_chat,
Ui::Text::Bold(chat),
tr::bold(chat),
lt_folder,
Ui::Text::Wrapped(name.text, EntityType::Bold),
Ui::Text::WithEntities),
tr::marked),
.textContext = Core::TextContext({
.session = &history->session(),
.customEmojiLoopLimit = isStatic ? -1 : 0,

View File

@@ -485,7 +485,7 @@ void ProxyRow::updateFields(View &&view) {
TextWithEntities()
.append(_view.type)
.append(' ')
.append(Ui::Text::Link(endpoint, QString())),
.append(tr::link(endpoint, QString())),
Ui::ItemTextDefaultOptions());
const auto state = _view.state;

View File

@@ -99,7 +99,7 @@ void DeleteMessagesBox::prepare() {
lt_date,
TextWithEntities{
langDayOfMonthFull(_wipeHistoryFirstToDelete) },
Ui::Text::RichLangValue)
tr::rich)
: tr::lng_sure_delete_by_date_many(
tr::now,
lt_days,
@@ -108,8 +108,8 @@ void DeleteMessagesBox::prepare() {
lt_count,
_wipeHistoryFirstToDelete.daysTo(
_wipeHistoryLastToDelete) + 1,
Ui::Text::WithEntities),
Ui::Text::RichLangValue);
tr::marked),
tr::rich);
deleteStyle = &st::attentionBoxButton;
} else if (_wipeHistoryJustClear) {
const auto isChannel = peer->isChannel() && !peer->isMegagroup();
@@ -130,7 +130,7 @@ void DeleteMessagesBox::prepare() {
tr::now,
lt_group,
peer->name());
details = Ui::Text::RichLangValue(details.text);
details = tr::rich(details.text);
deleteStyle = &st::attentionBoxButton;
} else {
details.text = peer->isSelf()
@@ -148,7 +148,7 @@ void DeleteMessagesBox::prepare() {
: peer->isMegagroup()
? tr::lng_sure_leave_group(tr::now)
: tr::lng_sure_leave_channel(tr::now);
details = Ui::Text::RichLangValue(details.text);
details = tr::rich(details.text);
if (!peer->isUser()) {
*deleteText = tr::lng_box_leave();
}
@@ -201,8 +201,8 @@ void DeleteMessagesBox::prepare() {
tr::lng_delete_all_from_user(
tr::now,
lt_user,
Ui::Text::Bold(_moderateFrom->name()),
Ui::Text::WithEntities),
tr::bold(_moderateFrom->name()),
tr::marked),
false,
st::defaultBoxCheckbox);
@@ -396,7 +396,7 @@ auto DeleteMessagesBox::revokeText(not_null<PeerData*> peer) const
tr::now,
lt_user,
{ user->firstName },
Ui::Text::RichLangValue);
tr::rich);
} else {
result.checkbox.text = tr::lng_delete_for_everyone_check(tr::now);
}
@@ -429,7 +429,7 @@ auto DeleteMessagesBox::revokeText(not_null<PeerData*> peer) const
tr::now,
lt_user,
{ user->firstName },
Ui::Text::RichLangValue);
tr::rich);
} else {
result.checkbox.text = tr::lng_delete_for_everyone_check(tr::now);
}
@@ -441,27 +441,27 @@ auto DeleteMessagesBox::revokeText(not_null<PeerData*> peer) const
result.description = tr::lng_selected_unsend_about_user_one(
tr::now,
lt_user,
Ui::Text::Bold(user->shortName()),
Ui::Text::WithEntities);
tr::bold(user->shortName()),
tr::marked);
} else {
result.description = tr::lng_selected_unsend_about_user(
tr::now,
lt_count,
canRevokeOutgoingCount,
lt_user,
Ui::Text::Bold(user->shortName()),
Ui::Text::WithEntities);
tr::bold(user->shortName()),
tr::marked);
}
} else if (canRevokeOutgoingCount == 1) {
result.description = tr::lng_selected_unsend_about_group_one(
tr::now,
Ui::Text::WithEntities);
tr::marked);
} else {
result.description = tr::lng_selected_unsend_about_group(
tr::now,
lt_count,
canRevokeOutgoingCount,
Ui::Text::WithEntities);
tr::marked);
}
return result;
}
@@ -557,7 +557,7 @@ void DeleteMessagesBox::deleteAndClear() {
? tr::lng_suggest_warn_text_ton
: tr::lng_suggest_warn_text_stars)(
tr::now,
Ui::Text::RichLangValue),
tr::rich),
.confirmed = callback,
.confirmText = tr::lng_suggest_warn_delete_anyway(tr::now),
.confirmStyle = &st::attentionBoxButton,
@@ -634,8 +634,8 @@ void DeleteMessagesBox::deleteAndClear() {
if (_reportSpam->checked()) {
_moderateInChannel->session().api().request(
MTPchannels_ReportSpam(
_moderateInChannel->inputChannel,
_moderateFrom->input,
_moderateInChannel->inputChannel(),
_moderateFrom->input(),
MTP_vector<MTPint>(1, MTP_int(_ids[0].msg)))
).send();
}

View File

@@ -907,7 +907,7 @@ void EditPrivacyBox::setupContent() {
const auto never = addExceptionLink(Exception::Never);
addLabel(
content,
_controller->exceptionsDescription() | Ui::Text::ToWithEntities(),
_controller->exceptionsDescription() | rpl::map(tr::marked),
st::defaultVerticalListSkip);
auto below = _controller->setupBelowWidget(
@@ -1092,15 +1092,15 @@ void EditMessagesPrivacyBox(
using WeakToast = base::weak_ptr<Ui::Toast::Instance>;
const auto toast = std::make_shared<WeakToast>();
const auto showToast = [=] {
auto link = Ui::Text::Link(
Ui::Text::Semibold(
auto link = tr::link(
tr::semibold(
tr::lng_messages_privacy_premium_link(tr::now)));
(*toast) = controller->showToast({
.text = tr::lng_messages_privacy_premium(
tr::now,
lt_link,
link,
Ui::Text::WithEntities),
tr::marked),
.filter = crl::guard(&controller->session(), [=](
const ClickHandlerPtr &,
Qt::MouseButton button) {
@@ -1277,7 +1277,7 @@ void EditDirectMessagesPriceBox(
.lottieMargins = st::settingsFilterIconPadding,
.showFinished = box->showFinishes(),
.about = tr::lng_manage_monoforum_about(
Ui::Text::RichLangValue
tr::rich
),
.aboutMargins = st::settingsFilterDividerLabelPadding,
});

View File

@@ -541,13 +541,13 @@ void LinkController::addHeader(not_null<Ui::VerticalLayout*> container) {
object_ptr<Ui::FlatLabel>(
verticalLayout,
(_data.url.isEmpty()
? tr::lng_filters_link_no_about(Ui::Text::WithEntities)
? tr::lng_filters_link_no_about(tr::marked)
: tr::lng_filters_link_share_about(
lt_folder,
rpl::single(Ui::Text::Wrapped(
_filterTitle.text,
EntityType::Bold)),
Ui::Text::WithEntities)),
tr::marked)),
st::settingsFilterDividerLabel,
st::defaultPopupMenu,
Core::TextContext({
@@ -1015,7 +1015,7 @@ void ExportFilterLink(
const auto front = peers.front();
const auto session = &front->session();
auto mtpPeers = peers | ranges::views::transform(
[](not_null<PeerData*> peer) { return MTPInputPeer(peer->input); }
[](not_null<PeerData*> peer) { return MTPInputPeer(peer->input()); }
) | ranges::to<QVector<MTPInputPeer>>();
session->api().request(MTPchatlists_ExportChatlistInvite(
MTP_inputChatlistDialogFilter(MTP_int(id)),
@@ -1048,7 +1048,7 @@ void EditLinkChats(
const auto front = peers.front();
const auto session = &front->session();
auto mtpPeers = peers | ranges::views::transform(
[](not_null<PeerData*> peer) { return MTPInputPeer(peer->input); }
[](not_null<PeerData*> peer) { return MTPInputPeer(peer->input()); }
) | ranges::to<QVector<MTPInputPeer>>();
session->api().request(MTPchatlists_EditExportedInvite(
MTP_flags(MTPchatlists_EditExportedInvite::Flag::f_peers),

View File

@@ -69,9 +69,9 @@ void GiftCreditsBox(
auto link = tr::lng_credits_box_history_entry_gift_about_link(
lt_emoji,
rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)),
Ui::Text::RichLangValue
tr::rich
) | rpl::map([](TextWithEntities text) {
return Ui::Text::Link(
return tr::link(
std::move(text),
u"internal:stars_examples"_q);
});
@@ -83,7 +83,7 @@ void GiftCreditsBox(
rpl::single(TextWithEntities{ peer->shortName() }),
lt_link,
std::move(link),
Ui::Text::RichLangValue),
tr::rich),
st::creditsBoxAbout),
st::boxRowPadding,
style::al_top);

View File

@@ -19,11 +19,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/peers/replace_boost_box.h" // BoostsForGift.
#include "boxes/premium_preview_box.h" // ShowPremiumPreviewBox.
#include "boxes/star_gift_box.h" // ShowStarGiftBox.
#include "boxes/star_gift_preview_box.h" // StarGiftPreviewBox.
#include "core/ui_integration.h"
#include "data/components/gift_auctions.h"
#include "data/data_boosts.h"
#include "data/data_changes.h"
#include "data/data_channel.h"
#include "data/data_credits.h"
#include "data/data_document.h"
#include "data/data_emoji_statuses.h"
#include "data/data_media_types.h" // Data::GiveawayStart.
#include "data/data_peer_values.h" // Data::PeerPremiumValue.
@@ -235,10 +238,10 @@ using SpinnerState = Data::GiftUpgradeSpinner::State;
tr::lng_gift_value_minimum_price_tooltip(
tr::now,
lt_amount,
Ui::Text::Bold(text.text),
tr::bold(text.text),
lt_gift,
Ui::Text::Bold(unique->title),
Ui::Text::WithEntities));
tr::bold(unique->title),
tr::marked));
}
[[nodiscard]] object_ptr<Ui::RpWidget> MakeAveragePriceValue(
@@ -254,10 +257,10 @@ using SpinnerState = Data::GiftUpgradeSpinner::State;
tr::lng_gift_value_average_price_tooltip(
tr::now,
lt_amount,
Ui::Text::Bold(text.text),
tr::bold(text.text),
lt_gift,
Ui::Text::Bold(unique->title),
Ui::Text::WithEntities));
tr::bold(unique->title),
tr::marked));
}
[[nodiscard]] object_ptr<Ui::RpWidget> MakeAttributeValue(
@@ -449,24 +452,79 @@ using SpinnerState = Data::GiftUpgradeSpinner::State;
void AddUniqueGiftPropertyRows(
not_null<Ui::RpWidget*> container,
std::shared_ptr<ChatHelpers::Show> show,
not_null<Ui::TableLayout*> table,
not_null<Data::UniqueGift*> unique,
std::shared_ptr<Data::UniqueGift> unique,
std::shared_ptr<Data::GiftUpgradeSpinner> spinner) {
const auto tooltip = std::make_shared<TableRowTooltipData>(
TableRowTooltipData{ .parent = container });
const auto showTooltip = [=](
not_null<Ui::RpWidget*> widget,
rpl::producer<TextWithEntities> text) {
ShowTableRowTooltip(tooltip, widget, std::move(text), kTooltipDuration);
ShowTableRowTooltip(
tooltip,
widget,
std::move(text),
kTooltipDuration);
};
const auto showRarity = [=](
not_null<Ui::RpWidget*> widget,
int rarity) {
const auto percent = QString::number(rarity / 10.) + '%';
showTooltip(widget, tr::lng_gift_unique_rarity(
lt_percent,
rpl::single(TextWithEntities{ percent }),
Ui::Text::WithEntities));
struct VariantsList {
rpl::variable<Data::UniqueGiftAttributes> attributes;
bool requested = false;
bool inited = false;
rpl::lifetime clickLifetime;
};
const auto variants = container->lifetime().make_state<VariantsList>();
const auto session = &unique->model.document->session();
const auto giftId = unique->initialGiftId;
const auto initVariants = [=] {
if (variants->requested || variants->inited) {
return;
}
const auto auctions = &session->giftAuctions();
if (auto attributes = auctions->attributes(giftId)) {
variants->inited = true;
variants->attributes = std::move(*attributes);
} else {
variants->requested = true;
auctions->requestAttributes(giftId, crl::guard(container, [=] {
variants->inited = true;
variants->attributes.force_assign(
*auctions->attributes(giftId));
}));
}
};
const auto title = unique->title;
const auto showRarity = [=](Data::GiftAttributeId id) {
return [=](
not_null<Ui::RpWidget*> widget,
int rarity) {
initVariants();
const auto weak = base::make_weak(widget);
variants->clickLifetime = variants->attributes.value(
) | rpl::filter([=] {
return variants->inited;
}) | rpl::take(1) | rpl::on_next([=](
const Data::UniqueGiftAttributes &list) {
if (!list.models.empty()) {
show->show(Box(
Ui::StarGiftPreviewBox,
title,
list,
id.type,
unique));
} else if (const auto widget = weak.get()) {
const auto percent = QString::number(rarity / 10.) + '%';
showTooltip(widget, tr::lng_gift_unique_rarity(
lt_percent,
rpl::single(TextWithEntities{ percent }),
tr::marked));
}
});
};
};
const auto empty = std::vector<Data::UniqueGiftAttribute>();
const auto extract = [&](const auto &list) {
@@ -490,7 +548,7 @@ void AddUniqueGiftPropertyRows(
MakeAttributeValue(
table,
unique->model,
showRarity,
showRarity(IdFor(unique->model)),
spinner,
models,
SpinnerState::FinishedModel),
@@ -501,7 +559,7 @@ void AddUniqueGiftPropertyRows(
MakeAttributeValue(
table,
unique->pattern,
showRarity,
showRarity(IdFor(unique->pattern)),
spinner,
patterns,
SpinnerState::FinishedPattern),
@@ -512,7 +570,7 @@ void AddUniqueGiftPropertyRows(
MakeAttributeValue(
table,
unique->backdrop,
showRarity,
showRarity(IdFor(unique->backdrop)),
spinner,
backdrops,
SpinnerState::FinishedBackdrop),
@@ -646,15 +704,15 @@ void AddTable(
AddTableRow(
table,
tr::lng_gift_link_label_to(),
tr::lng_gift_link_label_to_unclaimed(Ui::Text::WithEntities));
tr::lng_gift_link_label_to_unclaimed(tr::marked));
}
AddTableRow(
table,
tr::lng_gift_link_label_gift(),
tr::lng_gift_link_gift_premium(
lt_duration,
GiftDurationValue(current.days) | Ui::Text::ToWithEntities(),
Ui::Text::WithEntities));
GiftDurationValue(current.days) | rpl::map(tr::marked),
tr::marked));
if (!skipReason && current.from) {
const auto reason = AddTableRow(
table,
@@ -662,15 +720,14 @@ void AddTable(
(current.giveawayId
? ((current.to
? tr::lng_gift_link_reason_giveaway
: tr::lng_gift_link_reason_unclaimed)(
) | Ui::Text::ToLink())
: tr::lng_gift_link_reason_unclaimed)(tr::link))
: current.giveaway
? ((current.to
? tr::lng_gift_link_reason_giveaway
: tr::lng_gift_link_reason_unclaimed)(
Ui::Text::WithEntities
tr::marked
) | rpl::type_erased)
: tr::lng_gift_link_reason_chosen(Ui::Text::WithEntities)));
: tr::lng_gift_link_reason_chosen(tr::marked)));
reason->setClickHandlerFilter([=](const auto &...) {
if (const auto window = show->resolveWindow()) {
window->showPeerHistory(
@@ -685,7 +742,7 @@ void AddTable(
AddTableRow(
table,
tr::lng_gift_link_label_date(),
rpl::single(Ui::Text::WithEntities(
rpl::single(tr::marked(
langDateTime(base::unixtime::parse(current.date)))));
}
}
@@ -726,11 +783,11 @@ void ShowAlreadyPremiumToast(
.text = tr::lng_gift_link_already_about(
tr::now,
lt_date,
Ui::Text::Bold(langDateTime(base::unixtime::parse(date))),
tr::bold(langDateTime(base::unixtime::parse(date))),
lt_link,
Ui::Text::Link(
Ui::Text::Bold(tr::lng_gift_link_already_link(tr::now))),
Ui::Text::WithEntities),
tr::link(
tr::bold(tr::lng_gift_link_already_link(tr::now))),
tr::marked),
.filter = crl::guard(navigation, shareLink),
.duration = 6 * crl::time(1000),
});
@@ -789,8 +846,8 @@ void GiftCodeBox(
tr::lng_gift_link_title()),
.about = rpl::conditional(
state->used.value(),
tr::lng_gift_link_used_about(Ui::Text::RichLangValue),
tr::lng_gift_link_about(Ui::Text::RichLangValue)),
tr::lng_gift_link_used_about(tr::rich),
tr::lng_gift_link_about(tr::rich)),
.light = true,
}));
@@ -815,7 +872,7 @@ void GiftCodeBox(
auto shareLink = tr::lng_gift_link_also_send_link(
) | rpl::map([](const QString &text) {
return Ui::Text::Link(text);
return tr::link(text);
});
auto richDate = [](const Api::GiftCode &data) {
return TextWithEntities{
@@ -830,11 +887,11 @@ void GiftCodeBox(
tr::lng_gift_link_used_footer(
lt_date,
state->data.value() | rpl::map(richDate),
Ui::Text::WithEntities),
tr::marked),
tr::lng_gift_link_also_send(
lt_link,
std::move(shareLink),
Ui::Text::WithEntities)),
tr::marked)),
st::giveawayGiftCodeFooter),
st::giveawayGiftCodeFooterMargin,
style::al_top);
@@ -916,8 +973,8 @@ void GiftCodePendingBox(
.title = tr::lng_gift_link_title(),
.about = tr::lng_gift_link_pending_about(
lt_user,
rpl::single(Ui::Text::Link(resultToName)),
Ui::Text::RichLangValue),
rpl::single(tr::link(resultToName)),
tr::rich),
.light = true,
}));
@@ -1040,20 +1097,20 @@ void GiveawayInfoBox(
lt_cup,
rpl::single(
TextWithEntities{ QString::fromUtf8("\xf0\x9f\x8f\x86") }),
Ui::Text::WithEntities)
tr::marked)
: (info.credits)
? tr::lng_prizes_you_won_credits(
lt_amount,
tr::lng_prizes_you_won_credits_amount(
lt_count,
rpl::single(float64(info.credits)),
Ui::Text::Bold),
tr::bold),
lt_cup,
rpl::single(
TextWithEntities{ QString::fromUtf8("\xf0\x9f\x8f\x86") }),
Ui::Text::WithEntities)
tr::marked)
: (info.state == State::Finished)
? tr::lng_prizes_you_didnt(Ui::Text::WithEntities)
? tr::lng_prizes_you_didnt(tr::marked)
: (rpl::producer<TextWithEntities>)(nullptr);
if (resultText) {
@@ -1105,14 +1162,14 @@ void GiveawayInfoBox(
: tr::lng_prizes_credits_admins)(
tr::now,
lt_channel,
Ui::Text::Bold(first),
tr::bold(first),
lt_amount,
tr::lng_prizes_credits_admins_amount(
tr::now,
lt_count_decimal,
float64(credits),
Ui::Text::Bold),
Ui::Text::RichLangValue)
tr::bold),
tr::rich)
: (group
? tr::lng_prizes_admins_group
: tr::lng_prizes_admins)(
@@ -1120,11 +1177,11 @@ void GiveawayInfoBox(
lt_count,
quantity,
lt_channel,
Ui::Text::Bold(first),
tr::bold(first),
lt_duration,
TextWithEntities{ GiftDuration(months * 30) },
Ui::Text::RichLangValue),
Ui::Text::RichLangValue));
tr::rich),
tr::rich));
const auto many = start
? (start->channels.size() > 1)
: (results->additionalPeersCount > 0);
@@ -1144,8 +1201,8 @@ void GiveawayInfoBox(
lt_count,
count,
lt_channel,
Ui::Text::Bold(first),
Ui::Text::RichLangValue)
tr::bold(first),
tr::rich)
: (many
? tr::lng_prizes_winners_new_of_many
: tr::lng_prizes_winners_new_of_one)(
@@ -1153,11 +1210,11 @@ void GiveawayInfoBox(
lt_count,
count,
lt_channel,
Ui::Text::Bold(first),
tr::bold(first),
lt_start_date,
Ui::Text::Bold(
tr::bold(
langDateTime(base::unixtime::parse(info.startDate))),
Ui::Text::RichLangValue);
tr::rich);
const auto additionalPrize = results
? results->additionalPrize
: start->additionalPrize;
@@ -1169,10 +1226,10 @@ void GiveawayInfoBox(
lt_count,
count,
lt_channel,
Ui::Text::Bold(first),
tr::bold(first),
lt_prize,
TextWithEntities{ additionalPrize },
Ui::Text::RichLangValue));
tr::rich));
}
const auto untilDate = start
? start->untilDate
@@ -1182,17 +1239,17 @@ void GiveawayInfoBox(
: tr::lng_prizes_how_when_finish)(
tr::now,
lt_date,
Ui::Text::Bold(langDayOfMonthFull(
tr::bold(langDayOfMonthFull(
base::unixtime::parse(untilDate).date())),
lt_winners,
winners,
Ui::Text::RichLangValue));
tr::rich));
if (info.activatedCount > 0) {
text.append(' ').append(tr::lng_prizes_end_activated(
tr::now,
lt_count,
info.activatedCount,
Ui::Text::RichLangValue));
tr::rich));
}
if (!info.giftCode.isEmpty()
|| info.state == State::Finished
@@ -1206,8 +1263,8 @@ void GiveawayInfoBox(
: tr::lng_prizes_how_no_admin)(
tr::now,
lt_channel,
Ui::Text::Bold(channel->name()),
Ui::Text::RichLangValue));
tr::bold(channel->name()),
tr::rich));
} else if (info.tooEarlyDate) {
const auto channel = controller->session().data().channel(
info.adminChannelId);
@@ -1216,33 +1273,33 @@ void GiveawayInfoBox(
: tr::lng_prizes_how_no_joined)(
tr::now,
lt_date,
Ui::Text::Bold(
tr::bold(
langDateTime(
base::unixtime::parse(info.tooEarlyDate))),
Ui::Text::RichLangValue));
tr::rich));
} else if (!info.disallowedCountry.isEmpty()) {
text.append("\n\n").append(tr::lng_prizes_how_no_country(
tr::now,
Ui::Text::RichLangValue));
tr::rich));
} else if (info.participating) {
text.append("\n\n").append((many
? tr::lng_prizes_how_yes_joined_many
: tr::lng_prizes_how_yes_joined_one)(
tr::now,
lt_channel,
Ui::Text::Bold(first),
Ui::Text::RichLangValue));
tr::bold(first),
tr::rich));
} else {
text.append("\n\n").append((many
? tr::lng_prizes_how_participate_many
: tr::lng_prizes_how_participate_one)(
tr::now,
lt_channel,
Ui::Text::Bold(first),
tr::bold(first),
lt_date,
Ui::Text::Bold(langDayOfMonthFull(
tr::bold(langDayOfMonthFull(
base::unixtime::parse(untilDate).date())),
Ui::Text::RichLangValue));
tr::rich));
}
}
const auto padding = st::boxPadding;
@@ -1380,7 +1437,7 @@ struct AddedUniqueDetails {
rpl::single(
Ui::Text::IconEmoji(&st::starIconEmoji).append(
Lang::FormatCountDecimal(removeCost))),
Ui::Text::RichLangValue),
tr::rich),
.title = tr::lng_gift_unique_info_remove_title(),
});
box->addRow(
@@ -1460,8 +1517,8 @@ void AddStarGiftTable(
const auto show = [&](const auto &phrase) {
showTooltip(badge, phrase(
lt_name,
rpl::single(Ui::Text::Bold(UniqueGiftName(*unique))),
Ui::Text::WithEntities));
rpl::single(tr::bold(UniqueGiftName(*unique))),
tr::marked));
};
if (!*was || *was == id) {
*was = id;
@@ -1510,8 +1567,8 @@ void AddStarGiftTable(
const auto show = [&](const auto &phrase) {
showTooltip(badge, phrase(
lt_name,
rpl::single(Ui::Text::Bold(UniqueGiftName(*unique))),
Ui::Text::WithEntities));
rpl::single(tr::bold(UniqueGiftName(*unique))),
tr::marked));
};
if (!*was || *was == id) {
*was = id;
@@ -1582,24 +1639,25 @@ void AddStarGiftTable(
AddTableRow(
table,
tr::lng_gift_link_label_first_sale(),
rpl::single(Ui::Text::WithEntities(
rpl::single(tr::marked(
langDateTime(entry.firstSaleDate))));
}
if (!unique && !entry.lastSaleDate.isNull()) {
AddTableRow(
table,
tr::lng_gift_link_label_last_sale(),
rpl::single(Ui::Text::WithEntities(
rpl::single(tr::marked(
langDateTime(entry.lastSaleDate))));
}
if (!unique && !entry.date.isNull()) {
AddTableRow(
table,
tr::lng_gift_link_label_date(),
rpl::single(Ui::Text::WithEntities(langDateTime(entry.date))));
rpl::single(tr::marked(langDateTime(entry.date))));
}
if (unique) {
AddUniqueGiftPropertyRows(container, table, unique, spinner);
const auto shared = entry.uniqueGift;
AddUniqueGiftPropertyRows(container, show, table, shared, spinner);
} else {
AddTableRow(
table,
@@ -1626,7 +1684,7 @@ void AddStarGiftTable(
? tr::lng_gift_availability_none(
lt_amount,
std::move(amount),
Ui::Text::WithEntities)
tr::marked)
: (unique
? tr::lng_gift_unique_availability
: tr::lng_gift_availability_left)(
@@ -1634,13 +1692,13 @@ void AddStarGiftTable(
rpl::single(count * 1.),
lt_amount,
std::move(amount),
Ui::Text::WithEntities)));
tr::marked)));
}
if (!unique && !entry.soldOutInfo && canStartUpgrade) {
AddTableRow(
table,
tr::lng_gift_unique_status(),
tr::lng_gift_unique_status_non(Ui::Text::WithEntities));
tr::lng_gift_unique_status_non(tr::marked));
}
if (unique) {
if (unique->value) {
@@ -1662,37 +1720,37 @@ void AddStarGiftTable(
? (original.message.empty()
? tr::lng_gift_unique_info_sender(
lt_from,
rpl::single(Ui::Text::Link(from->name(), 2)),
rpl::single(tr::link(from->name(), 2)),
lt_recipient,
rpl::single(Ui::Text::Link(to->name(), 1)),
rpl::single(tr::link(to->name(), 1)),
lt_date,
rpl::single(dateText),
Ui::Text::WithEntities)
tr::marked)
: tr::lng_gift_unique_info_sender_comment(
lt_from,
rpl::single(Ui::Text::Link(from->name(), 2)),
rpl::single(tr::link(from->name(), 2)),
lt_recipient,
rpl::single(Ui::Text::Link(to->name(), 1)),
rpl::single(tr::link(to->name(), 1)),
lt_date,
rpl::single(dateText),
lt_text,
rpl::single(original.message),
Ui::Text::WithEntities))
tr::marked))
: (original.message.empty()
? tr::lng_gift_unique_info_reciever(
lt_recipient,
rpl::single(Ui::Text::Link(to->name(), 1)),
rpl::single(tr::link(to->name(), 1)),
lt_date,
rpl::single(dateText),
Ui::Text::WithEntities)
tr::marked)
: tr::lng_gift_unique_info_reciever_comment(
lt_recipient,
rpl::single(Ui::Text::Link(to->name(), 1)),
rpl::single(tr::link(to->name(), 1)),
lt_date,
rpl::single(dateText),
lt_text,
rpl::single(original.message),
Ui::Text::WithEntities));
tr::marked));
const auto tmp = std::make_shared<Ui::RpWidget*>(nullptr);
auto made = MakeUniqueDetails(
show,
@@ -1746,7 +1804,7 @@ void AddTransferGiftTable(
container,
st::giveawayGiftCodeTable),
st::giveawayGiftCodeTableMargin);
AddUniqueGiftPropertyRows(container, table, unique.get(), nullptr);
AddUniqueGiftPropertyRows(container, show, table, unique, nullptr);
if (const auto value = unique->value.get()) {
AddTableRow(
table,
@@ -1795,7 +1853,7 @@ void AddCreditsHistoryEntryTable(
table,
tr::lng_gift_link_label_reason(),
tr::lng_credits_box_history_entry_reason_star_ref(
Ui::Text::WithEntities));
tr::marked));
}
}
if (starrefRecipientId && entry.starrefAmount && !entry.giftResale) {
@@ -1861,7 +1919,7 @@ void AddCreditsHistoryEntryTable(
entry.bareMsgId);
auto label = object_ptr<Ui::FlatLabel>(
table,
rpl::single(Ui::Text::Link(link)),
rpl::single(tr::link(link)),
table->st().defaultValue);
label->setClickHandlerFilter([=](const auto &...) {
if (const auto window = show->resolveWindow()) {
@@ -1883,13 +1941,13 @@ void AddCreditsHistoryEntryTable(
table,
tr::lng_credits_box_history_entry_via(),
tr::lng_credits_box_history_entry_app_store(
Ui::Text::RichLangValue));
tr::rich));
} else if (entry.peerType == Type::PlayMarket) {
AddTableRow(
table,
tr::lng_credits_box_history_entry_via(),
tr::lng_credits_box_history_entry_play_market(
Ui::Text::RichLangValue));
tr::rich));
} else if (entry.peerType == Type::Fragment) {
AddTableRow(
table,
@@ -1899,18 +1957,18 @@ void AddCreditsHistoryEntryTable(
((entry.gift && entry.credits.stars())
? tr::lng_credits_box_history_entry_anonymous
: tr::lng_credits_box_history_entry_fragment)(
Ui::Text::RichLangValue));
tr::rich));
} else if (entry.peerType == Type::Ads) {
AddTableRow(
table,
tr::lng_credits_box_history_entry_via(),
tr::lng_credits_box_history_entry_ads(Ui::Text::RichLangValue));
tr::lng_credits_box_history_entry_ads(tr::rich));
} else if (entry.peerType == Type::PremiumBot) {
AddTableRow(
table,
tr::lng_credits_box_history_entry_via(),
tr::lng_credits_box_history_entry_via_premium_bot(
Ui::Text::RichLangValue));
tr::rich));
}
if (entry.bareGiveawayMsgId) {
AddTableRow(
@@ -1926,7 +1984,7 @@ void AddCreditsHistoryEntryTable(
tr::lng_gift_stars_title(
lt_count,
rpl::single(entry.credits.value()),
Ui::Text::RichLangValue));
tr::rich));
}
{
const auto link = CreateMessageLink(
@@ -1939,7 +1997,7 @@ void AddCreditsHistoryEntryTable(
tr::lng_gift_link_label_reason(),
tr::lng_gift_link_reason_giveaway(
) | rpl::map([link](const QString &text) {
return Ui::Text::Link(text, link);
return tr::link(text, link);
}));
}
}
@@ -1948,7 +2006,7 @@ void AddCreditsHistoryEntryTable(
table,
tr::lng_gift_link_label_reason(),
tr::lng_credits_box_history_entry_subscription(
Ui::Text::WithEntities));
tr::marked));
}
if (entry.paidMessagesAmount) {
auto value = Ui::Text::IconEmoji(&st::starIconEmojiColored);
@@ -1967,7 +2025,7 @@ void AddCreditsHistoryEntryTable(
tr::lng_months(
lt_count,
rpl::single(1. * months),
Ui::Text::WithEntities));
tr::marked));
}
if (!entry.id.isEmpty()) {
auto label = MakeMaybeMultilineTokenValue(table, entry.id, st);
@@ -1988,27 +2046,27 @@ void AddCreditsHistoryEntryTable(
table,
tr::lng_credits_box_history_entry_floodskip_row(),
rpl::single(
Ui::Text::WithEntities(
tr::marked(
Lang::FormatCountDecimal(entry.floodSkip))));
}
if (!entry.date.isNull()) {
AddTableRow(
table,
tr::lng_gift_link_label_date(),
rpl::single(Ui::Text::WithEntities(langDateTime(entry.date))));
rpl::single(tr::marked(langDateTime(entry.date))));
}
if (!entry.successDate.isNull()) {
AddTableRow(
table,
tr::lng_credits_box_history_entry_success_date(),
rpl::single(Ui::Text::WithEntities(langDateTime(entry.date))));
rpl::single(tr::marked(langDateTime(entry.date))));
}
if (!entry.successLink.isEmpty()) {
AddTableRow(
table,
tr::lng_credits_box_history_entry_success_url(),
rpl::single(
Ui::Text::Link(entry.successLink, entry.successLink)));
tr::link(entry.successLink, entry.successLink)));
}
if (entry.limitedCount > 0 && entry.limitedLeft >= 0) {
AddTableRow(
@@ -2021,7 +2079,7 @@ void AddCreditsHistoryEntryTable(
rpl::single(TextWithEntities{
Lang::FormatCountDecimal(entry.limitedCount)
}),
Ui::Text::WithEntities));
tr::marked));
}
}
@@ -2055,7 +2113,7 @@ void AddSubscriptionEntryTable(
AddTableRow(
table,
tr::lng_credits_subscription_row_to(),
rpl::single(Ui::Text::WithEntities(s.title)));
rpl::single(tr::marked(s.title)));
}
if (!s.until.isNull()) {
if (s.subscription.period > 0) {
@@ -2065,7 +2123,7 @@ void AddSubscriptionEntryTable(
table,
tr::lng_group_invite_joined_row_date(),
rpl::single(
Ui::Text::WithEntities(langDateTime(subscribed))));
tr::marked(langDateTime(subscribed))));
}
}
AddTableRow(
@@ -2075,7 +2133,7 @@ void AddSubscriptionEntryTable(
: s.cancelled
? tr::lng_credits_subscription_row_next_off()
: tr::lng_credits_subscription_row_next_on(),
rpl::single(Ui::Text::WithEntities(langDateTime(s.until))));
rpl::single(tr::marked(langDateTime(s.until))));
}
}
@@ -2099,7 +2157,7 @@ void AddSubscriberEntryTable(
AddTableRow(
table,
tr::lng_group_invite_joined_row_date(),
rpl::single(Ui::Text::WithEntities(langDateTime(d))));
rpl::single(tr::marked(langDateTime(d))));
}
}
@@ -2130,7 +2188,7 @@ void AddCreditsBoostTable(
tr::lng_gift_stars_title(
lt_count,
rpl::single(float64(b.credits)),
Ui::Text::RichLangValue));
tr::rich));
}
{
const auto link = CreateMessageLink(
@@ -2143,7 +2201,7 @@ void AddCreditsBoostTable(
tr::lng_gift_link_label_reason(),
tr::lng_gift_link_reason_giveaway(
) | rpl::map([link](const QString &text) {
return Ui::Text::Link(text, link);
return tr::link(text, link);
}));
}
}
@@ -2151,13 +2209,13 @@ void AddCreditsBoostTable(
AddTableRow(
table,
tr::lng_gift_link_label_date(),
rpl::single(Ui::Text::WithEntities(langDateTime(b.date))));
rpl::single(tr::marked(langDateTime(b.date))));
}
if (!b.expiresAt.isNull()) {
AddTableRow(
table,
tr::lng_gift_until(),
rpl::single(Ui::Text::WithEntities(langDateTime(b.expiresAt))));
rpl::single(tr::marked(langDateTime(b.expiresAt))));
}
}
@@ -2219,7 +2277,7 @@ void AddUniqueGiftValueTable(
value->initialSalePrice,
value->currency,
true)),
Ui::Text::WithEntities),
tr::marked),
helper.context());
if (value->lastSaleDate) {
AddTableRow(

View File

@@ -280,8 +280,8 @@ void CreateModerateMessagesBox(
}) | ranges::to<QVector<MTPint>>();
c->session().api().request(
MTPchannels_ReportSpam(
c->inputChannel,
p->input,
c->inputChannel(),
p->input(),
MTP_vector<MTPint>(std::move(filtered)))
).send();
});
@@ -297,12 +297,12 @@ void CreateModerateMessagesBox(
!(isSingle)
? tr::lng_delete_all_from_users(
tr::now,
Ui::Text::WithEntities)
tr::marked)
: tr::lng_delete_all_from_user(
tr::now,
lt_user,
Ui::Text::Bold(firstItem->from()->name()),
Ui::Text::WithEntities),
tr::bold(firstItem->from()->name()),
tr::marked),
false,
st::defaultBoxCheckbox),
st::boxRowPadding + buttonPadding);
@@ -456,10 +456,10 @@ void CreateModerateMessagesBox(
: tr::lng_restrict_users_full)(
lt_emoji,
rpl::single(toggled ? emojiUp : emojiDown),
Ui::Text::WithEntities);
tr::marked);
}) | rpl::flatten_latest(
) | rpl::on_next([=](const TextWithEntities &text) {
raw->setMarkedText(Ui::Text::Link(text, u"internal:"_q));
raw->setMarkedText(tr::link(text, u"internal:"_q));
}, label->lifetime());
Ui::AddSkip(inner);
@@ -622,12 +622,12 @@ void DeleteChatBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
Ui::CreateChild<Ui::FlatLabel>(
container,
peer->isSelf()
? tr::lng_saved_messages() | Ui::Text::ToBold()
? tr::lng_saved_messages(tr::bold)
: maybeUser
? tr::lng_profile_delete_conversation() | Ui::Text::ToBold()
? tr::lng_profile_delete_conversation(tr::bold)
: rpl::single(
userpicPeer->name()
) | Ui::Text::ToBold() | rpl::type_erased,
tr::bold(userpicPeer->name())
) | rpl::type_erased,
box->getDelegate()->style().title));
Ui::AddSkip(container);
@@ -661,10 +661,10 @@ void DeleteChatBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
tr::now,
lt_user,
TextWithEntities{ maybeUser->firstName },
Ui::Text::RichLangValue)
tr::rich)
: tr::lng_delete_for_everyone_check(
tr::now,
Ui::Text::WithEntities),
tr::marked),
false,
st::defaultBoxCheckbox));
}();
@@ -678,7 +678,7 @@ void DeleteChatBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
return box->addRow(
object_ptr<Ui::Checkbox>(
container,
tr::lng_profile_block_bot(tr::now, Ui::Text::WithEntities),
tr::lng_profile_block_bot(tr::now, tr::marked),
false,
st::defaultBoxCheckbox));
}();
@@ -712,7 +712,7 @@ void DeleteChatBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
? tr::lng_filters_checkbox_remove_channel
: tr::lng_filters_checkbox_remove_group)(
tr::now,
Ui::Text::WithEntities),
tr::marked),
false,
st::defaultBoxCheckbox));
}();
@@ -794,7 +794,7 @@ void DeleteSublistBox(
userpic,
Ui::CreateChild<Ui::FlatLabel>(
container,
tr::lng_profile_delete_conversation() | Ui::Text::ToBold(),
tr::lng_profile_delete_conversation(tr::bold),
box->getDelegate()->style().title));
Ui::AddSkip(container);

View File

@@ -73,17 +73,17 @@ void TransferPasswordError(
auto text = std::move(about).append('\n').append('\n').append(
tr::lng_rights_transfer_check_password(
tr::now,
Ui::Text::RichLangValue)
tr::rich)
).append('\n').append('\n').append(
tr::lng_rights_transfer_check_session(
tr::now,
Ui::Text::RichLangValue)
tr::rich)
);
if (error == PasswordErrorType::Later) {
text.append('\n').append('\n').append(
tr::lng_rights_transfer_check_later(
tr::now,
Ui::Text::RichLangValue));
tr::rich));
}
box->addRow(object_ptr<Ui::FlatLabel>(
box,
@@ -1152,7 +1152,7 @@ RecoverBox::RecoverBox(
tr::lng_signin_recover_hint(
lt_recover_email,
rpl::single(Ui::Text::WrapEmailPattern(pattern)),
Ui::Text::WithEntities),
tr::marked),
st::termsContent,
st::defaultPopupMenu)
, _closeParent(std::move(closeParent)) {

View File

@@ -788,11 +788,11 @@ RecipientMoneyRestrictionError WriteMoneyRestrictionError(
lt_user,
TextWithEntities{ user->shortName() },
lt_link,
Ui::Text::Link(
Ui::Text::Bold(
tr::link(
tr::bold(
tr::lng_send_non_premium_message_toast_link(
tr::now))),
Ui::Text::RichLangValue),
tr::rich),
};
}
@@ -995,7 +995,7 @@ void ChooseTopicSearchController::searchQuery(const QString &query) {
void ChooseTopicSearchController::searchOnServer() {
_requestId = _api.request(MTPmessages_GetForumTopics(
MTP_flags(MTPmessages_GetForumTopics::Flag::f_q),
_forum->peer()->input,
_forum->peer()->input(),
MTP_string(_query),
MTP_int(_offsetDate),
MTP_int(_offsetId),

View File

@@ -163,8 +163,8 @@ void AddBotToGroupBoxController::requestExistingRights(
_bot->session().api().request(_existingRightsRequestId).cancel();
_existingRightsRequestId = _bot->session().api().request(
MTPchannels_GetParticipant(
_existingRightsChannel->inputChannel,
_bot->input)
_existingRightsChannel->inputChannel(),
_bot->input())
).done([=](const MTPchannels_ChannelParticipant &result) {
result.match([&](const MTPDchannels_channelParticipant &data) {
channel->owner().processUsers(data.vusers());

View File

@@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/boxes/confirm_box.h"
#include "ui/boxes/show_or_premium_box.h"
#include "ui/effects/premium_graphics.h"
#include "ui/text/text_utilities.h" // Ui::Text::RichLangValue
#include "ui/text/text_utilities.h" // tr::rich
#include "ui/toast/toast.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/checkbox.h"
@@ -191,17 +191,17 @@ void FillUpgradeToPremiumCover(
for (auto i = 0; i != names; ++i) {
const auto name = userpicUsers[i]->shortName();
if (text.empty()) {
text = Ui::Text::Bold(name);
text = tr::bold(name);
} else if (i == names - 1 && !remaining) {
text = tr::lng_invite_upgrade_users_few(
tr::now,
lt_users,
text,
lt_last,
Ui::Text::Bold(name),
Ui::Text::RichLangValue);
tr::bold(name),
tr::rich);
} else {
text.append(", ").append(Ui::Text::Bold(name));
text.append(", ").append(tr::bold(name));
}
}
if (remaining > 0) {
@@ -211,7 +211,7 @@ void FillUpgradeToPremiumCover(
remaining,
lt_users,
text,
Ui::Text::RichLangValue);
tr::rich);
}
const auto inviteOnly = !forbidden.premiumAllowsInvite.empty()
&& (forbidden.premiumAllowsWrite.size() != forbidden.users.size());
@@ -227,7 +227,7 @@ void FillUpgradeToPremiumCover(
int(userpicUsers.size()),
lt_users,
text,
Ui::Text::RichLangValue);
tr::rich);
container->add(
object_ptr<Ui::FlatLabel>(
container,
@@ -474,11 +474,11 @@ void InviteForbiddenController::setSimpleCover() {
? phraseCounted(
lt_count,
rpl::single<float64>(count),
Ui::Text::RichLangValue)
tr::rich)
: phraseNamed(
lt_user,
rpl::single(TextWithEntities{ _users.front()->name() }),
Ui::Text::RichLangValue);
tr::rich);
delegate()->peerListSetAboveWidget(object_ptr<Ui::PaddingWrap<>>(
(QWidget*)nullptr,
object_ptr<Ui::FlatLabel>(
@@ -530,18 +530,18 @@ void InviteForbiddenController::setComplexCover() {
? tr::lng_invite_upgrade_via_channel_about
: tr::lng_invite_upgrade_via_group_about)(
tr::now,
Ui::Text::WithEntities)
tr::marked)
: (_forbidden.users.size() == 1
? tr::lng_via_link_cant_one(
tr::now,
lt_user,
TextWithEntities{ _forbidden.users.front()->shortName() },
Ui::Text::RichLangValue)
tr::rich)
: tr::lng_via_link_cant_many(
tr::now,
lt_count,
int(_forbidden.users.size()),
Ui::Text::RichLangValue));
tr::rich));
container->add(
object_ptr<Ui::FlatLabel>(
container,
@@ -721,12 +721,12 @@ void InviteForbiddenController::send(
tr::now,
lt_user,
TextWithEntities{ list.front()->name() },
Ui::Text::RichLangValue)
tr::rich)
: tr::lng_via_link_shared_many(
tr::now,
lt_count,
int(list.size()),
Ui::Text::RichLangValue);
tr::rich);
close();
show->showToast(std::move(text));
return true;
@@ -989,14 +989,14 @@ void AddParticipantsBoxController::inviteSelectedUsers(
{ users.front()->name()},
lt_group,
{ _peer->name()},
Ui::Text::RichLangValue)
tr::rich)
: tr::lng_participant_invite_sure_many(
tr::now,
lt_count,
int(users.size()),
lt_group,
{ _peer->name() },
Ui::Text::RichLangValue);
tr::rich);
Ui::ConfirmBox(box, {
.text = std::move(text),
.confirmed = crl::guard(weak, [=](Fn<void()> &&close) {
@@ -1330,7 +1330,7 @@ void AddSpecialBoxController::loadMoreRows() {
const auto channel = _peer->asChannel();
_loadRequestId = _api.request(MTPchannels_GetParticipants(
channel->inputChannel,
channel->inputChannel(),
MTP_channelParticipantsRecent(),
MTP_int(_offset),
MTP_int(perPage),
@@ -1393,8 +1393,8 @@ bool AddSpecialBoxController::checkInfoLoaded(
// We don't know what this user status is in the group.
const auto channel = _peer->asChannel();
_api.request(MTPchannels_GetParticipant(
channel->inputChannel,
participant->input
channel->inputChannel(),
participant->input()
)).done([=](const MTPchannels_ChannelParticipant &result) {
result.match([&](const MTPDchannels_channelParticipant &data) {
channel->owner().processUsers(data.vusers());
@@ -1800,7 +1800,7 @@ void AddSpecialBoxSearchController::requestParticipants() {
const auto channel = _peer->asChannel();
_requestId = _api.request(MTPchannels_GetParticipants(
channel->inputChannel,
channel->inputChannel(),
MTP_channelParticipantsSearch(MTP_string(_query)),
MTP_int(_offset),
MTP_int(perPage),

View File

@@ -202,10 +202,10 @@ object_ptr<Ui::BoxContent> MakeConfirmBox(
auto text = tr::lng_request_peer_confirm(
tr::now,
lt_chat,
Ui::Text::Bold(name),
tr::bold(name),
lt_bot,
Ui::Text::Bold(botName),
Ui::Text::WithEntities);
tr::bold(botName),
tr::marked);
if (!peer->isUser()) {
const auto rights = peer->isBroadcast()
? BroadcastRightsText(query.botRights)
@@ -215,12 +215,12 @@ object_ptr<Ui::BoxContent> MakeConfirmBox(
tr::lng_request_peer_confirm_rights(
tr::now,
lt_bot,
Ui::Text::Bold(botName),
tr::bold(botName),
lt_chat,
Ui::Text::Bold(name),
tr::bold(name),
lt_rights,
TextWithEntities{ rights },
Ui::Text::WithEntities));
tr::marked));
} else if (!peer->isBroadcast() && query.isBotParticipant) {
const auto common = bot->session().api().botCommonGroups(bot);
if (!common || !ranges::contains(*common, peer)) {
@@ -228,10 +228,10 @@ object_ptr<Ui::BoxContent> MakeConfirmBox(
tr::lng_request_peer_confirm_add(
tr::now,
lt_bot,
Ui::Text::Bold(botName),
tr::bold(botName),
lt_chat,
Ui::Text::Bold(name),
Ui::Text::WithEntities));
tr::bold(name),
tr::marked));
}
}
}

View File

@@ -92,7 +92,7 @@ void SendRequest(
user->session().api().request(MTPcontacts_AddContact(
MTP_flags(Flag::f_note
| (sharePhone ? Flag::f_add_phone_privacy_exception : Flag(0))),
user->inputUser,
user->inputUser(),
MTP_string(first),
MTP_string(last),
MTP_string(phone),
@@ -688,7 +688,7 @@ void Controller::setupDeleteContactButton() {
const auto deleteSure = [=](Fn<void()> &&close) {
close();
_user->session().api().request(MTPcontacts_DeleteContacts(
MTP_vector<MTPInputUser>(1, _user->inputUser)
MTP_vector<MTPInputUser>(1, _user->inputUser())
)).done([=](const MTPUpdates &result) {
_user->session().api().applyUpdates(result);
_box->closeBox();
@@ -751,13 +751,13 @@ void Controller::showPhotoMenu(bool suggest) {
? tr::lng_profile_suggest_sure(
tr::now,
lt_user,
Ui::Text::Bold(_user->shortName()),
Ui::Text::WithEntities)
tr::bold(_user->shortName()),
tr::marked)
: tr::lng_profile_set_personal_sure(
tr::now,
lt_user,
Ui::Text::Bold(_user->shortName()),
Ui::Text::WithEntities)),
tr::bold(_user->shortName()),
tr::marked)),
.confirm = (suggest
? tr::lng_profile_suggest_button(tr::now)
: tr::lng_profile_set_photo_button(tr::now)),
@@ -798,13 +798,13 @@ void Controller::choosePhotoFile(bool suggest) {
? tr::lng_profile_suggest_sure(
tr::now,
lt_user,
Ui::Text::Bold(_user->shortName()),
Ui::Text::WithEntities)
tr::bold(_user->shortName()),
tr::marked)
: tr::lng_profile_set_personal_sure(
tr::now,
lt_user,
Ui::Text::Bold(_user->shortName()),
Ui::Text::WithEntities)),
tr::bold(_user->shortName()),
tr::marked)),
.confirm = (suggest
? tr::lng_profile_suggest_button(tr::now)
: tr::lng_profile_set_photo_button(tr::now)),

View File

@@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/vertical_list.h"
#include "ui/widgets/buttons.h"
#include "ui/wrap/vertical_layout.h"
#include "ui/text/text_utilities.h" // Ui::Text::RichLangValue
#include "ui/text/text_utilities.h" // tr::rich
#include "boxes/peer_list_box.h"
#include "ui/boxes/confirm_box.h"
#include "boxes/add_contact_box.h"
@@ -146,10 +146,10 @@ void Controller::choose(not_null<ChannelData*> chat) {
auto text = tr::lng_manage_discussion_group_sure(
tr::now,
lt_group,
Ui::Text::Bold(chat->name()),
tr::bold(chat->name()),
lt_channel,
Ui::Text::Bold(_channel->name()),
Ui::Text::WithEntities);
tr::bold(_channel->name()),
tr::marked);
if (!_channel->isPublic()) {
text.append(
"\n\n" + tr::lng_manage_linked_channel_private(tr::now));
@@ -161,7 +161,7 @@ void Controller::choose(not_null<ChannelData*> chat) {
text.append("\n\n");
text.append(tr::lng_manage_discussion_group_warning(
tr::now,
Ui::Text::RichLangValue));
tr::rich));
}
}
const auto sure = [=](Fn<void()> &&close) {
@@ -180,10 +180,10 @@ void Controller::choose(not_null<ChatData*> chat) {
auto text = tr::lng_manage_discussion_group_sure(
tr::now,
lt_group,
Ui::Text::Bold(chat->name()),
tr::bold(chat->name()),
lt_channel,
Ui::Text::Bold(_channel->name()),
Ui::Text::WithEntities);
tr::bold(_channel->name()),
tr::marked);
if (!_channel->isPublic()) {
text.append("\n\n" + tr::lng_manage_linked_channel_private(tr::now));
}
@@ -191,7 +191,7 @@ void Controller::choose(not_null<ChatData*> chat) {
text.append("\n\n");
text.append(tr::lng_manage_discussion_group_warning(
tr::now,
Ui::Text::RichLangValue));
tr::rich));
const auto sure = [=](Fn<void()> &&close) {
close();
const auto done = [=](not_null<ChannelData*> chat) {
@@ -213,15 +213,15 @@ void Controller::choose(not_null<ChatData*> chat) {
if (!channel->isBroadcast()) {
return tr::lng_manage_linked_channel_about(
lt_channel,
rpl::single(Ui::Text::Bold(chat->name())),
Ui::Text::WithEntities);
rpl::single(tr::bold(chat->name())),
tr::marked);
} else if (chat != nullptr) {
return tr::lng_manage_discussion_group_about_chosen(
lt_group,
rpl::single(Ui::Text::Bold(chat->name())),
Ui::Text::WithEntities);
rpl::single(tr::bold(chat->name())),
tr::marked);
}
return tr::lng_manage_discussion_group_about(Ui::Text::WithEntities);
return tr::lng_manage_discussion_group_about(tr::marked);
}
[[nodiscard]] object_ptr<Ui::BoxContent> EditDiscussionLinkBox(
@@ -361,5 +361,5 @@ void ShowForumForDiscussionError(
navigation->showToast(
tr::lng_forum_topics_no_discussion(
tr::now,
Ui::Text::RichLangValue));
tr::rich));
}

View File

@@ -565,7 +565,7 @@ void EditForumTopicBox(
state->requestId = api->request(MTPmessages_EditForumTopic(
MTP_flags(Flag::f_title
| (topic->isGeneral() ? Flag() : Flag::f_icon_emoji_id)),
topic->peer()->input,
topic->peer()->input(),
MTP_int(rootId),
MTP_string(title->getLastText().trimmed()),
MTP_long(state->iconId.current()),

View File

@@ -65,7 +65,7 @@ namespace {
) | rpl::on_next([=](bool toggled) {
megagroup->session().api().request(
MTPchannels_ToggleParticipantsHidden(
megagroup->inputChannel,
megagroup->inputChannel(),
MTP_bool(toggled)
)
).done([=](const MTPUpdates &result) {

View File

@@ -301,11 +301,11 @@ void EditAdminBox::prepare() {
tr::lng_rights_about_by(
lt_user,
rpl::single(_by
? Ui::Text::Link(_by->name(), 1)
? tr::link(_by->name(), 1)
: TextWithEntities{ QString::fromUtf8("\U0001F47B") }),
lt_date,
rpl::single(TextWithEntities{ langDateTimeFull(parsed) }),
Ui::Text::WithEntities));
tr::marked));
if (_by) {
label->setLink(1, _by->createOpenLink());
}
@@ -465,8 +465,8 @@ void EditAdminBox::prepare() {
phrase(
tr::now,
lt_group,
Ui::Text::Bold(peer()->name()),
Ui::Text::WithEntities),
tr::bold(peer()->name()),
tr::marked),
crl::guard(this, [=] { finishAddAdmin(); })
}));
} else {
@@ -592,7 +592,7 @@ void EditAdminBox::transferOwnership() {
}
const auto channel = peer()->isChannel()
? peer()->asChannel()->inputChannel
? peer()->asChannel()->inputChannel()
: MTP_inputChannelEmpty();
const auto api = &peer()->session().api();
api->cloudPassword().reload();
@@ -611,10 +611,10 @@ void EditAdminBox::transferOwnership() {
.text = tr::lng_rights_transfer_about(
tr::now,
lt_group,
Ui::Text::Bold(peer()->name()),
tr::bold(peer()->name()),
lt_user,
Ui::Text::Bold(user()->shortName()),
Ui::Text::RichLangValue),
tr::bold(user()->shortName()),
tr::rich),
.confirmed = callback,
.confirmText = tr::lng_rights_transfer_sure(),
}));
@@ -627,8 +627,8 @@ bool EditAdminBox::handleTransferPasswordError(const QString &error) {
auto about = tr::lng_rights_transfer_check_about(
tr::now,
lt_user,
Ui::Text::Bold(user()->shortName()),
Ui::Text::WithEntities);
tr::bold(user()->shortName()),
tr::marked);
if (auto box = PrePasswordErrorBox(error, session, std::move(about))) {
getDelegate()->show(std::move(box));
return true;
@@ -680,8 +680,8 @@ void EditAdminBox::sendTransferRequestFrom(
const auto user = this->user();
const auto api = &channel->session().api();
_transferRequestId = api->request(MTPchannels_EditCreator(
channel->inputChannel,
user->inputUser,
channel->inputChannel(),
user->inputUser(),
result.result
)).done([=](const MTPUpdates &result) {
api->applyUpdates(result);
@@ -837,11 +837,11 @@ void EditRestrictedBox::prepare() {
: tr::lng_rights_chat_restricted_by)(
lt_user,
rpl::single(_by
? Ui::Text::Link(_by->name(), 1)
? tr::link(_by->name(), 1)
: TextWithEntities{ QString::fromUtf8("\U0001F47B") }),
lt_date,
rpl::single(TextWithEntities{ langDateTimeFull(parsed) }),
Ui::Text::WithEntities));
tr::marked));
if (_by) {
label->setLink(1, _by->createOpenLink());
}

View File

@@ -57,8 +57,8 @@ void RemoveAdmin(
Fn<void()> onFail) {
const auto newRights = MTP_chatAdminRights(MTP_flags(0));
channel->session().api().request(MTPchannels_EditAdmin(
channel->inputChannel,
user->inputUser,
channel->inputChannel(),
user->inputUser(),
newRights,
MTP_string(QString())
)).done([=](const MTPUpdates &result) {
@@ -81,8 +81,8 @@ void AddChatParticipant(
Fn<void()> onDone,
Fn<void()> onFail) {
chat->session().api().request(MTPmessages_AddChatUser(
chat->inputChat,
user->inputUser,
chat->inputChat(),
user->inputUser(),
MTP_int(kForwardMessagesOnAdd)
)).done([=](const MTPmessages_InvitedUsers &result) {
const auto &data = result.data();
@@ -111,8 +111,8 @@ void SaveChatAdmin(
Fn<void()> onFail,
bool retryOnNotParticipant = true) {
chat->session().api().request(MTPmessages_EditChatAdmin(
chat->inputChat,
user->inputUser,
chat->inputChat(),
user->inputUser(),
MTP_bool(isAdmin)
)).done([=] {
chat->applyEditAdmin(user, isAdmin);
@@ -150,8 +150,8 @@ void SaveChannelAdmin(
Fn<void()> onDone,
Fn<void()> onFail) {
channel->session().api().request(MTPchannels_EditAdmin(
channel->inputChannel,
user->inputUser,
channel->inputChannel(),
user->inputUser(),
AdminRightsToMTP(newRights),
MTP_string(rank)
)).done([=](const MTPUpdates &result) {
@@ -175,8 +175,8 @@ void SaveChatParticipantKick(
Fn<void()> onFail) {
chat->session().api().request(MTPmessages_DeleteChatUser(
MTP_flags(0),
chat->inputChat,
user->inputUser
chat->inputChat(),
user->inputUser()
)).done([=](const MTPUpdates &result) {
chat->session().api().applyUpdates(result);
if (onDone) {
@@ -1515,7 +1515,7 @@ void ParticipantsBoxController::loadMoreRows() {
const auto participantsHash = uint64(0);
_loadRequestId = _api.request(MTPchannels_GetParticipants(
channel->inputChannel,
channel->inputChannel(),
filter,
MTP_int(_offset),
MTP_int(perPage),
@@ -1686,11 +1686,11 @@ base::unique_qptr<Ui::PopupMenu> ParticipantsBoxController::rowContextMenu(
auto text = phrase(
tr::now,
lt_user,
Ui::Text::Bold(by->name()),
tr::bold(by->name()),
lt_date,
Ui::Text::Bold(
tr::bold(
langDateTimeFull(base::unixtime::parse(since))),
Ui::Text::WithEntities);
tr::marked);
auto button = base::make_unique_q<Ui::Menu::MultilineAction>(
result->menu(),
result->st().menu,
@@ -1902,6 +1902,9 @@ void ParticipantsBoxController::editRestrictedDone(
void ParticipantsBoxController::kickParticipant(not_null<PeerData*> participant) {
const auto user = participant->asUser();
if (user && user->isInaccessible()) {
return kickParticipantSure(participant);
}
const auto text = ((_peer->isChat() || _peer->isMegagroup())
? tr::lng_profile_sure_kick
: tr::lng_profile_sure_kick_channel)(
@@ -2128,7 +2131,12 @@ auto ParticipantsBoxController::computeType(
: (user && _additional.adminRights(user).has_value())
? Rights::Admin
: Rights::Normal;
result.adminRank = user ? _additional.adminRank(user) : QString();
result.canRemove = _additional.canRemoveParticipant(participant)
&& user
&& user->isInaccessible();
if (!result.canRemove) {
result.adminRank = user ? _additional.adminRank(user) : QString();
}
return result;
}
@@ -2209,7 +2217,7 @@ void ParticipantsBoxController::subscribeToCreatorChange(
const auto weak = base::make_weak(this);
const auto api = &channel->session().api();
api->request(MTPchannels_GetParticipants(
channel->inputChannel,
channel->inputChannel(),
MTP_channelParticipantsRecent(),
MTP_int(0), // offset
MTP_int(channel->session().serverConfig().chatSizeMax),
@@ -2356,7 +2364,7 @@ bool ParticipantsBoxSearchController::loadMoreRows() {
const auto participantsHash = uint64(0);
_requestId = _api.request(MTPchannels_GetParticipants(
_channel->inputChannel,
_channel->inputChannel(),
filter,
MTP_int(_offset),
MTP_int(perPage),

View File

@@ -436,7 +436,7 @@ void LevelBadge::updateText() {
tr::now,
lt_count,
_level,
Ui::Text::WithEntities));
tr::marked));
} else {
text.append(QString::number(_level));
}
@@ -602,7 +602,7 @@ void Set(
: Flag(0))
| Flag::f_background_emoji_id
| (values.forProfile ? Flag::f_for_profile : Flag(0))),
channel->inputChannel,
channel->inputChannel(),
MTP_int(values.colorIndex),
MTP_long(values.backgroundEmojiId)));
}
@@ -1126,7 +1126,7 @@ Fn<void()> AddColorGiftTabs(
auto tabs = std::vector<Ui::SubTabs::Tab>();
tabs.push_back({
.id = u"my"_q,
.text = tr::lng_gift_stars_tabs_my(tr::now, Ui::Text::WithEntities),
.text = tr::lng_gift_stars_tabs_my(tr::now, tr::marked),
});
for (const auto &gift : list) {
auto text = TextWithEntities();
@@ -1668,7 +1668,7 @@ void CreateBoostLevelContainer(
using namespace Ui::Text;
return Link(std::move(t), u"internal:"_q);
}),
Ui::Text::RichLangValue),
tr::rich),
style);
state->label->show();
boostLevelContainer->sizeValue(
@@ -2150,13 +2150,13 @@ void EditPeerColorSection(
tr::lng_gift_buy_resale_button(
lt_cost,
rpl::single(Data::FormatGiftResaleTon(*buy)),
Ui::Text::WithEntities),
tr::marked),
tr::lng_gift_buy_resale_equals(
lt_cost,
rpl::single(Ui::Text::IconEmoji(
&st::starIconEmojiSmall
).append(Lang::FormatCountDecimal(buy->starsForResale))),
Ui::Text::WithEntities),
tr::marked),
st::resaleButtonTitle,
st::resaleButtonSubtitle);
} else {
@@ -2164,7 +2164,7 @@ void EditPeerColorSection(
lt_cost,
rpl::single(Ui::Text::IconEmoji(&st::starIconEmoji).append(
Lang::FormatCountDecimal(buy->starsForResale))),
Ui::Text::WithEntities));
tr::marked));
}
}, button->lifetime());
}
@@ -2282,11 +2282,11 @@ void EditPeerProfileColorSection(
tr::lng_settings_color_profile_about_link(
lt_emoji,
rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)),
Ui::Text::RichLangValue
tr::rich
) | rpl::map([=](TextWithEntities t) {
return Ui::Text::Link(std::move(t), u"internal:"_q);
return tr::link(std::move(t), u"internal:"_q);
}),
Ui::Text::RichLangValue));
tr::rich));
Ui::AddSkip(container, st::settingsColorSampleSkip);
about->setClickHandlerFilter([=](auto...) {
aboutCallback();
@@ -2412,13 +2412,13 @@ void EditPeerProfileColorSection(
tr::lng_gift_buy_resale_button(
lt_cost,
rpl::single(Data::FormatGiftResaleTon(*buy)),
Ui::Text::WithEntities),
tr::marked),
tr::lng_gift_buy_resale_equals(
lt_cost,
rpl::single(Ui::Text::IconEmoji(
&st::starIconEmojiSmall
).append(Lang::FormatCountDecimal(buy->starsForResale))),
Ui::Text::WithEntities),
tr::marked),
st::resaleButtonTitle,
st::resaleButtonSubtitle);
} else {
@@ -2426,7 +2426,7 @@ void EditPeerProfileColorSection(
lt_cost,
rpl::single(Ui::Text::IconEmoji(&st::starIconEmoji).append(
Lang::FormatCountDecimal(buy->starsForResale))),
Ui::Text::WithEntities));
tr::marked));
}
}, button->lifetime());
}
@@ -2776,7 +2776,7 @@ void CheckBoostLevel(
Fn<std::optional<Ui::AskBoostReason>(int level)> askMore,
Fn<void()> cancel) {
peer->session().api().request(MTPpremium_GetBoostsStatus(
peer->input
peer->input()
)).done([=](const MTPpremium_BoostsStatus &result) {
const auto &data = result.data();
if (const auto channel = peer->asChannel()) {

View File

@@ -155,7 +155,7 @@ not_null<Ui::SettingsButton*> AddButtonWithText(
return AddButtonWithText(
parent,
std::move(text),
std::move(label) | Ui::Text::ToWithEntities(),
std::move(label) | rpl::map(tr::marked),
std::move(callback),
std::move(descriptor));
}
@@ -182,7 +182,7 @@ void SaveDefaultRestrictions(
const auto requestId = api->request(
MTPmessages_EditChatDefaultBannedRights(
peer->input,
peer->input(),
RestrictionsToMTP({ rights, 0 }))
).done([=](const MTPUpdates &result) {
api->clearModifyRequest(key);
@@ -214,7 +214,7 @@ void SaveSlowmodeSeconds(
const auto key = Api::RequestKey("slowmode_seconds", channel->id);
const auto requestId = api->request(MTPchannels_ToggleSlowMode(
channel->inputChannel,
channel->inputChannel(),
MTP_int(seconds)
)).done([=](const MTPUpdates &result) {
api->clearModifyRequest(key);
@@ -249,7 +249,7 @@ void SaveStarsPerMessage(
MTP_flags(broadcastAllowed
? Flag::f_broadcast_messages_allowed
: Flag(0)),
channel->inputChannel,
channel->inputChannel(),
MTP_long(starsPerMessage)
)).done([=](const MTPUpdates &result) {
api->clearModifyRequest(key);
@@ -284,7 +284,7 @@ void SaveBoostsUnrestrict(
const auto key = Api::RequestKey("boosts_unrestrict", channel->id);
const auto requestId = api->request(
MTPchannels_SetBoostsToUnblockRestrictions(
channel->inputChannel,
channel->inputChannel(),
MTP_int(boostsUnrestrict))
).done([=](const MTPUpdates &result) {
api->clearModifyRequest(key);
@@ -1098,9 +1098,9 @@ void Controller::fillDirectMessagesButton() {
auto label = _starsPerDirectMessageSavedValue->value(
) | rpl::map([](int starsPerMessage) {
return (starsPerMessage < 0)
? tr::lng_manage_monoforum_off(Ui::Text::WithEntities)
? tr::lng_manage_monoforum_off(tr::marked)
: !starsPerMessage
? tr::lng_manage_monoforum_free(Ui::Text::WithEntities)
? tr::lng_manage_monoforum_free(tr::marked)
: rpl::single(Ui::Text::IconEmoji(
&st::starIconEmojiColored
).append(' ').append(
@@ -1164,7 +1164,7 @@ void Controller::fillForumButton() {
tr::now,
lt_count,
EnableForumMinMembers(_peer),
Ui::Text::RichLangValue));
tr::rich));
}
} else {
_navigation->uiShow()->show(Box(
@@ -1323,8 +1323,8 @@ void Controller::fillSignaturesButton() {
_controls.buttonsLayout,
rpl::conditional(
signs->toggledValue(),
tr::lng_edit_sign_profiles_about(Ui::Text::WithEntities),
tr::lng_edit_sign_messages_about(Ui::Text::WithEntities)));
tr::lng_edit_sign_profiles_about(tr::marked),
tr::lng_edit_sign_messages_about(tr::marked)));
Ui::AddSkip(_controls.buttonsLayout);
}
@@ -1412,11 +1412,11 @@ void Controller::fillManageSection() {
container,
tr::lng_manage_peer_bot_about(
lt_bot,
rpl::single(Ui::Text::Link(
rpl::single(tr::link(
'@' + kBotManagerUsername.utf16(),
_peer->session().createInternalLinkFull(
kBotManagerUsername.utf16()))),
Ui::Text::RichLangValue),
tr::rich),
st::boxDividerLabel),
st::defaultBoxDividerLabelPadding));
fillBotVerifyAccounts();
@@ -1718,7 +1718,7 @@ void Controller::editReactions() {
}
_controls.levelRequested = true;
_api.request(MTPpremium_GetBoostsStatus(
_peer->input
_peer->input()
)).done([=](const MTPpremium_BoostsStatus &result) {
_controls.levelRequested = false;
if (const auto channel = _peer->asChannel()) {
@@ -2284,7 +2284,7 @@ void Controller::saveUsernamesOrder() {
}
if (_savingData.usernamesOrder->empty()) {
_api.request(MTPchannels_DeactivateAllUsernames(
channel->inputChannel
channel->inputChannel()
)).done([=] {
channel->setUsernames(channel->editableUsername().isEmpty()
? Data::Usernames()
@@ -2341,7 +2341,7 @@ void Controller::saveUsername() {
const auto newUsername = (*_savingData.username);
_api.request(MTPchannels_UpdateUsername(
channel->inputChannel,
channel->inputChannel(),
MTP_string(newUsername)
)).done([=] {
channel->setName(
@@ -2393,11 +2393,11 @@ void Controller::saveDiscussionLink() {
}
const auto input = *_savingData.discussionLink
? (*_savingData.discussionLink)->inputChannel
? (*_savingData.discussionLink)->inputChannel()
: MTP_inputChannelEmpty();
_api.request(MTPchannels_SetDiscussionGroup(
(channel->isBroadcast() ? channel->inputChannel : input),
(channel->isBroadcast() ? input : channel->inputChannel)
(channel->isBroadcast() ? channel->inputChannel() : input),
(channel->isBroadcast() ? input : channel->inputChannel())
)).done([=] {
channel->setDiscussionLink(*_savingData.discussionLink);
continueSave();
@@ -2462,14 +2462,14 @@ void Controller::saveTitle() {
if (const auto channel = _peer->asChannel()) {
_api.request(MTPchannels_EditTitle(
channel->inputChannel,
channel->inputChannel(),
MTP_string(*_savingData.title)
)).done(std::move(onDone)
).fail(std::move(onFail)
).send();
} else if (const auto chat = _peer->asChat()) {
_api.request(MTPmessages_EditChatTitle(
chat->inputChat,
chat->inputChat(),
MTP_string(*_savingData.title)
)).done(std::move(onDone)
).fail(std::move(onFail)
@@ -2477,7 +2477,7 @@ void Controller::saveTitle() {
} else if (_isBot) {
_api.request(MTPbots_GetBotInfo(
MTP_flags(MTPbots_GetBotInfo::Flag::f_bot),
_peer->asUser()->inputUser,
_peer->asUser()->inputUser(),
MTPstring() // Lang code.
)).done([=](const MTPbots_BotInfo &result) {
const auto was = qs(result.data().vname());
@@ -2488,7 +2488,7 @@ void Controller::saveTitle() {
using Flag = MTPbots_SetBotInfo::Flag;
_api.request(MTPbots_SetBotInfo(
MTP_flags(Flag::f_bot | Flag::f_name),
_peer->asUser()->inputUser,
_peer->asUser()->inputUser(),
MTPstring(), // Lang code.
MTP_string(now), // Name.
MTPstring(), // About.
@@ -2516,7 +2516,7 @@ void Controller::saveDescription() {
if (_isBot) {
_api.request(MTPbots_GetBotInfo(
MTP_flags(MTPbots_GetBotInfo::Flag::f_bot),
_peer->asUser()->inputUser,
_peer->asUser()->inputUser(),
MTPstring() // Lang code.
)).done([=](const MTPbots_BotInfo &result) {
const auto was = qs(result.data().vabout());
@@ -2527,7 +2527,7 @@ void Controller::saveDescription() {
using Flag = MTPbots_SetBotInfo::Flag;
_api.request(MTPbots_SetBotInfo(
MTP_flags(Flag::f_bot | Flag::f_about),
_peer->asUser()->inputUser,
_peer->asUser()->inputUser(),
MTPstring(), // Lang code.
MTPstring(), // Name.
MTP_string(now), // About.
@@ -2544,7 +2544,7 @@ void Controller::saveDescription() {
return;
}
_api.request(MTPmessages_EditChatAbout(
_peer->input,
_peer->input(),
MTP_string(*_savingData.description)
)).done([=] {
successCallback();
@@ -2620,7 +2620,7 @@ void Controller::togglePreHistoryHidden(
done();
};
_api.request(MTPchannels_TogglePreHistoryHidden(
channel->inputChannel,
channel->inputChannel(),
MTP_bool(hidden)
)).done([=](const MTPUpdates &result) {
channel->session().api().applyUpdates(result);
@@ -2658,7 +2658,7 @@ void Controller::saveForum() {
return;
}
_api.request(MTPchannels_ToggleForum(
channel->inputChannel,
channel->inputChannel(),
MTP_bool(*_savingData.forum),
MTP_bool(*_savingData.forum && *_savingData.forumTabs)
)).done([=](const MTPUpdates &result) {
@@ -2685,7 +2685,7 @@ void Controller::saveAutotranslate() {
return continueSave();
}
_api.request(MTPchannels_ToggleAutotranslation(
channel->inputChannel,
channel->inputChannel(),
MTP_bool(*_savingData.autotranslate)
)).done([=](const MTPUpdates &result) {
channel->session().api().applyUpdates(result);
@@ -2721,7 +2721,7 @@ void Controller::saveSignatures() {
| (*_savingData.signatureProfiles
? Flag::f_profiles_enabled
: Flag())),
channel->inputChannel
channel->inputChannel()
)).done([=](const MTPUpdates &result) {
channel->session().api().applyUpdates(result);
continueSave();
@@ -2741,7 +2741,7 @@ void Controller::saveForwards() {
return continueSave();
}
_api.request(MTPmessages_ToggleNoForwards(
_peer->input,
_peer->input(),
MTP_bool(*_savingData.noForwards)
)).done([=](const MTPUpdates &result) {
_peer->session().api().applyUpdates(result);
@@ -2764,7 +2764,7 @@ void Controller::saveJoinToWrite() {
return continueSave();
}
_api.request(MTPchannels_ToggleJoinToSend(
_peer->asChannel()->inputChannel,
_peer->asChannel()->inputChannel(),
MTP_bool(*_savingData.joinToWrite)
)).done([=](const MTPUpdates &result) {
_peer->session().api().applyUpdates(result);
@@ -2787,7 +2787,7 @@ void Controller::saveRequestToJoin() {
return continueSave();
}
_api.request(MTPchannels_ToggleJoinRequest(
_peer->asChannel()->inputChannel,
_peer->asChannel()->inputChannel(),
MTP_bool(*_savingData.requestToJoin)
)).done([=](const MTPUpdates &result) {
_peer->session().api().applyUpdates(result);
@@ -2847,7 +2847,7 @@ void Controller::deleteChannel() {
session->api().deleteConversation(chat, false);
}
session->api().request(MTPchannels_DeleteChannel(
channel->inputChannel
channel->inputChannel()
)).done([=](const MTPUpdates &result) {
session->api().applyUpdates(result);
//}).fail([=](const MTP::Error &error) {
@@ -2895,7 +2895,7 @@ object_ptr<Ui::SettingsButton> EditPeerInfoBox::CreateButton(
return CreateButton(
parent,
std::move(text),
std::move(count) | Ui::Text::ToWithEntities(),
std::move(count) | rpl::map(tr::marked),
std::move(callback),
st,
std::move(descriptor));

View File

@@ -73,6 +73,7 @@ constexpr auto kFirstPage = 20;
constexpr auto kPerPage = 100;
// constexpr auto kShareQrSize = 768;
// constexpr auto kShareQrPadding = 16;
constexpr auto kMaxShownJoined = 3;
using LinkData = Api::InviteLink;
@@ -739,14 +740,14 @@ void Controller::setupAboveJoinedWidget() {
TextWithEntities{ .text = QString(QChar(0x00D7)) },
lt_total,
{ QString::number(current.usage) },
Ui::Text::WithEntities)
tr::marked)
: tr::lng_group_invite_subscription_info_title_none(
tr::now,
lt_emoji,
_creditsEmoji,
lt_price,
{ QString::number(current.subscription.credits) },
Ui::Text::WithEntities),
tr::marked),
kMarkupTextOptions,
_emojiHelper.context([=] { widget->update(); }));
auto &lifetime = widget->lifetime();
@@ -902,11 +903,11 @@ void Controller::loadMoreRows() {
_requestId = _api.request(MTPmessages_GetChatInviteImporters(
MTP_flags(Flag::f_link
| (_role == Role::Requested ? Flag::f_requested : Flag(0))),
_peer->input,
_peer->input(),
MTP_string(_link),
MTPstring(), // q
MTP_int(_lastUser ? _lastUser->date : 0),
_lastUser ? _lastUser->user->inputUser : MTP_inputUserEmpty(),
_lastUser ? _lastUser->user->inputUser() : MTP_inputUserEmpty(),
MTP_int(_lastUser ? kPerPage : kFirstPage)
)).done([=](const MTPmessages_ChatInviteImporters &result) {
_requestId = 0;
@@ -997,7 +998,7 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
_creditsEmoji,
lt_cost,
{ QString::number(data.subscription.credits) },
Ui::Text::WithEntities),
tr::marked),
_emojiHelper.context());
const auto subtitle2 = box->addRow(
object_ptr<Ui::FlatLabel>(
@@ -1030,10 +1031,9 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
box,
tr::lng_credits_box_out_about(
lt_link,
tr::lng_payments_terms_link(
) | Ui::Text::ToLink(
tr::lng_credits_box_out_about_link(tr::now)),
Ui::Text::WithEntities),
tr::lng_payments_terms_link(tr::url(
tr::lng_credits_box_out_about_link(tr::now))),
tr::marked),
st::creditsBoxAboutDivider),
style::al_top);
@@ -1103,8 +1103,8 @@ void Controller::processRequest(
: tr::lng_group_requests_was_added)(
tr::now,
lt_user,
Ui::Text::Bold(user->name()),
Ui::Text::WithEntities));
tr::bold(user->name()),
tr::marked));
}
});
const auto fail = crl::guard(this, [=] {
@@ -1390,7 +1390,8 @@ void AddPermanentLinkBlock(
}) | rpl::flatten_latest(
) | rpl::on_next([=](const Api::JoinedByLinkSlice &slice) {
auto list = std::vector<HistoryView::UserpicInRow>();
list.reserve(slice.users.size());
const auto take = std::min(int(slice.users.size()), kMaxShownJoined);
list.reserve(take);
for (const auto &item : slice.users) {
const auto i = ranges::find(
state->list,
@@ -1401,6 +1402,9 @@ void AddPermanentLinkBlock(
} else {
list.push_back({ item.user });
}
if (list.size() == take) {
break;
}
}
state->count = slice.count;
state->list = std::move(list);

View File

@@ -803,7 +803,7 @@ void AdminsController::prepare() {
return;
}
_requestId = session().api().request(MTPmessages_GetAdminsWithInvites(
_peer->input
_peer->input()
)).done([=](const MTPmessages_ChatAdminsWithInvites &result) {
result.match([&](const MTPDmessages_chatAdminsWithInvites &data) {
auto &owner = _peer->owner();

View File

@@ -459,7 +459,7 @@ not_null<Ui::RpWidget*> AddInnerToggle(
rpl::empty_value()
) | rpl::map(countChecked)
) | rpl::map([=](const QString &t, int checked) {
auto count = Ui::Text::Bold(" "
auto count = tr::bold(" "
+ QString::number(checked)
+ '/'
+ QString::number(totalInnerChecks));
@@ -1273,7 +1273,7 @@ Fn<void()> AboutGigagroupCallback(
}
*converting = true;
channel->session().api().request(MTPchannels_ConvertToGigagroup(
channel->inputChannel
channel->inputChannel()
)).done([=](const MTPUpdates &result) {
channel->session().api().applyUpdates(result);
if (const auto strong = weak.get()) {
@@ -1295,7 +1295,7 @@ Fn<void()> AboutGigagroupCallback(
object_ptr<Ui::FlatLabel>(
box,
tr::lng_gigagroup_warning(
) | Ui::Text::ToRichLangValue(),
) | rpl::map(tr::rich),
st::infoAboutGigagroup));
box->addButton(tr::lng_gigagroup_convert_sure(), convertSure);
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });

View File

@@ -592,9 +592,8 @@ void AddReactionsText(
inner,
tr::lng_manage_peer_reactions_own(
lt_link,
tr::lng_manage_peer_reactions_own_link(
) | Ui::Text::ToLink(),
Ui::Text::WithEntities),
tr::lng_manage_peer_reactions_own_link(tr::link),
tr::marked),
st::boxDividerLabel));
const auto weak = base::make_weak(navigation);
label->setClickHandlerFilter([=](const auto &...) {
@@ -615,11 +614,11 @@ void AddReactionsText(
count->value() | tr::to_count(),
lt_same_count,
std::move(countString),
Ui::Text::RichLangValue),
tr::rich),
tr::lng_manage_peer_reactions_boost(
lt_link,
tr::lng_manage_peer_reactions_boost_link() | Ui::Text::ToLink(),
Ui::Text::RichLangValue)
tr::lng_manage_peer_reactions_boost_link(tr::link),
tr::rich)
) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) {
a.append(' ').append(std::move(b));
return std::move(a);
@@ -936,11 +935,11 @@ void EditAllowedReactionsBox(
tr::lng_manage_peer_reactions_paid_about(
lt_link,
tr::lng_manage_peer_reactions_paid_link([=](QString text) {
return Ui::Text::Link(
return tr::link(
text,
u"https://telegram.org/tos/stars"_q);
}),
Ui::Text::WithEntities));
tr::marked));
}
const auto collect = [=] {
auto result = AllowedReactions();
@@ -1011,7 +1010,7 @@ void SaveAllowedReactions(
MTP_flags(Flag()
| (maxCount ? Flag::f_reactions_limit : Flag())
| (editPaidEnabled ? Flag::f_paid_enabled : Flag())),
peer->input,
peer->input(),
updated,
MTP_int(maxCount),
MTP_bool(paidEnabled)

View File

@@ -362,11 +362,11 @@ void RequestsBoxController::loadMoreRows() {
using Flag = MTPmessages_GetChatInviteImporters::Flag;
_loadRequestId = _api.request(MTPmessages_GetChatInviteImporters(
MTP_flags(Flag::f_requested),
_peer->input,
_peer->input(),
MTPstring(), // link
MTPstring(), // q
MTP_int(_offsetDate),
_offsetUser ? _offsetUser->inputUser : MTP_inputUserEmpty(),
_offsetUser ? _offsetUser->inputUser() : MTP_inputUserEmpty(),
MTP_int(limit)
)).done([=](const MTPmessages_ChatInviteImporters &result) {
const auto firstLoad = !_offsetDate;
@@ -436,8 +436,8 @@ void RequestsBoxController::processRequest(
: tr::lng_group_requests_was_added)(
tr::now,
lt_user,
Ui::Text::Bold(user->name()),
Ui::Text::WithEntities));
tr::bold(user->name()),
tr::marked));
}
});
const auto fail = crl::guard(this, remove);
@@ -681,11 +681,11 @@ bool RequestsBoxSearchController::loadMoreRows() {
using Flag = MTPmessages_GetChatInviteImporters::Flag;
_requestId = _api.request(MTPmessages_GetChatInviteImporters(
MTP_flags(Flag::f_requested | Flag::f_q),
_peer->input,
_peer->input(),
MTPstring(), // link
MTP_string(_query),
MTP_int(_offsetDate),
_offsetUser ? _offsetUser->inputUser : MTP_inputUserEmpty(),
_offsetUser ? _offsetUser->inputUser() : MTP_inputUserEmpty(),
MTP_int(limit)
)).done([=](
const MTPmessages_ChatInviteImporters &result,

View File

@@ -553,7 +553,7 @@ void Controller::checkUsernameAvailability() {
const auto channel = _peer->migrateToOrMe()->asChannel();
const auto username = channel ? channel->editableUsername() : QString();
_checkUsernameRequestId = _api.request(MTPchannels_CheckUsername(
channel ? channel->inputChannel : MTP_inputChannelEmpty(),
channel ? channel->inputChannel() : MTP_inputChannelEmpty(),
MTP_string(checking)
)).done([=](const MTPBool &result) {
_checkUsernameRequestId = 0;

View File

@@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/boxes/confirm_box.h"
#include "ui/layers/show.h"
#include "ui/painter.h"
#include "ui/text/text_utilities.h" // Ui::Text::RichLangValue.
#include "ui/text/text_utilities.h" // tr::rich.
#include "ui/toast/toast.h"
#include "ui/ui_utility.h"
#include "ui/vertical_list.h"
@@ -335,7 +335,7 @@ void UsernamesList::rebuild(const Data::Usernames &usernames) {
tr::lng_usernames_activate_error(
lt_count,
rpl::single(kMaxUsernames),
Ui::Text::RichLangValue)));
tr::rich)));
}
if (error == Api::Usernames::Error::Flood) {
_show->showToast(

View File

@@ -751,7 +751,7 @@ void PeerShortInfoBox::prepareRows() {
const style::FlatLabel &textSt) {
auto line = CreateTextWithLabel(
_rows,
rpl::duplicate(label) | Ui::Text::ToWithEntities(),
rpl::duplicate(label) | rpl::map(tr::marked),
rpl::duplicate(text),
_st.label,
textSt,
@@ -801,7 +801,7 @@ void PeerShortInfoBox::prepareRows() {
tr::lng_context_copy_link(tr::now));
addInfoOneLine(
tr::lng_info_mobile_label(),
phoneValue() | Ui::Text::ToWithEntities(),
phoneValue() | rpl::map(tr::marked),
tr::lng_profile_copy_phone(tr::now));
auto label = _fields.current().isBio
? tr::lng_info_bio_label()
@@ -809,11 +809,11 @@ void PeerShortInfoBox::prepareRows() {
addInfoLine(std::move(label), aboutValue(), _st.labeled);
addInfoOneLine(
tr::lng_info_username_label(),
usernameValue() | Ui::Text::ToWithEntities(),
usernameValue() | rpl::map(tr::marked),
tr::lng_context_copy_mention(tr::now));
addInfoOneLine(
birthdayLabel(),
birthdayValue() | Ui::Text::ToWithEntities(),
birthdayValue() | rpl::map(tr::marked),
tr::lng_mediaview_copy(tr::now));
addInfoLine(
tr::lng_info_notes_label(),
@@ -881,14 +881,14 @@ rpl::producer<QString> PeerShortInfoBox::nameValue() const {
rpl::producer<TextWithEntities> PeerShortInfoBox::channelValue() const {
return _fields.value(
) | rpl::map([](const PeerShortInfoFields &fields) {
return Ui::Text::Link(fields.channelName, fields.channelLink);
return tr::link(fields.channelName, fields.channelLink);
}) | rpl::distinct_until_changed();
}
rpl::producer<TextWithEntities> PeerShortInfoBox::linkValue() const {
return _fields.value(
) | rpl::map([](const PeerShortInfoFields &fields) {
return Ui::Text::Link(fields.link, fields.link);
return tr::link(fields.link, fields.link);
}) | rpl::distinct_until_changed();
}

View File

@@ -217,13 +217,13 @@ void Controller::prepare() {
above.data(),
tr::lng_boost_reassign_text(
lt_channel,
rpl::single(Ui::Text::Bold(_to->name())),
rpl::single(tr::bold(_to->name())),
lt_gift,
tr::lng_boost_reassign_gift(
lt_count,
rpl::single(1. * BoostsForGift(session)),
Ui::Text::RichLangValue),
Ui::Text::RichLangValue),
tr::rich),
tr::rich),
st::boostReassignText),
st::boxRowPadding,
style::al_top);
@@ -278,7 +278,7 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
tr::now,
lt_count,
BoostsForGift(&session()),
Ui::Text::RichLangValue),
tr::rich),
.adaptive = true,
});
return;
@@ -331,14 +331,14 @@ object_ptr<Ui::BoxContent> ReassignBoostFloodBox(int seconds, bool group) {
? tr::lng_boost_error_flood_text_group
: tr::lng_boost_error_flood_text)(
lt_left,
rpl::single(Ui::Text::Bold((days > 1)
rpl::single(tr::bold((days > 1)
? tr::lng_days(tr::now, lt_count, days)
: (hours > 1)
? tr::lng_hours(tr::now, lt_count, hours)
: (minutes > 1)
? tr::lng_minutes(tr::now, lt_count, minutes)
: tr::lng_seconds(tr::now, lt_count, seconds))),
Ui::Text::RichLangValue),
tr::rich),
.title = tr::lng_boost_error_flood_title(),
});
}
@@ -362,10 +362,10 @@ object_ptr<Ui::BoxContent> ReassignBoostSingleBox(
Ui::ConfirmBox(box, {
.text = tr::lng_boost_now_instead(
lt_channel,
rpl::single(Ui::Text::Bold(peer->name())),
rpl::single(tr::bold(peer->name())),
lt_other,
rpl::single(Ui::Text::Bold(to->name())),
Ui::Text::WithEntities),
rpl::single(tr::bold(to->name())),
tr::marked),
.confirmed = confirmed,
.confirmText = tr::lng_boost_now_replace(),
.labelPadding = st::boxRowPadding,

View File

@@ -154,7 +154,7 @@ void ToggleTopicsBox(
.lottieMargins = st::settingsFilterIconPadding,
.showFinished = box->showFinishes(),
.about = tr::lng_edit_topics_about(
Ui::Text::RichLangValue
tr::rich
),
.aboutMargins = st::settingsFilterDividerLabelPadding,
});
@@ -205,7 +205,7 @@ void ToggleTopicsBox(
Ui::AddDividerText(
layout,
tr::lng_edit_topics_layout_about(Ui::Text::RichLangValue));
tr::lng_edit_topics_layout_about(tr::rich));
layoutWrap->toggle(enabled, anim::type::instant);
toggle->toggledChanges(

View File

@@ -58,8 +58,8 @@ void Setup(
MTP_flags(Flag::f_bot
| Flag::f_enabled
| (description.isEmpty() ? Flag() : Flag::f_custom_description)),
bot->inputUser,
peer->input,
bot->inputUser(),
peer->input(),
MTP_string(description)
)).done([=] {
done(QString());
@@ -74,8 +74,8 @@ void Remove(
Fn<void(QString)> done) {
bot->session().api().request(MTPbots_SetCustomVerification(
MTP_flags(MTPbots_SetCustomVerification::Flag::f_bot),
bot->inputUser,
peer->input,
bot->inputUser(),
peer->input(),
MTPstring()
)).done([=] {
done(QString());
@@ -138,8 +138,8 @@ void Controller::confirmAdd(not_null<PeerData*> peer) {
.text = PeerVerifyPhrases(peer).sent(
tr::now,
lt_name,
Ui::Text::Bold(peer->shortName()),
Ui::Text::WithEntities),
tr::bold(peer->shortName()),
tr::marked),
.duration = kSetupVerificationToastDuration,
});
} else {
@@ -153,8 +153,8 @@ void Controller::confirmAdd(not_null<PeerData*> peer) {
Ui::ConfirmBox(box, {
.text = phrases.text(
lt_name,
rpl::single(Ui::Text::Bold(peer->shortName())),
Ui::Text::WithEntities),
rpl::single(tr::bold(peer->shortName())),
tr::marked),
.confirmed = send,
.confirmText = phrases.submit(),
.title = phrases.title(),

View File

@@ -112,7 +112,7 @@ void PinMessageBox(
}
state->requestId = api->request(MTPmessages_UpdatePinnedMessage(
MTP_flags(flags),
peer->input,
peer->input(),
MTP_int(msgId)
)).done([=](const MTPUpdates &result) {
peer->session().api().applyUpdates(result);

View File

@@ -366,11 +366,11 @@ void PublicsController::rowRightActionClicked(not_null<PeerListRow*> row) {
}
*once = true;
peer->session().api().request(MTPchannels_UpdateUsername(
peer->asChannel()->inputChannel,
peer->asChannel()->inputChannel(),
MTP_string()
)).done([=] {
peer->session().api().request(MTPchannels_DeactivateAllUsernames(
peer->asChannel()->inputChannel
peer->asChannel()->inputChannel()
)).done([=] {
closeBox();
close();
@@ -517,13 +517,13 @@ void SimplePinsLimitBox(
tr::lng_filter_pin_limit1(
lt_count,
rpl::single(premium ? premiumLimit : defaultLimit),
Ui::Text::RichLangValue),
tr::rich),
((premium || !premiumPossible)
? rpl::single(TextWithEntities())
: tr::lng_filter_pin_limit2(
lt_count,
rpl::single(premiumLimit),
Ui::Text::RichLangValue))
tr::rich))
) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) {
return b.text.isEmpty()
? a
@@ -556,13 +556,13 @@ void ChannelsLimitBox(
tr::lng_channels_limit1(
lt_count,
rpl::single(current),
Ui::Text::RichLangValue),
tr::rich),
((premium || !premiumPossible)
? tr::lng_channels_limit2_final(Ui::Text::RichLangValue)
? tr::lng_channels_limit2_final(tr::rich)
: tr::lng_channels_limit2(
lt_count,
rpl::single(premiumLimit),
Ui::Text::RichLangValue))
tr::rich))
) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) {
return a.append(QChar(' ')).append(std::move(b));
});
@@ -646,13 +646,13 @@ void PublicLinksLimitBox(
tr::lng_links_limit1(
lt_count,
rpl::single(current),
Ui::Text::RichLangValue),
tr::rich),
((premium || !premiumPossible)
? tr::lng_links_limit2_final(Ui::Text::RichLangValue)
? tr::lng_links_limit2_final(tr::rich)
: tr::lng_links_limit2(
lt_count,
rpl::single(premiumLimit),
Ui::Text::RichLangValue))
tr::rich))
) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) {
return a.append(QChar(' ')).append(std::move(b));
});
@@ -714,13 +714,13 @@ void FilterChatsLimitBox(
: tr::lng_filter_chats_exlude_limit1)(
lt_count,
rpl::single(premium ? premiumLimit : defaultLimit),
Ui::Text::RichLangValue),
tr::rich),
((premium || !premiumPossible)
? rpl::single(TextWithEntities())
: tr::lng_filter_chats_limit2(
lt_count,
rpl::single(premiumLimit),
Ui::Text::RichLangValue))
tr::rich))
) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) {
return b.text.isEmpty()
? a
@@ -752,13 +752,13 @@ void FilterLinksLimitBox(
tr::lng_filter_links_limit1(
lt_count,
rpl::single(premium ? premiumLimit : defaultLimit),
Ui::Text::RichLangValue),
tr::rich),
((premium || !premiumPossible)
? rpl::single(TextWithEntities())
: tr::lng_filter_links_limit2(
lt_count,
rpl::single(premiumLimit),
Ui::Text::RichLangValue))
tr::rich))
) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) {
return b.text.isEmpty()
? a
@@ -801,13 +801,13 @@ void FiltersLimitBox(
tr::lng_filters_limit1(
lt_count,
rpl::single(premium ? premiumLimit : defaultLimit),
Ui::Text::RichLangValue),
tr::rich),
((premium || !premiumPossible)
? rpl::single(TextWithEntities())
: tr::lng_filters_limit2(
lt_count,
rpl::single(premiumLimit),
Ui::Text::RichLangValue))
tr::rich))
) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) {
return b.text.isEmpty()
? a
@@ -840,13 +840,13 @@ void ShareableFiltersLimitBox(
tr::lng_filter_shared_limit1(
lt_count,
rpl::single(premium ? premiumLimit : defaultLimit),
Ui::Text::RichLangValue),
tr::rich),
((premium || !premiumPossible)
? rpl::single(TextWithEntities())
: tr::lng_filter_shared_limit2(
lt_count,
rpl::single(premiumLimit),
Ui::Text::RichLangValue))
tr::rich))
) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) {
return b.text.isEmpty()
? a
@@ -929,7 +929,7 @@ void ForumPinsLimitBox(
auto text = tr::lng_forum_pin_limit(
lt_count,
rpl::single(current),
Ui::Text::RichLangValue);
tr::rich);
SimpleLimitBox(
box,
nullptr,
@@ -962,13 +962,13 @@ void CaptionLimitBox(
tr::lng_caption_limit1(
lt_count,
rpl::single(currentLimit),
Ui::Text::RichLangValue),
tr::rich),
(!premiumPossible
? rpl::single(TextWithEntities())
: tr::lng_caption_limit2(
lt_count,
rpl::single(premiumLimit),
Ui::Text::RichLangValue))
tr::rich))
) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) {
return b.text.isEmpty()
? a
@@ -1035,14 +1035,14 @@ void FileSizeLimitBox(
auto text = rpl::combine(
tr::lng_file_size_limit1(
lt_size,
rpl::single(Ui::Text::Bold(gb(showLimit))),
Ui::Text::RichLangValue),
rpl::single(tr::bold(gb(showLimit))),
tr::rich),
(!premiumPossible
? rpl::single(TextWithEntities())
: tr::lng_file_size_limit2(
lt_size,
rpl::single(Ui::Text::Bold(gb(premiumGb))),
Ui::Text::RichLangValue))
rpl::single(tr::bold(gb(premiumGb))),
tr::rich))
) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) {
return a.append(QChar(' ')).append(std::move(b));
});
@@ -1090,10 +1090,10 @@ void AccountsLimitBox(
tr::lng_accounts_limit1(
lt_count,
rpl::single<float64>(current),
Ui::Text::RichLangValue),
tr::rich),
((!premiumPossible || current > premiumLimit)
? rpl::single(TextWithEntities())
: tr::lng_accounts_limit2(Ui::Text::RichLangValue))
: tr::lng_accounts_limit2(tr::rich))
) | rpl::map([](TextWithEntities &&a, TextWithEntities &&b) {
return b.text.isEmpty()
? a

View File

@@ -913,7 +913,7 @@ void AddGiftsInfoRows(not_null<Ui::VerticalLayout*> container) {
raw->add(
object_ptr<Ui::FlatLabel>(
raw,
std::move(title) | Ui::Text::ToBold(),
std::move(title) | rpl::map(tr::bold),
st::defaultFlatLabel),
st::settingsPremiumRowTitlePadding);
raw->add(
@@ -1473,7 +1473,7 @@ void PremiumUnavailableBox(not_null<Ui::GenericBox*> box) {
Ui::ConfirmBox(box, {
.text = tr::lng_premium_unavailable(
tr::now,
Ui::Text::RichLangValue),
tr::rich),
.inform = true,
});
}
@@ -1492,7 +1492,7 @@ void DoubledLimitsPreviewBox(
tr::lng_premium_double_limits_about_channels(
lt_count,
rpl::single(float64(premium)),
Ui::Text::RichLangValue),
tr::rich),
limits.channelsDefault(),
premium,
});
@@ -1504,7 +1504,7 @@ void DoubledLimitsPreviewBox(
tr::lng_premium_double_limits_about_pins(
lt_count,
rpl::single(float64(premium)),
Ui::Text::RichLangValue),
tr::rich),
limits.dialogsPinnedDefault(),
premium,
});
@@ -1516,7 +1516,7 @@ void DoubledLimitsPreviewBox(
tr::lng_premium_double_limits_about_links(
lt_count,
rpl::single(float64(premium)),
Ui::Text::RichLangValue),
tr::rich),
limits.channelsPublicDefault(),
premium,
});
@@ -1528,7 +1528,7 @@ void DoubledLimitsPreviewBox(
tr::lng_premium_double_limits_about_gifs(
lt_count,
rpl::single(float64(premium)),
Ui::Text::RichLangValue),
tr::rich),
limits.gifsDefault(),
premium,
});
@@ -1540,7 +1540,7 @@ void DoubledLimitsPreviewBox(
tr::lng_premium_double_limits_about_stickers(
lt_count,
rpl::single(float64(premium)),
Ui::Text::RichLangValue),
tr::rich),
limits.stickersFavedDefault(),
premium,
});
@@ -1550,7 +1550,7 @@ void DoubledLimitsPreviewBox(
entries.push_back({
tr::lng_premium_double_limits_subtitle_bio(),
tr::lng_premium_double_limits_about_bio(
Ui::Text::RichLangValue),
tr::rich),
limits.aboutLengthDefault(),
premium,
});
@@ -1560,7 +1560,7 @@ void DoubledLimitsPreviewBox(
entries.push_back({
tr::lng_premium_double_limits_subtitle_captions(),
tr::lng_premium_double_limits_about_captions(
Ui::Text::RichLangValue),
tr::rich),
limits.captionLengthDefault(),
premium,
});
@@ -1572,7 +1572,7 @@ void DoubledLimitsPreviewBox(
tr::lng_premium_double_limits_about_folders(
lt_count,
rpl::single(float64(premium)),
Ui::Text::RichLangValue),
tr::rich),
limits.dialogFiltersDefault(),
premium,
});
@@ -1584,7 +1584,7 @@ void DoubledLimitsPreviewBox(
tr::lng_premium_double_limits_about_folder_chats(
lt_count,
rpl::single(float64(premium)),
Ui::Text::RichLangValue),
tr::rich),
limits.dialogFiltersChatsDefault(),
premium,
});
@@ -1598,7 +1598,7 @@ void DoubledLimitsPreviewBox(
tr::lng_premium_double_limits_about_accounts(
lt_count,
rpl::single(float64(Main::Domain::kPremiumMaxAccounts)),
Ui::Text::RichLangValue),
tr::rich),
Main::Domain::kMaxAccounts,
Main::Domain::kPremiumMaxAccounts,
till,
@@ -1610,7 +1610,7 @@ void DoubledLimitsPreviewBox(
tr::lng_premium_double_limits_about_similar_channels(
lt_count,
rpl::single(float64(premium)),
Ui::Text::RichLangValue),
tr::rich),
limits.similarChannelsDefault(),
premium,
});

View File

@@ -35,6 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/painter.h"
#include "ui/vertical_list.h"
#include "window/section_widget.h"
#include "window/themes/window_theme.h"
#include "window/window_session_controller.h"
#include "styles/style_boxes.h"
#include "styles/style_chat.h"
@@ -134,15 +135,19 @@ void AddMessage(
rightSize.height()).translated(st::settingsReactionCornerSkip);
};
using ThemePtr = std::unique_ptr<Ui::ChatTheme>;
const auto theme = widget->lifetime().make_state<ThemePtr>(
Window::Theme::DefaultChatThemeOn(widget->lifetime()));
widget->paintRequest(
) | rpl::on_next([=](const QRect &rect) {
Painter p(widget);
p.setClipRect(rect);
Window::SectionWidget::PaintBackground(
controller,
controller->defaultChatTheme().get(), // #TODO themes
widget,
p,
theme->get(),
QSize(widget->width(), widget->window()->height()),
rect);
Painter p(widget);
auto hq = PainterHighQualityEnabler(p);
const auto theme = controller->defaultChatTheme().get();
auto context = theme->preparePaintContext(
@@ -330,6 +335,8 @@ void AddReactionAnimatedIcon(
return true;
};
if (check(state->select) && check(state->appear)) {
state->select.icon->setCustomEndFrame(1);
state->select.icon->animate([] {});
state->loadingLifetime.destroy();
}
}, state->loadingLifetime);
@@ -353,6 +360,11 @@ void AddReactionAnimatedIcon(
}
if (appear && appear->animating()) {
paintFrame(appear);
if (appear->frameIndex() == appear->framesCount() - 1) {
if (const auto select = state->select.icon.get()) {
select->setCustomEndFrame(select->framesCount() - 1);
}
}
} else if (const auto select = state->select.icon.get()) {
paintFrame(select);
}

View File

@@ -53,7 +53,7 @@ void AddDeleteAccount(
fields.customTitle = tr::lng_settings_destroy_title();
fields.customDescription = tr::lng_context_mark_read_all_sure_2(
tr::now,
Ui::Text::RichLangValue).text;
tr::rich).text;
fields.customSubmitButton = tr::lng_theme_delete();
fields.customCheckCallback = [=](
const Core::CloudPasswordResult &result,

View File

@@ -109,9 +109,9 @@ void AddTerms(
tr::lng_paid_react_agree_link(),
tr::lng_group_invite_subscription_about_url()
) | rpl::map([](const QString &text, const QString &url) {
return Ui::Text::Link(text, url);
return tr::link(text, url);
}),
Ui::Text::RichLangValue),
tr::rich),
st::inviteLinkSubscribeBoxTerms);
const auto &buttonPadding = stBox.buttonPadding;
const auto style = box->lifetime().make_state<style::Box>(style::Box{
@@ -153,25 +153,25 @@ void AddTerms(
auto photosBold = tr::lng_credits_box_out_photos(
lt_count,
rpl::single(photos) | tr::to_count(),
Ui::Text::Bold);
tr::bold);
auto videosBold = tr::lng_credits_box_out_videos(
lt_count,
rpl::single(videos) | tr::to_count(),
Ui::Text::Bold);
tr::bold);
auto media = (!videos)
? ((photos > 1)
? std::move(photosBold)
: tr::lng_credits_box_out_photo(Ui::Text::WithEntities))
: tr::lng_credits_box_out_photo(tr::marked))
: (!photos)
? ((videos > 1)
? std::move(videosBold)
: tr::lng_credits_box_out_video(Ui::Text::WithEntities))
: tr::lng_credits_box_out_video(tr::marked))
: tr::lng_credits_box_out_both(
lt_photo,
std::move(photosBold),
lt_video,
std::move(videosBold),
Ui::Text::WithEntities);
tr::marked);
if (const auto user = data.peer->asUser()) {
return tr::lng_credits_box_out_media_user(
lt_count,
@@ -179,8 +179,8 @@ void AddTerms(
lt_media,
std::move(media),
lt_user,
rpl::single(Ui::Text::Bold(user->shortName())),
Ui::Text::RichLangValue);
rpl::single(tr::bold(user->shortName())),
tr::rich);
}
return tr::lng_credits_box_out_media(
lt_count,
@@ -188,8 +188,8 @@ void AddTerms(
lt_media,
std::move(media),
lt_chat,
rpl::single(Ui::Text::Bold(data.peer->name())),
Ui::Text::RichLangValue);
rpl::single(tr::bold(data.peer->name())),
tr::rich);
}
const auto bot = session->data().user(form->botId);
@@ -203,7 +203,7 @@ void AddTerms(
rpl::single(TextWithEntities{ form->title }),
lt_recipient,
rpl::single(TextWithEntities{ bot->name() }),
Ui::Text::RichLangValue);
tr::rich);
}
return tr::lng_credits_box_out_sure(
lt_count,
@@ -212,7 +212,7 @@ void AddTerms(
rpl::single(TextWithEntities{ form->title }),
lt_bot,
rpl::single(TextWithEntities{ bot->name() }),
Ui::Text::RichLangValue);
tr::rich);
}
[[nodiscard]] object_ptr<Ui::RpWidget> SendCreditsThumbnail(
@@ -455,7 +455,7 @@ void SendCreditsBox(
rpl::single(form->invoice.amount) | tr::to_count(),
lt_emoji,
rpl::single(CreditsEmojiSmall()),
Ui::Text::RichLangValue),
tr::rich),
state->confirmButtonBusy.value()
) | rpl::map([](TextWithEntities &&text, bool busy) {
return busy ? TextWithEntities() : std::move(text);

View File

@@ -158,8 +158,8 @@ void EditPriceBox(
box,
tr::lng_paid_about(
lt_link,
tr::lng_paid_about_link() | Ui::Text::ToLink(),
Ui::Text::WithEntities),
tr::lng_paid_about_link(tr::link),
tr::marked),
st::paidAmountAbout),
st::boxRowPadding + QMargins(0, st::sendMediaRowSkip, 0, 0));
about->setClickHandlerFilter([=](const auto &...) {
@@ -853,7 +853,7 @@ void SendFilesBox::refreshPriceTag() {
auto text = tr::lng_paid_price(
lt_price,
std::move(price),
Ui::Text::WithEntities);
tr::marked);
const auto label = Ui::CreateChild<Ui::FlatLabel>(
raw,
QString(),

View File

@@ -1781,13 +1781,13 @@ ShareBox::SubmitCallback ShareBox::DefaultForwardCallback(
threadHistory->sendRequestId = api.request(
MTPmessages_ForwardMessages(
MTP_flags(sendFlags),
history->peer->input,
history->peer->input(),
MTP_vector<MTPint>(mtpMsgIds),
MTP_vector<MTPlong>(generateRandom()),
peer->input,
peer->input(),
MTP_int(topMsgId),
(sublistPeer
? MTP_inputReplyToMonoForum(sublistPeer->input)
? MTP_inputReplyToMonoForum(sublistPeer->input())
: MTPInputReplyTo()),
MTP_int(options.scheduled),
MTP_int(options.scheduleRepeatPeriod),

View File

@@ -352,7 +352,7 @@ void PlaceAuctionBid(
| (passDetails ? Flag::f_peer : Flag())
| (passDetails ? Flag::f_message : Flag())
| (hideName ? Flag::f_hide_name : Flag())),
passDetails ? to->input : MTP_inputPeerEmpty(),
passDetails ? to->input() : MTP_inputPeerEmpty(),
MTP_long(state.gift->id),
MTP_long(amount),
MTP_textWithEntities(
@@ -1469,7 +1469,10 @@ void AuctionInfoBox(
st::boxRowPadding + st::uniqueGiftValueAvailableMargin,
style::al_top
)->setClickHandlerFilter([=](const auto &...) {
show->show(Box(StarGiftPreviewBox, window, *now.gift, list));
const auto title = now.gift->resellTitle;
const auto type = Data::GiftAttributeIdType::Model;
const auto null = nullptr;
show->show(Box(StarGiftPreviewBox, title, list, type, null));
return false;
});
}, box->lifetime());

View File

@@ -7,13 +7,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "boxes/star_gift_box.h"
#include "base/call_delayed.h"
#include "apiwrap.h"
#include "api/api_credits.h"
#include "api/api_global_privacy.h"
#include "api/api_premium.h"
#include "api/api_text_entities.h"
//#include "base/call_delayed.h"
#include "base/event_filter.h"
#include "base/qt_signal_producer.h"
#include "base/random.h"
@@ -36,6 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "chat_helpers/tabbed_panel.h"
#include "chat_helpers/tabbed_selector.h"
#include "core/application.h"
#include "core/click_handler_types.h"
#include "core/ui_integration.h"
#include "data/components/gift_auctions.h"
#include "data/components/promo_suggestions.h"
@@ -551,8 +551,8 @@ auto GenerateGiftMedia(
tr::lng_gift_released_by(
tr::now,
lt_name,
Ui::Text::Link('@' + by->username()),
Ui::Text::WithEntities),
tr::link('@' + by->username()),
tr::marked),
st::giftBoxReleasedByMargin,
st::uniqueGiftReleasedBy.style));
}
@@ -620,20 +620,20 @@ void ShowSentToast(
auto text = v::match(descriptor, [&](const GiftTypePremium &gift) {
return tr::lng_action_gift_premium_about(
tr::now,
Text::RichLangValue);
tr::rich);
}, [&](const GiftTypeStars &gift) {
if (gift.info.perUserTotal && gift.info.perUserRemains < 2) {
return tr::lng_gift_sent_finished(
tr::now,
lt_count,
gift.info.perUserTotal,
Text::RichLangValue);
tr::rich);
} else if (gift.info.perUserTotal) {
return tr::lng_gift_sent_remains(
tr::now,
lt_count,
gift.info.perUserRemains - 1,
Text::RichLangValue);
tr::rich);
}
const auto amount = gift.info.stars
+ (details.upgraded ? gift.info.starsToUpgrade : 0);
@@ -641,7 +641,7 @@ void ShowSentToast(
tr::now,
lt_count,
amount,
Text::RichLangValue);
tr::rich);
});
const auto strong = window->showToast({
.title = tr::lng_gift_sent_title(tr::now),
@@ -1301,7 +1301,12 @@ void SendGift(
const auto channel = (service && peerIsChannel(to))
? session->data().channel(peerToChannel(to)).get()
: nullptr;
const auto channelSavedId = data.vsaved_id().value_or_empty();
const auto channelSavedId = channel
? data.vsaved_id().value_or_empty()
: uint64();
const auto realGiftMsgId = (peerIsUser(to) && data.vsaved_id())
? MsgId(data.vsaved_id().value_or_empty())
: MsgId(message.vid().v);
result = std::make_shared<Data::GiftUpgradeResult>(
Data::GiftUpgradeResult{
@@ -1310,8 +1315,7 @@ void SendGift(
? Data::SavedStarGiftId::Chat(
channel,
channelSavedId)
: Data::SavedStarGiftId::User(
MsgId(message.vid().v)),
: Data::SavedStarGiftId::User(realGiftMsgId),
.date = message.vdate().v,
.starsForDetailsRemove = int(
data.vdrop_original_details_stars(
@@ -1344,8 +1348,8 @@ void ShowGiftUpgradedToast(
.text = tr::lng_gift_upgraded_about(
tr::now,
lt_name,
Text::Bold(Data::UniqueGiftName(*gift)),
Ui::Text::WithEntities),
tr::bold(Data::UniqueGiftName(*gift)),
tr::marked),
.duration = kUpgradeDoneToastDuration,
});
}
@@ -1471,7 +1475,7 @@ void GiftUpgrade(
RequestStarsFormAndSubmit(
window->uiShow(),
MTP_inputInvoiceStarGiftPrepaidUpgrade(
peer->input,
peer->input(),
MTP_string(giftPrepayUpgradeHash)),
std::move(formDone));
}
@@ -1520,7 +1524,7 @@ void AddUpgradeButton(
rpl::single(star.append(' '
+ Lang::FormatCreditsAmountDecimal(
CreditsAmount{ cost }))),
Text::WithEntities),
tr::marked),
st::boxLabel,
st::defaultPopupMenu,
helper.context());
@@ -1547,14 +1551,14 @@ void AddUpgradeButton(
lt_name,
rpl::single(TextWithEntities{ peer->name() }),
lt_link,
tr::lng_gift_send_unique_link() | Text::ToLink(),
Text::WithEntities)
tr::lng_gift_send_unique_link(tr::link),
tr::marked)
: tr::lng_gift_send_unique_about(
lt_user,
rpl::single(TextWithEntities{ peer->shortName() }),
lt_link,
tr::lng_gift_send_unique_link() | Text::ToLink(),
Text::WithEntities)));
tr::lng_gift_send_unique_link(tr::link),
tr::marked)));
about->setClickHandlerFilter([=](const auto &...) {
preview();
return false;
@@ -1816,7 +1820,7 @@ void CheckMaybeGiftLocked(
window->uiShow(),
MTP_inputInvoiceStarGiftTransfer(
Api::InputSavedStarGiftId(savedId, unique),
peer->input),
peer->input()),
formReady);
} else if (star && star->resale) {
const auto id = star->info.id;
@@ -1875,7 +1879,7 @@ void CheckMaybeGiftLocked(
tr::now,
lt_count,
star->info.perUserTotal,
Ui::Text::RichLangValue),
tr::rich),
});
} else {
send();
@@ -2188,10 +2192,10 @@ void GiftBox(
.subtitle = tr::lng_gift_premium_subtitle(),
.about = tr::lng_gift_premium_about(
lt_name,
rpl::single(Text::Bold(peer->shortName())),
rpl::single(tr::bold(peer->shortName())),
lt_features,
tr::lng_gift_premium_features() | Text::ToLink(),
Text::WithEntities),
tr::lng_gift_premium_features(tr::link),
tr::marked),
.aboutFilter = premiumClickHandlerFilter,
.content = MakePremiumGifts(window, peer),
});
@@ -2212,24 +2216,24 @@ void GiftBox(
? tr::lng_gift_channel_title()
: tr::lng_gift_stars_subtitle()),
.about = (peer->isSelf()
? tr::lng_gift_self_about(Text::WithEntities)
? tr::lng_gift_self_about(tr::marked)
: peer->isBroadcast()
? tr::lng_gift_channel_about(
lt_name,
rpl::single(Text::Bold(peer->name())),
Text::WithEntities)
rpl::single(tr::bold(peer->name())),
tr::marked)
: rpl::conditional(
collectibles->value(),
tr::lng_gift_stars_about_collectibles(
lt_link,
tr::lng_gift_stars_link() | Text::ToLink(),
Text::WithEntities),
tr::lng_gift_stars_link(tr::link),
tr::marked),
tr::lng_gift_stars_about(
lt_name,
rpl::single(Text::Bold(peer->shortName())),
rpl::single(tr::bold(peer->shortName())),
lt_link,
tr::lng_gift_stars_link() | Text::ToLink(),
Text::WithEntities))),
tr::lng_gift_stars_link(tr::link),
tr::marked))),
.aboutFilter = starsClickHandlerFilter,
.content = MakeStarsGifts(
window,
@@ -3915,6 +3919,107 @@ void AddWearGiftCover(
}, cover->lifetime());
}
void AttachGiftSenderBadge(
not_null<GenericBox*> box,
std::shared_ptr<ChatHelpers::Show> show,
not_null<PeerData*> from,
const QDateTime &date) {
const auto parent = box->getDelegate()->outerContainer();
const auto dateText = tr::bold(langDayOfMonth(date.date()));
const auto badge = CreateChild<FlatLabel>(
parent,
(from->isSelf()
? tr::lng_gift_unique_sender_you(
lt_date,
rpl::single(dateText),
tr::marked)
: tr::lng_gift_unique_sender(
lt_from,
rpl::single(tr::link(tr::bold(from->shortName()), 1)),
lt_date,
rpl::single(dateText),
tr::marked)),
st::uniqueGiftSenderBadge);
badge->paintOn([=](QPainter &p) {
auto hq = PainterHighQualityEnabler(p);
p.setBrush(st::radialBg);
p.setPen(Qt::NoPen);
const auto radius = badge->height() / 2.;
p.drawRoundedRect(badge->rect(), radius, radius);
});
badge->setLink(1, std::make_shared<LambdaClickHandler>([=] {
if (const auto window = show->resolveWindow()) {
window->showPeerHistory(from);
}
}));
auto widget = static_cast<QWidget*>(box);
while (widget->parentWidget() && widget->parentWidget() != parent) {
widget = widget->parentWidget();
}
const auto updateGeometry = [=] {
const auto outer = parent->rect();
const auto margin = st::msgServiceMargin;
const auto padding = st::msgServicePadding;
const auto available = outer.marginsRemoved(margin).width();
badge->resizeToWidth(std::min(
available - padding.left() - padding.right(),
badge->textMaxWidth()));
const auto inner = Ui::MapFrom(parent, box, box->rect());
const auto top = std::max(
inner.y() - badge->height() - margin.top(),
outer.y() + (margin.top() * 2));
const auto left = margin.left() + (available - badge->width()) / 2;
badge->move(left, top);
};
badge->naturalWidthValue(
) | rpl::on_next(updateGeometry, badge->lifetime());
for (auto w = static_cast<QWidget*>(box)
; w != widget
; w = w->parentWidget()) {
base::install_event_filter(w, [=](not_null<QEvent*> e) {
const auto type = e->type();
if (type == QEvent::Move || type == QEvent::Resize) {
PostponeCall(badge, updateGeometry);
}
return base::EventFilterResult::Continue;
});
}
base::install_event_filter(widget, [=](not_null<QEvent*> e) {
const auto type = e->type();
if (type == QEvent::Show) {
badge->show();
} else if (type == QEvent::Hide) {
badge->hide();
} else if (type == QEvent::Move || type == QEvent::Resize) {
PostponeCall(badge, updateGeometry);
} else if (type == QEvent::ZOrderChange) {
PostponeCall(badge, [=] { badge->raise(); });
}
return base::EventFilterResult::Continue;
});
badge->setVisible(!widget->isHidden());
base::install_event_filter(parent, [=](not_null<QEvent*> e) {
const auto type = e->type();
if (type == QEvent::ChildAdded) {
PostponeCall(badge, [=] { badge->raise(); });
} else if (e->type() == QEvent::Resize) {
PostponeCall(badge, updateGeometry);
}
return base::EventFilterResult::Continue;
});
badge->raise();
box->boxClosing() | rpl::on_next([=] {
delete badge;
}, badge->lifetime());
}
void ShowUniqueGiftWearBox(
std::shared_ptr<ChatHelpers::Show> show,
not_null<PeerData*> peer,
@@ -3941,7 +4046,7 @@ void ShowUniqueGiftWearBox(
raw->add(
object_ptr<Ui::FlatLabel>(
raw,
std::move(title) | Ui::Text::ToBold(),
std::move(title) | rpl::map(tr::bold),
st.infoTitle ? *st.infoTitle : st::defaultFlatLabel),
st::settingsPremiumRowTitlePadding);
raw->add(
@@ -4023,15 +4128,15 @@ void ShowUniqueGiftWearBox(
box->closeBox();
emojiStatuses->set(peer, id);
} else {
const auto link = Ui::Text::Bold(
const auto link = tr::bold(
tr::lng_send_as_premium_required_link(tr::now));
Settings::ShowPremiumPromoToast(
show,
tr::lng_gift_wear_subscribe(
tr::now,
lt_link,
Ui::Text::Link(link),
Ui::Text::WithEntities),
tr::link(link),
tr::marked),
u"wear_collectibles"_q);
}
});
@@ -4249,29 +4354,29 @@ void UniqueGiftSellBox(
tr::now,
lt_count,
nanoTonMin / float64(Ui::kNanosInOne),
Ui::Text::RichLangValue)
tr::rich)
: tr::lng_gift_sell_min_price(
tr::now,
lt_count,
starsMin,
Ui::Text::RichLangValue))
tr::rich))
: enough
? (value->ton()
? tr::lng_gift_sell_amount_ton(
tr::now,
lt_count,
receive,
Ui::Text::RichLangValue)
tr::rich)
: tr::lng_gift_sell_amount(
tr::now,
lt_count,
receive,
Ui::Text::RichLangValue))
tr::rich))
: tr::lng_gift_sell_about(
tr::now,
lt_percent,
TextWithEntities{ u"%1%"_q.arg(thousandths / 10.) },
Ui::Text::RichLangValue);
tr::rich);
});
const auto details = box->addRow(object_ptr<Ui::FlatLabel>(
box,
@@ -4298,7 +4403,7 @@ void UniqueGiftSellBox(
box->addRow(
object_ptr<Ui::FlatLabel>(
container,
tr::lng_gift_sell_only_ton_about(Ui::Text::RichLangValue),
tr::lng_gift_sell_only_ton_about(tr::rich),
st::boxDividerLabel));
Ui::AddSkip(container);
@@ -4352,7 +4457,7 @@ void SendOfferBuyGift(
using Flag = MTPpayments_SendStarGiftOffer::Flag;
show->session().api().request(MTPpayments_SendStarGiftOffer(
MTP_flags(starsPerMessage ? Flag::f_allow_paid_stars : Flag()),
owner->input,
owner->input(),
MTP_string(unique->slug),
StarsAmountToTL(options.price()),
MTP_int(options.offerDuration),
@@ -5085,7 +5190,7 @@ void UpgradeBox(
raw->add(
object_ptr<Ui::FlatLabel>(
raw,
std::move(title) | Ui::Text::ToBold(),
std::move(title) | rpl::map(tr::bold),
st::defaultFlatLabel),
st::settingsPremiumRowTitlePadding);
raw->add(
@@ -5314,7 +5419,7 @@ void UpgradeBox(
) | rpl::map([](int cost) {
if (!cost) {
return tr::lng_gift_upgrade_confirm(
Ui::Text::WithEntities);
tr::marked);
}
return tr::lng_gift_upgrade_button(
lt_price,
@@ -5322,7 +5427,7 @@ void UpgradeBox(
&st::starIconEmoji
).append(Lang::FormatCreditsAmountDecimal(
CreditsAmount{ cost }))),
Ui::Text::WithEntities);
tr::marked);
}) | rpl::flatten_latest();
};
auto subtext = state->cost->tillNextValue(
@@ -5363,7 +5468,7 @@ void UpgradeBox(
tr::lng_gift_upgrade_see_table(
lt_arrow,
rpl::single(Ui::Text::IconEmoji(&st::textMoreIconEmoji)),
[](QString text) { return Ui::Text::Link(text); }),
[](QString text) { return tr::link(text); }),
st::resalePriceTableLink);
link->setTryMakeSimilarLines(true);
button->geometryValue() | rpl::on_next([=](QRect geometry) {
@@ -5630,10 +5735,10 @@ void ShowGiftTransferredToast(
.text = tr::lng_gift_transferred_about(
tr::now,
lt_name,
Text::Bold(Data::UniqueGiftName(gift)),
tr::bold(Data::UniqueGiftName(gift)),
lt_recipient,
Text::Bold(to->shortName()),
Ui::Text::WithEntities),
tr::bold(to->shortName()),
tr::marked),
.duration = kUpgradeDoneToastDuration,
});
}
@@ -5875,7 +5980,7 @@ void SendGiftBox(
tr::lng_gift_send_pay_with_stars(
lt_amount,
rpl::single(base::duplicate(star).append(Lang::FormatCountDecimal(byStars))),
Ui::Text::WithEntities),
tr::marked),
st::settingsButtonNoIcon)
)->toggleOn(rpl::single(false))->toggledValue(
) | rpl::on_next([=](bool toggled) {
@@ -5895,9 +6000,8 @@ void SendGiftBox(
Lang::FormatCreditsAmountDecimal(amount));
}),
lt_link,
tr::lng_gift_send_stars_balance_link(
) | Ui::Text::ToLink(),
Ui::Text::WithEntities));
tr::lng_gift_send_stars_balance_link(tr::link),
tr::marked));
struct State {
Settings::BuyStarsHandler buyStars;
rpl::variable<bool> loading;
@@ -6027,7 +6131,7 @@ void SendGiftBox(
: tr::lng_gift_send_button)(
lt_cost,
std::move(cost),
Text::WithEntities),
tr::marked),
session,
st::creditsBoxButtonLabel,
&st::giftBox.button.textFg);

View File

@@ -94,6 +94,12 @@ void AddWearGiftCover(
const Data::UniqueGift &data,
not_null<PeerData*> peer);
void AttachGiftSenderBadge(
not_null<GenericBox*> box,
std::shared_ptr<ChatHelpers::Show> show,
not_null<PeerData*> from,
const QDateTime &date);
void ShowUniqueGiftWearBox(
std::shared_ptr<ChatHelpers::Show> show,
not_null<PeerData*> peer,

View File

@@ -24,7 +24,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/painter.h"
#include "ui/top_background_gradient.h"
#include "settings/settings_credits_graphics.h"
#include "window/window_session_controller.h"
#include "styles/style_credits.h"
#include "styles/style_layers.h"
@@ -199,9 +198,9 @@ public:
AttributesList(
QWidget *parent,
not_null<Delegate*> delegate,
not_null<Window::SessionController*> window,
not_null<const Data::UniqueGiftAttributes*> attributes,
rpl::producer<Tab> tab);
rpl::producer<Tab> tab,
Selection initialSelection);
[[nodiscard]] rpl::producer<Selection> selected() const;
@@ -233,7 +232,6 @@ private:
void clicked(int index);
const not_null<Delegate*> _delegate;
const not_null<Window::SessionController*> _window;
const not_null<const Data::UniqueGiftAttributes*> _attributes;
rpl::variable<Tab> _tab;
rpl::variable<Selection> _selected;
@@ -948,14 +946,14 @@ PatternEmoji Delegate::patternEmoji() {
AttributesList::AttributesList(
QWidget *parent,
not_null<Delegate*> delegate,
not_null<Window::SessionController*> window,
not_null<const Data::UniqueGiftAttributes*> attributes,
rpl::producer<Tab> tab)
rpl::producer<Tab> tab,
Selection initialSelection)
: BoxContentDivider(parent)
, _delegate(delegate)
, _window(window)
, _attributes(attributes)
, _tab(std::move(tab))
, _selected(initialSelection)
, _entries(&_models)
, _list(&_entries->list) {
_singleMin = _delegate->buttonSize();
@@ -1127,13 +1125,15 @@ void AttributesList::validateButtons() {
});
if (unused != end(_views)) {
views.push_back(base::take(*unused));
views.back().document = document;
views.back().button->setDescriptor(descriptor);
} else {
views.push_back({
.button = std::make_unique<AttributeButton>(
this,
_delegate,
descriptor)
descriptor),
.document = document,
});
views.back().button->show();
}
@@ -1239,9 +1239,10 @@ int AttributesList::resizeGetHeight(int width) {
void StarGiftPreviewBox(
not_null<GenericBox*> box,
not_null<Window::SessionController*> controller,
const Data::StarGift &gift,
const Data::UniqueGiftAttributes &attributes) {
const QString &title,
const Data::UniqueGiftAttributes &attributes,
Data::GiftAttributeIdType tab,
std::shared_ptr<Data::UniqueGift> selected) {
Expects(!attributes.models.empty());
Expects(!attributes.patterns.empty());
Expects(!attributes.backdrops.empty());
@@ -1251,16 +1252,38 @@ void StarGiftPreviewBox(
box->setNoContentMargin(true);
struct State {
State(QString title, const Data::UniqueGiftAttributes &attributes)
State(
QString title,
const Data::UniqueGiftAttributes &attributes,
Data::GiftAttributeIdType tab,
std::shared_ptr<Data::UniqueGift> selected)
: title(title)
, delegate([=] {
if (tab.current() != Tab::Model && list) {
if (this->tab.current() != Tab::Model && list) {
list->update();
}
})
, attributes(attributes)
, tab(tab)
, gift(make())
, pushNextTimer([=] { push(); }) {
apply(selected);
}
void apply(std::shared_ptr<Data::UniqueGift> selected) {
if (!selected) {
return;
}
const auto up = [&](auto &list, const auto &attribute) {
ranges::stable_partition(list, [&](const auto &existing) {
return IdFor(attribute) == IdFor(existing);
});
};
up(attributes.models, selected->model);
up(attributes.patterns, selected->pattern);
up(attributes.backdrops, selected->backdrop);
fixed = { 0, 0, 0 };
paused = true;
gift = make();
}
void randomize() {
@@ -1328,8 +1351,11 @@ void StarGiftPreviewBox(
base::Timer pushNextTimer;
};
const auto title = gift.resellTitle;
const auto state = box->lifetime().make_state<State>(title, attributes);
const auto state = box->lifetime().make_state<State>(
title,
attributes,
tab,
selected);
const auto repaintedHook = [=](
std::optional<Data::UniqueGift> now,
@@ -1338,8 +1364,9 @@ void StarGiftPreviewBox(
state->delegate.update(now, next, progress);
};
const auto container = box->verticalLayout();
AddUniqueGiftCover(container, state->gift.value(), {
const auto top = box->setPinnedToTopContent(
object_ptr<VerticalLayout>(box));
AddUniqueGiftCover(top, state->gift.value(), {
.subtitle = rpl::conditional(
state->paused.value(),
tr::lng_auction_preview_selected(tr::marked),
@@ -1347,14 +1374,16 @@ void StarGiftPreviewBox(
.attributesInfo = true,
.repaintedHook = repaintedHook,
});
AddUniqueCloseButton(box, {});
const auto container = box->verticalLayout();
state->list = container->add(object_ptr<AttributesList>(
box,
&state->delegate,
controller,
&state->attributes,
state->tab.value()));
state->tab.value(),
state->fixed));
state->list->selected(
) | rpl::on_next([=](Selection value) {
state->fixed = value;

View File

@@ -9,7 +9,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Data {
struct StarGift;
struct UniqueGift;
struct UniqueGiftAttributes;
enum class GiftAttributeIdType;
} // namespace Data
namespace Window {
@@ -22,8 +24,9 @@ class GenericBox;
void StarGiftPreviewBox(
not_null<GenericBox*> box,
not_null<Window::SessionController*> controller,
const Data::StarGift &gift,
const Data::UniqueGiftAttributes &attributes);
const QString &title,
const Data::UniqueGiftAttributes &attributes,
Data::GiftAttributeIdType tab,
std::shared_ptr<Data::UniqueGift> selected);
} // namespace Ui

View File

@@ -265,7 +265,7 @@ struct ResaleTabs {
const auto id = IdFor(entry.model);
const auto text = TextWithEntities{
entry.model.name
}.append(' ').append(Ui::Text::Bold(
}.append(' ').append(tr::bold(
Lang::FormatCountDecimal(entry.count)
));
actionWithDocument(text, [=] {
@@ -277,7 +277,7 @@ struct ResaleTabs {
const auto id = IdFor(entry.backdrop);
const auto text = TextWithEntities{
entry.backdrop.name
}.append(' ').append(Ui::Text::Bold(
}.append(' ').append(tr::bold(
Lang::FormatCountDecimal(entry.count)
));
actionWithColor(text, [=] {
@@ -289,7 +289,7 @@ struct ResaleTabs {
const auto id = IdFor(entry.pattern);
const auto text = TextWithEntities{
entry.pattern.name
}.append(' ').append(Ui::Text::Bold(
}.append(' ').append(tr::bold(
Lang::FormatCountDecimal(entry.count)
));
actionWithDocument(text, [=] {

View File

@@ -2087,9 +2087,9 @@ bool StickerSetBox::Inner::official() const {
rpl::producer<TextWithEntities> StickerSetBox::Inner::title() const {
if (!_loaded) {
return tr::lng_contacts_loading() | Ui::Text::ToWithEntities();
return tr::lng_contacts_loading(tr::marked);
} else if (_pack.isEmpty()) {
return tr::lng_attach_failed() | Ui::Text::ToWithEntities();
return tr::lng_attach_failed(tr::marked);
}
auto text = TextWithEntities{ _setTitle };
TextUtilities::ParseEntities(text, TextParseMentions);

View File

@@ -99,8 +99,8 @@ void ConfirmExportBox(
box,
tr::lng_gift_transfer_confirm_text(
lt_name,
rpl::single(Ui::Text::Bold(UniqueGiftName(*gift))),
Ui::Text::WithEntities),
rpl::single(tr::bold(UniqueGiftName(*gift))),
tr::marked),
st::boxLabel));
box->addButton(tr::lng_gift_transfer_confirm_button(), [=] {
confirmed([weak = base::make_weak(box)] {
@@ -468,7 +468,7 @@ void TransferGift(
// Like when we transfer a gift from Resale tab.
session->api().request(MTPpayments_TransferStarGift(
Api::InputSavedStarGiftId(savedId, gift),
to->input
to->input()
)).done([=](const MTPUpdates &result) {
session->api().applyUpdates(result);
formDone(Payments::CheckoutResult::Paid, &result);
@@ -492,7 +492,7 @@ void TransferGift(
window->uiShow(),
MTP_inputInvoiceStarGiftTransfer(
Api::InputSavedStarGiftId(savedId, gift),
to->input),
to->input()),
std::move(formDone));
}
}
@@ -541,7 +541,7 @@ void BuyResaleGift(
const auto invoice = MTP_inputInvoiceStarGiftResale(
MTP_flags((type == CreditsType::Ton) ? Flag::f_ton : Flag()),
MTP_string(gift->slug),
to->input);
to->input());
Ui::RequestOurForm(show, invoice, [=](
uint64 formId,
@@ -584,13 +584,13 @@ void BuyResaleGift(
tr::now,
lt_price,
Ui::Text::Wrapped(cost, EntityType::Bold),
Ui::Text::WithEntities),
tr::marked),
.confirmed = [=](Fn<void()> close) { close(); submit(); },
.cancelled = cancelled,
.confirmText = tr::lng_gift_buy_resale_button(
lt_cost,
rpl::single(cost),
Ui::Text::WithEntities),
tr::marked),
.title = tr::lng_gift_buy_price_change_title(),
}));
} else {
@@ -617,8 +617,8 @@ void ShowTransferToBox(
).append(Lang::FormatCreditsAmountDecimal(
CreditsAmount(stars)
))),
Ui::Text::WithEntities)
: tr::lng_gift_transfer_button(Ui::Text::WithEntities);
tr::marked)
: tr::lng_gift_transfer_button(tr::marked);
struct State {
bool sent = false;
@@ -659,21 +659,21 @@ void ShowTransferToBox(
.text = (stars > 0)
? tr::lng_gift_transfer_sure_for(
lt_name,
rpl::single(Ui::Text::Bold(UniqueGiftName(*gift))),
rpl::single(tr::bold(UniqueGiftName(*gift))),
lt_recipient,
rpl::single(Ui::Text::Bold(peer->shortName())),
rpl::single(tr::bold(peer->shortName())),
lt_price,
tr::lng_action_gift_for_stars(
lt_count,
rpl::single(stars * 1.),
Ui::Text::Bold),
Ui::Text::WithEntities)
tr::bold),
tr::marked)
: tr::lng_gift_transfer_sure(
lt_name,
rpl::single(Ui::Text::Bold(UniqueGiftName(*gift))),
rpl::single(tr::bold(UniqueGiftName(*gift))),
lt_recipient,
rpl::single(Ui::Text::Bold(peer->shortName())),
Ui::Text::WithEntities),
rpl::single(tr::bold(peer->shortName())),
tr::marked),
.confirmed = std::move(callback),
.confirmText = std::move(transfer),
});
@@ -922,7 +922,7 @@ void SendPeerThemeChangeRequest(
api->request(MTPmessages_SetChatWallPaper(
MTP_flags(0),
peer->input,
peer->input(),
MTPInputWallPaper(),
MTPWallPaperSettings(),
MTPint()
@@ -931,7 +931,7 @@ void SendPeerThemeChangeRequest(
}).send();
api->request(MTPmessages_SetChatTheme(
peer->input,
peer->input(),
(unique
? MTP_inputChatThemeUniqueGift(MTP_string(unique->slug))
: MTP_inputChatTheme(MTP_string(token)))
@@ -990,7 +990,7 @@ void ShowBuyResaleGiftBox(
object_ptr<Ui::FlatLabel>(
box,
tr::lng_gift_buy_resale_only_ton(
Ui::Text::RichLangValue),
tr::rich),
st::resaleConfirmTonOnly),
st::boxRowPadding + st::resaleConfirmTonOnlyMargin);
} else {
@@ -1009,13 +1009,13 @@ void ShowBuyResaleGiftBox(
u"stars"_q,
tr::lng_gift_buy_resale_pay_stars(
tr::now,
Ui::Text::WithEntities),
tr::marked),
},
{
u"ton"_q,
tr::lng_gift_buy_resale_pay_ton(
tr::now,
Ui::Text::WithEntities),
tr::marked),
},
}),
st::boxRowPadding + st::resaleConfirmTonOnlyMargin);
@@ -1031,7 +1031,7 @@ void ShowBuyResaleGiftBox(
rpl::single(ton
? Data::FormatGiftResaleTon(*gift)
: Data::FormatGiftResaleStars(*gift)),
Ui::Text::WithEntities);
tr::marked);
}) | rpl::flatten_latest();
auto callback = [=](Fn<void()> close) {
@@ -1063,28 +1063,28 @@ void ShowBuyResaleGiftBox(
lt_count_decimal,
rpl::single(gift->nanoTonForResale
/ float64(Ui::kNanosInOne)),
Ui::Text::Bold)
tr::bold)
: tr::lng_action_gift_for_stars(
lt_count_decimal,
rpl::single(gift->starsForResale * 1.),
Ui::Text::Bold);
tr::bold);
}) | rpl::flatten_latest();
Ui::ConfirmBox(box, {
.text = to->isSelf()
? tr::lng_gift_buy_resale_confirm_self(
lt_name,
rpl::single(Ui::Text::Bold(UniqueGiftName(*gift))),
rpl::single(tr::bold(UniqueGiftName(*gift))),
lt_price,
std::move(price),
Ui::Text::WithEntities)
tr::marked)
: tr::lng_gift_buy_resale_confirm(
lt_name,
rpl::single(Ui::Text::Bold(UniqueGiftName(*gift))),
rpl::single(tr::bold(UniqueGiftName(*gift))),
lt_price,
std::move(price),
lt_user,
rpl::single(Ui::Text::Bold(to->shortName())),
Ui::Text::WithEntities),
rpl::single(tr::bold(to->shortName())),
tr::marked),
.confirmed = std::move(callback),
.confirmText = std::move(transfer),
});

View File

@@ -228,7 +228,7 @@ void TranslateBox(
translated->hide(anim::type::instant);
state->api.request(MTPmessages_TranslateText(
MTP_flags(flags),
msgId ? peer->input : MTP_inputPeerEmpty(),
msgId ? peer->input() : MTP_inputPeerEmpty(),
(msgId
? MTP_vector<MTPint>(1, MTP_int(msgId))
: MTPVector<MTPint>()),
@@ -246,7 +246,7 @@ void TranslateBox(
const auto &list = data.vresult().v;
if (list.isEmpty()) {
showText(
Ui::Text::Italic(tr::lng_translate_box_error(tr::now)));
tr::italic(tr::lng_translate_box_error(tr::now)));
} else {
showText(Api::ParseTextWithEntities(
&peer->session(),
@@ -254,7 +254,7 @@ void TranslateBox(
}
}).fail([=](const MTP::Error &error) {
showText(
Ui::Text::Italic(tr::lng_translate_box_error(tr::now)));
tr::italic(tr::lng_translate_box_error(tr::now)));
}).send();
};
state->to.value() | rpl::on_next(send, box->lifetime());

View File

@@ -38,7 +38,7 @@ void UrlAuthBox::Activate(
return;
}
const auto session = &message->history()->session();
const auto inputPeer = message->history()->peer->input;
const auto inputPeer = message->history()->peer->input();
const auto buttonId = button->buttonId;
const auto url = QString::fromUtf8(button->data);
@@ -127,7 +127,7 @@ void UrlAuthBox::Request(
return;
}
const auto session = &message->history()->session();
const auto inputPeer = message->history()->peer->input;
const auto inputPeer = message->history()->peer->input();
const auto buttonId = button->buttonId;
const auto url = QString::fromUtf8(button->data);
@@ -276,16 +276,16 @@ not_null<Ui::RpWidget*> UrlAuthBox::setupContent(
tr::lng_url_auth_login_option(
tr::now,
lt_domain,
Ui::Text::Bold(domain),
tr::bold(domain),
lt_user,
Ui::Text::Bold(session->user()->name()),
Ui::Text::WithEntities));
tr::bold(session->user()->name()),
tr::marked));
const auto allow = bot
? addCheckbox(tr::lng_url_auth_allow_messages(
tr::now,
lt_bot,
Ui::Text::Bold(bot->firstName),
Ui::Text::WithEntities))
tr::bold(bot->firstName),
tr::marked))
: nullptr;
if (allow) {
rpl::single(

View File

@@ -333,20 +333,20 @@ void UsernamesBox(
auto description = [&]() -> rpl::producer<TextWithEntities> {
if (!isBot) {
return rpl::combine(
tr::lng_username_description1(Ui::Text::RichLangValue),
tr::lng_username_description2(Ui::Text::RichLangValue)
tr::lng_username_description1(tr::rich),
tr::lng_username_description2(tr::rich)
) | rpl::map([](TextWithEntities d1, TextWithEntities d2) {
return d1.append("\n\n").append(std::move(d2));
});
}
if (const auto url = AppConfig::FragmentLink(&peer->session())) {
const auto link = Ui::Text::Link(
const auto link = tr::link(
tr::lng_bot_username_description1_link(tr::now),
*url);
return tr::lng_bot_username_description1(
lt_link,
rpl::single(link),
Ui::Text::RichLangValue);
tr::rich);
}
return rpl::single<TextWithEntities>({});
}();
@@ -433,10 +433,10 @@ UsernameCheckInfo UsernameCheckInfo::PurchaseAvailable(
.text = tr::lng_username_purchase_available(
tr::now,
lt_link,
Ui::Text::Link(
tr::link(
tr::lng_username_purchase_available_link(tr::now),
(*fragmentLink) + u"/username/"_q + username),
Ui::Text::RichLangValue),
tr::rich),
};
} else {
return {

View File

@@ -783,7 +783,7 @@ void ClearCallsBox(
lt_count,
rpl::single(controller->session().appConfig().confcallSizeLimit()
* 1.),
Ui::Text::WithEntities));
tr::marked));
const auto icon = Ui::CreateChild<Info::Profile::FloatingIcon>(
result,

View File

@@ -349,7 +349,7 @@ void Call::startOutgoing() {
: MTPphone_RequestCall::Flag(0);
_api.request(MTPphone_RequestCall(
MTP_flags(flags),
_user->inputUser,
_user->inputUser(),
MTP_int(base::RandomValue<int32>()),
MTP_bytes(_gaHash),
MTP_phoneCallProtocol(

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