Compare commits
313 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1350fa64f3 | ||
|
|
70ba28bbd5 | ||
|
|
16649a9661 | ||
|
|
8eb6d2e36b | ||
|
|
8b580de47e | ||
|
|
5b1a9fb3e1 | ||
|
|
2a6e2fa353 | ||
|
|
16669402cf | ||
|
|
073c1a4d0f | ||
|
|
4c276e2357 | ||
|
|
889529718f | ||
|
|
acb092f9f2 | ||
|
|
9cd194e60e | ||
|
|
9c3173e4bb | ||
|
|
62b624c390 | ||
|
|
1ee9122660 | ||
|
|
6cb01998cc | ||
|
|
0e6c899cee | ||
|
|
09a6df1fdc | ||
|
|
43bdfbf170 | ||
|
|
bcfe4ac4a3 | ||
|
|
c67c53bcdf | ||
|
|
330c6a31a2 | ||
|
|
aa674a0ea5 | ||
|
|
e01910ac68 | ||
|
|
eac13b31f1 | ||
|
|
d4a2c4a151 | ||
|
|
8fc35e45e4 | ||
|
|
2931e754c3 | ||
|
|
4e7a5eeffb | ||
|
|
6fcafeff5b | ||
|
|
3165ef9f0b | ||
|
|
ec992ae552 | ||
|
|
f0a36d6460 | ||
|
|
ffb024a5f7 | ||
|
|
140dcb033b | ||
|
|
06d9d04787 | ||
|
|
a7c29991db | ||
|
|
e3d79d46f7 | ||
|
|
476a864be2 | ||
|
|
fc3810fd7f | ||
|
|
f5bff22bb8 | ||
|
|
157b4c43ee | ||
|
|
f2d2826fc7 | ||
|
|
cfa12fb0cc | ||
|
|
d9318c9935 | ||
|
|
5132fd5010 | ||
|
|
89879e355d | ||
|
|
278ab5ebaf | ||
|
|
39294a7fe1 | ||
|
|
7727cdff92 | ||
|
|
8bd0ff7925 | ||
|
|
4f948699c0 | ||
|
|
cd00d41cca | ||
|
|
749fb52113 | ||
|
|
4975254cc1 | ||
|
|
b36063e086 | ||
|
|
645ae69220 | ||
|
|
782c5c28a8 | ||
|
|
fba683be8e | ||
|
|
552d96df71 | ||
|
|
1043467eec | ||
|
|
9923cc9b31 | ||
|
|
47b32898f5 | ||
|
|
557a2e400e | ||
|
|
84400f5912 | ||
|
|
b28140c4b0 | ||
|
|
08321b8d8b | ||
|
|
bc340d75c4 | ||
|
|
cae18b3320 | ||
|
|
d81b2fbb69 | ||
|
|
02daa2a04b | ||
|
|
1363faddbf | ||
|
|
20a5950f99 | ||
|
|
40bdcd7ebc | ||
|
|
379736a7d1 | ||
|
|
d2234d88b6 | ||
|
|
c2fd4ccd59 | ||
|
|
26c79939e0 | ||
|
|
ffaeb239f0 | ||
|
|
7c8d3452b5 | ||
|
|
e2bca0a7ff | ||
|
|
2e8a03dfd1 | ||
|
|
a919978a37 | ||
|
|
20b5138e00 | ||
|
|
2523d6e8d8 | ||
|
|
03e90840de | ||
|
|
4ab34e3727 | ||
|
|
3129d9f0df | ||
|
|
2b6b1d7611 | ||
|
|
6e9493c725 | ||
|
|
746141a363 | ||
|
|
4942154a9c | ||
|
|
d511f2bb90 | ||
|
|
460b4b2de5 | ||
|
|
ab25cf214c | ||
|
|
b0203af398 | ||
|
|
c00f2f96ec | ||
|
|
2215500c9a | ||
|
|
5cc6275fc3 | ||
|
|
d4810713cb | ||
|
|
1877786707 | ||
|
|
06ec574543 | ||
|
|
f0955f2021 | ||
|
|
400d4b793a | ||
|
|
d6ba092697 | ||
|
|
9ef2f370ac | ||
|
|
234c74a439 | ||
|
|
88f1f8ff22 | ||
|
|
00ee31ce2d | ||
|
|
a5bd4ef6f7 | ||
|
|
c6c2a44e9d | ||
|
|
21b0454461 | ||
|
|
ca4b5edf21 | ||
|
|
9ac739c423 | ||
|
|
bd7a880468 | ||
|
|
807e63d9f2 | ||
|
|
4cedf89e51 | ||
|
|
a736ddb24e | ||
|
|
b48674d302 | ||
|
|
a6a9b16358 | ||
|
|
dfb40dd216 | ||
|
|
85acf051c1 | ||
|
|
86059f2b5e | ||
|
|
4f261ced8e | ||
|
|
feb6107ce6 | ||
|
|
eab41d272b | ||
|
|
38da0e086d | ||
|
|
f874876b00 | ||
|
|
2065616592 | ||
|
|
898edad09b | ||
|
|
49773dde72 | ||
|
|
fa6b4f9b52 | ||
|
|
fa4801ac94 | ||
|
|
9bb2bb09b9 | ||
|
|
e32031963b | ||
|
|
c13221a984 | ||
|
|
688cd70c91 | ||
|
|
a256eb4bc8 | ||
|
|
7d77e8a203 | ||
|
|
47709884dd | ||
|
|
7658d1da3c | ||
|
|
0a3077b9a5 | ||
|
|
e0513f7b7c | ||
|
|
7e7562fdad | ||
|
|
15aefddab4 | ||
|
|
e34b61d56b | ||
|
|
010b5e3949 | ||
|
|
5530df8f2d | ||
|
|
742b819c7e | ||
|
|
2618ee3d75 | ||
|
|
da281c4d3d | ||
|
|
2d07539892 | ||
|
|
923e725e18 | ||
|
|
b2d72e2541 | ||
|
|
7ed10eaacc | ||
|
|
5505a566be | ||
|
|
35c59ad35a | ||
|
|
5e81c65ea6 | ||
|
|
021e275336 | ||
|
|
e540b8cbdc | ||
|
|
ebf6cea2f5 | ||
|
|
a3c110dafa | ||
|
|
ad0c9ebb79 | ||
|
|
d5008fe7ac | ||
|
|
7c3814cdcd | ||
|
|
ed3f246510 | ||
|
|
d9a6d5f508 | ||
|
|
da6d580348 | ||
|
|
0ffa88d0f3 | ||
|
|
149d92d224 | ||
|
|
6f3d19914d | ||
|
|
fc759ac688 | ||
|
|
e03eaaaa98 | ||
|
|
857f56d5b4 | ||
|
|
638cf237c4 | ||
|
|
01b50a8460 | ||
|
|
b519b6bf4c | ||
|
|
b10bf0e12c | ||
|
|
4d43830c3b | ||
|
|
65ad8e6ac1 | ||
|
|
56cbde93da | ||
|
|
90ef0e4969 | ||
|
|
668a3308be | ||
|
|
ba83836922 | ||
|
|
14f937cb02 | ||
|
|
733cad798b | ||
|
|
8a6b3027f5 | ||
|
|
31db1804c8 | ||
|
|
f8c962712b | ||
|
|
a202174d12 | ||
|
|
3399397a76 | ||
|
|
c655f78780 | ||
|
|
73d8530c13 | ||
|
|
610c46e26f | ||
|
|
96805b62b2 | ||
|
|
4762c7a4fd | ||
|
|
0277d765bb | ||
|
|
20d4d00634 | ||
|
|
c5fa4aae62 | ||
|
|
f72092a261 | ||
|
|
33b266175d | ||
|
|
c9a98ae723 | ||
|
|
bd42c23999 | ||
|
|
f658cb7e99 | ||
|
|
fa26afaf9a | ||
|
|
b648387e96 | ||
|
|
8d2ebdbb99 | ||
|
|
a0d5456a4d | ||
|
|
c20ed7c7a8 | ||
|
|
ef543d040e | ||
|
|
27063167ae | ||
|
|
8a1118d9bb | ||
|
|
1e2e007d38 | ||
|
|
09124f6424 | ||
|
|
cece9cf09b | ||
|
|
60cc232884 | ||
|
|
ba8673af5e | ||
|
|
77772caabb | ||
|
|
e22bb40dd1 | ||
|
|
bd089f20a8 | ||
|
|
64bd4f0926 | ||
|
|
165d3143de | ||
|
|
21fd381778 | ||
|
|
285ce81b7b | ||
|
|
e7f85f7255 | ||
|
|
12d8d193a1 | ||
|
|
c18313614b | ||
|
|
f1092753fc | ||
|
|
5fc7caeec9 | ||
|
|
e20840b4d4 | ||
|
|
5f53dfda0e | ||
|
|
630e73fa23 | ||
|
|
92a9ba2ba0 | ||
|
|
4d4d75addf | ||
|
|
42fe80b5e2 | ||
|
|
96793179a3 | ||
|
|
fc19ce5a9b | ||
|
|
31fa6d24f4 | ||
|
|
7b005c64e0 | ||
|
|
82d68f5b98 | ||
|
|
2259f747f1 | ||
|
|
c793537d96 | ||
|
|
e568f7ab01 | ||
|
|
11b711c43f | ||
|
|
d1a81a83b4 | ||
|
|
42ca06d33c | ||
|
|
184ebc865c | ||
|
|
c8c3f43853 | ||
|
|
9105677325 | ||
|
|
7c2d3a8855 | ||
|
|
888306c017 | ||
|
|
6ff30c643a | ||
|
|
5f8fca0355 | ||
|
|
4933fbb74a | ||
|
|
51010e864c | ||
|
|
24ee944689 | ||
|
|
2c0a38d356 | ||
|
|
e05f570e1a | ||
|
|
2846b2f7a5 | ||
|
|
c126a1e56e | ||
|
|
f0f7318978 | ||
|
|
fede1ff173 | ||
|
|
94e4a8981f | ||
|
|
1e7117dd67 | ||
|
|
65ddbec794 | ||
|
|
8adec5fcfd | ||
|
|
f82089cbfe | ||
|
|
23d9ca896e | ||
|
|
5f3c957b1d | ||
|
|
b9181db407 | ||
|
|
be8d91055a | ||
|
|
df45294855 | ||
|
|
ef6d2b2c0b | ||
|
|
60839bb8ac | ||
|
|
228a48c8bf | ||
|
|
76a482317d | ||
|
|
01f28b4d52 | ||
|
|
655194c841 | ||
|
|
8fe48f3ca2 | ||
|
|
54f467eb47 | ||
|
|
3698396677 | ||
|
|
d2e1517e7a | ||
|
|
7733e3350d | ||
|
|
566128c3eb | ||
|
|
ab3d3a449b | ||
|
|
e9fd249c5a | ||
|
|
e7a3c5367a | ||
|
|
8bc807dc40 | ||
|
|
ceb7d5f238 | ||
|
|
84b3260f38 | ||
|
|
7a3452a18a | ||
|
|
05edf00d40 | ||
|
|
b67bfd0a8a | ||
|
|
90d2021f4d | ||
|
|
72ed3bfab9 | ||
|
|
d8743ec0e6 | ||
|
|
3a3341fef8 | ||
|
|
068eb3fcd1 | ||
|
|
75ee74ff1f | ||
|
|
dfb3346096 | ||
|
|
a098abefd7 | ||
|
|
f63984c9e3 | ||
|
|
9509c88ef9 | ||
|
|
819925fc72 | ||
|
|
cf4b869c27 | ||
|
|
5c43a541d7 | ||
|
|
68e0d155f9 | ||
|
|
8c1bef929e | ||
|
|
cde5e89e42 | ||
|
|
e0ddaf9da1 | ||
|
|
aa208fb7d0 | ||
|
|
b7cc2e9894 |
21
.github/stale.yml
vendored
@@ -1,21 +0,0 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 180
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 30
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels: [ "enhancement" ]
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: |
|
||||
Hey there!
|
||||
|
||||
This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.
|
||||
|
||||
Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.
|
||||
|
||||
Thanks!
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
||||
# Process only issues
|
||||
only: issues
|
||||
8
.github/workflows/docker.yml
vendored
@@ -25,16 +25,14 @@ jobs:
|
||||
submodules: recursive
|
||||
|
||||
- name: First set up.
|
||||
run: |
|
||||
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
|
||||
echo $HOME/.poetry/bin >> $GITHUB_PATH
|
||||
run: curl -sSL https://install.python-poetry.org | python3 -
|
||||
|
||||
- name: Docker image build.
|
||||
run: |
|
||||
cd Telegram/build/docker/centos_env
|
||||
poetry install
|
||||
DEBUG= poetry run gen_dockerfile | docker build -t $IMAGE_TAG -
|
||||
|
||||
DEBUG= poetry run gen_dockerfile | docker buildx build -t $IMAGE_TAG -
|
||||
|
||||
- name: Push the Docker image.
|
||||
if: ${{ github.ref_name == github.event.repository.default_branch }}
|
||||
run: |
|
||||
|
||||
1
.github/workflows/linux.yml
vendored
@@ -97,7 +97,6 @@ jobs:
|
||||
-D CMAKE_CXX_FLAGS="-Werror" \
|
||||
-D CMAKE_EXE_LINKER_FLAGS="-s" \
|
||||
-D TDESKTOP_API_TEST=ON \
|
||||
-D DESKTOP_APP_USE_PACKAGED=OFF \
|
||||
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF \
|
||||
$DEFINE
|
||||
|
||||
|
||||
3
.github/workflows/mac.yml
vendored
@@ -40,7 +40,7 @@ jobs:
|
||||
|
||||
macos:
|
||||
name: MacOS
|
||||
runs-on: macos-latest
|
||||
runs-on: macos-12
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -114,7 +114,6 @@ jobs:
|
||||
-D CMAKE_C_FLAGS="-Werror" \
|
||||
-D CMAKE_CXX_FLAGS="-Werror" \
|
||||
-D TDESKTOP_API_TEST=ON \
|
||||
-D DESKTOP_APP_USE_PACKAGED=OFF \
|
||||
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF \
|
||||
$DEFINE
|
||||
|
||||
|
||||
25
.github/workflows/stale.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
stale-issue-message: |
|
||||
Hey there!
|
||||
|
||||
This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.
|
||||
|
||||
Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.
|
||||
|
||||
Thanks!
|
||||
stale-issue-label: 'stale'
|
||||
exempt-issue-labels: 'enhancement'
|
||||
days-before-stale: 180
|
||||
days-before-close: 30
|
||||
days-before-pr-stale: -1
|
||||
operations-per-run: 1000
|
||||
16
.github/workflows/win.yml
vendored
@@ -79,23 +79,12 @@ jobs:
|
||||
submodules: recursive
|
||||
path: ${{ env.TBUILD }}\${{ env.REPO_NAME }}
|
||||
|
||||
- name: Choco installs.
|
||||
run: |
|
||||
choco install --no-progress -y nasm strawberryperl yasm jom ninja
|
||||
py -m pip install pywin32
|
||||
|
||||
- name: Install msys64.
|
||||
run: |
|
||||
mkdir %TBUILD%\ThirdParty
|
||||
xcopy /E /I C:\msys64 %TBUILD%\ThirdParty\msys64
|
||||
- name: Python installs.
|
||||
run: pip3 install --upgrade pywin32 six
|
||||
|
||||
- name: Set up environment paths.
|
||||
shell: bash
|
||||
run: |
|
||||
echo "C:\\Strawberry\\perl\\bin\\" >> $GITHUB_PATH
|
||||
echo "C:\\Program Files\\NASM\\" >> $GITHUB_PATH
|
||||
echo "C:\\ProgramData\\chocolatey\\lib\\ninja\\tools\\" >> $GITHUB_PATH
|
||||
|
||||
echo "CACHE_KEY=$(sha256sum $TBUILD/$REPO_NAME/$PREPARE_PATH | awk '{ print $1 }')" >> $GITHUB_ENV
|
||||
|
||||
echo "Configurate git for cherry-picks."
|
||||
@@ -149,7 +138,6 @@ jobs:
|
||||
call configure.bat ^
|
||||
${{ matrix.arch }} ^
|
||||
-D TDESKTOP_API_TEST=ON ^
|
||||
-D DESKTOP_APP_USE_PACKAGED=OFF ^
|
||||
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF ^
|
||||
-D DESKTOP_APP_NO_PDB=ON ^
|
||||
%TDESKTOP_BUILD_DEFINE% ^
|
||||
|
||||
4
.github/workflows/winget.yml
vendored
@@ -7,12 +7,12 @@ jobs:
|
||||
runs-on: windows-latest # action can only be run on windows
|
||||
steps:
|
||||
- if: github.event.action == 'released'
|
||||
uses: telegramdesktop/winget-releaser@latest
|
||||
uses: telegramdesktop/winget-releaser@main
|
||||
with:
|
||||
identifier: Telegram.TelegramDesktop
|
||||
token: ${{ secrets.WINGET_TOKEN }}
|
||||
- if: github.event.action == 'prereleased'
|
||||
uses: telegramdesktop/winget-releaser@latest
|
||||
uses: telegramdesktop/winget-releaser@main
|
||||
with:
|
||||
identifier: Telegram.TelegramDesktop.Beta
|
||||
token: ${{ secrets.WINGET_TOKEN }}
|
||||
|
||||
9
.gitmodules
vendored
@@ -79,9 +79,6 @@
|
||||
[submodule "Telegram/lib_webview"]
|
||||
path = Telegram/lib_webview
|
||||
url = https://github.com/desktop-app/lib_webview.git
|
||||
[submodule "Telegram/lib_waylandshells"]
|
||||
path = Telegram/lib_waylandshells
|
||||
url = https://github.com/desktop-app/lib_waylandshells.git
|
||||
[submodule "Telegram/ThirdParty/jemalloc"]
|
||||
path = Telegram/ThirdParty/jemalloc
|
||||
url = https://github.com/jemalloc/jemalloc
|
||||
@@ -94,3 +91,9 @@
|
||||
[submodule "Telegram/ThirdParty/wayland-protocols"]
|
||||
path = Telegram/ThirdParty/wayland-protocols
|
||||
url = https://github.com/gitlab-freedesktop-mirrors/wayland-protocols.git
|
||||
[submodule "Telegram/ThirdParty/kimageformats"]
|
||||
path = Telegram/ThirdParty/kimageformats
|
||||
url = https://github.com/KDE/kimageformats.git
|
||||
[submodule "Telegram/ThirdParty/kcoreaddons"]
|
||||
path = Telegram/ThirdParty/kcoreaddons
|
||||
url = https://github.com/KDE/kcoreaddons.git
|
||||
|
||||
@@ -38,6 +38,8 @@ get_filename_component(cmake_helpers_loc "cmake" REALPATH)
|
||||
|
||||
include(cmake/variables.cmake)
|
||||
include(cmake/nice_target_sources.cmake)
|
||||
include(cmake/target_compile_options_if_exists.cmake)
|
||||
include(cmake/target_link_options_if_exists.cmake)
|
||||
include(cmake/target_link_static_libraries.cmake)
|
||||
include(cmake/target_link_frameworks.cmake)
|
||||
include(cmake/init_target.cmake)
|
||||
@@ -48,6 +50,15 @@ include(cmake/target_prepare_qrc.cmake)
|
||||
|
||||
include(cmake/options.cmake)
|
||||
|
||||
if (NOT DESKTOP_APP_USE_PACKAGED)
|
||||
if (WIN32)
|
||||
set(qt_version 5.15.4)
|
||||
elseif (APPLE)
|
||||
set(qt_version 6.3.1)
|
||||
else()
|
||||
set(qt_version 6.4.0)
|
||||
endif()
|
||||
endif()
|
||||
include(cmake/external/qt/package.cmake)
|
||||
|
||||
set(desktop_app_skip_libs
|
||||
|
||||
@@ -18,9 +18,6 @@ endif()
|
||||
add_subdirectory(lib_storage)
|
||||
add_subdirectory(lib_lottie)
|
||||
add_subdirectory(lib_qr)
|
||||
if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
|
||||
add_subdirectory(lib_waylandshells)
|
||||
endif()
|
||||
add_subdirectory(lib_webrtc)
|
||||
add_subdirectory(lib_webview)
|
||||
add_subdirectory(codegen)
|
||||
@@ -82,9 +79,9 @@ PRIVATE
|
||||
desktop-app::lib_webview
|
||||
desktop-app::lib_ffmpeg
|
||||
desktop-app::lib_stripe
|
||||
desktop-app::external_lz4
|
||||
desktop-app::external_rlottie
|
||||
desktop-app::external_zlib
|
||||
desktop-app::external_kcoreaddons
|
||||
desktop-app::external_qt_static_plugins
|
||||
desktop-app::external_qt
|
||||
desktop-app::external_qr_code_generator
|
||||
@@ -139,6 +136,8 @@ PRIVATE
|
||||
api/api_polls.h
|
||||
api/api_premium.cpp
|
||||
api/api_premium.h
|
||||
api/api_premium_option.cpp
|
||||
api/api_premium_option.h
|
||||
api/api_report.cpp
|
||||
api/api_report.h
|
||||
api/api_ringtones.cpp
|
||||
@@ -464,6 +463,8 @@ PRIVATE
|
||||
data/data_download_manager.h
|
||||
data/data_drafts.cpp
|
||||
data/data_drafts.h
|
||||
data/data_emoji_statuses.cpp
|
||||
data/data_emoji_statuses.h
|
||||
data/data_folder.cpp
|
||||
data/data_folder.h
|
||||
data/data_file_click_handler.cpp
|
||||
@@ -487,6 +488,8 @@ PRIVATE
|
||||
data/data_media_types.h
|
||||
# data/data_messages.cpp
|
||||
# data/data_messages.h
|
||||
data/data_message_reaction_id.cpp
|
||||
data/data_message_reaction_id.h
|
||||
data/data_message_reactions.cpp
|
||||
data/data_message_reactions.h
|
||||
data/data_msg_id.h
|
||||
@@ -614,54 +617,69 @@ PRIVATE
|
||||
history/view/controls/history_view_voice_record_bar.h
|
||||
history/view/controls/history_view_voice_record_button.cpp
|
||||
history/view/controls/history_view_voice_record_button.h
|
||||
history/view/media/history_view_call.h
|
||||
history/view/media/history_view_call.cpp
|
||||
history/view/media/history_view_contact.h
|
||||
history/view/media/history_view_call.h
|
||||
history/view/media/history_view_contact.cpp
|
||||
history/view/media/history_view_custom_emoji.h
|
||||
history/view/media/history_view_contact.h
|
||||
history/view/media/history_view_custom_emoji.cpp
|
||||
history/view/media/history_view_dice.h
|
||||
history/view/media/history_view_custom_emoji.h
|
||||
history/view/media/history_view_dice.cpp
|
||||
history/view/media/history_view_document.h
|
||||
history/view/media/history_view_dice.h
|
||||
history/view/media/history_view_document.cpp
|
||||
history/view/media/history_view_file.h
|
||||
history/view/media/history_view_document.h
|
||||
history/view/media/history_view_extended_preview.cpp
|
||||
history/view/media/history_view_extended_preview.h
|
||||
history/view/media/history_view_file.cpp
|
||||
history/view/media/history_view_game.h
|
||||
history/view/media/history_view_file.h
|
||||
history/view/media/history_view_game.cpp
|
||||
history/view/media/history_view_gif.h
|
||||
history/view/media/history_view_game.h
|
||||
history/view/media/history_view_gif.cpp
|
||||
history/view/media/history_view_invoice.h
|
||||
history/view/media/history_view_gif.h
|
||||
history/view/media/history_view_invoice.cpp
|
||||
history/view/media/history_view_large_emoji.h
|
||||
history/view/media/history_view_invoice.h
|
||||
history/view/media/history_view_large_emoji.cpp
|
||||
history/view/media/history_view_location.h
|
||||
history/view/media/history_view_large_emoji.h
|
||||
history/view/media/history_view_location.cpp
|
||||
history/view/media/history_view_media.h
|
||||
history/view/media/history_view_location.h
|
||||
history/view/media/history_view_media.cpp
|
||||
history/view/media/history_view_media_common.h
|
||||
history/view/media/history_view_media.h
|
||||
history/view/media/history_view_media_common.cpp
|
||||
history/view/media/history_view_media_grouped.h
|
||||
history/view/media/history_view_media_common.h
|
||||
history/view/media/history_view_media_grouped.cpp
|
||||
history/view/media/history_view_media_unwrapped.h
|
||||
history/view/media/history_view_media_grouped.h
|
||||
history/view/media/history_view_media_unwrapped.cpp
|
||||
history/view/media/history_view_photo.h
|
||||
history/view/media/history_view_media_unwrapped.h
|
||||
history/view/media/history_view_photo.cpp
|
||||
history/view/media/history_view_poll.h
|
||||
history/view/media/history_view_photo.h
|
||||
history/view/media/history_view_poll.cpp
|
||||
history/view/media/history_view_service_media_gift.h
|
||||
history/view/media/history_view_poll.h
|
||||
history/view/media/history_view_service_media_gift.cpp
|
||||
history/view/media/history_view_slot_machine.h
|
||||
history/view/media/history_view_service_media_gift.h
|
||||
history/view/media/history_view_slot_machine.cpp
|
||||
history/view/media/history_view_sticker.h
|
||||
history/view/media/history_view_slot_machine.h
|
||||
history/view/media/history_view_sticker.cpp
|
||||
history/view/media/history_view_theme_document.h
|
||||
history/view/media/history_view_sticker.h
|
||||
history/view/media/history_view_sticker_player.cpp
|
||||
history/view/media/history_view_sticker_player.h
|
||||
history/view/media/history_view_sticker_player_abstract.h
|
||||
history/view/media/history_view_theme_document.cpp
|
||||
history/view/media/history_view_web_page.h
|
||||
history/view/media/history_view_theme_document.h
|
||||
history/view/media/history_view_web_page.cpp
|
||||
history/view/reactions/message_reactions_list.cpp
|
||||
history/view/reactions/message_reactions_list.h
|
||||
history/view/reactions/message_reactions_selector.cpp
|
||||
history/view/reactions/message_reactions_selector.h
|
||||
history/view/media/history_view_web_page.h
|
||||
history/view/reactions/history_view_reactions.cpp
|
||||
history/view/reactions/history_view_reactions.h
|
||||
history/view/reactions/history_view_reactions_animation.cpp
|
||||
history/view/reactions/history_view_reactions_animation.h
|
||||
history/view/reactions/history_view_reactions_button.cpp
|
||||
history/view/reactions/history_view_reactions_button.h
|
||||
history/view/reactions/history_view_reactions_list.cpp
|
||||
history/view/reactions/history_view_reactions_list.h
|
||||
history/view/reactions/history_view_reactions_selector.cpp
|
||||
history/view/reactions/history_view_reactions_selector.h
|
||||
history/view/reactions/history_view_reactions_strip.cpp
|
||||
history/view/reactions/history_view_reactions_strip.h
|
||||
history/view/reactions/history_view_reactions_tabs.cpp
|
||||
history/view/reactions/history_view_reactions_tabs.h
|
||||
history/view/history_view_bottom_info.cpp
|
||||
history/view/history_view_bottom_info.h
|
||||
history/view/history_view_contact_status.cpp
|
||||
@@ -692,12 +710,6 @@ PRIVATE
|
||||
history/view/history_view_pinned_tracker.h
|
||||
history/view/history_view_quick_action.cpp
|
||||
history/view/history_view_quick_action.h
|
||||
history/view/history_view_react_animation.cpp
|
||||
history/view/history_view_react_animation.h
|
||||
history/view/history_view_react_button.cpp
|
||||
history/view/history_view_react_button.h
|
||||
history/view/history_view_reactions.cpp
|
||||
history/view/history_view_reactions.h
|
||||
history/view/history_view_replies_section.cpp
|
||||
history/view/history_view_replies_section.h
|
||||
history/view/history_view_requests_bar.cpp
|
||||
@@ -797,8 +809,12 @@ PRIVATE
|
||||
info/polls/info_polls_results_widget.h
|
||||
info/profile/info_profile_actions.cpp
|
||||
info/profile/info_profile_actions.h
|
||||
info/profile/info_profile_badge.cpp
|
||||
info/profile/info_profile_badge.h
|
||||
info/profile/info_profile_cover.cpp
|
||||
info/profile/info_profile_cover.h
|
||||
info/profile/info_profile_emoji_status_panel.cpp
|
||||
info/profile/info_profile_emoji_status_panel.h
|
||||
info/profile/info_profile_icon.cpp
|
||||
info/profile/info_profile_icon.h
|
||||
info/profile/info_profile_inner_widget.cpp
|
||||
@@ -1452,18 +1468,13 @@ else()
|
||||
endif()
|
||||
|
||||
if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
|
||||
if (DESKTOP_APP_QT6)
|
||||
qt6_generate_wayland_protocol_client_sources(Telegram
|
||||
FILES
|
||||
${third_party_loc}/plasma-wayland-protocols/src/protocols/plasma-shell.xml
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "This piece of cmake code is not ported to Qt 5")
|
||||
endif()
|
||||
qt_generate_wayland_protocol_client_sources(Telegram
|
||||
FILES
|
||||
${third_party_loc}/plasma-wayland-protocols/src/protocols/plasma-shell.xml
|
||||
)
|
||||
|
||||
target_link_libraries(Telegram
|
||||
PRIVATE
|
||||
desktop-app::lib_waylandshells
|
||||
desktop-app::external_wayland_client
|
||||
)
|
||||
endif()
|
||||
|
||||
BIN
Telegram/Resources/icons/chat/reactions_bubble.png
Normal file
|
After Width: | Height: | Size: 331 B |
BIN
Telegram/Resources/icons/chat/reactions_bubble@2x.png
Normal file
|
After Width: | Height: | Size: 531 B |
BIN
Telegram/Resources/icons/chat/reactions_bubble@3x.png
Normal file
|
After Width: | Height: | Size: 772 B |
BIN
Telegram/Resources/icons/chat/reactions_bubble_shadow.png
Normal file
|
After Width: | Height: | Size: 496 B |
BIN
Telegram/Resources/icons/chat/reactions_bubble_shadow@2x.png
Normal file
|
After Width: | Height: | Size: 967 B |
BIN
Telegram/Resources/icons/chat/reactions_bubble_shadow@3x.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
Telegram/Resources/icons/chat/reactions_expand_panel.png
Normal file
|
After Width: | Height: | Size: 244 B |
BIN
Telegram/Resources/icons/chat/reactions_expand_panel@2x.png
Normal file
|
After Width: | Height: | Size: 337 B |
BIN
Telegram/Resources/icons/chat/reactions_expand_panel@3x.png
Normal file
|
After Width: | Height: | Size: 465 B |
BIN
Telegram/Resources/icons/chat/reactions_round_big.png
Normal file
|
After Width: | Height: | Size: 398 B |
BIN
Telegram/Resources/icons/chat/reactions_round_big@2x.png
Normal file
|
After Width: | Height: | Size: 691 B |
BIN
Telegram/Resources/icons/chat/reactions_round_big@3x.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
Telegram/Resources/icons/chat/reactions_round_small.png
Normal file
|
After Width: | Height: | Size: 359 B |
BIN
Telegram/Resources/icons/chat/reactions_round_small@2x.png
Normal file
|
After Width: | Height: | Size: 670 B |
BIN
Telegram/Resources/icons/chat/reactions_round_small@3x.png
Normal file
|
After Width: | Height: | Size: 947 B |
BIN
Telegram/Resources/icons/settings/premium/arrow.png
Normal file
|
After Width: | Height: | Size: 268 B |
BIN
Telegram/Resources/icons/settings/premium/arrow@2x.png
Normal file
|
After Width: | Height: | Size: 470 B |
BIN
Telegram/Resources/icons/settings/premium/arrow@3x.png
Normal file
|
After Width: | Height: | Size: 610 B |
BIN
Telegram/Resources/icons/settings/premium/status.png
Normal file
|
After Width: | Height: | Size: 497 B |
BIN
Telegram/Resources/icons/settings/premium/status@2x.png
Normal file
|
After Width: | Height: | Size: 787 B |
BIN
Telegram/Resources/icons/settings/premium/status@3x.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
@@ -1,9 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg version="1.1" viewBox="0 0 76 73" xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Star</title>
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<g transform="translate(-5 -5)" fill="#fff">
|
||||
<path d="m40.806 66.037-17.389 10.627c-1.5943 0.97436-3.6766 0.4718-4.651-1.1225-0.47558-0.77817-0.61685-1.7154-0.39178-2.5992l2.8114-11.039c0.91458-3.5913 3.3384-6.6111 6.6467-8.281l15.265-7.7056c0.84279-0.42542 1.1811-1.4535 0.7557-2.2963-0.3335-0.66067-1.0543-1.0317-1.7857-0.91925l-17.288 2.6578c-4.0448 0.62183-8.1617-0.52596-11.301-3.1508l-7.112-5.9459c-1.4335-1.1985-1.624-3.3321-0.42557-4.7656 0.58391-0.69842 1.4246-1.1321 2.3322-1.2029l20.357-1.5894c1.3848-0.10811 2.5919-0.98375 3.1246-2.2665l7.8535-18.913c0.71656-1.7256 2.6963-2.5436 4.4219-1.8271 0.82676 0.34331 1.4838 1.0003 1.8271 1.8271l7.8535 18.913c0.53267 1.2828 1.7398 2.1584 3.1246 2.2665l20.456 1.5971c1.8628 0.14544 3.255 1.7734 3.1096 3.6363-0.070088 0.89771-0.49515 1.7304-1.1811 2.3138l-15.589 13.259c-1.0616 0.90287-1.5248 2.3263-1.1979 3.681l4.7945 19.87c0.43827 1.8163-0.67888 3.6441-2.4952 4.0824-0.87218 0.21045-1.7922 0.065833-2.5578-0.40204l-17.515-10.704c-1.1827-0.72283-2.6706-0.72283-3.8533 0z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<svg width="84" height="81" viewBox="0 0 84 81" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(-190.000000, -73.000000)" fill="#fff"><defs>gradientPlaceholder</defs><path d="M217.584175 95.7198452l10.102137-20.1302773C228.851735 73.2672578 231.669488 72.3342655 233.979937 73.5056713 234.886993 73.9655512 235.620771 74.7092927 236.070698 75.6248193l9.540513 19.41335C246.390574 96.6240434 247.914247 97.7068442 249.661599 97.9165844L269.640156 100.314675C272.352386 100.640233 274.288515 103.114133 273.96462 105.840286 273.831224 106.963049 273.321003 108.006556 272.518147 108.798619l-15.7911 15.578821C256.089452 125.006464 255.780497 125.898568 255.89167 126.789576L258.515919 147.821772C258.891602 150.832711 256.767771 153.579675 253.772209 153.957287 252.636962 154.100393 251.485656 153.881854 250.480518 153.332463L233.796907 144.21349C232.589892 143.553757 231.136827 143.534799 229.913183 144.162822l-17.2854 8.871545C210.195073 154.282929 207.215982 153.312865 205.973797 150.867667 205.509027 149.952785 205.337643 148.915649 205.483212 147.898872L206.864713 138.249309C207.540411 133.529666 210.458736 129.435705 214.68762 127.274973L233.885915 117.465678C234.398537 117.203755 234.602854 116.57373 234.342269 116.058476 234.140381 115.659283 233.708181 115.433429 233.267119 115.496635l-23.479483 3.364749C206.198378 119.375746 202.558336 118.361996 199.744254 116.064306L191.92377 109.678904C189.692048 107.856709 189.352516 104.561073 191.165405 102.317895 192.008458 101.274743 193.218498 100.597614 194.544752 100.426837L214.594132 97.8451554C215.880032 97.679575 217.000319 96.8832795 217.584175 95.7198452z"/></g></g></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -17,6 +17,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_menu_night_mode" = "Night Mode";
|
||||
"lng_menu_add_account" = "Add Account";
|
||||
"lng_menu_activate" = "Activate";
|
||||
"lng_menu_set_status" = "Set Emoji Status";
|
||||
"lng_menu_change_status" = "Change Emoji Status";
|
||||
|
||||
"lng_disable_notifications_from_tray" = "Disable notifications";
|
||||
"lng_enable_notifications_from_tray" = "Enable notifications";
|
||||
@@ -267,7 +269,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_proxy_unsupported" = "Your Telegram Desktop version doesn't support this proxy type or the proxy link is invalid. Please update Telegram Desktop to the latest version.";
|
||||
|
||||
"lng_edit_deleted" = "This message was deleted";
|
||||
"lng_edit_too_long" = "Your message text is too long";
|
||||
"lng_edit_limit_reached#one" = "You've reached the message text limit. Please make the text shorter by {count} character.";
|
||||
"lng_edit_limit_reached#other" = "You've reached the message text limit. Please make the text shorter by {count} characters.";
|
||||
"lng_edit_message" = "Edit message";
|
||||
"lng_edit_message_text" = "New message text...";
|
||||
"lng_deleted" = "Deleted Account";
|
||||
@@ -511,6 +514,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_settings_send_cmdenter" = "Send by Cmd+Enter";
|
||||
"lng_settings_chat_quick_action_reply" = "Reply with double click";
|
||||
"lng_settings_chat_quick_action_react" = "Send reaction with double click";
|
||||
"lng_settings_chat_corner_reaction" = "Reaction button on messages";
|
||||
|
||||
"lng_settings_chat_reactions_title" = "Quick Reaction";
|
||||
"lng_settings_chat_reactions_subtitle" = "Choose your favorite reaction";
|
||||
@@ -1194,13 +1198,20 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_manage_peer_permissions" = "Permissions";
|
||||
"lng_manage_peer_invite_links" = "Invite links";
|
||||
"lng_manage_peer_reactions" = "Reactions";
|
||||
"lng_manage_peer_reactions_on" = "All";
|
||||
"lng_manage_peer_reactions_off" = "Off";
|
||||
"lng_manage_peer_requests" = "Member Requests";
|
||||
"lng_manage_peer_requests_channel" = "Subscriber Requests";
|
||||
|
||||
"lng_manage_peer_reactions_enable" = "Enable Reactions";
|
||||
"lng_manage_peer_reactions_about" = "Allow members to react to group messages.";
|
||||
"lng_manage_peer_reactions_about_channel" = "Allow subscribers to react to channel posts.";
|
||||
"lng_manage_peer_reactions_all" = "All reactions";
|
||||
"lng_manage_peer_reactions_all_about" = "Members of the group can use any emoji as reactions to messages.";
|
||||
"lng_manage_peer_reactions_some" = "Some reactions";
|
||||
"lng_manage_peer_reactions_some_about" = "You can select emoji that will allow members of your group to react to messages.";
|
||||
"lng_manage_peer_reactions_none" = "No reactions";
|
||||
"lng_manage_peer_reactions_none_about" = "Members of the group can't add any reactions to messages.";
|
||||
"lng_manage_peer_reactions_some_title" = "Only allow these reactions";
|
||||
"lng_manage_peer_reactions_available" = "Available reactions";
|
||||
|
||||
"lng_manage_peer_group_type" = "Group type";
|
||||
@@ -1700,6 +1711,22 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_premium_unlock_reactions" = "Unlock Premium Reactions";
|
||||
"lng_premium_unlock_stickers" = "Unlock Premium Stickers";
|
||||
"lng_premium_unlock_emoji" = "Unlock Animated Emoji";
|
||||
"lng_premium_unlock_status" = "Unlock Emoji Status";
|
||||
|
||||
"lng_premium_subscribe_months_12" = "Annual";
|
||||
"lng_premium_subscribe_months_6" = "Semiannual";
|
||||
"lng_premium_subscribe_months_1" = "Monthly";
|
||||
"lng_premium_subscribe_total" = "{cost} per year";
|
||||
"lng_premium_subscribe_button" = "Subscribe for {cost} per month";
|
||||
|
||||
"lng_premium_emoji_status_title" = "{user} set this emoji from {link} as their current status.";
|
||||
"lng_premium_emoji_status_title_colored" = "{user} set this emoji as their current status.";
|
||||
"lng_premium_emoji_status_about" = "Emoji status is a premium feature. Other features included in **Telegram Premium**:";
|
||||
"lng_premium_emoji_status_button" = "Unlock Emoji Status";
|
||||
|
||||
"lng_premium_summary_user_title" = "{user} is a subscriber of Telegram Premium.";
|
||||
"lng_premium_summary_user_about" = "Owners of Telegram Premium accounts have exclusive access to multiple additional features.";
|
||||
"lng_premium_summary_user_button" = "Learn More";
|
||||
|
||||
"lng_premium_summary_title" = "Telegram Premium";
|
||||
"lng_premium_summary_top_about" = "Go **beyond the limits**, get **exclusive features** and support us by subscribing to **Telegram Premium**.";
|
||||
@@ -1718,8 +1745,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_premium_summary_about_voice_to_text" = "Ability to read the transcript of any incoming voice message.";
|
||||
"lng_premium_summary_subtitle_no_ads" = "No Ads";
|
||||
"lng_premium_summary_about_no_ads" = "No more ads in public channels where Telegram sometimes shows ads.";
|
||||
"lng_premium_summary_subtitle_unique_reactions" = "Unique Reactions";
|
||||
"lng_premium_summary_about_unique_reactions" = "Additional animated reactions on messages available only to the Premium subscribers.";
|
||||
"lng_premium_summary_subtitle_emoji_status" = "Emoji Status";
|
||||
"lng_premium_summary_about_emoji_status" = "Add any of thousands emoji next to your name to display current activity.";
|
||||
"lng_premium_summary_subtitle_infinite_reactions" = "Infinite Reactions";
|
||||
"lng_premium_summary_about_infinite_reactions" = "React with thousands of emoji — with multiple reactions per message.";
|
||||
"lng_premium_summary_subtitle_premium_stickers" = "Premium Stickers";
|
||||
"lng_premium_summary_about_premium_stickers" = "Exclusive enlarged stickers featuring additional effects, updated monthly.";
|
||||
"lng_premium_summary_subtitle_animated_emoji" = "Animated Emoji";
|
||||
@@ -1789,6 +1818,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_accounts_limit1#other" = "You have reached the limit of **{count}** connected accounts.";
|
||||
"lng_accounts_limit2" = "You can free one space by subscribing to **Telegram Premium** with one of these connected accounts:";
|
||||
|
||||
"lng_emoji_status_for_title" = "Set Status for...";
|
||||
"lng_emoji_status_for_submit" = "Set Status";
|
||||
"lng_emoji_status_menu_duration_any" = "Set Status for {duration}";
|
||||
|
||||
"lng_group_about_header" = "You have created a group.";
|
||||
"lng_group_about_text" = "Groups can have:";
|
||||
"lng_group_about1" = "Up to 100,000 members";
|
||||
@@ -1884,6 +1917,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_new_contact_unarchive" = "Unarchive";
|
||||
"lng_new_contact_from_request_channel" = "{user} is an admin of {name}, a channel you requested to join.";
|
||||
"lng_new_contact_from_request_group" = "{user} is an admin of {name}, a group you requested to join.";
|
||||
"lng_new_contact_about_status" = "This account uses {emoji} as a custom status next to its\nname. Such emoji statuses are available to all\nsubscribers of {link}.";
|
||||
"lng_new_contact_about_status_link" = "Telegram Premium";
|
||||
"lng_from_request_title_channel" = "Chat with channel's admin";
|
||||
"lng_from_request_title_group" = "Chat with group's admin";
|
||||
"lng_from_request_body" = "You received this message because you requested to join {name} on {date}.";
|
||||
@@ -1913,6 +1948,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_send_anonymous_ph" = "Send anonymously...";
|
||||
"lng_send_as_title" = "Send message as...";
|
||||
"lng_send_as_anonymous_admin" = "Anonymous admin";
|
||||
"lng_send_as_premium_required" = "Subscribe to {link} to be able to comment on behalf of your channels in group chats.";
|
||||
"lng_send_as_premium_required_link" = "Telegram Premium";
|
||||
"lng_record_cancel" = "Release outside this field to cancel";
|
||||
"lng_record_lock_cancel_sure" = "Are you sure you want to stop recording and discard your voice message?";
|
||||
"lng_record_listen_cancel_sure" = "Are you sure you want to discard your recorded voice message?";
|
||||
@@ -2168,6 +2205,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_context_animated_emoji" = "This message contains emoji from **{name} pack**.";
|
||||
"lng_context_animated_emoji_many#one" = "This message contains emoji from **{count} pack**.";
|
||||
"lng_context_animated_emoji_many#other" = "This message contains emoji from **{count} packs**.";
|
||||
"lng_context_animated_reaction" = "This reaction is from **{name} pack**.";
|
||||
"lng_context_animated_reactions" = "Reactions contain emoji from **{name} pack**.";
|
||||
"lng_context_animated_reactions_many#one" = "Reactions contain emoji from **{count} pack**.";
|
||||
"lng_context_animated_reactions_many#other" = "Reactions contain emoji from **{count} packs**.";
|
||||
|
||||
"lng_downloads_section" = "Downloads";
|
||||
"lng_downloads_view_in_chat" = "View in chat";
|
||||
@@ -2783,6 +2824,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_slowmode_enabled"= "Slow mode is enabled. You can send your next message in {left}.";
|
||||
"lng_slowmode_no_many" = "Slow mode is enabled. You can't send more than one message at a time.";
|
||||
"lng_slowmode_too_long" = "Sorry, this text is too long to send as one message.\n\nSlow mode is enabled. You can't send more than one message at a time.";
|
||||
"lng_slowmode_seconds#one" = "{count} second";
|
||||
"lng_slowmode_seconds#other" = "{count} seconds";
|
||||
|
||||
"lng_rights_gigagroup_title" = "Broadcast group";
|
||||
"lng_rights_gigagroup_convert" = "Convert to Broadcast Group";
|
||||
@@ -2991,6 +3034,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_admin_log_messages_ttl_removed" = "{from} disabled messages auto-deletion after {duration}";
|
||||
"lng_admin_log_reactions_disabled" = "{from} disabled reactions";
|
||||
"lng_admin_log_reactions_updated" = "{from} updated the list of allowed reactions to: {emoji}";
|
||||
"lng_admin_log_reactions_allowed_all" = "{from} allowed all reactions";
|
||||
"lng_admin_log_reactions_allowed_official" = "{from} allowed all official reactions";
|
||||
"lng_admin_log_edited_invite_link" = "edited invite link {link}";
|
||||
"lng_admin_log_invite_link_expire_date" = "Expire date: {previous} -> {limit}";
|
||||
"lng_admin_log_invite_link_usage_limit" = "Usage limit: {previous} -> {limit}";
|
||||
|
||||
@@ -68,7 +68,7 @@ inputMediaVenue#c13d1c11 geo_point:InputGeoPoint title:string address:string pro
|
||||
inputMediaPhotoExternal#e5bbfe1a flags:# url:string ttl_seconds:flags.0?int = InputMedia;
|
||||
inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int = InputMedia;
|
||||
inputMediaGame#d33f43f3 id:InputGame = InputMedia;
|
||||
inputMediaInvoice#d9799874 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:flags.1?string = InputMedia;
|
||||
inputMediaInvoice#8eb5a6d5 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:flags.1?string extended_media:flags.2?InputMedia = InputMedia;
|
||||
inputMediaGeoLive#971fa843 flags:# stopped:flags.0?true geo_point:InputGeoPoint heading:flags.2?int period:flags.1?int proximity_notification_radius:flags.3?int = InputMedia;
|
||||
inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> = InputMedia;
|
||||
inputMediaDice#e66fbf7b emoticon:string = InputMedia;
|
||||
@@ -110,7 +110,7 @@ storage.fileMp4#b3cea0e4 = storage.FileType;
|
||||
storage.fileWebp#1081464c = storage.FileType;
|
||||
|
||||
userEmpty#d3bc4b7a id:long = User;
|
||||
user#3ff6ecb0 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
|
||||
user#5d99adee flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus = User;
|
||||
|
||||
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
|
||||
userProfilePhoto#82d1f706 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;
|
||||
@@ -128,8 +128,8 @@ chatForbidden#6592a1a7 id:long title:string = Chat;
|
||||
channel#8261ac61 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
|
||||
channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat;
|
||||
|
||||
chatFull#d18ee226 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector<long> available_reactions:flags.18?Vector<string> = ChatFull;
|
||||
channelFull#ea68a619 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?Vector<string> = ChatFull;
|
||||
chatFull#c9d31138 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector<long> available_reactions:flags.18?ChatReactions = ChatFull;
|
||||
channelFull#f2355507 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions = ChatFull;
|
||||
|
||||
chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant;
|
||||
chatParticipantCreator#e46bcee4 user_id:long = ChatParticipant;
|
||||
@@ -154,7 +154,7 @@ messageMediaDocument#9cb070d7 flags:# nopremium:flags.3?true document:flags.0?Do
|
||||
messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia;
|
||||
messageMediaVenue#2ec0533f geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string = MessageMedia;
|
||||
messageMediaGame#fdb19008 game:Game = MessageMedia;
|
||||
messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia;
|
||||
messageMediaInvoice#f6a548d3 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string extended_media:flags.4?MessageExtendedMedia = MessageMedia;
|
||||
messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int proximity_notification_radius:flags.1?int = MessageMedia;
|
||||
messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;
|
||||
messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia;
|
||||
@@ -324,7 +324,7 @@ updateChannelMessageViews#f226ac08 channel_id:long id:int views:int = Update;
|
||||
updateChatParticipantAdmin#d7ca61a2 chat_id:long user_id:long is_admin:Bool version:int = Update;
|
||||
updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update;
|
||||
updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true emojis:flags.1?true order:Vector<long> = Update;
|
||||
updateStickerSets#43ae3dec = Update;
|
||||
updateStickerSets#31c24808 flags:# masks:flags.0?true emojis:flags.1?true = Update;
|
||||
updateSavedGifs#9375341e = Update;
|
||||
updateBotInlineQuery#496f379c flags:# query_id:long user_id:long query:string geo:flags.0?GeoPoint peer_type:flags.1?InlineQueryPeerType offset:string = Update;
|
||||
updateBotInlineSend#12f12a07 flags:# user_id:long query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update;
|
||||
@@ -393,6 +393,11 @@ updateBotMenuButton#14b85813 bot_id:long button:BotMenuButton = Update;
|
||||
updateSavedRingtones#74d8be99 = Update;
|
||||
updateTranscribedAudio#84cd5a flags:# pending:flags.0?true peer:Peer msg_id:int transcription_id:long text:string = Update;
|
||||
updateReadFeaturedEmojiStickers#fb4c496c = Update;
|
||||
updateUserEmojiStatus#28373599 user_id:long emoji_status:EmojiStatus = Update;
|
||||
updateRecentEmojiStatuses#30f443db = Update;
|
||||
updateRecentReactions#6f7863f4 = Update;
|
||||
updateMoveStickerSetToTop#86fccf85 flags:# masks:flags.0?true emojis:flags.1?true stickerset:long = Update;
|
||||
updateMessageExtendedMedia#5a73a98c peer:Peer msg_id:int extended_media:MessageExtendedMedia = Update;
|
||||
|
||||
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
||||
|
||||
@@ -419,7 +424,7 @@ upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes
|
||||
|
||||
dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true this_port_only:flags.5?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption;
|
||||
|
||||
config#330b4067 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true force_try_ipv6:flags.14?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int = Config;
|
||||
config#232566ac flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true force_try_ipv6:flags.14?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector<DcOption> dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int reactions_default:flags.15?Reaction = Config;
|
||||
|
||||
nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
|
||||
|
||||
@@ -557,7 +562,7 @@ authorization#ad01d61d flags:# current:flags.0?true official_app:flags.1?true pa
|
||||
|
||||
account.authorizations#4bff8ea0 authorization_ttl_days:int authorizations:Vector<Authorization> = account.Authorizations;
|
||||
|
||||
account.password#185b184f flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes pending_reset_date:flags.5?int = account.Password;
|
||||
account.password#957b50fb flags:# has_recovery:flags.0?true has_secure_values:flags.1?true has_password:flags.2?true current_algo:flags.2?PasswordKdfAlgo srp_B:flags.2?bytes srp_id:flags.2?long hint:flags.3?string email_unconfirmed_pattern:flags.4?string new_algo:PasswordKdfAlgo new_secure_algo:SecurePasswordKdfAlgo secure_random:bytes pending_reset_date:flags.5?int login_email_pattern:flags.6?string = account.Password;
|
||||
|
||||
account.passwordSettings#9a5c33e5 flags:# email:flags.0?string secure_settings:flags.1?SecureSecretSettings = account.PasswordSettings;
|
||||
|
||||
@@ -581,6 +586,8 @@ inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;
|
||||
inputStickerSetDice#e67f520e emoticon:string = InputStickerSet;
|
||||
inputStickerSetAnimatedEmojiAnimations#cde3739 = InputStickerSet;
|
||||
inputStickerSetPremiumGifts#c88b3b02 = InputStickerSet;
|
||||
inputStickerSetEmojiGenericAnimations#4c4d4ce = InputStickerSet;
|
||||
inputStickerSetEmojiDefaultStatuses#29d0f5ee = InputStickerSet;
|
||||
|
||||
stickerSet#2dd14edc flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true videos:flags.6?true emojis:flags.7?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector<PhotoSize> thumb_dc_id:flags.4?int thumb_version:flags.4?int thumb_document_id:flags.8?long count:int hash:int = StickerSet;
|
||||
|
||||
@@ -716,6 +723,8 @@ auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType;
|
||||
auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType;
|
||||
auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType;
|
||||
auth.sentCodeTypeMissedCall#82006484 prefix:string length:int = auth.SentCodeType;
|
||||
auth.sentCodeTypeEmailCode#5a159841 flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true email_pattern:string length:int next_phone_login_date:flags.2?int = auth.SentCodeType;
|
||||
auth.sentCodeTypeSetUpEmailRequired#a5491dea flags:# apple_signin_allowed:flags.0?true google_signin_allowed:flags.1?true = auth.SentCodeType;
|
||||
|
||||
messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true native_ui:flags.4?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer;
|
||||
|
||||
@@ -942,7 +951,7 @@ channelAdminLogEventActionChangeHistoryTTL#6e941a38 prev_value:int new_value:int
|
||||
channelAdminLogEventActionParticipantJoinByRequest#afb6144a invite:ExportedChatInvite approved_by:long = ChannelAdminLogEventAction;
|
||||
channelAdminLogEventActionToggleNoForwards#cb2ac766 new_value:Bool = ChannelAdminLogEventAction;
|
||||
channelAdminLogEventActionSendMessage#278f2868 message:Message = ChannelAdminLogEventAction;
|
||||
channelAdminLogEventActionChangeAvailableReactions#9cf7f76a prev_value:Vector<string> new_value:Vector<string> = ChannelAdminLogEventAction;
|
||||
channelAdminLogEventActionChangeAvailableReactions#be4e0ef8 prev_value:ChatReactions new_value:ChatReactions = ChannelAdminLogEventAction;
|
||||
|
||||
channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent;
|
||||
|
||||
@@ -1319,7 +1328,7 @@ searchResultPosition#7f648b67 msg_id:int date:int offset:int = SearchResultsPosi
|
||||
|
||||
messages.searchResultsPositions#53b22baf count:int positions:Vector<SearchResultsPosition> = messages.SearchResultsPositions;
|
||||
|
||||
channels.sendAsPeers#8356cda9 peers:Vector<Peer> chats:Vector<Chat> users:Vector<User> = channels.SendAsPeers;
|
||||
channels.sendAsPeers#f496b0c6 peers:Vector<SendAsPeer> chats:Vector<Chat> users:Vector<User> = channels.SendAsPeers;
|
||||
|
||||
users.userFull#3b6d152e full_user:UserFull chats:Vector<Chat> users:Vector<User> = users.UserFull;
|
||||
|
||||
@@ -1327,7 +1336,7 @@ messages.peerSettings#6880b94d settings:PeerSettings chats:Vector<Chat> users:Ve
|
||||
|
||||
auth.loggedOut#c3a2835f flags:# future_auth_token:flags.0?bytes = auth.LoggedOut;
|
||||
|
||||
reactionCount#6fb250d1 flags:# chosen:flags.0?true reaction:string count:int = ReactionCount;
|
||||
reactionCount#a3d1cb80 flags:# chosen_order:flags.0?int reaction:Reaction count:int = ReactionCount;
|
||||
|
||||
messageReactions#4f2b9479 flags:# min:flags.0?true can_see_list:flags.2?true results:Vector<ReactionCount> recent_reactions:flags.1?Vector<MessagePeerReaction> = MessageReactions;
|
||||
|
||||
@@ -1341,7 +1350,7 @@ messages.availableReactions#768e3aad hash:int reactions:Vector<AvailableReaction
|
||||
messages.translateNoResult#67ca4737 = messages.TranslatedText;
|
||||
messages.translateResultText#a214f7d0 text:string = messages.TranslatedText;
|
||||
|
||||
messagePeerReaction#51b67eff flags:# big:flags.0?true unread:flags.1?true peer_id:Peer reaction:string = MessagePeerReaction;
|
||||
messagePeerReaction#b156fe9c flags:# big:flags.0?true unread:flags.1?true peer_id:Peer reaction:Reaction = MessagePeerReaction;
|
||||
|
||||
groupCallStreamChannel#80eb48af channel:int scale:int last_timestamp_ms:long = GroupCallStreamChannel;
|
||||
|
||||
@@ -1394,7 +1403,7 @@ payments.exportedInvoice#aed0cbd9 url:string = payments.ExportedInvoice;
|
||||
|
||||
messages.transcribedAudio#93752c52 flags:# pending:flags.0?true transcription_id:long text:string = messages.TranscribedAudio;
|
||||
|
||||
help.premiumPromo#8a4f3c29 status_text:string status_entities:Vector<MessageEntity> video_sections:Vector<string> videos:Vector<Document> currency:string monthly_amount:long users:Vector<User> = help.PremiumPromo;
|
||||
help.premiumPromo#5334759c status_text:string status_entities:Vector<MessageEntity> video_sections:Vector<string> videos:Vector<Document> period_options:Vector<PremiumSubscriptionOption> users:Vector<User> = help.PremiumPromo;
|
||||
|
||||
inputStorePaymentPremiumSubscription#a6751e66 flags:# restore:flags.0?true = InputStorePaymentPurpose;
|
||||
inputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:long = InputStorePaymentPurpose;
|
||||
@@ -1403,6 +1412,42 @@ premiumGiftOption#74c34319 flags:# months:int currency:string amount:long bot_ur
|
||||
|
||||
paymentFormMethod#88f8f21b url:string title:string = PaymentFormMethod;
|
||||
|
||||
emojiStatusEmpty#2de11aae = EmojiStatus;
|
||||
emojiStatus#929b619d document_id:long = EmojiStatus;
|
||||
emojiStatusUntil#fa30a8c7 document_id:long until:int = EmojiStatus;
|
||||
|
||||
account.emojiStatusesNotModified#d08ce645 = account.EmojiStatuses;
|
||||
account.emojiStatuses#90c467d1 hash:long statuses:Vector<EmojiStatus> = account.EmojiStatuses;
|
||||
|
||||
reactionEmpty#79f5d419 = Reaction;
|
||||
reactionEmoji#1b2286b8 emoticon:string = Reaction;
|
||||
reactionCustomEmoji#8935fc73 document_id:long = Reaction;
|
||||
|
||||
chatReactionsNone#eafc32bc = ChatReactions;
|
||||
chatReactionsAll#52928bca flags:# allow_custom:flags.0?true = ChatReactions;
|
||||
chatReactionsSome#661d4037 reactions:Vector<Reaction> = ChatReactions;
|
||||
|
||||
messages.reactionsNotModified#b06fdbdf = messages.Reactions;
|
||||
messages.reactions#eafdf716 hash:long reactions:Vector<Reaction> = messages.Reactions;
|
||||
|
||||
emailVerifyPurposeLoginSetup#4345be73 phone_number:string phone_code_hash:string = EmailVerifyPurpose;
|
||||
emailVerifyPurposeLoginChange#527d22eb = EmailVerifyPurpose;
|
||||
emailVerifyPurposePassport#bbf51685 = EmailVerifyPurpose;
|
||||
|
||||
emailVerificationCode#922e55a9 code:string = EmailVerification;
|
||||
emailVerificationGoogle#db909ec2 token:string = EmailVerification;
|
||||
emailVerificationApple#96d074fd token:string = EmailVerification;
|
||||
|
||||
account.emailVerified#2b96cd1b email:string = account.EmailVerified;
|
||||
account.emailVerifiedLogin#e1bb0d61 email:string sent_code:auth.SentCode = account.EmailVerified;
|
||||
|
||||
premiumSubscriptionOption#b6f11ebe flags:# current:flags.1?true can_purchase_upgrade:flags.2?true months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumSubscriptionOption;
|
||||
|
||||
sendAsPeer#b81c7034 flags:# premium_required:flags.0?true peer:Peer = SendAsPeer;
|
||||
|
||||
messageExtendedMediaPreview#ad628cc8 flags:# w:flags.0?int h:flags.0?int thumb:flags.1?PhotoSize video_duration:flags.2?int = MessageExtendedMedia;
|
||||
messageExtendedMedia#ee479c64 media:MessageMedia = MessageExtendedMedia;
|
||||
|
||||
---functions---
|
||||
|
||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||
@@ -1415,7 +1460,7 @@ invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X;
|
||||
|
||||
auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;
|
||||
auth.signUp#80eee427 phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization;
|
||||
auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization;
|
||||
auth.signIn#8d52a951 flags:# phone_number:string phone_code_hash:string phone_code:flags.0?string email_verification:flags.1?EmailVerification = auth.Authorization;
|
||||
auth.logOut#3e72ba19 = auth.LoggedOut;
|
||||
auth.resetAuthorizations#9fab0d1a = Bool;
|
||||
auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization;
|
||||
@@ -1471,8 +1516,8 @@ account.getAuthorizationForm#a929597a bot_id:long scope:string public_key:string
|
||||
account.acceptAuthorization#f3ed4c73 bot_id:long scope:string public_key:string value_hashes:Vector<SecureValueHash> credentials:SecureCredentialsEncrypted = Bool;
|
||||
account.sendVerifyPhoneCode#a5a356f9 phone_number:string settings:CodeSettings = auth.SentCode;
|
||||
account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool;
|
||||
account.sendVerifyEmailCode#7011509f email:string = account.SentEmailCode;
|
||||
account.verifyEmail#ecba39db email:string code:string = Bool;
|
||||
account.sendVerifyEmailCode#98e037bb purpose:EmailVerifyPurpose email:string = account.SentEmailCode;
|
||||
account.verifyEmail#32da4cf purpose:EmailVerifyPurpose verification:EmailVerification = account.EmailVerified;
|
||||
account.initTakeoutSession#8ef3eab0 flags:# contacts:flags.0?true message_users:flags.1?true message_chats:flags.2?true message_megagroups:flags.3?true message_channels:flags.4?true files:flags.5?true file_max_size:flags.5?long = account.Takeout;
|
||||
account.finishTakeoutSession#1d2652ee flags:# success:flags.0?true = Bool;
|
||||
account.confirmPasswordEmail#8fdf1920 code:string = Bool;
|
||||
@@ -1509,6 +1554,10 @@ account.changeAuthorizationSettings#40f48462 flags:# hash:long encrypted_request
|
||||
account.getSavedRingtones#e1902288 hash:long = account.SavedRingtones;
|
||||
account.saveRingtone#3dea5b03 id:InputDocument unsave:Bool = account.SavedRingtone;
|
||||
account.uploadRingtone#831a83a2 file:InputFile file_name:string mime_type:string = Document;
|
||||
account.updateEmojiStatus#fbd3de6b emoji_status:EmojiStatus = Bool;
|
||||
account.getDefaultEmojiStatuses#d6753386 hash:long = account.EmojiStatuses;
|
||||
account.getRecentEmojiStatuses#f578105 hash:long = account.EmojiStatuses;
|
||||
account.clearRecentEmojiStatuses#18201aae = Bool;
|
||||
|
||||
users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
|
||||
users.getFullUser#b60f5918 id:InputUser = users.UserFull;
|
||||
@@ -1545,8 +1594,8 @@ messages.deleteHistory#b08f922a flags:# just_clear:flags.0?true revoke:flags.1?t
|
||||
messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;
|
||||
messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
|
||||
messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool;
|
||||
messages.sendMessage#d9d75a4 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
||||
messages.sendMedia#e25ff8e0 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
||||
messages.sendMessage#d9d75a4 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
||||
messages.sendMedia#e25ff8e0 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
||||
messages.forwardMessages#cc30290b flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector<int> random_id:Vector<long> to_peer:InputPeer schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
||||
messages.reportSpam#cf1592db peer:InputPeer = Bool;
|
||||
messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings;
|
||||
@@ -1626,7 +1675,7 @@ messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool;
|
||||
messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
|
||||
messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory;
|
||||
messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages;
|
||||
messages.sendMultiMedia#f803138f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
||||
messages.sendMultiMedia#f803138f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
||||
messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile;
|
||||
messages.searchStickerSets#35705b8a flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets;
|
||||
messages.getSplitRanges#1cff7e08 = Vector<MessageRange>;
|
||||
@@ -1685,12 +1734,12 @@ messages.hideChatJoinRequest#7fe7e815 flags:# approved:flags.0?true peer:InputPe
|
||||
messages.hideAllChatJoinRequests#e085f4ea flags:# approved:flags.0?true peer:InputPeer link:flags.1?string = Updates;
|
||||
messages.toggleNoForwards#b11eafa2 peer:InputPeer enabled:Bool = Updates;
|
||||
messages.saveDefaultSendAs#ccfddf96 peer:InputPeer send_as:InputPeer = Bool;
|
||||
messages.sendReaction#25690ce4 flags:# big:flags.1?true peer:InputPeer msg_id:int reaction:flags.0?string = Updates;
|
||||
messages.sendReaction#d30d78d4 flags:# big:flags.1?true add_to_recent:flags.2?true peer:InputPeer msg_id:int reaction:flags.0?Vector<Reaction> = Updates;
|
||||
messages.getMessagesReactions#8bba90e6 peer:InputPeer id:Vector<int> = Updates;
|
||||
messages.getMessageReactionsList#e0ee6b77 flags:# peer:InputPeer id:int reaction:flags.0?string offset:flags.1?string limit:int = messages.MessageReactionsList;
|
||||
messages.setChatAvailableReactions#14050ea6 peer:InputPeer available_reactions:Vector<string> = Updates;
|
||||
messages.getMessageReactionsList#461b3f48 flags:# peer:InputPeer id:int reaction:flags.0?Reaction offset:flags.1?string limit:int = messages.MessageReactionsList;
|
||||
messages.setChatAvailableReactions#feb16771 peer:InputPeer available_reactions:ChatReactions = Updates;
|
||||
messages.getAvailableReactions#18dea0ac hash:int = messages.AvailableReactions;
|
||||
messages.setDefaultReaction#d960c4d4 reaction:string = Bool;
|
||||
messages.setDefaultReaction#4f47a016 reaction:Reaction = Bool;
|
||||
messages.translateText#24ce6dee flags:# peer:flags.0?InputPeer msg_id:flags.0?int text:flags.1?string from_lang:flags.2?string to_lang:string = messages.TranslatedText;
|
||||
messages.getUnreadReactions#e85bae1a peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages;
|
||||
messages.readReactions#82e251d7 peer:InputPeer = messages.AffectedHistory;
|
||||
@@ -1698,9 +1747,9 @@ messages.searchSentMedia#107e31a0 q:string filter:MessagesFilter limit:int = mes
|
||||
messages.getAttachMenuBots#16fcc2cb hash:long = AttachMenuBots;
|
||||
messages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot;
|
||||
messages.toggleBotInAttachMenu#1aee33af bot:InputUser enabled:Bool = Bool;
|
||||
messages.requestWebView#91b15831 flags:# from_bot_menu:flags.4?true silent:flags.5?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON reply_to_msg_id:flags.0?int send_as:flags.13?InputPeer = WebViewResult;
|
||||
messages.requestWebView#fc87a53c flags:# from_bot_menu:flags.4?true silent:flags.5?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to_msg_id:flags.0?int send_as:flags.13?InputPeer = WebViewResult;
|
||||
messages.prolongWebView#ea5fbcce flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to_msg_id:flags.0?int send_as:flags.13?InputPeer = Bool;
|
||||
messages.requestSimpleWebView#6abb2f73 flags:# bot:InputUser url:string theme_params:flags.0?DataJSON = SimpleWebViewResult;
|
||||
messages.requestSimpleWebView#299bec8e flags:# bot:InputUser url:string theme_params:flags.0?DataJSON platform:string = SimpleWebViewResult;
|
||||
messages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent;
|
||||
messages.sendWebViewData#dc0242c8 bot:InputUser random_id:long button_text:string data:string = Updates;
|
||||
messages.transcribeAudio#269e9a49 peer:InputPeer msg_id:int = messages.TranscribedAudio;
|
||||
@@ -1708,6 +1757,11 @@ messages.rateTranscribedAudio#7f1d072f peer:InputPeer msg_id:int transcription_i
|
||||
messages.getCustomEmojiDocuments#d9ab0f54 document_id:Vector<long> = Vector<Document>;
|
||||
messages.getEmojiStickers#fbfca18f hash:long = messages.AllStickers;
|
||||
messages.getFeaturedEmojiStickers#ecf6736 hash:long = messages.FeaturedStickers;
|
||||
messages.reportReaction#3f64c076 peer:InputPeer id:int reaction_peer:InputPeer = Bool;
|
||||
messages.getTopReactions#bb8125ba limit:int hash:long = messages.Reactions;
|
||||
messages.getRecentReactions#39461db2 limit:int hash:long = messages.Reactions;
|
||||
messages.clearRecentReactions#9dfeefb4 = Bool;
|
||||
messages.getExtendedMedia#84f80814 peer:InputPeer id:Vector<int> = Updates;
|
||||
|
||||
updates.getState#edd4882a = updates.State;
|
||||
updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
|
||||
@@ -1814,7 +1868,6 @@ payments.exportInvoice#f91b065 invoice_media:InputMedia = payments.ExportedInvoi
|
||||
payments.assignAppStoreTransaction#80ed747d receipt:bytes purpose:InputStorePaymentPurpose = Updates;
|
||||
payments.assignPlayMarketTransaction#dffd50d3 receipt:DataJSON purpose:InputStorePaymentPurpose = Updates;
|
||||
payments.canPurchasePremium#9fc19eb6 purpose:InputStorePaymentPurpose = Bool;
|
||||
payments.requestRecurringPayment#146e958d user_id:InputUser recurring_init_charge:string invoice_media:InputMedia = Updates;
|
||||
|
||||
stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true animated:flags.1?true videos:flags.4?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector<InputStickerSetItem> software:flags.3?string = messages.StickerSet;
|
||||
stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet;
|
||||
@@ -1871,4 +1924,4 @@ stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel
|
||||
stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
|
||||
stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats;
|
||||
|
||||
// LAYER 144
|
||||
// LAYER 146
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
|
||||
ProcessorArchitecture="ARCHITECTURE"
|
||||
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
|
||||
Version="4.0.4.0" />
|
||||
Version="4.2.4.0" />
|
||||
<Properties>
|
||||
<DisplayName>Telegram Desktop</DisplayName>
|
||||
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>
|
||||
|
||||
@@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 4,0,4,0
|
||||
PRODUCTVERSION 4,0,4,0
|
||||
FILEVERSION 4,2,4,0
|
||||
PRODUCTVERSION 4,2,4,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -62,10 +62,10 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Telegram FZ-LLC"
|
||||
VALUE "FileDescription", "Telegram Desktop"
|
||||
VALUE "FileVersion", "4.0.4.0"
|
||||
VALUE "FileVersion", "4.2.4.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "4.0.4.0"
|
||||
VALUE "ProductVersion", "4.2.4.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 4,0,4,0
|
||||
PRODUCTVERSION 4,0,4,0
|
||||
FILEVERSION 4,2,4,0
|
||||
PRODUCTVERSION 4,2,4,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -53,10 +53,10 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Telegram FZ-LLC"
|
||||
VALUE "FileDescription", "Telegram Desktop Updater"
|
||||
VALUE "FileVersion", "4.0.4.0"
|
||||
VALUE "FileVersion", "4.2.4.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "4.0.4.0"
|
||||
VALUE "ProductVersion", "4.2.4.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -41,7 +41,7 @@ void AttachedStickers::request(
|
||||
return;
|
||||
} else if (result.v.size() > 1) {
|
||||
strongController->show(
|
||||
Box<StickersBox>(strongController, result));
|
||||
Box<StickersBox>(strongController, result.v));
|
||||
return;
|
||||
}
|
||||
// Single attached sticker pack.
|
||||
|
||||
@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_session.h"
|
||||
#include "ui/empty_userpic.h"
|
||||
#include "ui/painter.h"
|
||||
#include "core/application.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_photo.h"
|
||||
@@ -175,17 +176,28 @@ ConfirmInviteBox::ConfirmInviteBox(
|
||||
const MTPDchatInvite &data,
|
||||
ChannelData *invitePeekChannel,
|
||||
Fn<void()> submit)
|
||||
: ConfirmInviteBox(
|
||||
session,
|
||||
Parse(session, data),
|
||||
invitePeekChannel,
|
||||
std::move(submit)) {
|
||||
}
|
||||
|
||||
ConfirmInviteBox::ConfirmInviteBox(
|
||||
not_null<Main::Session*> session,
|
||||
ChatInvite &&invite,
|
||||
ChannelData *invitePeekChannel,
|
||||
Fn<void()> submit)
|
||||
: _session(session)
|
||||
, _submit(std::move(submit))
|
||||
, _title(this, st::confirmInviteTitle)
|
||||
, _status(this, st::confirmInviteStatus)
|
||||
, _about(this, st::confirmInviteAbout)
|
||||
, _aboutRequests(this, st::confirmInviteStatus)
|
||||
, _participants(GetParticipants(_session, data))
|
||||
, _isChannel(data.is_channel() && !data.is_megagroup())
|
||||
, _requestApprove(data.is_request_needed()) {
|
||||
const auto title = qs(data.vtitle());
|
||||
const auto count = data.vparticipants_count().v;
|
||||
, _participants(std::move(invite.participants))
|
||||
, _isChannel(invite.isChannel && !invite.isMegagroup)
|
||||
, _requestApprove(invite.isRequestNeeded) {
|
||||
const auto count = invite.participantsCount;
|
||||
const auto status = [&] {
|
||||
return invitePeekChannel
|
||||
? tr::lng_channel_invite_private(tr::now)
|
||||
@@ -202,10 +214,10 @@ ConfirmInviteBox::ConfirmInviteBox(
|
||||
? tr::lng_channel_status(tr::now)
|
||||
: tr::lng_group_status(tr::now);
|
||||
}();
|
||||
_title->setText(title);
|
||||
_title->setText(invite.title);
|
||||
_status->setText(status);
|
||||
if (const auto v = qs(data.vabout().value_or_empty()); !v.isEmpty()) {
|
||||
_about->setText(v);
|
||||
if (!invite.about.isEmpty()) {
|
||||
_about->setText(invite.about);
|
||||
} else {
|
||||
_about.destroy();
|
||||
}
|
||||
@@ -217,9 +229,8 @@ ConfirmInviteBox::ConfirmInviteBox(
|
||||
_aboutRequests.destroy();
|
||||
}
|
||||
|
||||
const auto photo = _session->data().processPhoto(data.vphoto());
|
||||
if (!photo->isNull()) {
|
||||
_photo = photo->createMediaView();
|
||||
if (invite.photo) {
|
||||
_photo = invite.photo->createMediaView();
|
||||
_photo->wanted(Data::PhotoSize::Small, Data::FileOrigin());
|
||||
if (!_photo->image(Data::PhotoSize::Small)) {
|
||||
_session->downloaderTaskFinished(
|
||||
@@ -230,29 +241,37 @@ ConfirmInviteBox::ConfirmInviteBox(
|
||||
} else {
|
||||
_photoEmpty = std::make_unique<Ui::EmptyUserpic>(
|
||||
Data::PeerUserpicColor(0),
|
||||
title);
|
||||
invite.title);
|
||||
}
|
||||
}
|
||||
|
||||
ConfirmInviteBox::~ConfirmInviteBox() = default;
|
||||
|
||||
auto ConfirmInviteBox::GetParticipants(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPDchatInvite &data)
|
||||
-> std::vector<Participant> {
|
||||
const auto participants = data.vparticipants();
|
||||
if (!participants) {
|
||||
return {};
|
||||
}
|
||||
const auto &v = participants->v;
|
||||
auto result = std::vector<Participant>();
|
||||
result.reserve(v.size());
|
||||
for (const auto &participant : v) {
|
||||
if (const auto user = session->data().processUser(participant)) {
|
||||
result.push_back(Participant{ user });
|
||||
ConfirmInviteBox::ChatInvite ConfirmInviteBox::Parse(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPDchatInvite &data) {
|
||||
auto participants = std::vector<Participant>();
|
||||
if (const auto list = data.vparticipants()) {
|
||||
participants.reserve(list->v.size());
|
||||
for (const auto &participant : list->v) {
|
||||
if (const auto user = session->data().processUser(participant)) {
|
||||
participants.push_back(Participant{ user });
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
const auto photo = session->data().processPhoto(data.vphoto());
|
||||
return {
|
||||
.title = qs(data.vtitle()),
|
||||
.about = data.vabout().value_or_empty(),
|
||||
.photo = (photo->isNull() ? nullptr : photo.get()),
|
||||
.participantsCount = data.vparticipants_count().v,
|
||||
.participants = std::move(participants),
|
||||
.isPublic = data.is_public(),
|
||||
.isChannel = data.is_channel(),
|
||||
.isMegagroup = data.is_megagroup(),
|
||||
.isBroadcast = data.is_broadcast(),
|
||||
.isRequestNeeded = data.is_request_needed(),
|
||||
};
|
||||
}
|
||||
|
||||
void ConfirmInviteBox::prepare() {
|
||||
@@ -280,7 +299,7 @@ void ConfirmInviteBox::prepare() {
|
||||
auto name = new Ui::FlatLabel(this, st::confirmInviteUserName);
|
||||
name->resizeToWidth(st::confirmInviteUserPhotoSize + padding);
|
||||
name->setText(participant.user->firstName.isEmpty()
|
||||
? participant.user->name
|
||||
? participant.user->name()
|
||||
: participant.user->firstName);
|
||||
name->moveToLeft(left + (padding / 2), st::confirmInviteUserNameTop);
|
||||
left += _userWidth;
|
||||
|
||||
@@ -59,10 +59,28 @@ private:
|
||||
not_null<UserData*> user;
|
||||
std::shared_ptr<Data::CloudImageView> userpic;
|
||||
};
|
||||
static std::vector<Participant> GetParticipants(
|
||||
struct ChatInvite {
|
||||
QString title;
|
||||
QString about;
|
||||
PhotoData *photo = nullptr;
|
||||
int participantsCount = 0;
|
||||
std::vector<Participant> participants;
|
||||
bool isPublic = false;
|
||||
bool isChannel = false;
|
||||
bool isMegagroup = false;
|
||||
bool isBroadcast = false;
|
||||
bool isRequestNeeded = false;
|
||||
};
|
||||
[[nodiscard]] static ChatInvite Parse(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPDchatInvite &data);
|
||||
|
||||
ConfirmInviteBox(
|
||||
not_null<Main::Session*> session,
|
||||
ChatInvite &&invite,
|
||||
ChannelData *invitePeekChannel,
|
||||
Fn<void()> submit);
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
|
||||
Fn<void()> _submit;
|
||||
|
||||
@@ -35,6 +35,10 @@ void ConfirmPhone::resolve(
|
||||
_sendRequestId = 0;
|
||||
|
||||
result.match([&](const MTPDauth_sentCode &data) {
|
||||
const auto bad = [](const char *type) {
|
||||
LOG(("API Error: Should not be '%1'.").arg(type));
|
||||
return 0;
|
||||
};
|
||||
const auto sentCodeLength = data.vtype().match([&](
|
||||
const MTPDauth_sentCodeTypeApp &data) {
|
||||
LOG(("Error: should not be in-app code!"));
|
||||
@@ -43,12 +47,14 @@ void ConfirmPhone::resolve(
|
||||
return data.vlength().v;
|
||||
}, [&](const MTPDauth_sentCodeTypeCall &data) {
|
||||
return data.vlength().v;
|
||||
}, [&](const MTPDauth_sentCodeTypeFlashCall &data) {
|
||||
LOG(("Error: should not be flashcall!"));
|
||||
return 0;
|
||||
}, [&](const MTPDauth_sentCodeTypeMissedCall &data) {
|
||||
LOG(("Error: should not be missedcall!"));
|
||||
return 0;
|
||||
}, [&](const MTPDauth_sentCodeTypeFlashCall &) {
|
||||
return bad("FlashCall");
|
||||
}, [&](const MTPDauth_sentCodeTypeMissedCall &) {
|
||||
return bad("MissedCall");
|
||||
}, [&](const MTPDauth_sentCodeTypeEmailCode &) {
|
||||
return bad("EmailCode");
|
||||
}, [&](const MTPDauth_sentCodeTypeSetUpEmailRequired &) {
|
||||
return bad("SetUpEmailRequired");
|
||||
});
|
||||
const auto phoneHash = qs(data.vphone_code_hash());
|
||||
const auto timeout = [&]() -> std::optional<int> {
|
||||
|
||||
@@ -27,13 +27,19 @@ using namespace rpl::details;
|
||||
|
||||
template <typename T>
|
||||
constexpr auto WithId =
|
||||
is_callable_plain_v<T, const MTPUpdates &, Fn<void()>, mtpRequestId>;
|
||||
is_callable_plain_v<T, Fn<void()>, mtpRequestId>;
|
||||
template <typename T>
|
||||
constexpr auto WithoutId =
|
||||
is_callable_plain_v<T, const MTPUpdates &, Fn<void()>>;
|
||||
is_callable_plain_v<T, Fn<void()>>;
|
||||
template <typename T>
|
||||
constexpr auto WithoutCallback =
|
||||
is_callable_plain_v<T, const MTPUpdates &>;
|
||||
is_callable_plain_v<T>;
|
||||
template <typename T>
|
||||
constexpr auto ErrorWithId =
|
||||
is_callable_plain_v<T, QString, mtpRequestId>;
|
||||
template <typename T>
|
||||
constexpr auto ErrorWithoutId =
|
||||
is_callable_plain_v<T, QString>;
|
||||
|
||||
template <typename DoneCallback, typename FailCallback>
|
||||
mtpRequestId EditMessage(
|
||||
@@ -93,22 +99,30 @@ mtpRequestId EditMessage(
|
||||
const auto apply = [=] { api->applyUpdates(result); };
|
||||
|
||||
if constexpr (WithId<DoneCallback>) {
|
||||
done(result, apply, requestId);
|
||||
done(apply, requestId);
|
||||
} else if constexpr (WithoutId<DoneCallback>) {
|
||||
done(result, apply);
|
||||
done(apply);
|
||||
} else if constexpr (WithoutCallback<DoneCallback>) {
|
||||
done(result);
|
||||
done();
|
||||
apply();
|
||||
} else {
|
||||
apply();
|
||||
t_bad_callback(done);
|
||||
}
|
||||
|
||||
if (updateRecentStickers) {
|
||||
api->requestRecentStickersForce(true);
|
||||
}
|
||||
}).fail(
|
||||
fail
|
||||
).send();
|
||||
}).fail([=](const MTP::Error &error, mtpRequestId requestId) {
|
||||
if constexpr (ErrorWithId<FailCallback>) {
|
||||
fail(error.type(), requestId);
|
||||
} else if constexpr (ErrorWithoutId<FailCallback>) {
|
||||
fail(error.type());
|
||||
} else if constexpr (WithoutCallback<FailCallback>) {
|
||||
fail();
|
||||
} else {
|
||||
t_bad_callback(fail);
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
||||
template <typename DoneCallback, typename FailCallback>
|
||||
@@ -132,7 +146,7 @@ void EditMessageWithUploadedMedia(
|
||||
not_null<HistoryItem*> item,
|
||||
SendOptions options,
|
||||
MTPInputMedia media) {
|
||||
const auto done = [=](const auto &result, Fn<void()> applyUpdates) {
|
||||
const auto done = [=](Fn<void()> applyUpdates) {
|
||||
if (item) {
|
||||
item->clearSavedMedia();
|
||||
item->setIsLocalUpdateMedia(true);
|
||||
@@ -140,11 +154,10 @@ void EditMessageWithUploadedMedia(
|
||||
item->setIsLocalUpdateMedia(false);
|
||||
}
|
||||
};
|
||||
const auto fail = [=](const MTP::Error &error) {
|
||||
const auto err = error.type();
|
||||
const auto fail = [=](const QString &error) {
|
||||
const auto session = &item->history()->session();
|
||||
const auto notModified = (err == u"MESSAGE_NOT_MODIFIED"_q);
|
||||
const auto mediaInvalid = (err == u"MEDIA_NEW_INVALID"_q);
|
||||
const auto notModified = (error == u"MESSAGE_NOT_MODIFIED"_q);
|
||||
const auto mediaInvalid = (error == u"MEDIA_NEW_INVALID"_q);
|
||||
if (notModified || mediaInvalid) {
|
||||
item->returnSavedMedia();
|
||||
session->data().sendHistoryChangeNotifications();
|
||||
@@ -200,8 +213,8 @@ mtpRequestId EditCaption(
|
||||
not_null<HistoryItem*> item,
|
||||
const TextWithEntities &caption,
|
||||
SendOptions options,
|
||||
Fn<void(const MTPUpdates &)> done,
|
||||
Fn<void(const MTP::Error &)> fail) {
|
||||
Fn<void()> done,
|
||||
Fn<void(const QString &)> fail) {
|
||||
return EditMessage(item, caption, options, done, fail);
|
||||
}
|
||||
|
||||
@@ -209,17 +222,13 @@ mtpRequestId EditTextMessage(
|
||||
not_null<HistoryItem*> item,
|
||||
const TextWithEntities &caption,
|
||||
SendOptions options,
|
||||
Fn<void(const MTPUpdates &, mtpRequestId requestId)> done,
|
||||
Fn<void(const MTP::Error &, mtpRequestId requestId)> fail) {
|
||||
const auto callback = [=](
|
||||
const auto &result,
|
||||
Fn<void()> applyUpdates,
|
||||
auto id) {
|
||||
Fn<void(mtpRequestId requestId)> done,
|
||||
Fn<void(const QString &, mtpRequestId requestId)> fail) {
|
||||
const auto callback = [=](Fn<void()> applyUpdates, mtpRequestId id) {
|
||||
applyUpdates();
|
||||
done(result, id);
|
||||
done(id);
|
||||
};
|
||||
return EditMessage(item, caption, options, callback, fail);
|
||||
}
|
||||
|
||||
|
||||
} // namespace Api
|
||||
|
||||
@@ -42,14 +42,14 @@ mtpRequestId EditCaption(
|
||||
not_null<HistoryItem*> item,
|
||||
const TextWithEntities &caption,
|
||||
SendOptions options,
|
||||
Fn<void(const MTPUpdates &)> done,
|
||||
Fn<void(const MTP::Error &)> fail);
|
||||
Fn<void()> done,
|
||||
Fn<void(const QString &)> fail);
|
||||
|
||||
mtpRequestId EditTextMessage(
|
||||
not_null<HistoryItem*> item,
|
||||
const TextWithEntities &caption,
|
||||
SendOptions options,
|
||||
Fn<void(const MTPUpdates &, mtpRequestId requestId)> done,
|
||||
Fn<void(const MTP::Error &, mtpRequestId requestId)> fail);
|
||||
Fn<void(mtpRequestId requestId)> done,
|
||||
Fn<void(const QString &error, mtpRequestId requestId)> fail);
|
||||
|
||||
} // namespace Api
|
||||
|
||||
@@ -37,7 +37,7 @@ void Polls::create(
|
||||
const PollData &data,
|
||||
const SendAction &action,
|
||||
Fn<void()> done,
|
||||
Fn<void(const MTP::Error &error)> fail) {
|
||||
Fn<void()> fail) {
|
||||
_session->api().sendAction(action);
|
||||
|
||||
const auto history = action.history;
|
||||
@@ -101,7 +101,7 @@ void Polls::create(
|
||||
history->finishSavingCloudDraft(
|
||||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
}
|
||||
fail(error);
|
||||
fail();
|
||||
finish();
|
||||
}).afterRequest(history->sendRequestId
|
||||
).send();
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
const PollData &data,
|
||||
const SendAction &action,
|
||||
Fn<void()> done,
|
||||
Fn<void(const MTP::Error &error)> fail);
|
||||
Fn<void()> fail);
|
||||
void sendVotes(
|
||||
FullMsgId itemId,
|
||||
const std::vector<QByteArray> &options);
|
||||
|
||||
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "api/api_premium.h"
|
||||
|
||||
#include "api/api_premium_option.h"
|
||||
#include "api/api_text_entities.h"
|
||||
#include "main/main_session.h"
|
||||
#include "data/data_peer_values.h"
|
||||
@@ -86,37 +87,43 @@ void Premium::reloadPromo() {
|
||||
_promoRequestId = _api.request(MTPhelp_GetPremiumPromo(
|
||||
)).done([=](const MTPhelp_PremiumPromo &result) {
|
||||
_promoRequestId = 0;
|
||||
result.match([&](const MTPDhelp_premiumPromo &data) {
|
||||
_session->data().processUsers(data.vusers());
|
||||
_monthlyAmount = data.vmonthly_amount().v;
|
||||
_monthlyCurrency = qs(data.vcurrency());
|
||||
auto text = TextWithEntities{
|
||||
qs(data.vstatus_text()),
|
||||
EntitiesFromMTP(_session, data.vstatus_entities().v),
|
||||
};
|
||||
_statusText = text;
|
||||
_statusTextUpdates.fire(std::move(text));
|
||||
auto videos = base::flat_map<QString, not_null<DocumentData*>>();
|
||||
const auto count = int(std::min(
|
||||
data.vvideo_sections().v.size(),
|
||||
data.vvideos().v.size()));
|
||||
videos.reserve(count);
|
||||
for (auto i = 0; i != count; ++i) {
|
||||
const auto document = _session->data().processDocument(
|
||||
data.vvideos().v[i]);
|
||||
if ((!document->isVideoFile() && !document->isGifv())
|
||||
|| !document->supportsStreaming()) {
|
||||
document->forceIsStreamedAnimation();
|
||||
}
|
||||
videos.emplace(
|
||||
qs(data.vvideo_sections().v[i]),
|
||||
document);
|
||||
const auto &data = result.data();
|
||||
_session->data().processUsers(data.vusers());
|
||||
|
||||
_subscriptionOptions = SubscriptionOptionsFromTL(
|
||||
data.vperiod_options().v);
|
||||
for (const auto &option : data.vperiod_options().v) {
|
||||
if (option.data().vmonths().v == 1) {
|
||||
_monthlyAmount = option.data().vamount().v;
|
||||
_monthlyCurrency = qs(option.data().vcurrency());
|
||||
}
|
||||
if (_videos != videos) {
|
||||
_videos = std::move(videos);
|
||||
_videosUpdated.fire({});
|
||||
}
|
||||
auto text = TextWithEntities{
|
||||
qs(data.vstatus_text()),
|
||||
EntitiesFromMTP(_session, data.vstatus_entities().v),
|
||||
};
|
||||
_statusText = text;
|
||||
_statusTextUpdates.fire(std::move(text));
|
||||
auto videos = base::flat_map<QString, not_null<DocumentData*>>();
|
||||
const auto count = int(std::min(
|
||||
data.vvideo_sections().v.size(),
|
||||
data.vvideos().v.size()));
|
||||
videos.reserve(count);
|
||||
for (auto i = 0; i != count; ++i) {
|
||||
const auto document = _session->data().processDocument(
|
||||
data.vvideos().v[i]);
|
||||
if ((!document->isVideoFile() && !document->isGifv())
|
||||
|| !document->supportsStreaming()) {
|
||||
document->forceIsStreamedAnimation();
|
||||
}
|
||||
});
|
||||
videos.emplace(
|
||||
qs(data.vvideo_sections().v[i]),
|
||||
document);
|
||||
}
|
||||
if (_videos != videos) {
|
||||
_videos = std::move(videos);
|
||||
_videosUpdated.fire({});
|
||||
}
|
||||
}).fail([=] {
|
||||
_promoRequestId = 0;
|
||||
}).send();
|
||||
@@ -176,4 +183,8 @@ void Premium::reloadCloudSet() {
|
||||
}).send();
|
||||
}
|
||||
|
||||
const Data::SubscriptionOptions &Premium::subscriptionOptions() const {
|
||||
return _subscriptionOptions;
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
|
||||
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "data/data_subscription_option.h"
|
||||
#include "mtproto/sender.h"
|
||||
|
||||
class ApiWrap;
|
||||
@@ -39,6 +40,9 @@ public:
|
||||
[[nodiscard]] int64 monthlyAmount() const;
|
||||
[[nodiscard]] QString monthlyCurrency() const;
|
||||
|
||||
[[nodiscard]] auto subscriptionOptions() const
|
||||
-> const Data::SubscriptionOptions &;
|
||||
|
||||
private:
|
||||
void reloadPromo();
|
||||
void reloadStickers();
|
||||
@@ -67,6 +71,8 @@ private:
|
||||
int64 _monthlyAmount = 0;
|
||||
QString _monthlyCurrency;
|
||||
|
||||
Data::SubscriptionOptions _subscriptionOptions;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Api
|
||||
|
||||
40
Telegram/SourceFiles/api/api_premium_option.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "api/api_premium_option.h"
|
||||
|
||||
#include "ui/text/format_values.h"
|
||||
|
||||
namespace Api {
|
||||
|
||||
constexpr auto kDiscountDivider = 5.;
|
||||
|
||||
Data::SubscriptionOption CreateSubscriptionOption(
|
||||
int months,
|
||||
int monthlyAmount,
|
||||
int64 amount,
|
||||
const QString ¤cy,
|
||||
const QString &botUrl) {
|
||||
const auto discount = [&] {
|
||||
const auto percent = monthlyAmount * months / float64(amount) - 1.;
|
||||
return std::round(percent * 100. / kDiscountDivider)
|
||||
* kDiscountDivider;
|
||||
}();
|
||||
return {
|
||||
.duration = Ui::FormatTTL(months * 86400 * 31),
|
||||
.discount = discount
|
||||
? QString::fromUtf8("\xe2\x88\x92%1%").arg(discount)
|
||||
: QString(),
|
||||
.costPerMonth = Ui::FillAmountAndCurrency(
|
||||
amount / float64(months),
|
||||
currency),
|
||||
.costTotal = Ui::FillAmountAndCurrency(amount, currency),
|
||||
.botUrl = botUrl,
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
50
Telegram/SourceFiles/api/api_premium_option.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "data/data_subscription_option.h"
|
||||
|
||||
namespace Api {
|
||||
|
||||
[[nodiscard]] Data::SubscriptionOption CreateSubscriptionOption(
|
||||
int months,
|
||||
int monthlyAmount,
|
||||
int64 amount,
|
||||
const QString ¤cy,
|
||||
const QString &botUrl);
|
||||
|
||||
template<typename Option>
|
||||
[[nodiscard]] Data::SubscriptionOptions SubscriptionOptionsFromTL(
|
||||
const QVector<Option> &tlOptions) {
|
||||
auto result = Data::SubscriptionOptions();
|
||||
const auto monthlyAmount = [&] {
|
||||
const auto &min = ranges::min_element(
|
||||
tlOptions,
|
||||
ranges::less(),
|
||||
[](const Option &o) { return o.data().vamount().v; }
|
||||
)->data();
|
||||
return min.vamount().v / float64(min.vmonths().v);
|
||||
}();
|
||||
result.reserve(tlOptions.size());
|
||||
for (const auto &tlOption : tlOptions) {
|
||||
const auto &option = tlOption.data();
|
||||
const auto botUrl = qs(option.vbot_url());
|
||||
const auto months = option.vmonths().v;
|
||||
const auto amount = option.vamount().v;
|
||||
const auto currency = qs(option.vcurrency());
|
||||
result.push_back(CreateSubscriptionOption(
|
||||
months,
|
||||
monthlyAmount,
|
||||
amount,
|
||||
currency,
|
||||
botUrl));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
@@ -103,7 +103,7 @@ void SendExistingMedia(
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_send_as;
|
||||
}
|
||||
const auto messagePostAuthor = peer->isBroadcast()
|
||||
? session->user()->name
|
||||
? session->user()->name()
|
||||
: QString();
|
||||
|
||||
auto caption = TextWithEntities{
|
||||
@@ -231,7 +231,8 @@ bool SendDice(MessageToSend &message) {
|
||||
const auto full = QStringView(message.textWithTags.text).trimmed();
|
||||
auto length = 0;
|
||||
if (!Ui::Emoji::Find(full.data(), full.data() + full.size(), &length)
|
||||
|| length != full.size()) {
|
||||
|| length != full.size()
|
||||
|| !message.textWithTags.tags.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
auto &account = message.action.history->session().account();
|
||||
@@ -290,7 +291,7 @@ bool SendDice(MessageToSend &message) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_send_as;
|
||||
}
|
||||
const auto messagePostAuthor = peer->isBroadcast()
|
||||
? session->user()->name
|
||||
? session->user()->name()
|
||||
: QString();
|
||||
const auto replyTo = message.action.replyTo;
|
||||
|
||||
@@ -423,7 +424,7 @@ void SendConfirmedFile(
|
||||
? PeerId()
|
||||
: session->userPeerId();
|
||||
const auto messagePostAuthor = peer->isBroadcast()
|
||||
? session->user()->name
|
||||
? session->user()->name()
|
||||
: QString();
|
||||
|
||||
const auto media = MTPMessageMedia([&] {
|
||||
|
||||
@@ -20,31 +20,24 @@ namespace {
|
||||
using namespace TextUtilities;
|
||||
|
||||
[[nodiscard]] QString CustomEmojiEntityData(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPDmessageEntityCustomEmoji &data) {
|
||||
return Data::SerializeCustomEmojiId({
|
||||
.selfId = session->userId().bare,
|
||||
.id = data.vdocument_id().v,
|
||||
});
|
||||
}
|
||||
|
||||
[[nodiscard]] std::optional<MTPMessageEntity> CustomEmojiEntity(
|
||||
not_null<Main::Session*> session,
|
||||
MTPint offset,
|
||||
MTPint length,
|
||||
const QString &data) {
|
||||
const auto parsed = Data::ParseCustomEmojiData(data);
|
||||
if (!parsed.id || parsed.selfId != session->userId().bare) {
|
||||
return {};
|
||||
}
|
||||
const auto document = session->data().document(parsed.id);
|
||||
if (!document->sticker()) {
|
||||
if (!parsed.id) {
|
||||
return {};
|
||||
}
|
||||
return MTP_messageEntityCustomEmoji(
|
||||
offset,
|
||||
length,
|
||||
MTP_long(document->id));
|
||||
MTP_long(parsed.id));
|
||||
}
|
||||
|
||||
[[nodiscard]] std::optional<MTPMessageEntity> MentionNameEntity(
|
||||
@@ -125,9 +118,9 @@ EntitiesInText EntitiesFromMTP(
|
||||
case mtpc_messageEntityPre: { auto &d = entity.c_messageEntityPre(); result.push_back({ EntityType::Pre, d.voffset().v, d.vlength().v, qs(d.vlanguage()) }); } break;
|
||||
case mtpc_messageEntityBankCard: break; // Skipping cards. // #TODO entities
|
||||
case mtpc_messageEntitySpoiler: { auto &d = entity.c_messageEntitySpoiler(); result.push_back({ EntityType::Spoiler, d.voffset().v, d.vlength().v }); } break;
|
||||
case mtpc_messageEntityCustomEmoji: if (session) {
|
||||
case mtpc_messageEntityCustomEmoji: {
|
||||
const auto &d = entity.c_messageEntityCustomEmoji();
|
||||
result.push_back({ EntityType::CustomEmoji, d.voffset().v, d.vlength().v, CustomEmojiEntityData(session, d) });
|
||||
result.push_back({ EntityType::CustomEmoji, d.voffset().v, d.vlength().v, CustomEmojiEntityData(d) });
|
||||
} break;
|
||||
}
|
||||
}
|
||||
@@ -181,7 +174,7 @@ MTPVector<MTPMessageEntity> EntitiesToMTP(
|
||||
case EntityType::Pre: v.push_back(MTP_messageEntityPre(offset, length, MTP_string(entity.data()))); break;
|
||||
case EntityType::Spoiler: v.push_back(MTP_messageEntitySpoiler(offset, length)); break;
|
||||
case EntityType::CustomEmoji: {
|
||||
if (const auto valid = CustomEmojiEntity(session, offset, length, entity.data())) {
|
||||
if (const auto valid = CustomEmojiEntity(offset, length, entity.data())) {
|
||||
v.push_back(*valid);
|
||||
}
|
||||
} break;
|
||||
|
||||
@@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat_filters.h"
|
||||
#include "data/data_cloud_themes.h"
|
||||
#include "data/data_emoji_statuses.h"
|
||||
#include "data/data_group_call.h"
|
||||
#include "data/data_drafts.h"
|
||||
#include "data/data_histories.h"
|
||||
@@ -1649,6 +1650,15 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
}
|
||||
} break;
|
||||
|
||||
case mtpc_updateMessageExtendedMedia: {
|
||||
const auto &d = update.c_updateMessageExtendedMedia();
|
||||
const auto peerId = peerFromMTP(d.vpeer());
|
||||
const auto msgId = d.vmsg_id().v;
|
||||
if (const auto item = session().data().message(peerId, msgId)) {
|
||||
item->applyEdition(d.vextended_media());
|
||||
}
|
||||
} break;
|
||||
|
||||
// Messages being read.
|
||||
case mtpc_updateReadHistoryInbox: {
|
||||
auto &d = update.c_updateReadHistoryInbox();
|
||||
@@ -2344,12 +2354,48 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
}
|
||||
} break;
|
||||
|
||||
case mtpc_updateMoveStickerSetToTop: {
|
||||
const auto &d = update.c_updateMoveStickerSetToTop();
|
||||
auto &stickers = session().data().stickers();
|
||||
const auto isEmoji = d.is_emojis();
|
||||
const auto setId = d.vstickerset().v;
|
||||
auto &order = isEmoji
|
||||
? stickers.emojiSetsOrderRef()
|
||||
: stickers.setsOrderRef();
|
||||
const auto i = ranges::find(order, setId);
|
||||
if (i == order.end()) {
|
||||
if (isEmoji) {
|
||||
stickers.setLastEmojiUpdate(0);
|
||||
session().api().updateCustomEmoji();
|
||||
} else {
|
||||
stickers.setLastUpdate(0);
|
||||
session().api().updateStickers();
|
||||
}
|
||||
} else if (i != order.begin()) {
|
||||
std::rotate(order.begin(), i, i + 1);
|
||||
if (isEmoji) {
|
||||
session().local().writeInstalledCustomEmoji();
|
||||
} else {
|
||||
session().local().writeInstalledStickers();
|
||||
}
|
||||
stickers.notifyUpdated(isEmoji
|
||||
? Data::StickersType::Emoji
|
||||
: Data::StickersType::Stickers);
|
||||
}
|
||||
} break;
|
||||
|
||||
case mtpc_updateStickerSets: {
|
||||
// Can't determine is it masks or stickers, so update both.
|
||||
session().data().stickers().setLastUpdate(0);
|
||||
session().api().updateStickers();
|
||||
session().data().stickers().setLastMasksUpdate(0);
|
||||
session().api().updateMasks();
|
||||
const auto &d = update.c_updateStickerSets();
|
||||
if (d.is_emojis()) {
|
||||
session().data().stickers().setLastEmojiUpdate(0);
|
||||
session().api().updateCustomEmoji();
|
||||
} else if (d.is_masks()) {
|
||||
session().data().stickers().setLastMasksUpdate(0);
|
||||
session().api().updateMasks();
|
||||
} else {
|
||||
session().data().stickers().setLastUpdate(0);
|
||||
session().api().updateStickers();
|
||||
}
|
||||
} break;
|
||||
|
||||
case mtpc_updateRecentStickers: {
|
||||
@@ -2370,6 +2416,25 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||
session().api().updateStickers();
|
||||
} break;
|
||||
|
||||
case mtpc_updateReadFeaturedEmojiStickers: {
|
||||
// We don't track read status of them for now.
|
||||
} break;
|
||||
|
||||
case mtpc_updateUserEmojiStatus: {
|
||||
const auto &d = update.c_updateUserEmojiStatus();
|
||||
if (const auto user = session().data().userLoaded(d.vuser_id())) {
|
||||
user->setEmojiStatus(d.vemoji_status());
|
||||
}
|
||||
} break;
|
||||
|
||||
case mtpc_updateRecentEmojiStatuses: {
|
||||
session().data().emojiStatuses().refreshRecentDelayed();
|
||||
} break;
|
||||
|
||||
case mtpc_updateRecentReactions: {
|
||||
session().data().reactions().refreshRecentDelayed();
|
||||
} break;
|
||||
|
||||
////// Cloud saved GIFs
|
||||
case mtpc_updateSavedGifs: {
|
||||
session().data().stickers().setLastSavedGifsUpdate(0);
|
||||
|
||||
@@ -20,13 +20,16 @@ namespace {
|
||||
|
||||
// Send channel views each second.
|
||||
constexpr auto kSendViewsTimeout = crl::time(1000);
|
||||
constexpr auto kPollExtendedMediaPeriod = 30 * crl::time(1000);
|
||||
constexpr auto kMaxPollPerRequest = 100;
|
||||
|
||||
} // namespace
|
||||
|
||||
ViewsManager::ViewsManager(not_null<ApiWrap*> api)
|
||||
: _session(&api->session())
|
||||
, _api(&api->instance())
|
||||
, _incrementTimer([=] { viewsIncrement(); }) {
|
||||
, _incrementTimer([=] { viewsIncrement(); })
|
||||
, _pollTimer([=] { sendPollRequests(); }) {
|
||||
}
|
||||
|
||||
void ViewsManager::scheduleIncrement(not_null<HistoryItem*> item) {
|
||||
@@ -52,6 +55,25 @@ void ViewsManager::removeIncremented(not_null<PeerData*> peer) {
|
||||
_incremented.remove(peer);
|
||||
}
|
||||
|
||||
void ViewsManager::pollExtendedMedia(not_null<HistoryItem*> item) {
|
||||
if (!item->isRegular()) {
|
||||
return;
|
||||
}
|
||||
const auto id = item->id;
|
||||
const auto peer = item->history()->peer;
|
||||
auto &request = _pollRequests[peer];
|
||||
if (request.ids.contains(id) || request.sent.contains(id)) {
|
||||
return;
|
||||
}
|
||||
request.ids.emplace(id);
|
||||
if (!request.id && !request.when) {
|
||||
request.when = crl::now() + kPollExtendedMediaPeriod;
|
||||
}
|
||||
if (!_pollTimer.isActive()) {
|
||||
_pollTimer.callOnce(kPollExtendedMediaPeriod);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewsManager::viewsIncrement() {
|
||||
for (auto i = _toIncrement.begin(); i != _toIncrement.cend();) {
|
||||
if (_incrementRequests.contains(i->first)) {
|
||||
@@ -81,6 +103,88 @@ void ViewsManager::viewsIncrement() {
|
||||
}
|
||||
}
|
||||
|
||||
void ViewsManager::sendPollRequests() {
|
||||
const auto now = crl::now();
|
||||
auto toRequest = base::flat_map<not_null<PeerData*>, QVector<MTPint>>();
|
||||
auto nearest = crl::time();
|
||||
for (auto &[peer, request] : _pollRequests) {
|
||||
if (request.id) {
|
||||
continue;
|
||||
} else if (request.when <= now) {
|
||||
Assert(request.sent.empty());
|
||||
auto &list = toRequest[peer];
|
||||
const auto count = int(request.ids.size());
|
||||
if (count < kMaxPollPerRequest) {
|
||||
request.sent = base::take(request.ids);
|
||||
} else {
|
||||
const auto from = begin(request.ids);
|
||||
const auto end = from + kMaxPollPerRequest;
|
||||
request.sent = { from, end };
|
||||
request.ids.erase(from, end);
|
||||
}
|
||||
list.reserve(request.sent.size());
|
||||
for (const auto &id : request.sent) {
|
||||
list.push_back(MTP_int(id.bare));
|
||||
}
|
||||
if (!request.ids.empty()) {
|
||||
nearest = now;
|
||||
}
|
||||
} else if (!nearest || nearest > request.when) {
|
||||
nearest = request.when;
|
||||
}
|
||||
}
|
||||
sendPollRequests(toRequest);
|
||||
if (nearest) {
|
||||
_pollTimer.callOnce(std::max(nearest - now, crl::time(1)));
|
||||
}
|
||||
}
|
||||
|
||||
void ViewsManager::sendPollRequests(
|
||||
const base::flat_map<
|
||||
not_null<PeerData*>,
|
||||
QVector<MTPint>> &batched) {
|
||||
for (auto &[peer, list] : batched) {
|
||||
const auto finish = [=, list = list](mtpRequestId id) {
|
||||
const auto now = crl::now();
|
||||
const auto owner = &_session->data();
|
||||
for (auto i = begin(_pollRequests); i != end(_pollRequests);) {
|
||||
if (i->second.id == id) {
|
||||
const auto peer = i->first->id;
|
||||
for (const auto &itemId : i->second.sent) {
|
||||
if (const auto item = owner->message(peer, itemId)) {
|
||||
owner->requestItemRepaint(item);
|
||||
}
|
||||
}
|
||||
i->second.sent.clear();
|
||||
i->second.id = 0;
|
||||
if (i->second.ids.empty()) {
|
||||
i = _pollRequests.erase(i);
|
||||
} else {
|
||||
i->second.when = now + kPollExtendedMediaPeriod;
|
||||
if (!_pollTimer.isActive()) {
|
||||
_pollTimer.callOnce(kPollExtendedMediaPeriod);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
};
|
||||
const auto requestId = _api.request(MTPmessages_GetExtendedMedia(
|
||||
peer->input,
|
||||
MTP_vector<MTPint>(list)
|
||||
)).done([=](const MTPUpdates &result, mtpRequestId id) {
|
||||
_session->api().applyUpdates(result);
|
||||
finish(id);
|
||||
}).fail([=](const MTP::Error &error, mtpRequestId id) {
|
||||
finish(id);
|
||||
}).send();
|
||||
|
||||
_pollRequests[peer].id = requestId;
|
||||
}
|
||||
}
|
||||
|
||||
void ViewsManager::done(
|
||||
QVector<MTPint> ids,
|
||||
const MTPmessages_MessageViews &result,
|
||||
|
||||
@@ -26,8 +26,22 @@ public:
|
||||
void scheduleIncrement(not_null<HistoryItem*> item);
|
||||
void removeIncremented(not_null<PeerData*> peer);
|
||||
|
||||
void pollExtendedMedia(not_null<HistoryItem*> item);
|
||||
|
||||
private:
|
||||
struct PollExtendedMediaRequest {
|
||||
crl::time when = 0;
|
||||
mtpRequestId id = 0;
|
||||
base::flat_set<MsgId> ids;
|
||||
base::flat_set<MsgId> sent;
|
||||
};
|
||||
|
||||
void viewsIncrement();
|
||||
void sendPollRequests();
|
||||
void sendPollRequests(
|
||||
const base::flat_map<
|
||||
not_null<PeerData*>,
|
||||
QVector<MTPint>> &prepared);
|
||||
|
||||
void done(
|
||||
QVector<MTPint> ids,
|
||||
@@ -44,6 +58,11 @@ private:
|
||||
base::flat_map<mtpRequestId, not_null<PeerData*>> _incrementByRequest;
|
||||
base::Timer _incrementTimer;
|
||||
|
||||
base::flat_map<
|
||||
not_null<PeerData*>,
|
||||
PollExtendedMediaRequest> _pollRequests;
|
||||
base::Timer _pollTimer;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Api
|
||||
|
||||
@@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "history/history_item.h"
|
||||
#include "history/history.h"
|
||||
#include "data/stickers/data_custom_emoji.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_channel.h"
|
||||
@@ -17,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_changes.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_media_types.h"
|
||||
#include "data/data_message_reaction_id.h"
|
||||
#include "main/main_app_config.h"
|
||||
#include "main/main_session.h"
|
||||
#include "main/main_account.h"
|
||||
@@ -31,6 +33,8 @@ namespace {
|
||||
|
||||
constexpr auto kContextReactionsLimit = 50;
|
||||
|
||||
using Data::ReactionId;
|
||||
|
||||
struct Peers {
|
||||
std::vector<PeerId> list;
|
||||
bool unknown = false;
|
||||
@@ -41,7 +45,7 @@ inline bool operator==(const Peers &a, const Peers &b) noexcept {
|
||||
|
||||
struct PeerWithReaction {
|
||||
PeerId peer = 0;
|
||||
QString reaction;
|
||||
ReactionId reaction;
|
||||
};
|
||||
inline bool operator==(
|
||||
const PeerWithReaction &a,
|
||||
@@ -84,7 +88,7 @@ struct Context {
|
||||
base::flat_map<not_null<HistoryItem*>, CachedRead> cachedRead;
|
||||
base::flat_map<
|
||||
not_null<HistoryItem*>,
|
||||
base::flat_map<QString, CachedReacted>> cachedReacted;
|
||||
base::flat_map<ReactionId, CachedReacted>> cachedReacted;
|
||||
base::flat_map<not_null<Main::Session*>, rpl::lifetime> subscriptions;
|
||||
|
||||
[[nodiscard]] CachedRead &cacheRead(not_null<HistoryItem*> item) {
|
||||
@@ -97,7 +101,7 @@ struct Context {
|
||||
|
||||
[[nodiscard]] CachedReacted &cacheReacted(
|
||||
not_null<HistoryItem*> item,
|
||||
const QString &reaction) {
|
||||
const ReactionId &reaction) {
|
||||
auto &map = cachedReacted[item];
|
||||
const auto i = map.find(reaction);
|
||||
if (i != end(map)) {
|
||||
@@ -109,7 +113,7 @@ struct Context {
|
||||
|
||||
struct Userpic {
|
||||
not_null<PeerData*> peer;
|
||||
QString reaction;
|
||||
QString customEntityData;
|
||||
mutable std::shared_ptr<Data::CloudImageView> view;
|
||||
mutable InMemoryKey uniqueKey;
|
||||
};
|
||||
@@ -249,7 +253,7 @@ struct State {
|
||||
Peers &&peers) {
|
||||
auto result = PeersWithReactions{
|
||||
.list = peers.list | ranges::views::transform([](PeerId peer) {
|
||||
return PeerWithReaction{.peer = peer };
|
||||
return PeerWithReaction{ .peer = peer };
|
||||
}) | ranges::to_vector,
|
||||
.unknown = peers.unknown,
|
||||
};
|
||||
@@ -259,7 +263,7 @@ struct State {
|
||||
|
||||
[[nodiscard]] rpl::producer<PeersWithReactions> WhoReactedIds(
|
||||
not_null<HistoryItem*> item,
|
||||
const QString &reaction,
|
||||
const ReactionId &reaction,
|
||||
not_null<QWidget*> context) {
|
||||
auto weak = QPointer<QWidget>(context.get());
|
||||
const auto session = &item->history()->session();
|
||||
@@ -273,12 +277,12 @@ struct State {
|
||||
using Flag = MTPmessages_GetMessageReactionsList::Flag;
|
||||
entry.requestId = session->api().request(
|
||||
MTPmessages_GetMessageReactionsList(
|
||||
MTP_flags(reaction.isEmpty()
|
||||
MTP_flags(reaction.empty()
|
||||
? Flag(0)
|
||||
: Flag::f_reaction),
|
||||
item->history()->peer->input,
|
||||
MTP_int(item->id),
|
||||
MTP_string(reaction),
|
||||
ReactionToMTP(reaction),
|
||||
MTPstring(), // offset
|
||||
MTP_int(kContextReactionsLimit)
|
||||
)
|
||||
@@ -299,7 +303,8 @@ struct State {
|
||||
vote.match([&](const auto &data) {
|
||||
parsed.list.push_back(PeerWithReaction{
|
||||
.peer = peerFromMTP(data.vpeer_id()),
|
||||
.reaction = qs(data.vreaction()),
|
||||
.reaction = Data::ReactionFromMTP(
|
||||
data.vreaction()),
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -322,7 +327,7 @@ struct State {
|
||||
not_null<QWidget*> context)
|
||||
-> rpl::producer<PeersWithReactions> {
|
||||
return rpl::combine(
|
||||
WhoReactedIds(item, QString(), context),
|
||||
WhoReactedIds(item, {}, context),
|
||||
WhoReadIds(item, context)
|
||||
) | rpl::map([=](PeersWithReactions &&reacted, Peers &&read) {
|
||||
if (reacted.unknown || read.unknown) {
|
||||
@@ -347,7 +352,7 @@ bool UpdateUserpics(
|
||||
|
||||
struct ResolvedPeer {
|
||||
PeerData *peer = nullptr;
|
||||
QString reaction;
|
||||
ReactionId reaction;
|
||||
};
|
||||
const auto peers = ranges::views::all(
|
||||
ids
|
||||
@@ -373,17 +378,16 @@ bool UpdateUserpics(
|
||||
auto now = std::vector<Userpic>();
|
||||
for (const auto &resolved : peers) {
|
||||
const auto peer = not_null{ resolved.peer };
|
||||
if (ranges::contains(now, peer, &Userpic::peer)) {
|
||||
continue;
|
||||
}
|
||||
const auto &data = ReactionEntityData(resolved.reaction);
|
||||
const auto i = ranges::find(was, peer, &Userpic::peer);
|
||||
if (i != end(was)) {
|
||||
if (i != end(was) && i->view) {
|
||||
now.push_back(std::move(*i));
|
||||
now.back().customEntityData = data;
|
||||
continue;
|
||||
}
|
||||
now.push_back(Userpic{
|
||||
.peer = peer,
|
||||
.reaction = resolved.reaction,
|
||||
.customEntityData = data,
|
||||
});
|
||||
auto &userpic = now.back();
|
||||
userpic.uniqueKey = peer->userpicUniqueKey(userpic.view);
|
||||
@@ -426,13 +430,13 @@ void RegenerateParticipants(not_null<State*> state, int small, int large) {
|
||||
const auto id = peer->id.value;
|
||||
const auto was = ranges::find(old, id, &Ui::WhoReadParticipant::id);
|
||||
if (was != end(old)) {
|
||||
was->name = peer->name;
|
||||
was->name = peer->name();
|
||||
now.push_back(std::move(*was));
|
||||
continue;
|
||||
}
|
||||
now.push_back({
|
||||
.name = peer->name,
|
||||
.reaction = userpic.reaction,
|
||||
.name = peer->name(),
|
||||
.customEntityData = userpic.customEntityData,
|
||||
.userpicLarge = GenerateUserpic(userpic, large),
|
||||
.userpicKey = userpic.uniqueKey,
|
||||
.id = id,
|
||||
@@ -446,7 +450,7 @@ void RegenerateParticipants(not_null<State*> state, int small, int large) {
|
||||
|
||||
rpl::producer<Ui::WhoReadContent> WhoReacted(
|
||||
not_null<HistoryItem*> item,
|
||||
const QString &reaction,
|
||||
const ReactionId &reaction,
|
||||
not_null<QWidget*> context,
|
||||
const style::WhoRead &st,
|
||||
std::shared_ptr<WhoReadList> whoReadIds) {
|
||||
@@ -455,7 +459,7 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
|
||||
return [=](auto consumer) {
|
||||
auto lifetime = rpl::lifetime();
|
||||
|
||||
const auto resolveWhoRead = reaction.isEmpty()
|
||||
const auto resolveWhoRead = reaction.empty()
|
||||
&& WhoReadExists(item);
|
||||
|
||||
const auto state = lifetime.make_state<State>();
|
||||
@@ -463,7 +467,7 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
|
||||
consumer.put_next_copy(state->current);
|
||||
};
|
||||
|
||||
const auto resolveWhoReacted = !reaction.isEmpty()
|
||||
const auto resolveWhoReacted = !reaction.empty()
|
||||
|| item->canViewReactions();
|
||||
auto idsWithReactions = (resolveWhoRead && resolveWhoReacted)
|
||||
? WhoReadOrReactedIds(item, context)
|
||||
@@ -475,22 +479,26 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
|
||||
: Ui::WhoReadType::Reacted;
|
||||
if (resolveWhoReacted) {
|
||||
const auto &list = item->reactions();
|
||||
state->current.fullReactionsCount = reaction.isEmpty()
|
||||
? ranges::accumulate(
|
||||
state->current.fullReactionsCount = [&] {
|
||||
if (reaction.empty()) {
|
||||
return ranges::accumulate(
|
||||
list,
|
||||
0,
|
||||
ranges::plus{},
|
||||
&Data::MessageReaction::count);
|
||||
}
|
||||
const auto i = ranges::find(
|
||||
list,
|
||||
0,
|
||||
ranges::plus{},
|
||||
[](const auto &pair) { return pair.second; })
|
||||
: list.contains(reaction)
|
||||
? list.find(reaction)->second
|
||||
: 0;
|
||||
|
||||
// #TODO reactions
|
||||
state->current.singleReaction = !reaction.isEmpty()
|
||||
reaction,
|
||||
&Data::MessageReaction::id);
|
||||
return (i != end(list)) ? i->count : 0;
|
||||
}();
|
||||
state->current.singleCustomEntityData = ReactionEntityData(
|
||||
!reaction.empty()
|
||||
? reaction
|
||||
: (list.size() == 1)
|
||||
? list.front().first
|
||||
: QString();
|
||||
? list.front().id
|
||||
: ReactionId());
|
||||
}
|
||||
std::move(
|
||||
idsWithReactions
|
||||
@@ -510,7 +518,7 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
|
||||
if (whoReadIds) {
|
||||
const auto reacted = peers.list.size() - ranges::count(
|
||||
peers.list,
|
||||
QString(),
|
||||
ReactionId(),
|
||||
&PeerWithReaction::reaction);
|
||||
whoReadIds->list = (peers.read.size() > reacted)
|
||||
? std::move(peers.read)
|
||||
@@ -583,8 +591,13 @@ bool WhoReadExists(not_null<HistoryItem*> item) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WhoReactedExists(not_null<HistoryItem*> item) {
|
||||
return item->canViewReactions() || WhoReadExists(item);
|
||||
bool WhoReactedExists(
|
||||
not_null<HistoryItem*> item,
|
||||
WhoReactedList list) {
|
||||
if (item->canViewReactions() || WhoReadExists(item)) {
|
||||
return true;
|
||||
}
|
||||
return (list == WhoReactedList::One) && item->history()->peer->isUser();
|
||||
}
|
||||
|
||||
rpl::producer<Ui::WhoReadContent> WhoReacted(
|
||||
@@ -592,12 +605,12 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
|
||||
not_null<QWidget*> context,
|
||||
const style::WhoRead &st,
|
||||
std::shared_ptr<WhoReadList> whoReadIds) {
|
||||
return WhoReacted(item, QString(), context, st, std::move(whoReadIds));
|
||||
return WhoReacted(item, {}, context, st, std::move(whoReadIds));
|
||||
}
|
||||
|
||||
rpl::producer<Ui::WhoReadContent> WhoReacted(
|
||||
not_null<HistoryItem*> item,
|
||||
const QString &reaction,
|
||||
const Data::ReactionId &reaction,
|
||||
not_null<QWidget*> context,
|
||||
const style::WhoRead &st) {
|
||||
return WhoReacted(item, reaction, context, st, nullptr);
|
||||
|
||||
@@ -18,10 +18,21 @@ struct WhoReadContent;
|
||||
enum class WhoReadType;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Data {
|
||||
struct ReactionId;
|
||||
} // namespace Data
|
||||
|
||||
namespace Api {
|
||||
|
||||
enum class WhoReactedList {
|
||||
All,
|
||||
One,
|
||||
};
|
||||
|
||||
[[nodiscard]] bool WhoReadExists(not_null<HistoryItem*> item);
|
||||
[[nodiscard]] bool WhoReactedExists(not_null<HistoryItem*> item);
|
||||
[[nodiscard]] bool WhoReactedExists(
|
||||
not_null<HistoryItem*> item,
|
||||
WhoReactedList list);
|
||||
|
||||
struct WhoReadList {
|
||||
std::vector<PeerId> list;
|
||||
@@ -36,7 +47,7 @@ struct WhoReadList {
|
||||
std::shared_ptr<WhoReadList> whoReadIds = nullptr);
|
||||
[[nodiscard]] rpl::producer<Ui::WhoReadContent> WhoReacted(
|
||||
not_null<HistoryItem*> item,
|
||||
const QString &reaction,
|
||||
const Data::ReactionId &reaction,
|
||||
not_null<QWidget*> context, // Cache results for this lifetime.
|
||||
const style::WhoRead &st);
|
||||
|
||||
|
||||
@@ -293,14 +293,20 @@ void ApiWrap::topPromotionDone(const MTPhelp_PromoData &proxy) {
|
||||
|
||||
void ApiWrap::requestDeepLinkInfo(
|
||||
const QString &path,
|
||||
Fn<void(const MTPDhelp_deepLinkInfo &result)> callback) {
|
||||
Fn<void(TextWithEntities message, bool updateRequired)> callback) {
|
||||
request(_deepLinkInfoRequestId).cancel();
|
||||
_deepLinkInfoRequestId = request(MTPhelp_GetDeepLinkInfo(
|
||||
MTP_string(path)
|
||||
)).done([=](const MTPhelp_DeepLinkInfo &result) {
|
||||
_deepLinkInfoRequestId = 0;
|
||||
if (result.type() == mtpc_help_deepLinkInfo) {
|
||||
callback(result.c_help_deepLinkInfo());
|
||||
const auto &data = result.c_help_deepLinkInfo();
|
||||
callback(TextWithEntities{
|
||||
qs(data.vmessage()),
|
||||
Api::EntitiesFromMTP(
|
||||
_session,
|
||||
data.ventities().value_or_empty())
|
||||
}, data.is_update_app());
|
||||
}
|
||||
}).fail([=] {
|
||||
_deepLinkInfoRequestId = 0;
|
||||
@@ -438,14 +444,22 @@ void ApiWrap::sendMessageFail(
|
||||
not_null<PeerData*> peer,
|
||||
uint64 randomId,
|
||||
FullMsgId itemId) {
|
||||
sendMessageFail(error.type(), peer, randomId, itemId);
|
||||
}
|
||||
|
||||
void ApiWrap::sendMessageFail(
|
||||
const QString &error,
|
||||
not_null<PeerData*> peer,
|
||||
uint64 randomId,
|
||||
FullMsgId itemId) {
|
||||
const auto show = ShowForPeer(peer);
|
||||
|
||||
if (error.type() == qstr("PEER_FLOOD")) {
|
||||
if (error == qstr("PEER_FLOOD")) {
|
||||
show->showBox(
|
||||
Ui::MakeInformBox(
|
||||
PeerFloodErrorText(&session(), PeerFloodType::Send)),
|
||||
Ui::LayerOption::CloseOther);
|
||||
} else if (error.type() == qstr("USER_BANNED_IN_CHANNEL")) {
|
||||
} else if (error == qstr("USER_BANNED_IN_CHANNEL")) {
|
||||
const auto link = Ui::Text::Link(
|
||||
tr::lng_cant_more_info(tr::now),
|
||||
session().createInternalLinkFull(qsl("spambot")));
|
||||
@@ -457,9 +471,9 @@ void ApiWrap::sendMessageFail(
|
||||
link,
|
||||
Ui::Text::WithEntities)),
|
||||
Ui::LayerOption::CloseOther);
|
||||
} else if (error.type().startsWith(qstr("SLOWMODE_WAIT_"))) {
|
||||
} else if (error.startsWith(qstr("SLOWMODE_WAIT_"))) {
|
||||
const auto chop = qstr("SLOWMODE_WAIT_").size();
|
||||
const auto left = base::StringViewMid(error.type(), chop).toInt();
|
||||
const auto left = base::StringViewMid(error, chop).toInt();
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
const auto seconds = channel->slowmodeSeconds();
|
||||
if (seconds >= left) {
|
||||
@@ -469,7 +483,7 @@ void ApiWrap::sendMessageFail(
|
||||
requestFullPeer(peer);
|
||||
}
|
||||
}
|
||||
} else if (error.type() == qstr("SCHEDULE_STATUS_PRIVATE")) {
|
||||
} else if (error == qstr("SCHEDULE_STATUS_PRIVATE")) {
|
||||
auto &scheduled = _session->data().scheduledMessages();
|
||||
Assert(peer->isUser());
|
||||
if (const auto item = scheduled.lookupItem(peer->id, itemId.msg)) {
|
||||
@@ -478,7 +492,7 @@ void ApiWrap::sendMessageFail(
|
||||
Ui::MakeInformBox(tr::lng_cant_do_this()),
|
||||
Ui::LayerOption::CloseOther);
|
||||
}
|
||||
} else if (error.type() == qstr("CHAT_FORWARDS_RESTRICTED")) {
|
||||
} else if (error == qstr("CHAT_FORWARDS_RESTRICTED")) {
|
||||
if (show->valid()) {
|
||||
Ui::ShowMultilineToast({
|
||||
.parentOverride = show->toastParent(),
|
||||
@@ -489,7 +503,7 @@ void ApiWrap::sendMessageFail(
|
||||
.duration = kJoinErrorDuration
|
||||
});
|
||||
}
|
||||
} else if (error.type() == qstr("PREMIUM_ACCOUNT_REQUIRED")) {
|
||||
} else if (error == qstr("PREMIUM_ACCOUNT_REQUIRED")) {
|
||||
Settings::ShowPremium(&session(), "premium_stickers");
|
||||
}
|
||||
if (const auto item = _session->data().message(itemId)) {
|
||||
@@ -984,7 +998,7 @@ rpl::producer<bool> ApiWrap::dialogsLoadBlockedByDate() const {
|
||||
void ApiWrap::requestWallPaper(
|
||||
const QString &slug,
|
||||
Fn<void(const Data::WallPaper &)> done,
|
||||
Fn<void(const MTP::Error &)> fail) {
|
||||
Fn<void()> fail) {
|
||||
if (_wallPaperSlug != slug) {
|
||||
_wallPaperSlug = slug;
|
||||
if (_wallPaperRequestId) {
|
||||
@@ -1006,13 +1020,13 @@ void ApiWrap::requestWallPaper(
|
||||
done(*paper);
|
||||
}
|
||||
} else if (const auto fail = base::take(_wallPaperFail)) {
|
||||
fail(MTP::Error::Local("BAD_DOCUMENT", "In a wallpaper."));
|
||||
fail();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_wallPaperRequestId = 0;
|
||||
_wallPaperSlug = QString();
|
||||
if (const auto fail = base::take(_wallPaperFail)) {
|
||||
fail(error);
|
||||
fail();
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
@@ -1117,44 +1131,6 @@ void ApiWrap::gotUserFull(
|
||||
Data::PeerUpdate::Flag::FullInfo);
|
||||
}
|
||||
|
||||
void ApiWrap::requestPeer(not_null<PeerData*> peer) {
|
||||
if (_fullPeerRequests.contains(peer) || _peerRequests.contains(peer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto requestId = [&] {
|
||||
const auto failHandler = [=] {
|
||||
_peerRequests.remove(peer);
|
||||
};
|
||||
const auto chatHandler = [=](const MTPmessages_Chats &result) {
|
||||
_peerRequests.remove(peer);
|
||||
const auto &chats = result.match([](const auto &data) {
|
||||
return data.vchats();
|
||||
});
|
||||
_session->data().applyMaximumChatVersions(chats);
|
||||
_session->data().processChats(chats);
|
||||
};
|
||||
if (const auto user = peer->asUser()) {
|
||||
return request(MTPusers_GetUsers(
|
||||
MTP_vector<MTPInputUser>(1, user->inputUser)
|
||||
)).done([=](const MTPVector<MTPUser> &result) {
|
||||
_peerRequests.remove(user);
|
||||
_session->data().processUsers(result);
|
||||
}).fail(failHandler).send();
|
||||
} else if (const auto chat = peer->asChat()) {
|
||||
return request(MTPmessages_GetChats(
|
||||
MTP_vector<MTPlong>(1, chat->inputChat)
|
||||
)).done(chatHandler).fail(failHandler).send();
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
return request(MTPchannels_GetChannels(
|
||||
MTP_vector<MTPInputChannel>(1, channel->inputChannel)
|
||||
)).done(chatHandler).fail(failHandler).send();
|
||||
}
|
||||
Unexpected("Peer type in requestPeer.");
|
||||
}();
|
||||
_peerRequests.emplace(peer, requestId);
|
||||
}
|
||||
|
||||
void ApiWrap::requestPeerSettings(not_null<PeerData*> peer) {
|
||||
if (!_requestedPeerSettings.emplace(peer).second) {
|
||||
return;
|
||||
@@ -1311,51 +1287,6 @@ void ApiWrap::markContentsRead(not_null<HistoryItem*> item) {
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::requestPeers(const QList<PeerData*> &peers) {
|
||||
QVector<MTPlong> chats;
|
||||
QVector<MTPInputChannel> channels;
|
||||
QVector<MTPInputUser> users;
|
||||
chats.reserve(peers.size());
|
||||
channels.reserve(peers.size());
|
||||
users.reserve(peers.size());
|
||||
for (const auto peer : peers) {
|
||||
if (!peer
|
||||
|| _fullPeerRequests.contains(peer)
|
||||
|| _peerRequests.contains(peer)) {
|
||||
continue;
|
||||
}
|
||||
if (const auto user = peer->asUser()) {
|
||||
users.push_back(user->inputUser);
|
||||
} else if (const auto chat = peer->asChat()) {
|
||||
chats.push_back(chat->inputChat);
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
channels.push_back(channel->inputChannel);
|
||||
}
|
||||
}
|
||||
const auto handleChats = [=](const MTPmessages_Chats &result) {
|
||||
_session->data().processChats(result.match([](const auto &data) {
|
||||
return data.vchats();
|
||||
}));
|
||||
};
|
||||
if (!chats.isEmpty()) {
|
||||
request(MTPmessages_GetChats(
|
||||
MTP_vector<MTPlong>(chats)
|
||||
)).done(handleChats).send();
|
||||
}
|
||||
if (!channels.isEmpty()) {
|
||||
request(MTPchannels_GetChannels(
|
||||
MTP_vector<MTPInputChannel>(channels)
|
||||
)).done(handleChats).send();
|
||||
}
|
||||
if (!users.isEmpty()) {
|
||||
request(MTPusers_GetUsers(
|
||||
MTP_vector<MTPInputUser>(users)
|
||||
)).done([=](const MTPVector<MTPUser> &result) {
|
||||
_session->data().processUsers(result);
|
||||
}).send();
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::deleteAllFromParticipant(
|
||||
not_null<ChannelData*> channel,
|
||||
not_null<PeerData*> from) {
|
||||
@@ -1559,6 +1490,8 @@ void ApiWrap::saveStickerSets(
|
||||
if (!archived) {
|
||||
const auto featured = !!(set->flags & Flag::Featured);
|
||||
const auto special = !!(set->flags & Flag::Special);
|
||||
const auto emoji = !!(set->flags & Flag::Emoji);
|
||||
const auto locked = (set->locked > 0);
|
||||
const auto setId = set->mtpInput();
|
||||
|
||||
auto requestId = request(MTPmessages_UninstallStickerSet(
|
||||
@@ -1575,7 +1508,7 @@ void ApiWrap::saveStickerSets(
|
||||
if (removeIndex >= 0) {
|
||||
orderRef.removeAt(removeIndex);
|
||||
}
|
||||
if (!featured && !special) {
|
||||
if (!featured && !special && !emoji && !locked) {
|
||||
sets.erase(it);
|
||||
} else {
|
||||
if (archived) {
|
||||
@@ -1642,7 +1575,9 @@ void ApiWrap::saveStickerSets(
|
||||
if ((set->flags & Flag::Featured)
|
||||
|| (set->flags & Flag::Installed)
|
||||
|| (set->flags & Flag::Archived)
|
||||
|| (set->flags & Flag::Special)) {
|
||||
|| (set->flags & Flag::Special)
|
||||
|| (set->flags & Flag::Emoji)
|
||||
|| (set->locked > 0)) {
|
||||
++it;
|
||||
} else {
|
||||
it = sets.erase(it);
|
||||
@@ -3191,7 +3126,7 @@ void ApiWrap::forwardMessages(
|
||||
? PeerId(0)
|
||||
: self->id;
|
||||
const auto messagePostAuthor = peer->isBroadcast()
|
||||
? self->name
|
||||
? self->name()
|
||||
: QString();
|
||||
history->addNewLocalMessage(
|
||||
newId.msg,
|
||||
@@ -3274,7 +3209,7 @@ void ApiWrap::sendSharedContact(
|
||||
? PeerId()
|
||||
: _session->userPeerId();
|
||||
const auto messagePostAuthor = peer->isBroadcast()
|
||||
? _session->user()->name
|
||||
? _session->user()->name()
|
||||
: QString();
|
||||
const auto viaBotId = UserId();
|
||||
const auto item = history->addNewLocalMessage(
|
||||
@@ -3537,7 +3472,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||
sendFlags |= MTPmessages_SendMessage::Flag::f_send_as;
|
||||
}
|
||||
const auto messagePostAuthor = peer->isBroadcast()
|
||||
? _session->user()->name
|
||||
? _session->user()->name()
|
||||
: QString();
|
||||
if (action.options.scheduled) {
|
||||
flags |= MessageFlag::IsOrWasScheduled;
|
||||
@@ -3685,7 +3620,7 @@ void ApiWrap::sendInlineResult(
|
||||
sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_send_as;
|
||||
}
|
||||
const auto messagePostAuthor = peer->isBroadcast()
|
||||
? _session->user()->name
|
||||
? _session->user()->name()
|
||||
: QString();
|
||||
|
||||
_session->data().registerMessageRandomId(randomId, newId);
|
||||
|
||||
@@ -171,11 +171,9 @@ public:
|
||||
void requestWallPaper(
|
||||
const QString &slug,
|
||||
Fn<void(const Data::WallPaper &)> done,
|
||||
Fn<void(const MTP::Error &)> fail);
|
||||
Fn<void()> fail);
|
||||
|
||||
void requestFullPeer(not_null<PeerData*> peer);
|
||||
void requestPeer(not_null<PeerData*> peer);
|
||||
void requestPeers(const QList<PeerData*> &peers);
|
||||
void requestPeerSettings(not_null<PeerData*> peer);
|
||||
|
||||
using UpdatedFileReferences = Data::UpdatedFileReferences;
|
||||
@@ -195,7 +193,7 @@ public:
|
||||
void refreshTopPromotion();
|
||||
void requestDeepLinkInfo(
|
||||
const QString &path,
|
||||
Fn<void(const MTPDhelp_deepLinkInfo &result)> callback);
|
||||
Fn<void(TextWithEntities message, bool updateRequired)> callback);
|
||||
void requestTermsUpdate();
|
||||
void acceptTerms(bytes::const_span termsId);
|
||||
|
||||
@@ -343,6 +341,11 @@ public:
|
||||
not_null<PeerData*> peer,
|
||||
uint64 randomId = 0,
|
||||
FullMsgId itemId = FullMsgId());
|
||||
void sendMessageFail(
|
||||
const QString &error,
|
||||
not_null<PeerData*> peer,
|
||||
uint64 randomId = 0,
|
||||
FullMsgId itemId = FullMsgId());
|
||||
|
||||
void reloadContactSignupSilent();
|
||||
rpl::producer<bool> contactSignupSilent() const;
|
||||
@@ -533,7 +536,6 @@ private:
|
||||
|
||||
using PeerRequests = base::flat_map<PeerData*, mtpRequestId>;
|
||||
PeerRequests _fullPeerRequests;
|
||||
PeerRequests _peerRequests;
|
||||
base::flat_set<not_null<PeerData*>> _requestedPeerSettings;
|
||||
|
||||
base::flat_map<
|
||||
@@ -616,8 +618,6 @@ private:
|
||||
mtpRequestId _termsUpdateRequestId = 0;
|
||||
|
||||
mtpRequestId _checkInviteRequestId = 0;
|
||||
FnMut<void(const MTPChatInvite &result)> _checkInviteDone;
|
||||
Fn<void(const MTP::Error &error)> _checkInviteFail;
|
||||
|
||||
struct MigrateCallbacks {
|
||||
FnMut<void(not_null<ChannelData*>)> done;
|
||||
@@ -627,8 +627,6 @@ private:
|
||||
not_null<PeerData*>,
|
||||
std::vector<MigrateCallbacks>> _migrateCallbacks;
|
||||
|
||||
std::vector<FnMut<void(const MTPUser &)>> _supportContactCallbacks;
|
||||
|
||||
struct {
|
||||
mtpRequestId requestId = 0;
|
||||
QString requestedText;
|
||||
@@ -656,7 +654,7 @@ private:
|
||||
mtpRequestId _wallPaperRequestId = 0;
|
||||
QString _wallPaperSlug;
|
||||
Fn<void(const Data::WallPaper &)> _wallPaperDone;
|
||||
Fn<void(const MTP::Error &)> _wallPaperFail;
|
||||
Fn<void()> _wallPaperFail;
|
||||
|
||||
mtpRequestId _contactSignupSilentRequestId = 0;
|
||||
std::optional<bool> _contactSignupSilent;
|
||||
|
||||
@@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/unread_badge.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "ui/painter.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_user.h"
|
||||
@@ -269,7 +270,7 @@ void AddContactBox::setInnerFocus() {
|
||||
void AddContactBox::paintEvent(QPaintEvent *e) {
|
||||
BoxContent::paintEvent(e);
|
||||
|
||||
Painter p(this);
|
||||
auto p = QPainter(this);
|
||||
if (_retrying) {
|
||||
p.setPen(st::boxTextFg);
|
||||
p.setFont(st::boxTextFont);
|
||||
@@ -897,10 +898,10 @@ void SetupChannelBox::prepare() {
|
||||
}
|
||||
|
||||
void SetupChannelBox::setInnerFocus() {
|
||||
if (_link->isHidden()) {
|
||||
setFocus();
|
||||
} else {
|
||||
if (!_link->isHidden()) {
|
||||
_link->setFocusFast();
|
||||
} else {
|
||||
BoxContent::setInnerFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1091,7 +1092,7 @@ void SetupChannelBox::save() {
|
||||
MTP_string(_sentUsername)
|
||||
)).done([=] {
|
||||
_channel->setName(
|
||||
TextUtilities::SingleLine(_channel->name),
|
||||
TextUtilities::SingleLine(_channel->name()),
|
||||
_sentUsername);
|
||||
closeBox();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
@@ -1164,7 +1165,7 @@ void SetupChannelBox::handleChange() {
|
||||
|
||||
void SetupChannelBox::check() {
|
||||
if (_checkRequestId) {
|
||||
_channel->session().api().request(_checkRequestId).cancel();
|
||||
_api.request(_checkRequestId).cancel();
|
||||
}
|
||||
const auto link = _link->text().trimmed();
|
||||
if (link.size() >= Ui::EditPeer::kMinUsernameLength) {
|
||||
@@ -1239,7 +1240,7 @@ void SetupChannelBox::updateFail(UsernameResult result) {
|
||||
if ((result == UsernameResult::Ok)
|
||||
|| (_sentUsername == _channel->username)) {
|
||||
_channel->setName(
|
||||
TextUtilities::SingleLine(_channel->name),
|
||||
TextUtilities::SingleLine(_channel->name()),
|
||||
TextUtilities::SingleLine(_sentUsername));
|
||||
closeBox();
|
||||
} else if (result == UsernameResult::Invalid) {
|
||||
|
||||
@@ -111,7 +111,7 @@ private:
|
||||
void requestPapers();
|
||||
void sortPapers();
|
||||
void paintPaper(
|
||||
Painter &p,
|
||||
QPainter &p,
|
||||
const Paper &paper,
|
||||
int column,
|
||||
int row) const;
|
||||
@@ -289,7 +289,7 @@ void BackgroundBox::Inner::resizeToContentAndPreload() {
|
||||
|
||||
void BackgroundBox::Inner::paintEvent(QPaintEvent *e) {
|
||||
QRect r(e->rect());
|
||||
Painter p(this);
|
||||
auto p = QPainter(this);
|
||||
|
||||
if (_papers.empty()) {
|
||||
p.setFont(st::noContactsFont);
|
||||
@@ -361,7 +361,7 @@ void BackgroundBox::Inner::validatePaperThumbnail(
|
||||
}
|
||||
|
||||
void BackgroundBox::Inner::paintPaper(
|
||||
Painter &p,
|
||||
QPainter &p,
|
||||
const Paper &paper,
|
||||
int column,
|
||||
int row) const {
|
||||
|
||||
@@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_message.h"
|
||||
@@ -357,7 +358,8 @@ void BackgroundPreviewBox::paintTexts(Painter &p, crl::time ms) {
|
||||
auto context = _controller->defaultChatTheme()->preparePaintContext(
|
||||
_chatStyle.get(),
|
||||
rect(),
|
||||
rect());
|
||||
rect(),
|
||||
_controller->isGifPausedAtLeastFor(Window::GifPauseReason::Layer));
|
||||
p.translate(0, textsTop());
|
||||
paintDate(p);
|
||||
|
||||
@@ -552,7 +554,7 @@ bool BackgroundPreviewBox::Start(
|
||||
controller->show(Box<BackgroundPreviewBox>(
|
||||
controller,
|
||||
result.withUrlParams(params)));
|
||||
}), crl::guard(controller, [=](const MTP::Error &error) {
|
||||
}), crl::guard(controller, [=] {
|
||||
controller->show(Ui::MakeInformBox(tr::lng_background_bad_link()));
|
||||
}));
|
||||
return true;
|
||||
|
||||
@@ -215,6 +215,11 @@ void ChangePhone::EnterPhone::sendPhoneDone(
|
||||
return data;
|
||||
});
|
||||
|
||||
const auto bad = [&](const char *type) {
|
||||
LOG(("API Error: Should not be '%1'.").arg(type));
|
||||
showError(Lang::Hard::ServerError());
|
||||
return false;
|
||||
};
|
||||
auto codeLength = 0;
|
||||
const auto hasLength = data.vtype().match([&](
|
||||
const MTPDauth_sentCodeTypeApp &typeData) {
|
||||
@@ -227,14 +232,14 @@ void ChangePhone::EnterPhone::sendPhoneDone(
|
||||
}, [&](const MTPDauth_sentCodeTypeCall &typeData) {
|
||||
codeLength = typeData.vlength().v;
|
||||
return true;
|
||||
}, [&](const MTPDauth_sentCodeTypeFlashCall &typeData) {
|
||||
LOG(("Error: should not be flashcall!"));
|
||||
showError(Lang::Hard::ServerError());
|
||||
return false;
|
||||
}, [&](const MTPDauth_sentCodeTypeMissedCall &data) {
|
||||
LOG(("Error: should not be missedcall!"));
|
||||
showError(Lang::Hard::ServerError());
|
||||
return false;
|
||||
}, [&](const MTPDauth_sentCodeTypeFlashCall &) {
|
||||
return bad("FlashCall");
|
||||
}, [&](const MTPDauth_sentCodeTypeMissedCall &) {
|
||||
return bad("MissedCall");
|
||||
}, [&](const MTPDauth_sentCodeTypeEmailCode &) {
|
||||
return bad("EmailCode");
|
||||
}, [&](const MTPDauth_sentCodeTypeSetUpEmailRequired &) {
|
||||
return bad("SetUpEmailRequired");
|
||||
});
|
||||
if (!hasLength) {
|
||||
return;
|
||||
|
||||
@@ -69,7 +69,7 @@ void ChangeFilterById(
|
||||
MTP_flags(MTPmessages_UpdateDialogFilter::Flag::f_filter),
|
||||
MTP_int(filter.id()),
|
||||
filter.tl()
|
||||
)).done([=, chat = history->peer->name, filterName = filter.title()] {
|
||||
)).done([=, chat = history->peer->name(), name = filter.title()]{
|
||||
// Since only the primary window has dialogs list,
|
||||
// We can safely show toast there.
|
||||
if (const auto controller = Core::App().primaryWindow()) {
|
||||
@@ -80,7 +80,7 @@ void ChangeFilterById(
|
||||
lt_chat,
|
||||
Ui::Text::Bold(chat),
|
||||
lt_folder,
|
||||
Ui::Text::Bold(filterName),
|
||||
Ui::Text::Bold(name),
|
||||
Ui::Text::WithEntities);
|
||||
Ui::Toast::Show(
|
||||
Window::Show(controller).toastParent(),
|
||||
|
||||
@@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/basic_click_handlers.h"
|
||||
#include "ui/painter.h"
|
||||
#include "boxes/abstract_box.h" // Ui::show().
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
@@ -120,20 +120,29 @@ void DeleteMessagesBox::prepare() {
|
||||
: peer->isSelf()
|
||||
? tr::lng_sure_delete_saved_messages(tr::now)
|
||||
: peer->isUser()
|
||||
? tr::lng_sure_delete_history(tr::now, lt_contact, peer->name)
|
||||
? tr::lng_sure_delete_history(
|
||||
tr::now,
|
||||
lt_contact,
|
||||
peer->name())
|
||||
: tr::lng_sure_delete_group_history(
|
||||
tr::now,
|
||||
lt_group,
|
||||
peer->name);
|
||||
peer->name());
|
||||
details = Ui::Text::RichLangValue(details.text);
|
||||
deleteStyle = &st::attentionBoxButton;
|
||||
} else {
|
||||
details.text = peer->isSelf()
|
||||
? tr::lng_sure_delete_saved_messages(tr::now)
|
||||
: peer->isUser()
|
||||
? tr::lng_sure_delete_history(tr::now, lt_contact, peer->name)
|
||||
? tr::lng_sure_delete_history(
|
||||
tr::now,
|
||||
lt_contact,
|
||||
peer->name())
|
||||
: peer->isChat()
|
||||
? tr::lng_sure_delete_and_exit(tr::now, lt_group, peer->name)
|
||||
? tr::lng_sure_delete_and_exit(
|
||||
tr::now,
|
||||
lt_group,
|
||||
peer->name())
|
||||
: peer->isMegagroup()
|
||||
? tr::lng_sure_leave_group(tr::now)
|
||||
: tr::lng_sure_leave_channel(tr::now);
|
||||
@@ -189,7 +198,7 @@ void DeleteMessagesBox::prepare() {
|
||||
tr::lng_delete_all_from_user(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(_moderateFrom->name),
|
||||
Ui::Text::Bold(_moderateFrom->name()),
|
||||
Ui::Text::WithEntities),
|
||||
false,
|
||||
st::defaultBoxCheckbox);
|
||||
|
||||
@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "apiwrap.h"
|
||||
#include "base/event_filter.h"
|
||||
#include "boxes/premium_limits_box.h"
|
||||
#include "boxes/premium_preview_box.h"
|
||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||
#include "chat_helpers/message_field.h"
|
||||
#include "chat_helpers/tabbed_panel.h"
|
||||
@@ -25,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_premium_limits.h"
|
||||
#include "data/stickers/data_stickers.h"
|
||||
#include "data/stickers/data_custom_emoji.h"
|
||||
#include "editor/photo_editor_layer_widget.h"
|
||||
#include "history/history_drag_area.h"
|
||||
@@ -46,6 +48,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/effects/scroll_content_shadow.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
@@ -67,7 +70,7 @@ auto ListFromMimeData(not_null<const QMimeData*> data, bool premium) {
|
||||
auto result = data->hasUrls()
|
||||
? Storage::PrepareMediaList(
|
||||
// When we edit media, we need only 1 file.
|
||||
data->urls().mid(0, 1),
|
||||
base::GetMimeUrls(data).mid(0, 1),
|
||||
st::sendMediaPreviewSize,
|
||||
premium)
|
||||
: Ui::PreparedList(Error::EmptyFile, QString());
|
||||
@@ -128,8 +131,7 @@ EditCaptionBox::EditCaptionBox(
|
||||
this,
|
||||
st::confirmCaptionArea,
|
||||
Ui::InputField::Mode::MultiLine,
|
||||
tr::lng_photo_caption(),
|
||||
PrepareEditText(item)))
|
||||
tr::lng_photo_caption()))
|
||||
, _emojiToggle(base::make_unique_q<Ui::EmojiButton>(
|
||||
this,
|
||||
st::boxAttachEmoji)) {
|
||||
@@ -153,6 +155,7 @@ void EditCaptionBox::prepare() {
|
||||
|
||||
setupField();
|
||||
setupEmojiPanel();
|
||||
setInitialText();
|
||||
|
||||
rebuildPreview();
|
||||
setupEditEventHandler();
|
||||
@@ -280,7 +283,12 @@ void EditCaptionBox::setupField() {
|
||||
}
|
||||
Unexpected("Action in MimeData hook.");
|
||||
});
|
||||
}
|
||||
|
||||
void EditCaptionBox::setInitialText() {
|
||||
_field->setTextWithTags(
|
||||
PrepareEditText(_historyItem),
|
||||
Ui::InputField::HistoryAction::Clear);
|
||||
auto cursor = _field->textCursor();
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
_field->setTextCursor(cursor);
|
||||
@@ -497,14 +505,22 @@ void EditCaptionBox::setupEmojiPanel() {
|
||||
_emojiPanel->hide();
|
||||
_emojiPanel->selector()->setCurrentPeer(_historyItem->history()->peer);
|
||||
_emojiPanel->selector()->emojiChosen(
|
||||
) | rpl::start_with_next([=](EmojiPtr emoji) {
|
||||
Ui::InsertEmojiAtCursor(_field->textCursor(), emoji);
|
||||
) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) {
|
||||
Ui::InsertEmojiAtCursor(_field->textCursor(), data.emoji);
|
||||
}, lifetime());
|
||||
_emojiPanel->selector()->customEmojiChosen(
|
||||
) | rpl::start_with_next([=](Selector::FileChosen data) {
|
||||
Data::InsertCustomEmoji(_field.get(), data.document);
|
||||
) | rpl::start_with_next([=](ChatHelpers::FileChosen data) {
|
||||
const auto info = data.document->sticker();
|
||||
if (info
|
||||
&& info->setType == Data::StickersType::Emoji
|
||||
&& !_controller->session().premium()) {
|
||||
ShowPremiumPreviewBox(
|
||||
_controller,
|
||||
PremiumPreview::AnimatedEmoji);
|
||||
} else {
|
||||
Data::InsertCustomEmoji(_field.get(), data.document);
|
||||
}
|
||||
}, lifetime());
|
||||
_emojiPanel->selector()->showPromoForPremiumEmoji();
|
||||
|
||||
const auto filterCallback = [=](not_null<QEvent*> event) {
|
||||
emojiFilterForGeometry(event);
|
||||
@@ -723,20 +739,19 @@ void EditCaptionBox::save() {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto done = crl::guard(this, [=](const MTPUpdates &updates) {
|
||||
const auto done = crl::guard(this, [=] {
|
||||
_saveRequestId = 0;
|
||||
closeBox();
|
||||
});
|
||||
|
||||
const auto fail = crl::guard(this, [=](const MTP::Error &error) {
|
||||
const auto fail = crl::guard(this, [=](const QString &error) {
|
||||
_saveRequestId = 0;
|
||||
const auto &type = error.type();
|
||||
if (ranges::contains(Api::kDefaultEditMessagesErrors, type)) {
|
||||
if (ranges::contains(Api::kDefaultEditMessagesErrors, error)) {
|
||||
_error = tr::lng_edit_error(tr::now);
|
||||
update();
|
||||
} else if (type == u"MESSAGE_NOT_MODIFIED"_q) {
|
||||
} else if (error == u"MESSAGE_NOT_MODIFIED"_q) {
|
||||
closeBox();
|
||||
} else if (type == u"MESSAGE_EMPTY"_q) {
|
||||
} else if (error == u"MESSAGE_EMPTY"_q) {
|
||||
_field->setFocus();
|
||||
_field->showError();
|
||||
update();
|
||||
|
||||
@@ -52,6 +52,7 @@ private:
|
||||
void setupPhotoEditorEventHandler();
|
||||
void setupField();
|
||||
void setupControls();
|
||||
void setInitialText();
|
||||
|
||||
void updateBoxSize();
|
||||
void captionResized();
|
||||
|
||||
@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/widgets/shadow.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "styles/style_boxes.h"
|
||||
@@ -72,7 +73,7 @@ QCursor EditColorBox::Picker::generateCursor() {
|
||||
cursor.setDevicePixelRatio(cRetinaFactor());
|
||||
cursor.fill(Qt::transparent);
|
||||
{
|
||||
Painter p(&cursor);
|
||||
auto p = QPainter(&cursor);
|
||||
PainterHighQualityEnabler hq(p);
|
||||
|
||||
p.setBrush(Qt::NoBrush);
|
||||
@@ -102,7 +103,7 @@ EditColorBox::Picker::Picker(QWidget *parent, Mode mode, QColor color)
|
||||
}
|
||||
|
||||
void EditColorBox::Picker::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
auto p = QPainter(this);
|
||||
|
||||
preparePalette();
|
||||
|
||||
@@ -360,7 +361,7 @@ void EditColorBox::Slider::prepareMinSize() {
|
||||
}
|
||||
|
||||
void EditColorBox::Slider::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
auto p = QPainter(this);
|
||||
auto to = rect().marginsRemoved(QMargins(st::colorSliderSkip, st::colorSliderSkip, st::colorSliderSkip, st::colorSliderSkip));
|
||||
Ui::Shadow::paint(p, to, width(), st::defaultRoundShadow);
|
||||
if (_type == Type::Opacity) {
|
||||
@@ -573,7 +574,7 @@ public:
|
||||
|
||||
protected:
|
||||
void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) override;
|
||||
void paintAdditionalPlaceholder(Painter &p) override;
|
||||
void paintAdditionalPlaceholder(QPainter &p) override;
|
||||
|
||||
void wheelEvent(QWheelEvent *e) override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
@@ -632,7 +633,7 @@ void EditColorBox::Field::correctValue(const QString &was, int wasCursor, QStrin
|
||||
}
|
||||
}
|
||||
|
||||
void EditColorBox::Field::paintAdditionalPlaceholder(Painter &p) {
|
||||
void EditColorBox::Field::paintAdditionalPlaceholder(QPainter &p) {
|
||||
p.setFont(_st.font);
|
||||
p.setPen(_st.placeholderFg);
|
||||
auto inner = QRect(_st.textMargins.right(), _st.textMargins.top(), width() - 2 * _st.textMargins.right(), height() - _st.textMargins.top() - _st.textMargins.bottom());
|
||||
@@ -696,7 +697,7 @@ public:
|
||||
|
||||
protected:
|
||||
void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) override;
|
||||
void paintAdditionalPlaceholder(Painter &p) override;
|
||||
void paintAdditionalPlaceholder(QPainter &p) override;
|
||||
|
||||
};
|
||||
|
||||
@@ -737,7 +738,7 @@ void EditColorBox::ResultField::correctValue(const QString &was, int wasCursor,
|
||||
}
|
||||
}
|
||||
|
||||
void EditColorBox::ResultField::paintAdditionalPlaceholder(Painter &p) {
|
||||
void EditColorBox::ResultField::paintAdditionalPlaceholder(QPainter &p) {
|
||||
p.setFont(_st.font);
|
||||
p.setPen(_st.placeholderFg);
|
||||
p.drawText(QRect(_st.textMargins.right(), _st.textMargins.top(), width(), height() - _st.textMargins.top() - _st.textMargins.bottom()), "#", style::al_topleft);
|
||||
|
||||
@@ -11,11 +11,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/effects/panel_animation.h"
|
||||
#include "ui/filter_icons.h"
|
||||
#include "ui/filter_icon_panel.h"
|
||||
#include "ui/painter.h"
|
||||
#include "data/data_chat_filters.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "data/data_peer_values.h" // Data::AmPremiumValue.
|
||||
@@ -82,6 +84,7 @@ private:
|
||||
struct PeerButton {
|
||||
not_null<History*> history;
|
||||
std::shared_ptr<Data::CloudImageView> userpic;
|
||||
Ui::Text::String name;
|
||||
Button button;
|
||||
};
|
||||
|
||||
@@ -208,7 +211,7 @@ int FilterChatsPreview::resizeGetHeight(int newWidth) {
|
||||
for (const auto &[flag, button] : _removeFlag) {
|
||||
moveNextButton(button.get());
|
||||
}
|
||||
for (const auto &[history, userpic, button] : _removePeer) {
|
||||
for (const auto &[history, userpic, name, button] : _removePeer) {
|
||||
moveNextButton(button.get());
|
||||
}
|
||||
return top;
|
||||
@@ -240,7 +243,7 @@ void FilterChatsPreview::paintEvent(QPaintEvent *e) {
|
||||
FilterChatsTypeName(flag));
|
||||
top += st.height;
|
||||
}
|
||||
for (auto &[history, userpic, button] : _removePeer) {
|
||||
for (auto &[history, userpic, name, button] : _removePeer) {
|
||||
const auto savedMessages = history->peer->isSelf();
|
||||
const auto repliesMessages = history->peer->isRepliesChat();
|
||||
if (savedMessages || repliesMessages) {
|
||||
@@ -276,7 +279,13 @@ void FilterChatsPreview::paintEvent(QPaintEvent *e) {
|
||||
width(),
|
||||
st.photoSize);
|
||||
p.setPen(st::contactsNameFg);
|
||||
history->peer->nameText().drawLeftElided(
|
||||
if (name.isEmpty()) {
|
||||
name.setText(
|
||||
st::msgNameStyle,
|
||||
history->peer->name(),
|
||||
Ui::NameTextOptions());
|
||||
}
|
||||
name.drawLeftElided(
|
||||
p,
|
||||
nameLeft,
|
||||
top + nameTop,
|
||||
|
||||
@@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/painter.h"
|
||||
#include "main/main_app_config.h"
|
||||
#include "main/main_account.h"
|
||||
#include "main/main_session.h"
|
||||
@@ -125,7 +126,7 @@ QString TypeRow::generateShortName() {
|
||||
|
||||
PaintRoundImageCallback TypeRow::generatePaintUserpicCallback() {
|
||||
const auto flag = this->flag();
|
||||
return [=](Painter &p, int x, int y, int outerWidth, int size) {
|
||||
return [=](QPainter &p, int x, int y, int outerWidth, int size) {
|
||||
PaintFilterChatsTypeIcon(p, flag, x, y, outerWidth, size);
|
||||
};
|
||||
}
|
||||
@@ -241,7 +242,7 @@ auto TypeController::rowSelectionChanges() const
|
||||
}
|
||||
|
||||
void PaintFilterChatsTypeIcon(
|
||||
Painter &p,
|
||||
QPainter &p,
|
||||
Data::ChatFilter::Flag flag,
|
||||
int x,
|
||||
int y,
|
||||
|
||||
@@ -28,7 +28,7 @@ class Painter;
|
||||
|
||||
[[nodiscard]] QString FilterChatsTypeName(Data::ChatFilter::Flag flag);
|
||||
void PaintFilterChatsTypeIcon(
|
||||
Painter &p,
|
||||
QPainter &p,
|
||||
Data::ChatFilter::Flag flag,
|
||||
int x,
|
||||
int y,
|
||||
|
||||
@@ -8,19 +8,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/gift_premium_box.h"
|
||||
|
||||
#include "apiwrap.h"
|
||||
#include "api/api_premium_option.h"
|
||||
#include "base/weak_ptr.h"
|
||||
#include "core/click_handler_types.h" // ClickHandlerContext.
|
||||
#include "core/local_url_handlers.h" // TryConvertUrlToLocal.
|
||||
#include "data/data_changes.h"
|
||||
#include "data/data_peer_values.h" // Data::PeerPremiumValue.
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_subscription_option.h"
|
||||
#include "data/data_user.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_session.h"
|
||||
#include "settings/settings_premium.h"
|
||||
#include "ui/basic_click_handlers.h" // UrlClickHandler::Open.
|
||||
#include "ui/effects/premium_graphics.h"
|
||||
#include "ui/effects/premium_stars.h"
|
||||
#include "ui/effects/premium_stars_colored.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "ui/text/format_values.h"
|
||||
@@ -39,11 +39,8 @@ namespace {
|
||||
|
||||
constexpr auto kDiscountDivider = 5.;
|
||||
|
||||
struct GiftOption final {
|
||||
QString url;
|
||||
Ui::Premium::GiftInfo info;
|
||||
};
|
||||
using GiftOptions = std::vector<GiftOption>;
|
||||
using GiftOption = Data::SubscriptionOption;
|
||||
using GiftOptions = Data::SubscriptionOptions;
|
||||
|
||||
GiftOptions GiftOptionFromTL(const MTPDuserFull &data) {
|
||||
auto result = GiftOptions();
|
||||
@@ -51,115 +48,16 @@ GiftOptions GiftOptionFromTL(const MTPDuserFull &data) {
|
||||
if (!gifts) {
|
||||
return result;
|
||||
}
|
||||
const auto monthlyAmount = [&] {
|
||||
const auto &min = ranges::min_element(
|
||||
gifts->v,
|
||||
ranges::less(),
|
||||
[](const MTPPremiumGiftOption &o) { return o.data().vamount().v; }
|
||||
)->data();
|
||||
return min.vamount().v / float64(min.vmonths().v);
|
||||
}();
|
||||
result.reserve(gifts->v.size());
|
||||
for (const auto &gift : gifts->v) {
|
||||
const auto &option = gift.data();
|
||||
const auto botUrl = qs(option.vbot_url());
|
||||
const auto months = option.vmonths().v;
|
||||
const auto amount = option.vamount().v;
|
||||
const auto currency = qs(option.vcurrency());
|
||||
const auto discount = [&] {
|
||||
const auto percent = monthlyAmount * months / float64(amount)
|
||||
- 1.;
|
||||
return std::round(percent * 100. / kDiscountDivider)
|
||||
* kDiscountDivider;
|
||||
}();
|
||||
auto info = Ui::Premium::GiftInfo{
|
||||
.duration = Ui::FormatTTL(months * 86400 * 31),
|
||||
.discount = discount
|
||||
? QString::fromUtf8("\xe2\x88\x92%1%").arg(discount)
|
||||
: QString(),
|
||||
.perMonth = tr::lng_premium_gift_per(
|
||||
tr::now,
|
||||
lt_cost,
|
||||
Ui::FillAmountAndCurrency(
|
||||
amount / float64(months),
|
||||
currency)),
|
||||
.total = Ui::FillAmountAndCurrency(amount, currency),
|
||||
};
|
||||
result.push_back({ .url = botUrl, .info = std::move(info) });
|
||||
result = Api::SubscriptionOptionsFromTL(gifts->v);
|
||||
for (auto &option : result) {
|
||||
option.costPerMonth = tr::lng_premium_gift_per(
|
||||
tr::now,
|
||||
lt_cost,
|
||||
option.costPerMonth);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
class ColoredMiniStars final {
|
||||
public:
|
||||
ColoredMiniStars(not_null<Ui::RpWidget*> parent);
|
||||
|
||||
void setSize(const QSize &size);
|
||||
void setPosition(QPoint position);
|
||||
void paint(Painter &p);
|
||||
|
||||
private:
|
||||
Ui::Premium::MiniStars _ministars;
|
||||
QRectF _ministarsRect;
|
||||
QImage _frame;
|
||||
QImage _mask;
|
||||
QSize _size;
|
||||
QPoint _position;
|
||||
|
||||
};
|
||||
|
||||
ColoredMiniStars::ColoredMiniStars(not_null<Ui::RpWidget*> parent)
|
||||
: _ministars([=](const QRect &r) {
|
||||
parent->update(r.translated(_position));
|
||||
}, true) {
|
||||
}
|
||||
|
||||
void ColoredMiniStars::setSize(const QSize &size) {
|
||||
_frame = QImage(
|
||||
size * style::DevicePixelRatio(),
|
||||
QImage::Format_ARGB32_Premultiplied);
|
||||
_frame.setDevicePixelRatio(style::DevicePixelRatio());
|
||||
|
||||
_mask = _frame;
|
||||
_mask.fill(Qt::transparent);
|
||||
{
|
||||
Painter p(&_mask);
|
||||
auto gradient = QLinearGradient(0, 0, size.width(), 0);
|
||||
gradient.setStops(Ui::Premium::GiftGradientStops());
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(gradient);
|
||||
p.drawRect(0, 0, size.width(), size.height());
|
||||
}
|
||||
|
||||
_size = size;
|
||||
|
||||
{
|
||||
const auto s = _size / Ui::Premium::MiniStars::kSizeFactor;
|
||||
const auto margins = QMarginsF(
|
||||
s.width() / 2.,
|
||||
s.height() / 2.,
|
||||
s.width() / 2.,
|
||||
s.height() / 2.);
|
||||
_ministarsRect = QRectF(QPointF(), _size) - margins;
|
||||
}
|
||||
}
|
||||
|
||||
void ColoredMiniStars::setPosition(QPoint position) {
|
||||
_position = std::move(position);
|
||||
}
|
||||
|
||||
void ColoredMiniStars::paint(Painter &p) {
|
||||
_frame.fill(Qt::transparent);
|
||||
{
|
||||
Painter q(&_frame);
|
||||
_ministars.paint(q, _ministarsRect);
|
||||
q.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
q.drawImage(0, 0, _mask);
|
||||
}
|
||||
|
||||
p.drawImage(_position, _frame);
|
||||
}
|
||||
|
||||
void GiftBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Window::SessionController*> controller,
|
||||
@@ -182,6 +80,7 @@ void GiftBox(
|
||||
+ userpicPadding.bottom()
|
||||
+ st::defaultUserpicButton.size.height()));
|
||||
|
||||
using ColoredMiniStars = Ui::Premium::ColoredMiniStars;
|
||||
const auto stars = box->lifetime().make_state<ColoredMiniStars>(top);
|
||||
|
||||
const auto userpic = Ui::CreateChild<Ui::UserpicButton>(
|
||||
@@ -209,7 +108,7 @@ void GiftBox(
|
||||
|
||||
top->paintRequest(
|
||||
) | rpl::start_with_next([=](const QRect &r) {
|
||||
Painter p(top);
|
||||
auto p = QPainter(top);
|
||||
|
||||
p.fillRect(r, Qt::transparent);
|
||||
stars->paint(p);
|
||||
@@ -263,17 +162,14 @@ void GiftBox(
|
||||
auto text = tr::lng_premium_gift_button(
|
||||
tr::now,
|
||||
lt_cost,
|
||||
options[value].info.total);
|
||||
options[value].costTotal);
|
||||
state->buttonText.fire(std::move(text));
|
||||
});
|
||||
Ui::Premium::AddGiftOptions(
|
||||
buttonsParent,
|
||||
group,
|
||||
ranges::views::all(
|
||||
options
|
||||
) | ranges::views::transform([](const GiftOption &option) {
|
||||
return option.info;
|
||||
}) | ranges::to_vector);
|
||||
options,
|
||||
st::premiumGiftOption);
|
||||
|
||||
// Footer.
|
||||
auto terms = object_ptr<Ui::FlatLabel>(
|
||||
@@ -304,26 +200,17 @@ void GiftBox(
|
||||
[] { return QString("gift"); },
|
||||
state->buttonText.events(),
|
||||
Ui::Premium::GiftGradientStops(),
|
||||
[=] {
|
||||
const auto value = group->value();
|
||||
return (value < options.size() && value >= 0)
|
||||
? options[value].botUrl
|
||||
: QString();
|
||||
},
|
||||
});
|
||||
auto button = object_ptr<Ui::GradientButton>::fromRaw(raw);
|
||||
button->resizeToWidth(boxWidth
|
||||
- stButton.buttonPadding.left()
|
||||
- stButton.buttonPadding.right());
|
||||
button->setClickedCallback([=] {
|
||||
const auto value = group->value();
|
||||
Assert(value < options.size() && value >= 0);
|
||||
|
||||
const auto local = Core::TryConvertUrlToLocal(options[value].url);
|
||||
if (local.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
UrlClickHandler::Open(
|
||||
local,
|
||||
QVariant::fromValue(ClickHandlerContext{
|
||||
.sessionWindow = base::make_weak(controller.get()),
|
||||
.botStartAutoSubmit = true,
|
||||
}));
|
||||
});
|
||||
box->setShowFinishedCallback([raw = button.data()]{
|
||||
raw->startGlareAnimation();
|
||||
});
|
||||
|
||||
@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/painter.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "mainwidget.h"
|
||||
|
||||
@@ -242,7 +242,7 @@ void LocalStorageBox::Row::paintEvent(QPaintEvent *e) {
|
||||
if (!_progress || true) {
|
||||
return;
|
||||
}
|
||||
Painter p(this);
|
||||
auto p = QPainter(this);
|
||||
const auto padding = st::localStorageRowPadding;
|
||||
const auto height = st::localStorageRowHeight;
|
||||
const auto bottom = height - padding.bottom() - _description->height();
|
||||
@@ -595,12 +595,3 @@ void LocalStorageBox::save() {
|
||||
_session->data().cache().updateSettings(update);
|
||||
closeBox();
|
||||
}
|
||||
|
||||
void LocalStorageBox::paintEvent(QPaintEvent *e) {
|
||||
BoxContent::paintEvent(e);
|
||||
|
||||
Painter p(this);
|
||||
|
||||
p.setFont(st::boxTextFont);
|
||||
p.setPen(st::windowFg);
|
||||
}
|
||||
|
||||
@@ -45,8 +45,6 @@ public:
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
private:
|
||||
class Row;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/layers/generic_box.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/painter.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ void MuteSettingsBox::prepare() {
|
||||
icon->moveToLeft(st::boxPadding.left(), y);
|
||||
|
||||
object_ptr<Ui::FlatLabel> title(this, st::muteChatTitle);
|
||||
title->setText(_peer->name);
|
||||
title->setText(_peer->name());
|
||||
title->moveToLeft(
|
||||
st::boxPadding.left() + st::muteChatTitleLeft,
|
||||
y + (icon->height() / 2) - (title->height() / 2));
|
||||
@@ -76,7 +76,9 @@ void MuteSettingsBox::prepare() {
|
||||
|
||||
_save = [=] {
|
||||
const auto muteForSeconds = group->value() * 3600;
|
||||
_peer->owner().notifySettings().update(_peer, muteForSeconds);
|
||||
_peer->owner().notifySettings().update(
|
||||
_peer,
|
||||
{ .period = muteForSeconds });
|
||||
closeBox();
|
||||
};
|
||||
addButton(tr::lng_box_ok(), _save);
|
||||
|
||||
@@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/sent_code_field.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/wrap/fade_wrap.h"
|
||||
#include "ui/painter.h"
|
||||
#include "passport/passport_encryption.h"
|
||||
#include "passport/passport_panel_edit_contact.h"
|
||||
#include "settings/settings_privacy_security.h"
|
||||
@@ -1297,6 +1298,7 @@ void RecoverBox::proceedToChange(const QString &code) {
|
||||
// like if (_cloudFields.turningOff) { just RecoverPassword else Check }
|
||||
fields.mtp.curRequest = {};
|
||||
fields.hasPassword = false;
|
||||
fields.customCheckCallback = nullptr;
|
||||
auto box = Box<PasscodeBox>(_session, fields);
|
||||
|
||||
box->boxClosing(
|
||||
|
||||
@@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/empty_userpic.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/painter.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "storage/file_download.h"
|
||||
#include "data/data_peer_values.h"
|
||||
@@ -37,11 +38,11 @@ PaintRoundImageCallback PaintUserpicCallback(
|
||||
bool respectSavedMessagesChat) {
|
||||
if (respectSavedMessagesChat) {
|
||||
if (peer->isSelf()) {
|
||||
return [](Painter &p, int x, int y, int outerWidth, int size) {
|
||||
return [](QPainter &p, int x, int y, int outerWidth, int size) {
|
||||
Ui::EmptyUserpic::PaintSavedMessages(p, x, y, outerWidth, size);
|
||||
};
|
||||
} else if (peer->isRepliesChat()) {
|
||||
return [](Painter &p, int x, int y, int outerWidth, int size) {
|
||||
return [](QPainter &p, int x, int y, int outerWidth, int size) {
|
||||
Ui::EmptyUserpic::PaintRepliesMessages(p, x, y, outerWidth, size);
|
||||
};
|
||||
}
|
||||
@@ -206,7 +207,7 @@ void PeerListBox::resizeEvent(QResizeEvent *e) {
|
||||
}
|
||||
|
||||
void PeerListBox::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
auto p = QPainter(this);
|
||||
|
||||
const auto &bg = (_controller->listSt()
|
||||
? *_controller->listSt()
|
||||
@@ -613,7 +614,7 @@ void PeerListRow::elementsPaint(
|
||||
}
|
||||
|
||||
QString PeerListRow::generateName() {
|
||||
return peer()->name;
|
||||
return peer()->name();
|
||||
}
|
||||
|
||||
QString PeerListRow::generateShortName() {
|
||||
@@ -653,27 +654,45 @@ void PeerListRow::invalidatePixmapsCache() {
|
||||
}
|
||||
}
|
||||
|
||||
int PeerListRow::nameIconWidth() const {
|
||||
return special()
|
||||
? 0
|
||||
: _peer->isVerified()
|
||||
? st::dialogsVerifiedIcon.width()
|
||||
: (_peer->isPremium() && !_peer->isSelf())
|
||||
? st::dialogsPremiumIcon.width()
|
||||
: 0;
|
||||
}
|
||||
|
||||
void PeerListRow::paintNameIcon(
|
||||
int PeerListRow::paintNameIconGetWidth(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
Fn<void()> repaint,
|
||||
crl::time now,
|
||||
int nameLeft,
|
||||
int nameTop,
|
||||
int nameWidth,
|
||||
int availableWidth,
|
||||
int outerWidth,
|
||||
bool selected) {
|
||||
if (_peer->isVerified()) {
|
||||
st::dialogsVerifiedIcon.paint(p, x, y, outerWidth);
|
||||
} else if (_peer->isPremium() && !_peer->isSelf()) {
|
||||
st::dialogsPremiumIcon.paint(p, x, y, outerWidth);
|
||||
if (special() || _isSavedMessagesChat || _isRepliesMessagesChat) {
|
||||
return 0;
|
||||
}
|
||||
return _bagde.drawGetWidth(
|
||||
p,
|
||||
QRect(
|
||||
nameLeft,
|
||||
nameTop,
|
||||
availableWidth,
|
||||
st::msgNameStyle.font->height),
|
||||
nameWidth,
|
||||
outerWidth,
|
||||
{
|
||||
.peer = _peer,
|
||||
.verified = &(selected
|
||||
? st::dialogsVerifiedIconOver
|
||||
: st::dialogsVerifiedIcon),
|
||||
.premium = &(selected
|
||||
? st::dialogsPremiumIconOver
|
||||
: st::dialogsPremiumIcon),
|
||||
.scam = &(selected ? st::dialogsScamFgOver : st::dialogsScamFg),
|
||||
.premiumFg = &(selected
|
||||
? st::dialogsVerifiedIconBgOver
|
||||
: st::dialogsVerifiedIconBg),
|
||||
.preview = st::windowBgOver->c,
|
||||
.customEmojiRepaint = repaint,
|
||||
.now = now,
|
||||
.paused = false,
|
||||
});
|
||||
}
|
||||
|
||||
void PeerListRow::paintStatusText(
|
||||
@@ -829,7 +848,7 @@ PeerListContent::PeerListContent(
|
||||
|
||||
using UpdateFlag = Data::PeerUpdate::Flag;
|
||||
_controller->session().changes().peerUpdates(
|
||||
UpdateFlag::Name | UpdateFlag::Photo
|
||||
UpdateFlag::Name | UpdateFlag::Photo | UpdateFlag::EmojiStatus
|
||||
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
|
||||
if (update.flags & UpdateFlag::Name) {
|
||||
handleNameChanged(update.peer);
|
||||
@@ -1549,33 +1568,49 @@ crl::time PeerListContent::paintRow(
|
||||
|
||||
p.setPen(st::contactsNameFg);
|
||||
|
||||
auto skipRight = _st.item.photoPosition.x();
|
||||
auto rightActionSize = row->rightActionSize();
|
||||
auto rightActionMargins = rightActionSize.isEmpty()
|
||||
const auto skipRight = _st.item.photoPosition.x();
|
||||
const auto rightActionSize = row->rightActionSize();
|
||||
const auto rightActionMargins = rightActionSize.isEmpty()
|
||||
? QMargins()
|
||||
: row->rightActionMargins();
|
||||
auto &name = row->name();
|
||||
auto namex = _st.item.namePosition.x();
|
||||
const auto &name = row->name();
|
||||
const auto namex = _st.item.namePosition.x();
|
||||
const auto namey = _st.item.namePosition.y();
|
||||
auto namew = outerWidth - namex - skipRight;
|
||||
if (!rightActionSize.isEmpty()) {
|
||||
if (!rightActionSize.isEmpty()
|
||||
&& (namey < rightActionMargins.top() + rightActionSize.height())
|
||||
&& (namey + _st.item.nameStyle.font->height
|
||||
> rightActionMargins.top())) {
|
||||
namew -= rightActionMargins.left()
|
||||
+ rightActionSize.width()
|
||||
+ rightActionMargins.right()
|
||||
- skipRight;
|
||||
}
|
||||
auto statusw = namew;
|
||||
if (auto iconWidth = row->nameIconWidth()) {
|
||||
namew -= iconWidth;
|
||||
row->paintNameIcon(
|
||||
p,
|
||||
namex + qMin(name.maxWidth(), namew),
|
||||
_st.item.namePosition.y(),
|
||||
width(),
|
||||
selected);
|
||||
const auto statusx = _st.item.statusPosition.x();
|
||||
const auto statusy = _st.item.statusPosition.y();
|
||||
auto statusw = outerWidth - statusx - skipRight;
|
||||
if (!rightActionSize.isEmpty()
|
||||
&& (statusy < rightActionMargins.top() + rightActionSize.height())
|
||||
&& (statusy + st::contactsStatusFont->height
|
||||
> rightActionMargins.top())) {
|
||||
statusw -= rightActionMargins.left()
|
||||
+ rightActionSize.width()
|
||||
+ rightActionMargins.right()
|
||||
- skipRight;
|
||||
}
|
||||
namew -= row->paintNameIconGetWidth(
|
||||
p,
|
||||
[=] { updateRow(row); },
|
||||
now,
|
||||
namex,
|
||||
namey,
|
||||
name.maxWidth(),
|
||||
namew,
|
||||
width(),
|
||||
selected);
|
||||
auto nameCheckedRatio = row->disabled() ? 0. : row->checkedRatio();
|
||||
p.setPen(anim::pen(_st.item.nameFg, _st.item.nameFgChecked, nameCheckedRatio));
|
||||
name.drawLeftElided(p, namex, _st.item.namePosition.y(), namew, width());
|
||||
name.drawLeftElided(p, namex, namey, namew, width());
|
||||
|
||||
p.setFont(st::contactsStatusFont);
|
||||
if (row->isSearchResult()
|
||||
@@ -1594,16 +1629,16 @@ crl::time PeerListContent::paintRow(
|
||||
highlightedPart = st::contactsStatusFont->elided(highlightedPart, availableWidth);
|
||||
}
|
||||
p.setPen(_st.item.statusFgActive);
|
||||
p.drawTextLeft(_st.item.statusPosition.x(), _st.item.statusPosition.y(), width(), highlightedPart);
|
||||
p.drawTextLeft(statusx, statusy, width(), highlightedPart);
|
||||
} else {
|
||||
grayedPart = st::contactsStatusFont->elided(grayedPart, availableWidth - highlightedWidth);
|
||||
p.setPen(_st.item.statusFgActive);
|
||||
p.drawTextLeft(_st.item.statusPosition.x(), _st.item.statusPosition.y(), width(), highlightedPart);
|
||||
p.drawTextLeft(statusx, statusy, width(), highlightedPart);
|
||||
p.setPen(selected ? _st.item.statusFgOver : _st.item.statusFg);
|
||||
p.drawTextLeft(_st.item.statusPosition.x() + highlightedWidth, _st.item.statusPosition.y(), width(), grayedPart);
|
||||
p.drawTextLeft(statusx + highlightedWidth, statusy, width(), grayedPart);
|
||||
}
|
||||
} else {
|
||||
row->paintStatusText(p, _st.item, _st.item.statusPosition.x(), _st.item.statusPosition.y(), statusw, width(), selected);
|
||||
row->paintStatusText(p, _st.item, statusx, statusy, statusw, width(), selected);
|
||||
}
|
||||
|
||||
row->elementsPaint(
|
||||
|
||||
@@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/empty_userpic.h"
|
||||
#include "ui/unread_badge.h"
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "data/data_cloud_file.h"
|
||||
@@ -94,11 +95,14 @@ public:
|
||||
void clearCustomStatus();
|
||||
|
||||
// Box interface.
|
||||
virtual int nameIconWidth() const;
|
||||
virtual void paintNameIcon(
|
||||
virtual int paintNameIconGetWidth(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
Fn<void()> repaint,
|
||||
crl::time now,
|
||||
int nameLeft,
|
||||
int nameTop,
|
||||
int nameWidth,
|
||||
int availableWidth,
|
||||
int outerWidth,
|
||||
bool selected);
|
||||
|
||||
@@ -258,6 +262,7 @@ private:
|
||||
std::unique_ptr<Ui::RoundImageCheckbox> _checkbox;
|
||||
Ui::Text::String _name;
|
||||
Ui::Text::String _status;
|
||||
Ui::PeerBadge _bagde;
|
||||
StatusType _statusType = StatusType::Online;
|
||||
crl::time _statusValidTill = 0;
|
||||
base::flat_set<QChar> _nameFirstLetters;
|
||||
|
||||
@@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "base/random.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "main/main_session.h"
|
||||
#include "data/data_session.h"
|
||||
|
||||
@@ -278,7 +278,7 @@ void PeerListsBox::resizeEvent(QResizeEvent *e) {
|
||||
}
|
||||
|
||||
void PeerListsBox::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
auto p = QPainter(this);
|
||||
|
||||
const auto &bg = (firstController()->listSt()
|
||||
? *firstController()->listSt()
|
||||
|
||||
@@ -207,9 +207,15 @@ void AddBotToGroupBoxController::shareBotGame(not_null<PeerData*> chat) {
|
||||
});
|
||||
auto confirmText = [chat] {
|
||||
if (chat->isUser()) {
|
||||
return tr::lng_bot_sure_share_game(tr::now, lt_user, chat->name);
|
||||
return tr::lng_bot_sure_share_game(
|
||||
tr::now,
|
||||
lt_user,
|
||||
chat->name());
|
||||
}
|
||||
return tr::lng_bot_sure_share_game_group(tr::now, lt_group, chat->name);
|
||||
return tr::lng_bot_sure_share_game_group(
|
||||
tr::now,
|
||||
lt_group,
|
||||
chat->name());
|
||||
}();
|
||||
_controller->show(
|
||||
Ui::MakeConfirmBox({
|
||||
@@ -320,7 +326,7 @@ void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
|
||||
});
|
||||
controller->show(
|
||||
Ui::MakeConfirmBox({
|
||||
tr::lng_bot_sure_invite(tr::now, lt_group, chat->name),
|
||||
tr::lng_bot_sure_invite(tr::now, lt_group, chat->name()),
|
||||
std::move(callback),
|
||||
}),
|
||||
Ui::LayerOption::KeepOther);
|
||||
|
||||
@@ -262,16 +262,16 @@ void AddParticipantsBoxController::inviteSelectedUsers(
|
||||
? tr::lng_participant_invite_sure(
|
||||
tr::now,
|
||||
lt_user,
|
||||
{ users.front()->name },
|
||||
{ users.front()->name()},
|
||||
lt_group,
|
||||
{ _peer->name },
|
||||
{ _peer->name()},
|
||||
Ui::Text::RichLangValue)
|
||||
: tr::lng_participant_invite_sure_many(
|
||||
tr::now,
|
||||
lt_count,
|
||||
int(users.size()),
|
||||
lt_group,
|
||||
{ _peer->name },
|
||||
{ _peer->name() },
|
||||
Ui::Text::RichLangValue);
|
||||
Ui::ConfirmBox(box, {
|
||||
.text = std::move(text),
|
||||
@@ -834,7 +834,7 @@ void AddSpecialBoxController::kickUser(
|
||||
: tr::lng_profile_sure_kick_channel)(
|
||||
tr::now,
|
||||
lt_user,
|
||||
participant->name);
|
||||
participant->name());
|
||||
_editBox = showBox(Ui::MakeConfirmBox({ text, kickUserSure }));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/peers/edit_peer_common.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/text/format_values.h" // Ui::FormatPhone
|
||||
#include "ui/text/text_utilities.h"
|
||||
|
||||
@@ -134,9 +134,9 @@ void Controller::choose(not_null<ChannelData*> chat) {
|
||||
auto text = tr::lng_manage_discussion_group_sure(
|
||||
tr::now,
|
||||
lt_group,
|
||||
Ui::Text::Bold(chat->name),
|
||||
Ui::Text::Bold(chat->name()),
|
||||
lt_channel,
|
||||
Ui::Text::Bold(_channel->name),
|
||||
Ui::Text::Bold(_channel->name()),
|
||||
Ui::Text::WithEntities);
|
||||
if (!_channel->isPublic()) {
|
||||
text.append(
|
||||
@@ -170,9 +170,9 @@ void Controller::choose(not_null<ChatData*> chat) {
|
||||
auto text = tr::lng_manage_discussion_group_sure(
|
||||
tr::now,
|
||||
lt_group,
|
||||
Ui::Text::Bold(chat->name),
|
||||
Ui::Text::Bold(chat->name()),
|
||||
lt_channel,
|
||||
Ui::Text::Bold(_channel->name),
|
||||
Ui::Text::Bold(_channel->name()),
|
||||
Ui::Text::WithEntities);
|
||||
if (!_channel->isPublic()) {
|
||||
text.append("\n\n" + tr::lng_manage_linked_channel_private(tr::now));
|
||||
@@ -212,13 +212,13 @@ object_ptr<Ui::RpWidget> SetupAbout(
|
||||
return tr::lng_manage_linked_channel_about(
|
||||
tr::now,
|
||||
lt_channel,
|
||||
Ui::Text::Bold(chat->name),
|
||||
Ui::Text::Bold(chat->name()),
|
||||
Ui::Text::WithEntities);
|
||||
} else if (chat != nullptr) {
|
||||
return tr::lng_manage_discussion_group_about_chosen(
|
||||
tr::now,
|
||||
lt_group,
|
||||
Ui::Text::Bold(chat->name),
|
||||
Ui::Text::Bold(chat->name()),
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
return tr::lng_manage_discussion_group_about(
|
||||
@@ -257,7 +257,7 @@ object_ptr<Ui::RpWidget> SetupCreateGroup(
|
||||
Box<GroupInfoBox>(
|
||||
navigation,
|
||||
GroupInfoBox::Type::Megagroup,
|
||||
channel->name + " Chat",
|
||||
channel->name() + " Chat",
|
||||
guarded),
|
||||
Ui::LayerOption::KeepOther);
|
||||
});
|
||||
|
||||
@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "ui/painter.h"
|
||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||
#include "settings/settings_privacy_security.h"
|
||||
#include "ui/boxes/choose_date_time.h"
|
||||
@@ -99,7 +100,7 @@ EditParticipantBox::Inner::Inner(
|
||||
_userPhoto->setPointerCursor(false);
|
||||
_userName.setText(
|
||||
st::rightsNameStyle,
|
||||
_user->name,
|
||||
_user->name(),
|
||||
Ui::NameTextOptions());
|
||||
}
|
||||
|
||||
@@ -394,7 +395,7 @@ void EditAdminBox::prepare() {
|
||||
phrase(
|
||||
tr::now,
|
||||
lt_group,
|
||||
Ui::Text::Bold(peer()->name),
|
||||
Ui::Text::Bold(peer()->name()),
|
||||
Ui::Text::WithEntities),
|
||||
crl::guard(this, [=] { finishAddAdmin(); })
|
||||
}), Ui::LayerOption::KeepOther);
|
||||
@@ -542,7 +543,7 @@ void EditAdminBox::transferOwnership() {
|
||||
.text = tr::lng_rights_transfer_about(
|
||||
tr::now,
|
||||
lt_group,
|
||||
Ui::Text::Bold(peer()->name),
|
||||
Ui::Text::Bold(peer()->name()),
|
||||
lt_user,
|
||||
Ui::Text::Bold(user()->shortName()),
|
||||
Ui::Text::RichLangValue),
|
||||
|
||||
@@ -1298,7 +1298,7 @@ void ParticipantsBoxController::rebuildChatAdmins(
|
||||
list.emplace_back(creator);
|
||||
}
|
||||
ranges::sort(list, [](not_null<UserData*> a, not_null<UserData*> b) {
|
||||
return (a->name.compare(b->name, Qt::CaseInsensitive) < 0);
|
||||
return (a->name().compare(b->name(), Qt::CaseInsensitive) < 0);
|
||||
});
|
||||
|
||||
const auto same = [&] {
|
||||
@@ -1723,7 +1723,7 @@ void ParticipantsBoxController::kickParticipant(not_null<PeerData*> participant)
|
||||
: tr::lng_profile_sure_kick_channel)(
|
||||
tr::now,
|
||||
lt_user,
|
||||
user ? user->firstName : participant->name);
|
||||
user ? user->firstName : participant->name());
|
||||
_editBox = showBox(
|
||||
Ui::MakeConfirmBox({
|
||||
.text = text,
|
||||
@@ -1932,18 +1932,6 @@ auto ParticipantsBoxController::computeType(
|
||||
? Rights::Admin
|
||||
: Rights::Normal;
|
||||
result.adminRank = user ? _additional.adminRank(user) : QString();
|
||||
using Badge = Info::Profile::Badge;
|
||||
result.badge = !user
|
||||
? Badge::None
|
||||
: user->isScam()
|
||||
? Badge::Scam
|
||||
: user->isFake()
|
||||
? Badge::Fake
|
||||
: user->isVerified()
|
||||
? Badge::Verified
|
||||
: (user->isPremium() && participant->session().premiumBadgesShown())
|
||||
? Badge::Premium
|
||||
: Badge::None;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1952,7 +1940,8 @@ void ParticipantsBoxController::recomputeTypeFor(
|
||||
if (_role != Role::Profile) {
|
||||
return;
|
||||
}
|
||||
if (const auto row = delegate()->peerListFindRow(participant->id.value)) {
|
||||
const auto row = delegate()->peerListFindRow(participant->id.value);
|
||||
if (row) {
|
||||
static_cast<Row*>(row)->setType(computeType(participant));
|
||||
}
|
||||
}
|
||||
@@ -1967,7 +1956,7 @@ void ParticipantsBoxController::refreshCustomStatus(
|
||||
row->setCustomStatus(tr::lng_channel_admin_status_promoted_by(
|
||||
tr::now,
|
||||
lt_user,
|
||||
by->name));
|
||||
by->name()));
|
||||
} else {
|
||||
if (_additional.isCreator(user)) {
|
||||
row->setCustomStatus(
|
||||
@@ -1984,7 +1973,7 @@ void ParticipantsBoxController::refreshCustomStatus(
|
||||
: tr::lng_channel_banned_status_restricted_by)(
|
||||
tr::now,
|
||||
lt_user,
|
||||
by ? by->name : "Unknown"));
|
||||
by ? by->name() : "Unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -473,7 +473,7 @@ object_ptr<Ui::RpWidget> Controller::createTitleEdit() {
|
||||
(_isGroup
|
||||
? tr::lng_dlg_new_group_name
|
||||
: tr::lng_dlg_new_channel_name)(),
|
||||
_peer->name),
|
||||
_peer->name()),
|
||||
st::editPeerTitleMargins);
|
||||
result->entity()->setMaxLength(Ui::EditPeer::kMaxGroupChannelTitle);
|
||||
result->entity()->setInstantReplaces(Ui::InstantReplaces::Default());
|
||||
@@ -769,15 +769,13 @@ void Controller::fillLinkedChatButton() {
|
||||
auto label = isGroup
|
||||
? _linkedChatUpdates.events(
|
||||
) | rpl::map([](ChannelData *chat) {
|
||||
return chat ? chat->name : QString();
|
||||
return chat ? chat->name() : QString();
|
||||
}) | rpl::type_erased()
|
||||
: rpl::combine(
|
||||
tr::lng_manage_discussion_group_add(),
|
||||
_linkedChatUpdates.events()
|
||||
) | rpl::map([=](const QString &add, ChannelData *chat) {
|
||||
return chat
|
||||
? chat->name
|
||||
: add;
|
||||
return chat ? chat->name() : add;
|
||||
}) | rpl::type_erased();
|
||||
AddButtonWithText(
|
||||
_controls.buttonsLayout,
|
||||
@@ -990,21 +988,30 @@ void Controller::fillManageSection() {
|
||||
|
||||
if (canEditReactions()) {
|
||||
const auto session = &_peer->session();
|
||||
auto reactionsCount = Info::Profile::MigratedOrMeValue(
|
||||
auto allowedReactions = Info::Profile::MigratedOrMeValue(
|
||||
_peer
|
||||
) | rpl::map(
|
||||
Info::Profile::AllowedReactionsCountValue
|
||||
) | rpl::flatten_latest();
|
||||
auto fullCount = Info::Profile::FullReactionsCountValue(session);
|
||||
) | rpl::map([=](not_null<PeerData*> peer) {
|
||||
return peer->session().changes().peerFlagsValue(
|
||||
peer,
|
||||
Data::PeerUpdate::Flag::Reactions
|
||||
) | rpl::map([=] {
|
||||
return Data::PeerAllowedReactions(peer);
|
||||
});
|
||||
}) | rpl::flatten_latest();
|
||||
auto label = rpl::combine(
|
||||
std::move(reactionsCount),
|
||||
std::move(fullCount)
|
||||
) | rpl::map([=](int allowed, int total) {
|
||||
return allowed
|
||||
? QString::number(allowed) + " / " + QString::number(total)
|
||||
std::move(allowedReactions),
|
||||
Info::Profile::FullReactionsCountValue(session)
|
||||
) | rpl::map([=](const Data::AllowedReactions &allowed, int total) {
|
||||
const auto some = int(allowed.some.size());
|
||||
return (allowed.type != Data::AllowedReactionsType::Some)
|
||||
? tr::lng_manage_peer_reactions_on(tr::now)
|
||||
: some
|
||||
? (QString::number(some)
|
||||
+ " / "
|
||||
+ QString::number(std::max(some, total)))
|
||||
: tr::lng_manage_peer_reactions_off(tr::now);
|
||||
});
|
||||
const auto done = [=](const std::vector<QString> &chosen) {
|
||||
const auto done = [=](const Data::AllowedReactions &chosen) {
|
||||
SaveAllowedReactions(_peer, chosen);
|
||||
};
|
||||
AddButtonWithCount(
|
||||
@@ -1014,10 +1021,11 @@ void Controller::fillManageSection() {
|
||||
[=] {
|
||||
_navigation->parentController()->show(Box(
|
||||
EditAllowedReactionsBox,
|
||||
_navigation,
|
||||
!_peer->isBroadcast(),
|
||||
session->data().reactions().list(
|
||||
Data::Reactions::Type::Active),
|
||||
*Data::PeerAllowedReactions(_peer),
|
||||
Data::PeerAllowedReactions(_peer),
|
||||
done));
|
||||
},
|
||||
{ &st::infoRoundedIconReactions, Settings::kIconRed });
|
||||
@@ -1388,14 +1396,14 @@ void Controller::saveUsername() {
|
||||
MTP_string(*_savingData.username)
|
||||
)).done([=] {
|
||||
channel->setName(
|
||||
TextUtilities::SingleLine(channel->name),
|
||||
TextUtilities::SingleLine(channel->name()),
|
||||
*_savingData.username);
|
||||
continueSave();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
if (type == qstr("USERNAME_NOT_MODIFIED")) {
|
||||
channel->setName(
|
||||
TextUtilities::SingleLine(channel->name),
|
||||
TextUtilities::SingleLine(channel->name()),
|
||||
TextUtilities::SingleLine(*_savingData.username));
|
||||
continueSave();
|
||||
return;
|
||||
@@ -1450,7 +1458,7 @@ void Controller::saveLinkedChat() {
|
||||
}
|
||||
|
||||
void Controller::saveTitle() {
|
||||
if (!_savingData.title || *_savingData.title == _peer->name) {
|
||||
if (!_savingData.title || *_savingData.title == _peer->name()) {
|
||||
return continueSave();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/toasts/common_toasts.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/boxes/edit_invite_link.h"
|
||||
#include "ui/painter.h"
|
||||
#include "boxes/share_box.h"
|
||||
#include "history/view/history_view_group_call_bar.h" // GenerateUserpics...
|
||||
#include "history/history_message.h" // GetErrorTextForSending.
|
||||
@@ -809,7 +810,7 @@ void Controller::processRequest(
|
||||
: tr::lng_group_requests_was_added)(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(user->name),
|
||||
Ui::Text::Bold(user->name()),
|
||||
Ui::Text::WithEntities)
|
||||
});
|
||||
}
|
||||
@@ -1164,7 +1165,7 @@ object_ptr<Ui::BoxContent> ShareInviteLinkBox(
|
||||
auto text = TextWithEntities();
|
||||
if (result.size() > 1) {
|
||||
text.append(
|
||||
Ui::Text::Bold(error.second->name)
|
||||
Ui::Text::Bold(error.second->name())
|
||||
).append("\n\n");
|
||||
}
|
||||
text.append(error.first);
|
||||
|
||||
@@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/painter.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "boxes/peer_list_controllers.h"
|
||||
@@ -328,7 +329,7 @@ QString Row::generateShortName() {
|
||||
|
||||
PaintRoundImageCallback Row::generatePaintUserpicCallback() {
|
||||
return [=](
|
||||
Painter &p,
|
||||
QPainter &p,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
|
||||
@@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "boxes/peers/edit_peer_reactions.h"
|
||||
|
||||
#include "boxes/reactions_settings_box.h" // AddReactionLottieIcon
|
||||
#include "boxes/reactions_settings_box.h" // AddReactionAnimatedIcon
|
||||
#include "data/data_message_reactions.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "data/data_chat.h"
|
||||
@@ -18,47 +18,76 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "styles/style_settings.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
void EditAllowedReactionsBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
bool isGroup,
|
||||
const std::vector<Data::Reaction> &list,
|
||||
const base::flat_set<QString> &selected,
|
||||
Fn<void(const std::vector<QString> &)> callback) {
|
||||
const Data::AllowedReactions &allowed,
|
||||
Fn<void(const Data::AllowedReactions &)> callback) {
|
||||
using namespace Data;
|
||||
using namespace rpl::mappers;
|
||||
|
||||
const auto iconHeight = st::editPeerReactionsPreview;
|
||||
box->setTitle(tr::lng_manage_peer_reactions());
|
||||
|
||||
struct State {
|
||||
base::flat_map<QString, not_null<Ui::SettingsButton*>> toggles;
|
||||
rpl::variable<bool> anyToggled;
|
||||
rpl::event_stream<bool> forceToggleAll;
|
||||
enum class Option {
|
||||
All,
|
||||
Some,
|
||||
None,
|
||||
};
|
||||
struct State {
|
||||
base::flat_map<ReactionId, not_null<Ui::SettingsButton*>> toggles;
|
||||
rpl::variable<Option> option; // For groups.
|
||||
rpl::variable<bool> anyToggled; // For channels.
|
||||
rpl::event_stream<bool> forceToggleAll; // For channels.
|
||||
};
|
||||
const auto optionInitial = (allowed.type != AllowedReactionsType::Some)
|
||||
? Option::All
|
||||
: allowed.some.empty()
|
||||
? Option::None
|
||||
: Option::Some;
|
||||
const auto state = box->lifetime().make_state<State>(State{
|
||||
.anyToggled = !selected.empty(),
|
||||
.option = optionInitial,
|
||||
.anyToggled = (optionInitial != Option::None),
|
||||
});
|
||||
|
||||
const auto collect = [=] {
|
||||
auto result = std::vector<QString>();
|
||||
result.reserve(state->toggles.size());
|
||||
for (const auto &[emoji, button] : state->toggles) {
|
||||
if (button->toggled()) {
|
||||
result.push_back(emoji);
|
||||
auto result = AllowedReactions();
|
||||
if (!isGroup || state->option.current() == Option::Some) {
|
||||
result.some.reserve(state->toggles.size());
|
||||
for (const auto &[id, button] : state->toggles) {
|
||||
if (button->toggled()) {
|
||||
result.some.push_back(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
result.type = isGroup
|
||||
? (state->option.current() != Option::All
|
||||
? AllowedReactionsType::Some
|
||||
: AllowedReactionsType::All)
|
||||
: (result.some.size() == state->toggles.size())
|
||||
? AllowedReactionsType::Default
|
||||
: AllowedReactionsType::Some;
|
||||
return result;
|
||||
};
|
||||
|
||||
const auto container = box->verticalLayout();
|
||||
|
||||
const auto enabled = Settings::AddButton(
|
||||
const auto enabled = isGroup ? nullptr : Settings::AddButton(
|
||||
container,
|
||||
tr::lng_manage_peer_reactions_enable(),
|
||||
st::manageGroupButton.button);
|
||||
if (!list.empty()) {
|
||||
AddReactionLottieIcon(
|
||||
st::manageGroupButton.button
|
||||
).get();
|
||||
if (enabled && !list.empty()) {
|
||||
AddReactionAnimatedIcon(
|
||||
enabled,
|
||||
enabled->sizeValue(
|
||||
) | rpl::map([=](const QSize &size) {
|
||||
@@ -72,33 +101,88 @@ void EditAllowedReactionsBox(
|
||||
rpl::never<>(),
|
||||
&enabled->lifetime());
|
||||
}
|
||||
enabled->toggleOn(state->anyToggled.value());
|
||||
enabled->toggledChanges(
|
||||
) | rpl::filter([=](bool value) {
|
||||
return (value != state->anyToggled.current());
|
||||
}) | rpl::start_to_stream(state->forceToggleAll, enabled->lifetime());
|
||||
if (enabled) {
|
||||
enabled->toggleOn(state->anyToggled.value());
|
||||
enabled->toggledChanges(
|
||||
) | rpl::filter([=](bool value) {
|
||||
return (value != state->anyToggled.current());
|
||||
}) | rpl::start_to_stream(state->forceToggleAll, enabled->lifetime());
|
||||
}
|
||||
const auto group = std::make_shared<Ui::RadioenumGroup<Option>>(
|
||||
state->option.current());
|
||||
group->setChangedCallback([=](Option value) {
|
||||
state->option = value;
|
||||
});
|
||||
const auto addOption = [&](Option option, const QString &text) {
|
||||
if (!isGroup) {
|
||||
return;
|
||||
}
|
||||
container->add(
|
||||
object_ptr<Ui::Radioenum<Option>>(
|
||||
container,
|
||||
group,
|
||||
option,
|
||||
text,
|
||||
st::settingsSendType),
|
||||
st::settingsSendTypePadding);
|
||||
};
|
||||
addOption(Option::All, tr::lng_manage_peer_reactions_all(tr::now));
|
||||
addOption(Option::Some, tr::lng_manage_peer_reactions_some(tr::now));
|
||||
addOption(Option::None, tr::lng_manage_peer_reactions_none(tr::now));
|
||||
|
||||
const auto about = [](Option option) {
|
||||
switch (option) {
|
||||
case Option::All: return tr::lng_manage_peer_reactions_all_about();
|
||||
case Option::Some: return tr::lng_manage_peer_reactions_some_about();
|
||||
case Option::None: return tr::lng_manage_peer_reactions_none_about();
|
||||
}
|
||||
Unexpected("Option value in EditAllowedReactionsBox.");
|
||||
};
|
||||
Settings::AddSkip(container);
|
||||
Settings::AddDividerText(
|
||||
container,
|
||||
(isGroup
|
||||
? tr::lng_manage_peer_reactions_about
|
||||
: tr::lng_manage_peer_reactions_about_channel)());
|
||||
? (state->option.value()
|
||||
| rpl::map(about)
|
||||
| rpl::flatten_latest())
|
||||
: tr::lng_manage_peer_reactions_about_channel()));
|
||||
|
||||
Settings::AddSkip(container);
|
||||
Settings::AddSubsectionTitle(
|
||||
container,
|
||||
tr::lng_manage_peer_reactions_available());
|
||||
|
||||
const auto active = [&](const Data::Reaction &entry) {
|
||||
return selected.contains(entry.emoji);
|
||||
};
|
||||
const auto add = [&](const Data::Reaction &entry) {
|
||||
const auto button = Settings::AddButton(
|
||||
const auto wrap = enabled ? nullptr : container->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
container,
|
||||
object_ptr<Ui::VerticalLayout>(container)));
|
||||
if (wrap) {
|
||||
wrap->toggleOn(state->option.value() | rpl::map(_1 == Option::Some));
|
||||
wrap->finishAnimating();
|
||||
}
|
||||
const auto reactions = wrap ? wrap->entity() : container.get();
|
||||
|
||||
Settings::AddSkip(reactions);
|
||||
Settings::AddSubsectionTitle(
|
||||
reactions,
|
||||
(enabled
|
||||
? tr::lng_manage_peer_reactions_available()
|
||||
: tr::lng_manage_peer_reactions_some_title()));
|
||||
|
||||
const auto like = QString::fromUtf8("\xf0\x9f\x91\x8d");
|
||||
const auto dislike = QString::fromUtf8("\xf0\x9f\x91\x8e");
|
||||
const auto activeOnStart = [&](const ReactionId &id) {
|
||||
const auto inSome = ranges::contains(allowed.some, id);
|
||||
if (!isGroup) {
|
||||
return inSome || (allowed.type != AllowedReactionsType::Some);
|
||||
}
|
||||
const auto emoji = id.emoji();
|
||||
const auto isDefault = (emoji == like) || (emoji == dislike);
|
||||
return (allowed.type != AllowedReactionsType::Some)
|
||||
? isDefault
|
||||
: (inSome || (isDefault && allowed.some.empty()));
|
||||
};
|
||||
const auto add = [&](const Reaction &entry) {
|
||||
const auto button = Settings::AddButton(
|
||||
reactions,
|
||||
rpl::single(entry.title),
|
||||
st::manageGroupButton.button);
|
||||
AddReactionLottieIcon(
|
||||
AddReactionAnimatedIcon(
|
||||
button,
|
||||
button->sizeValue(
|
||||
) | rpl::map([=](const QSize &size) {
|
||||
@@ -114,29 +198,56 @@ void EditAllowedReactionsBox(
|
||||
}) | rpl::to_empty,
|
||||
rpl::never<>(),
|
||||
&button->lifetime());
|
||||
state->toggles.emplace(entry.emoji, button);
|
||||
state->toggles.emplace(entry.id, button);
|
||||
button->toggleOn(rpl::single(
|
||||
active(entry)
|
||||
) | rpl::then(
|
||||
state->forceToggleAll.events()
|
||||
activeOnStart(entry.id)
|
||||
) | rpl::then(enabled
|
||||
? (state->forceToggleAll.events() | rpl::type_erased())
|
||||
: rpl::never<bool>()
|
||||
));
|
||||
button->toggledChanges(
|
||||
) | rpl::start_with_next([=](bool toggled) {
|
||||
if (toggled) {
|
||||
state->anyToggled = true;
|
||||
} else if (collect().empty()) {
|
||||
state->anyToggled = false;
|
||||
}
|
||||
}, button->lifetime());
|
||||
if (enabled) {
|
||||
button->toggledChanges(
|
||||
) | rpl::start_with_next([=](bool toggled) {
|
||||
if (toggled) {
|
||||
state->anyToggled = true;
|
||||
} else if (collect().some.empty()) {
|
||||
state->anyToggled = false;
|
||||
}
|
||||
}, button->lifetime());
|
||||
}
|
||||
};
|
||||
for (const auto &entry : list) {
|
||||
add(entry);
|
||||
}
|
||||
for (const auto &id : allowed.some) {
|
||||
if (const auto customId = id.custom()) {
|
||||
// Some possible forward compatibility.
|
||||
const auto button = Settings::AddButton(
|
||||
reactions,
|
||||
rpl::single(u"Custom reaction"_q),
|
||||
st::manageGroupButton.button);
|
||||
AddReactionCustomIcon(
|
||||
button,
|
||||
button->sizeValue(
|
||||
) | rpl::map([=](const QSize &size) {
|
||||
return QPoint(
|
||||
st::editPeerReactionsIconLeft,
|
||||
(size.height() - iconHeight) / 2);
|
||||
}),
|
||||
iconHeight,
|
||||
navigation->parentController(),
|
||||
customId,
|
||||
rpl::never<>(),
|
||||
&button->lifetime());
|
||||
state->toggles.emplace(id, button);
|
||||
button->toggleOn(rpl::single(true));
|
||||
}
|
||||
}
|
||||
|
||||
box->addButton(tr::lng_settings_save(), [=] {
|
||||
const auto ids = collect();
|
||||
const auto result = collect();
|
||||
box->closeBox();
|
||||
callback(ids);
|
||||
callback(result);
|
||||
});
|
||||
box->addButton(tr::lng_cancel(), [=] {
|
||||
box->closeBox();
|
||||
@@ -145,27 +256,35 @@ void EditAllowedReactionsBox(
|
||||
|
||||
void SaveAllowedReactions(
|
||||
not_null<PeerData*> peer,
|
||||
const std::vector<QString> &allowed) {
|
||||
auto ids = allowed | ranges::views::transform([=](QString value) {
|
||||
return MTP_string(value);
|
||||
}) | ranges::to<QVector<MTPstring>>;
|
||||
const Data::AllowedReactions &allowed) {
|
||||
auto ids = allowed.some | ranges::views::transform(
|
||||
Data::ReactionToMTP
|
||||
) | ranges::to<QVector<MTPReaction>>;
|
||||
|
||||
using Type = Data::AllowedReactionsType;
|
||||
const auto updated = (allowed.type != Type::Some)
|
||||
? MTP_chatReactionsAll(MTP_flags((allowed.type == Type::Default)
|
||||
? MTPDchatReactionsAll::Flag(0)
|
||||
: MTPDchatReactionsAll::Flag::f_allow_custom))
|
||||
: allowed.some.empty()
|
||||
? MTP_chatReactionsNone()
|
||||
: MTP_chatReactionsSome(MTP_vector<MTPReaction>(ids));
|
||||
peer->session().api().request(MTPmessages_SetChatAvailableReactions(
|
||||
peer->input,
|
||||
MTP_vector<MTPstring>(ids)
|
||||
updated
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
peer->session().api().applyUpdates(result);
|
||||
if (const auto chat = peer->asChat()) {
|
||||
chat->setAllowedReactions({ begin(allowed), end(allowed) });
|
||||
chat->setAllowedReactions(Data::Parse(updated));
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
channel->setAllowedReactions({ begin(allowed), end(allowed) });
|
||||
channel->setAllowedReactions(Data::Parse(updated));
|
||||
} else {
|
||||
Unexpected("Invalid peer type in SaveAllowedReactions.");
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == qstr("REACTION_INVALID")) {
|
||||
peer->updateFullForced();
|
||||
peer->owner().reactions().refresh();
|
||||
peer->owner().reactions().refreshDefault();
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
||||
@@ -11,19 +11,25 @@ class PeerData;
|
||||
|
||||
namespace Data {
|
||||
struct Reaction;
|
||||
struct AllowedReactions;
|
||||
} // namespace Data
|
||||
|
||||
namespace Ui {
|
||||
class GenericBox;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Window {
|
||||
class SessionNavigation;
|
||||
} // namespace Window
|
||||
|
||||
void EditAllowedReactionsBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
bool isGroup,
|
||||
const std::vector<Data::Reaction> &list,
|
||||
const base::flat_set<QString> &selected,
|
||||
Fn<void(const std::vector<QString> &)> callback);
|
||||
const Data::AllowedReactions &allowed,
|
||||
Fn<void(const Data::AllowedReactions &)> callback);
|
||||
|
||||
void SaveAllowedReactions(
|
||||
not_null<PeerData*> peer,
|
||||
const std::vector<QString> &allowed);
|
||||
const Data::AllowedReactions &allowed);
|
||||
|
||||
@@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "mtproto/sender.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/toasts/common_toasts.h"
|
||||
#include "ui/painter.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "apiwrap.h"
|
||||
@@ -388,7 +389,7 @@ void RequestsBoxController::processRequest(
|
||||
: tr::lng_group_requests_was_added)(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(user->name),
|
||||
Ui::Text::Bold(user->name()),
|
||||
Ui::Text::WithEntities)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -241,6 +241,10 @@ void Controller::createContent() {
|
||||
) | rpl::start_with_next([=](bool toggled) {
|
||||
_dataSavedValue->joinToWrite = toggled;
|
||||
}, wrap->lifetime());
|
||||
} else {
|
||||
_controls.whoSendWrap->toggle(
|
||||
(_controls.privacy->value() == Privacy::HasUsername),
|
||||
anim::type::instant);
|
||||
}
|
||||
auto joinToWrite = _controls.joinToWrite
|
||||
? _controls.joinToWrite->toggledValue()
|
||||
|
||||
@@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/wrap/wrap.h"
|
||||
#include "ui/image/image_prepare.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/painter.h"
|
||||
#include "info/profile/info_profile_text.h"
|
||||
#include "media/streaming/media_streaming_instance.h"
|
||||
#include "media/streaming/media_streaming_player.h"
|
||||
|
||||
@@ -209,7 +209,7 @@ void ProcessFullPhoto(
|
||||
const auto user = peer->asUser();
|
||||
const auto username = peer->userName();
|
||||
return PeerShortInfoFields{
|
||||
.name = peer->name,
|
||||
.name = peer->name(),
|
||||
.phone = user ? Ui::FormatPhone(user->phone()) : QString(),
|
||||
.link = ((user || username.isEmpty())
|
||||
? QString()
|
||||
|
||||
@@ -356,7 +356,7 @@ void PublicsController::rowRightActionClicked(not_null<PeerListRow*> row) {
|
||||
lt_link,
|
||||
peer->session().createInternalLink(peer->userName()),
|
||||
lt_group,
|
||||
peer->name);
|
||||
peer->name());
|
||||
const auto confirmText = tr::lng_channels_too_much_public_revoke(
|
||||
tr::now);
|
||||
const auto closeBox = _closeBox;
|
||||
@@ -929,7 +929,7 @@ void AccountsLimitBox(
|
||||
&& account->session().premiumPossible();
|
||||
}) | ranges::views::transform([&](not_null<Main::Account*> account) {
|
||||
const auto user = account->session().user();
|
||||
return Args::Entry{ user->name, PaintUserpicCallback(user, false) };
|
||||
return Args::Entry{ user->name(), PaintUserpicCallback(user, false)};
|
||||
}) | ranges::views::take(defaultLimit) | ranges::to_vector;
|
||||
|
||||
const auto premiumPossible = !promotePossible.empty();
|
||||
|
||||
@@ -12,7 +12,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_file_origin.h"
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_message_reactions.h"
|
||||
#include "data/data_document_media.h"
|
||||
#include "data/data_streaming.h"
|
||||
#include "data/data_peer_values.h"
|
||||
@@ -32,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/gradient_round_button.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "ui/painter.h"
|
||||
#include "settings/settings_premium.h"
|
||||
#include "lottie/lottie_single_player.h"
|
||||
#include "history/view/media/history_view_sticker.h"
|
||||
@@ -50,7 +50,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
namespace {
|
||||
|
||||
constexpr auto kPremiumShift = 21. / 240;
|
||||
constexpr auto kShiftDuration = crl::time(200);
|
||||
constexpr auto kReactionsPerRow = 5;
|
||||
constexpr auto kDisabledOpacity = 0.5;
|
||||
constexpr auto kPreviewsCount = int(PremiumPreview::kCount);
|
||||
@@ -59,10 +58,11 @@ constexpr auto kStarOpacityOff = 0.1;
|
||||
constexpr auto kStarOpacityOn = 1.;
|
||||
constexpr auto kStarPeriod = 3 * crl::time(1000);
|
||||
|
||||
using Data::ReactionId;
|
||||
|
||||
struct Descriptor {
|
||||
PremiumPreview section = PremiumPreview::Stickers;
|
||||
DocumentData *requestedSticker = nullptr;
|
||||
base::flat_map<QString, ReactionDisableType> disabled;
|
||||
bool fromSettings = false;
|
||||
Fn<void()> hiddenCallback;
|
||||
Fn<void(not_null<Ui::BoxContent*>)> shownCallback;
|
||||
@@ -71,27 +71,9 @@ struct Descriptor {
|
||||
bool operator==(const Descriptor &a, const Descriptor &b) {
|
||||
return (a.section == b.section)
|
||||
&& (a.requestedSticker == b.requestedSticker)
|
||||
&& (a.disabled == b.disabled)
|
||||
&& (a.fromSettings == b.fromSettings);
|
||||
}
|
||||
|
||||
[[nodiscard]] int ComputeX(int column, int columns) {
|
||||
const auto skip = st::premiumReactionWidthSkip;
|
||||
const auto fullWidth = columns * skip;
|
||||
const auto left = (st::boxWideWidth - fullWidth) / 2;
|
||||
return left + column * skip + (skip / 2);
|
||||
}
|
||||
|
||||
[[nodiscard]] int ComputeY(int row, int rows) {
|
||||
const auto middle = (rows > 3)
|
||||
? (st::premiumReactionInfoTop / 2)
|
||||
: st::premiumReactionsMiddle;
|
||||
const auto skip = st::premiumReactionHeightSkip;
|
||||
const auto fullHeight = rows * skip;
|
||||
const auto top = middle - (fullHeight / 2);
|
||||
return top + row * skip + (skip / 2);
|
||||
}
|
||||
|
||||
struct Preload {
|
||||
Descriptor descriptor;
|
||||
std::shared_ptr<Data::DocumentMedia> media;
|
||||
@@ -119,8 +101,10 @@ void PreloadSticker(const std::shared_ptr<Data::DocumentMedia> &media) {
|
||||
return tr::lng_premium_summary_subtitle_voice_to_text();
|
||||
case PremiumPreview::NoAds:
|
||||
return tr::lng_premium_summary_subtitle_no_ads();
|
||||
case PremiumPreview::Reactions:
|
||||
return tr::lng_premium_summary_subtitle_unique_reactions();
|
||||
case PremiumPreview::EmojiStatus:
|
||||
return tr::lng_premium_summary_subtitle_emoji_status();
|
||||
case PremiumPreview::InfiniteReactions:
|
||||
return tr::lng_premium_summary_subtitle_infinite_reactions();
|
||||
case PremiumPreview::Stickers:
|
||||
return tr::lng_premium_summary_subtitle_premium_stickers();
|
||||
case PremiumPreview::AnimatedEmoji:
|
||||
@@ -145,8 +129,10 @@ void PreloadSticker(const std::shared_ptr<Data::DocumentMedia> &media) {
|
||||
return tr::lng_premium_summary_about_voice_to_text();
|
||||
case PremiumPreview::NoAds:
|
||||
return tr::lng_premium_summary_about_no_ads();
|
||||
case PremiumPreview::Reactions:
|
||||
return tr::lng_premium_summary_about_unique_reactions();
|
||||
case PremiumPreview::EmojiStatus:
|
||||
return tr::lng_premium_summary_about_emoji_status();
|
||||
case PremiumPreview::InfiniteReactions:
|
||||
return tr::lng_premium_summary_about_infinite_reactions();
|
||||
case PremiumPreview::Stickers:
|
||||
return tr::lng_premium_summary_about_premium_stickers();
|
||||
case PremiumPreview::AnimatedEmoji:
|
||||
@@ -464,6 +450,8 @@ struct VideoPreviewDocument {
|
||||
case PremiumPreview::AnimatedEmoji: return "animated_emoji";
|
||||
case PremiumPreview::AdvancedChatManagement:
|
||||
return "advanced_chat_management";
|
||||
case PremiumPreview::EmojiStatus: return "emoji_status";
|
||||
case PremiumPreview::InfiniteReactions: return "infinite_reactions";
|
||||
case PremiumPreview::ProfileBadge: return "profile_badge";
|
||||
case PremiumPreview::AnimatedUserpics: return "animated_userpics";
|
||||
}
|
||||
@@ -725,423 +713,12 @@ struct VideoPreviewDocument {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
class ReactionPreview final {
|
||||
public:
|
||||
ReactionPreview(
|
||||
not_null<Window::SessionController*> controller,
|
||||
const Data::Reaction &reaction,
|
||||
ReactionDisableType type,
|
||||
Fn<void()> update,
|
||||
QPoint position);
|
||||
|
||||
[[nodiscard]] bool playsEffect() const;
|
||||
void paint(Painter &p);
|
||||
void paintEffect(QPainter &p);
|
||||
|
||||
void setOver(bool over);
|
||||
void startAnimations();
|
||||
void cancelAnimations();
|
||||
[[nodiscard]] bool ready() const;
|
||||
[[nodiscard]] bool disabled() const;
|
||||
[[nodiscard]] QRect geometry() const;
|
||||
|
||||
private:
|
||||
void checkReady();
|
||||
|
||||
const not_null<Window::SessionController*> _controller;
|
||||
const Fn<void()> _update;
|
||||
const QPoint _position;
|
||||
Ui::Animations::Simple _scale;
|
||||
std::shared_ptr<Data::DocumentMedia> _centerMedia;
|
||||
std::shared_ptr<Data::DocumentMedia> _aroundMedia;
|
||||
std::unique_ptr<Lottie::SinglePlayer> _center;
|
||||
std::unique_ptr<Lottie::SinglePlayer> _around;
|
||||
std::unique_ptr<Ui::PathShiftGradient> _pathGradient;
|
||||
QImage _cache1;
|
||||
QImage _cache2;
|
||||
bool _over = false;
|
||||
bool _disabled = false;
|
||||
bool _playRequested = false;
|
||||
bool _aroundPlaying = false;
|
||||
bool _centerPlaying = false;
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
};
|
||||
|
||||
ReactionPreview::ReactionPreview(
|
||||
not_null<Window::SessionController*> controller,
|
||||
const Data::Reaction &reaction,
|
||||
ReactionDisableType type,
|
||||
Fn<void()> update,
|
||||
QPoint position)
|
||||
: _controller(controller)
|
||||
, _update(std::move(update))
|
||||
, _position(position)
|
||||
, _centerMedia(reaction.centerIcon->createMediaView())
|
||||
, _aroundMedia(reaction.aroundAnimation->createMediaView())
|
||||
, _pathGradient(
|
||||
HistoryView::MakePathShiftGradient(
|
||||
controller->chatStyle(),
|
||||
_update))
|
||||
, _disabled(type != ReactionDisableType::None) {
|
||||
_centerMedia->checkStickerLarge();
|
||||
_aroundMedia->checkStickerLarge();
|
||||
checkReady();
|
||||
if (!_center || !_around) {
|
||||
_controller->session().downloaderTaskFinished(
|
||||
) | rpl::take_while([=] {
|
||||
checkReady();
|
||||
return !_center || !_around;
|
||||
}) | rpl::start(_lifetime);
|
||||
}
|
||||
}
|
||||
|
||||
QRect ReactionPreview::geometry() const {
|
||||
const auto xsize = st::premiumReactionWidthSkip;
|
||||
const auto ysize = st::premiumReactionHeightSkip;
|
||||
return { _position - QPoint(xsize / 2, ysize / 2), QSize(xsize, ysize) };
|
||||
}
|
||||
|
||||
void ReactionPreview::checkReady() {
|
||||
const auto make = [&](
|
||||
const std::shared_ptr<Data::DocumentMedia> &media,
|
||||
int size) {
|
||||
const auto bytes = media->bytes();
|
||||
const auto filepath = media->owner()->filepath();
|
||||
auto result = ChatHelpers::LottiePlayerFromDocument(
|
||||
media.get(),
|
||||
nullptr,
|
||||
ChatHelpers::StickerLottieSize::PremiumReactionPreview,
|
||||
QSize(size, size) * style::DevicePixelRatio(),
|
||||
Lottie::Quality::Default);
|
||||
result->updates() | rpl::start_with_next(_update, _lifetime);
|
||||
return result;
|
||||
};
|
||||
if (!_center && _centerMedia->loaded()) {
|
||||
_center = make(_centerMedia, st::premiumReactionSize);
|
||||
}
|
||||
if (!_around && _aroundMedia->loaded()) {
|
||||
_around = make(_aroundMedia, st::premiumReactionAround);
|
||||
}
|
||||
}
|
||||
|
||||
void ReactionPreview::setOver(bool over) {
|
||||
if (_over == over || _disabled) {
|
||||
return;
|
||||
}
|
||||
_over = over;
|
||||
const auto from = st::premiumReactionScale;
|
||||
_scale.start(
|
||||
_update,
|
||||
over ? from : 1.,
|
||||
over ? 1. : from,
|
||||
st::slideWrapDuration);
|
||||
}
|
||||
|
||||
void ReactionPreview::startAnimations() {
|
||||
if (_disabled) {
|
||||
return;
|
||||
}
|
||||
_playRequested = true;
|
||||
if (!_center || !_center->ready() || !_around || !_around->ready()) {
|
||||
return;
|
||||
}
|
||||
_update();
|
||||
}
|
||||
|
||||
void ReactionPreview::cancelAnimations() {
|
||||
_playRequested = false;
|
||||
}
|
||||
|
||||
bool ReactionPreview::ready() const {
|
||||
return _center && _center->ready();
|
||||
}
|
||||
|
||||
bool ReactionPreview::disabled() const {
|
||||
return _disabled;
|
||||
}
|
||||
|
||||
void ReactionPreview::paint(Painter &p) {
|
||||
const auto center = st::premiumReactionSize;
|
||||
const auto scale = _scale.value(_over ? 1. : st::premiumReactionScale);
|
||||
const auto inner = QRect(
|
||||
-center / 2,
|
||||
-center / 2,
|
||||
center,
|
||||
center
|
||||
).translated(_position);
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
const auto centerReady = _center && _center->ready();
|
||||
const auto staticCenter = centerReady && !_centerPlaying;
|
||||
const auto use1 = staticCenter && scale == 1.;
|
||||
const auto use2 = staticCenter && scale == st::premiumReactionScale;
|
||||
const auto useScale = (!use1 && !use2 && scale != 1.);
|
||||
if (useScale) {
|
||||
p.save();
|
||||
p.translate(inner.center());
|
||||
p.scale(scale, scale);
|
||||
p.translate(-inner.center());
|
||||
}
|
||||
if (_disabled) {
|
||||
p.setOpacity(kDisabledOpacity);
|
||||
}
|
||||
checkReady();
|
||||
if (centerReady) {
|
||||
if (use1 || use2) {
|
||||
auto &cache = use1 ? _cache1 : _cache2;
|
||||
const auto use = int(std::round(center * scale));
|
||||
const auto rect = QRect(-use / 2, -use / 2, use, use).translated(
|
||||
_position);
|
||||
if (cache.isNull()) {
|
||||
cache = _center->frame().scaledToWidth(
|
||||
use * style::DevicePixelRatio(),
|
||||
Qt::SmoothTransformation);
|
||||
}
|
||||
p.drawImage(rect, cache);
|
||||
} else {
|
||||
p.drawImage(inner, _center->frame());
|
||||
}
|
||||
if (_centerPlaying) {
|
||||
const auto almost = (_center->frameIndex() + 1)
|
||||
== _center->framesCount();
|
||||
const auto marked = _center->markFrameShown();
|
||||
if (almost && marked) {
|
||||
_centerPlaying = false;
|
||||
}
|
||||
}
|
||||
if (_around
|
||||
&& _around->ready()
|
||||
&& !_aroundPlaying
|
||||
&& !_centerPlaying
|
||||
&& _playRequested) {
|
||||
_aroundPlaying = _centerPlaying = true;
|
||||
_playRequested = false;
|
||||
}
|
||||
} else {
|
||||
p.setBrush(_controller->chatStyle()->msgServiceBg());
|
||||
ChatHelpers::PaintStickerThumbnailPath(
|
||||
p,
|
||||
_centerMedia.get(),
|
||||
inner,
|
||||
_pathGradient.get());
|
||||
}
|
||||
if (useScale) {
|
||||
p.restore();
|
||||
} else if (_disabled) {
|
||||
p.setOpacity(1.);
|
||||
}
|
||||
}
|
||||
|
||||
bool ReactionPreview::playsEffect() const {
|
||||
return _aroundPlaying;
|
||||
}
|
||||
|
||||
void ReactionPreview::paintEffect(QPainter &p) {
|
||||
if (!_aroundPlaying) {
|
||||
return;
|
||||
}
|
||||
const auto size = st::premiumReactionAround;
|
||||
const auto outer = QRect(-size/2, -size/2, size, size).translated(
|
||||
_position);
|
||||
const auto scale = _scale.value(_over ? 1. : st::premiumReactionScale);
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
if (scale != 1.) {
|
||||
p.save();
|
||||
p.translate(outer.center());
|
||||
p.scale(scale, scale);
|
||||
p.translate(-outer.center());
|
||||
}
|
||||
p.drawImage(outer, _around->frame());
|
||||
if (scale != 1.) {
|
||||
p.restore();
|
||||
}
|
||||
if (_aroundPlaying) {
|
||||
const auto almost = (_around->frameIndex() + 1)
|
||||
== _around->framesCount();
|
||||
const auto marked = _around->markFrameShown();
|
||||
if (almost && marked) {
|
||||
_aroundPlaying = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] not_null<Ui::RpWidget*> ReactionsPreview(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
not_null<Window::SessionController*> controller,
|
||||
const base::flat_map<QString, ReactionDisableType> &disabled,
|
||||
Fn<void()> readyCallback) {
|
||||
struct State {
|
||||
std::vector<std::unique_ptr<ReactionPreview>> entries;
|
||||
Ui::Text::String bottom;
|
||||
int selected = -1;
|
||||
bool readyInvoked = false;
|
||||
};
|
||||
const auto result = Ui::CreateChild<Ui::RpWidget>(parent.get());
|
||||
result->show();
|
||||
|
||||
auto &lifetime = result->lifetime();
|
||||
const auto state = lifetime.make_state<State>();
|
||||
|
||||
result->setMouseTracking(true);
|
||||
|
||||
parent->sizeValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
result->setGeometry(parent->rect());
|
||||
}, result->lifetime());
|
||||
|
||||
using namespace HistoryView;
|
||||
const auto list = controller->session().data().reactions().list(
|
||||
Data::Reactions::Type::Active);
|
||||
const auto count = ranges::count(list, true, &Data::Reaction::premium);
|
||||
const auto rows = (count + kReactionsPerRow - 1) / kReactionsPerRow;
|
||||
const auto inrowmax = (count + rows - 1) / rows;
|
||||
const auto inrowless = (inrowmax * rows - count);
|
||||
const auto inrowmore = rows - inrowless;
|
||||
const auto inmaxrows = inrowmore * inrowmax;
|
||||
auto index = 0;
|
||||
auto disableType = ReactionDisableType::None;
|
||||
for (const auto &reaction : list) {
|
||||
if (!reaction.premium) {
|
||||
continue;
|
||||
}
|
||||
const auto inrow = (index < inmaxrows) ? inrowmax : (inrowmax - 1);
|
||||
const auto row = (index < inmaxrows)
|
||||
? (index / inrow)
|
||||
: (inrowmore + ((index - inmaxrows) / inrow));
|
||||
const auto column = (index < inmaxrows)
|
||||
? (index % inrow)
|
||||
: ((index - inmaxrows) % inrow);
|
||||
++index;
|
||||
if (!reaction.centerIcon || !reaction.aroundAnimation) {
|
||||
continue;
|
||||
}
|
||||
const auto i = disabled.find(reaction.emoji);
|
||||
const auto disable = (i != end(disabled))
|
||||
? i->second
|
||||
: ReactionDisableType::None;
|
||||
if (disable != ReactionDisableType::None) {
|
||||
disableType = disable;
|
||||
}
|
||||
state->entries.push_back(std::make_unique<ReactionPreview>(
|
||||
controller,
|
||||
reaction,
|
||||
disable,
|
||||
[=] { result->update(); },
|
||||
QPoint(ComputeX(column, inrow), ComputeY(row, rows))));
|
||||
}
|
||||
|
||||
const auto bottom1 = tr::lng_reaction_premium_info(tr::now);
|
||||
const auto bottom2 = (disableType == ReactionDisableType::None)
|
||||
? QString()
|
||||
: (disableType == ReactionDisableType::Group)
|
||||
? tr::lng_reaction_premium_no_group(tr::now)
|
||||
: tr::lng_reaction_premium_no_channel(tr::now);
|
||||
state->bottom.setText(
|
||||
st::defaultTextStyle,
|
||||
(bottom1 + '\n' + bottom2).trimmed());
|
||||
|
||||
result->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
auto p = Painter(result);
|
||||
auto effects = std::vector<Fn<void()>>();
|
||||
auto ready = 0;
|
||||
for (const auto &entry : state->entries) {
|
||||
entry->paint(p);
|
||||
if (entry->ready()) {
|
||||
++ready;
|
||||
}
|
||||
if (entry->playsEffect()) {
|
||||
effects.push_back([&] {
|
||||
entry->paintEffect(p);
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!state->readyInvoked
|
||||
&& readyCallback
|
||||
&& ready > 0
|
||||
&& ready == state->entries.size()) {
|
||||
state->readyInvoked = true;
|
||||
readyCallback();
|
||||
|
||||
}
|
||||
const auto padding = st::boxRowPadding;
|
||||
const auto available = parent->width()
|
||||
- padding.left()
|
||||
- padding.right();
|
||||
const auto top = st::premiumReactionInfoTop
|
||||
+ ((state->bottom.maxWidth() > available)
|
||||
? st::normalFont->height
|
||||
: 0);
|
||||
p.setPen(st::premiumButtonFg);
|
||||
state->bottom.draw(
|
||||
p,
|
||||
padding.left(),
|
||||
top,
|
||||
available,
|
||||
style::al_top);
|
||||
for (const auto &paint : effects) {
|
||||
paint();
|
||||
}
|
||||
}, lifetime);
|
||||
|
||||
const auto lookup = [=](QPoint point) {
|
||||
auto index = 0;
|
||||
for (const auto &entry : state->entries) {
|
||||
if (entry->geometry().contains(point) && !entry->disabled()) {
|
||||
return index;
|
||||
}
|
||||
++index;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
const auto select = [=](int index) {
|
||||
const auto wasInside = (state->selected >= 0);
|
||||
const auto nowInside = (index >= 0);
|
||||
if (state->selected != index) {
|
||||
if (wasInside) {
|
||||
state->entries[state->selected]->setOver(false);
|
||||
}
|
||||
if (nowInside) {
|
||||
state->entries[index]->setOver(true);
|
||||
}
|
||||
state->selected = index;
|
||||
}
|
||||
if (wasInside != nowInside) {
|
||||
result->setCursor(nowInside
|
||||
? style::cur_pointer
|
||||
: style::cur_default);
|
||||
}
|
||||
};
|
||||
result->events(
|
||||
) | rpl::start_with_next([=](not_null<QEvent*> event) {
|
||||
if (event->type() == QEvent::MouseButtonPress) {
|
||||
const auto point = static_cast<QMouseEvent*>(event.get())->pos();
|
||||
if (state->selected >= 0) {
|
||||
state->entries[state->selected]->cancelAnimations();
|
||||
}
|
||||
if (const auto index = lookup(point); index >= 0) {
|
||||
state->entries[index]->startAnimations();
|
||||
}
|
||||
} else if (event->type() == QEvent::MouseMove) {
|
||||
const auto point = static_cast<QMouseEvent*>(event.get())->pos();
|
||||
select(lookup(point));
|
||||
} else if (event->type() == QEvent::Leave) {
|
||||
select(-1);
|
||||
}
|
||||
}, lifetime);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[[nodiscard]] not_null<Ui::RpWidget*> GenerateDefaultPreview(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
not_null<Window::SessionController*> controller,
|
||||
PremiumPreview section,
|
||||
Fn<void()> readyCallback) {
|
||||
switch (section) {
|
||||
case PremiumPreview::Reactions:
|
||||
return ReactionsPreview(parent, controller, {}, readyCallback);
|
||||
case PremiumPreview::Stickers:
|
||||
return StickersPreview(parent, controller, readyCallback);
|
||||
default:
|
||||
@@ -1227,8 +804,6 @@ void PreviewBox(
|
||||
Ui::RpWidget *content = nullptr;
|
||||
Ui::RpWidget *stickersPreload = nullptr;
|
||||
bool stickersPreloadReady = false;
|
||||
Ui::RpWidget *reactionsPreload = nullptr;
|
||||
bool reactionsPreloadReady = false;
|
||||
bool preloadScheduled = false;
|
||||
bool showFinished = false;
|
||||
Ui::Animations::Simple animation;
|
||||
@@ -1291,21 +866,6 @@ void PreviewBox(
|
||||
ready);
|
||||
state->stickersPreload->hide();
|
||||
}
|
||||
if (now != PremiumPreview::Reactions && !state->reactionsPreload) {
|
||||
const auto ready = [=] {
|
||||
if (state->reactionsPreload) {
|
||||
state->reactionsPreloadReady = true;
|
||||
} else {
|
||||
state->preload();
|
||||
}
|
||||
};
|
||||
state->reactionsPreload = GenerateDefaultPreview(
|
||||
outer,
|
||||
controller,
|
||||
PremiumPreview::Reactions,
|
||||
ready);
|
||||
state->reactionsPreload->hide();
|
||||
}
|
||||
};
|
||||
|
||||
switch (descriptor.section) {
|
||||
@@ -1314,13 +874,6 @@ void PreviewBox(
|
||||
? StickerPreview(outer, controller, media, state->preload)
|
||||
: StickersPreview(outer, controller, state->preload);
|
||||
break;
|
||||
case PremiumPreview::Reactions:
|
||||
state->content = ReactionsPreview(
|
||||
outer,
|
||||
controller,
|
||||
descriptor.disabled,
|
||||
state->preload);
|
||||
break;
|
||||
default:
|
||||
state->content = GenericPreview(
|
||||
outer,
|
||||
@@ -1380,13 +933,6 @@ void PreviewBox(
|
||||
if (base::take(state->stickersPreloadReady)) {
|
||||
state->preload();
|
||||
}
|
||||
} else if (now == PremiumPreview::Reactions
|
||||
&& state->reactionsPreload) {
|
||||
state->content = base::take(state->reactionsPreload);
|
||||
state->content->show();
|
||||
if (base::take(state->reactionsPreloadReady)) {
|
||||
state->preload();
|
||||
}
|
||||
} else {
|
||||
state->content = GenerateDefaultPreview(
|
||||
outer,
|
||||
@@ -1456,12 +1002,14 @@ void PreviewBox(
|
||||
};
|
||||
auto unlock = state->selected.value(
|
||||
) | rpl::map([=](PremiumPreview section) {
|
||||
return (section == PremiumPreview::Reactions)
|
||||
return (section == PremiumPreview::InfiniteReactions)
|
||||
? tr::lng_premium_unlock_reactions()
|
||||
: (section == PremiumPreview::Stickers)
|
||||
? tr::lng_premium_unlock_stickers()
|
||||
: (section == PremiumPreview::AnimatedEmoji)
|
||||
? tr::lng_premium_unlock_emoji()
|
||||
: (section == PremiumPreview::EmojiStatus)
|
||||
? tr::lng_premium_unlock_status()
|
||||
: tr::lng_premium_more_about();
|
||||
}) | rpl::flatten_latest();
|
||||
auto button = descriptor.fromSettings
|
||||
@@ -1624,11 +1172,9 @@ void ShowStickerPreviewBox(
|
||||
void ShowPremiumPreviewBox(
|
||||
not_null<Window::SessionController*> controller,
|
||||
PremiumPreview section,
|
||||
const base::flat_map<QString, ReactionDisableType> &disabled,
|
||||
Fn<void(not_null<Ui::BoxContent*>)> shown) {
|
||||
Show(controller, Descriptor{
|
||||
.section = section,
|
||||
.disabled = disabled,
|
||||
.shownCallback = std::move(shown),
|
||||
});
|
||||
}
|
||||
@@ -1671,14 +1217,14 @@ void DoubledLimitsPreviewBox(
|
||||
});
|
||||
}
|
||||
{
|
||||
const auto premium = limits.dialogsFolderPinnedPremium();
|
||||
const auto premium = limits.dialogsPinnedPremium();
|
||||
entries.push_back(Ui::Premium::ListEntry{
|
||||
tr::lng_premium_double_limits_subtitle_pins(),
|
||||
tr::lng_premium_double_limits_about_pins(
|
||||
lt_count,
|
||||
rpl::single(float64(premium)),
|
||||
Ui::Text::RichLangValue),
|
||||
limits.dialogsFolderPinnedDefault(),
|
||||
limits.dialogsPinnedDefault(),
|
||||
premium,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
class DocumentData;
|
||||
|
||||
namespace Data {
|
||||
struct ReactionId;
|
||||
} // namespace Data
|
||||
|
||||
namespace Ui {
|
||||
class BoxContent;
|
||||
class GenericBox;
|
||||
@@ -38,7 +42,8 @@ enum class PremiumPreview {
|
||||
FasterDownload,
|
||||
VoiceToText,
|
||||
NoAds,
|
||||
Reactions,
|
||||
EmojiStatus,
|
||||
InfiniteReactions,
|
||||
Stickers,
|
||||
AnimatedEmoji,
|
||||
AdvancedChatManagement,
|
||||
@@ -47,16 +52,10 @@ enum class PremiumPreview {
|
||||
|
||||
kCount,
|
||||
};
|
||||
enum class ReactionDisableType {
|
||||
None,
|
||||
Group,
|
||||
Channel,
|
||||
};
|
||||
|
||||
void ShowPremiumPreviewBox(
|
||||
not_null<Window::SessionController*> controller,
|
||||
PremiumPreview section,
|
||||
const base::flat_map<QString, ReactionDisableType> &disabled = {},
|
||||
Fn<void(not_null<Ui::BoxContent*>)> shown = nullptr);
|
||||
|
||||
void ShowPremiumPreviewToBuy(
|
||||
|
||||