Compare commits
166 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e206f42e4e | ||
|
|
3f60410190 | ||
|
|
3cdd8558db | ||
|
|
f2b89445ae | ||
|
|
3ff4bf77e7 | ||
|
|
d16ccf0d9e | ||
|
|
fc7d9b264f | ||
|
|
b28d5a63d1 | ||
|
|
043ba4ff04 | ||
|
|
d6c3bf4168 | ||
|
|
7bf7a8feff | ||
|
|
3413ad1d22 | ||
|
|
84af084a3b | ||
|
|
cd50008429 | ||
|
|
767459ab57 | ||
|
|
3b45a120e6 | ||
|
|
b04aaba8d0 | ||
|
|
bfa3655c7b | ||
|
|
8642eb23a7 | ||
|
|
ef8ecc546b | ||
|
|
fafbbb4996 | ||
|
|
3a021f4e49 | ||
|
|
2788c19c85 | ||
|
|
300cc3dbca | ||
|
|
62516e264d | ||
|
|
8b89cfc4cb | ||
|
|
e3f65d2346 | ||
|
|
2b383a4236 | ||
|
|
a8426bd6da | ||
|
|
39a02e649d | ||
|
|
276fe2169a | ||
|
|
8fae56bee8 | ||
|
|
0e16a50bbc | ||
|
|
9de372d715 | ||
|
|
fbae5bdbcf | ||
|
|
aee1ef78da | ||
|
|
27c5c4b8f2 | ||
|
|
94e06c6846 | ||
|
|
7948d971e8 | ||
|
|
70acc7a0e3 | ||
|
|
56fdc7d39a | ||
|
|
f67c3bbf65 | ||
|
|
de194c4aa2 | ||
|
|
511805199f | ||
|
|
aa241a1f62 | ||
|
|
4125a45503 | ||
|
|
1349989494 | ||
|
|
639ed8b973 | ||
|
|
2f5db08c9b | ||
|
|
4c6814def6 | ||
|
|
387914be31 | ||
|
|
2f2003c89b | ||
|
|
48589b721d | ||
|
|
3bdf1634a9 | ||
|
|
1878061c9a | ||
|
|
774c3b5ba0 | ||
|
|
a64b8d4181 | ||
|
|
e3e380124d | ||
|
|
823fc25fa8 | ||
|
|
4062912a98 | ||
|
|
62b5192f24 | ||
|
|
058717532a | ||
|
|
d117a72e6e | ||
|
|
3ba5b825e5 | ||
|
|
075ab20e5b | ||
|
|
deeea0aaed | ||
|
|
8113117cc4 | ||
|
|
7bfe096f3b | ||
|
|
c37b08ac8b | ||
|
|
c52a5927e5 | ||
|
|
edcfac8da3 | ||
|
|
a994c9f017 | ||
|
|
66e6bf8217 | ||
|
|
4a4cc766c2 | ||
|
|
31cd841b75 | ||
|
|
1710890886 | ||
|
|
16f616c5e0 | ||
|
|
7600c9bb2f | ||
|
|
100a44daef | ||
|
|
54305fafde | ||
|
|
d172d3d7db | ||
|
|
cee593c423 | ||
|
|
43adbb1cb1 | ||
|
|
e96731be11 | ||
|
|
6ea062462f | ||
|
|
1bc8d6fb18 | ||
|
|
73d00a4caf | ||
|
|
a23561c380 | ||
|
|
bb75a6a31b | ||
|
|
ce79c1f0c4 | ||
|
|
3cdb82a0bf | ||
|
|
d2f928f0c3 | ||
|
|
3cc0110464 | ||
|
|
df533f2efe | ||
|
|
2529bd3f44 | ||
|
|
a5c12065af | ||
|
|
101e795af8 | ||
|
|
8faa65fdf3 | ||
|
|
644881bd3e | ||
|
|
efa1b2dcbc | ||
|
|
92a9832337 | ||
|
|
8f3456cd6c | ||
|
|
e67192cdf0 | ||
|
|
9f2683a35b | ||
|
|
0a7e25e45a | ||
|
|
643a034aae | ||
|
|
1c5a3aef54 | ||
|
|
bfe47a1ba2 | ||
|
|
acd76fc97b | ||
|
|
78fedce2d5 | ||
|
|
5261e962e2 | ||
|
|
e4bfd562b5 | ||
|
|
d289bbdc5e | ||
|
|
2e9e3b3751 | ||
|
|
af0a2f182c | ||
|
|
e3ac84a849 | ||
|
|
6dce8dfa20 | ||
|
|
eef1da56c8 | ||
|
|
e37866d0b9 | ||
|
|
1ed7d482ab | ||
|
|
f1a7db780e | ||
|
|
8591fae031 | ||
|
|
18b9bba21c | ||
|
|
580e15dc21 | ||
|
|
bf4fc2596a | ||
|
|
9a4d2bc8f9 | ||
|
|
62a2277f43 | ||
|
|
d11885d48c | ||
|
|
c8cec18ad3 | ||
|
|
86105403bf | ||
|
|
41288f5ddb | ||
|
|
9cc1a020f3 | ||
|
|
68f35e98e0 | ||
|
|
b6c9a1d655 | ||
|
|
9b35fa29b8 | ||
|
|
53272d951b | ||
|
|
e3dc4ae088 | ||
|
|
000d9d8b52 | ||
|
|
3d8742fa7c | ||
|
|
ae43e78a86 | ||
|
|
7c72393361 | ||
|
|
fa95ca4289 | ||
|
|
e6e90e99da | ||
|
|
6a3c1f2fd9 | ||
|
|
90f99ebfbe | ||
|
|
59fb61e3e6 | ||
|
|
261740967d | ||
|
|
e99e35a12a | ||
|
|
fd6d09caaa | ||
|
|
47ec5b18b8 | ||
|
|
aac21e1f71 | ||
|
|
21c647147a | ||
|
|
07a022bfb6 | ||
|
|
0427f90649 | ||
|
|
64627c9093 | ||
|
|
148a173474 | ||
|
|
acb6e5dbc3 | ||
|
|
9bd9f17a6c | ||
|
|
d59ed7b14c | ||
|
|
3600055424 | ||
|
|
949caecb75 | ||
|
|
87df42f8c1 | ||
|
|
2996cbc518 | ||
|
|
205cd3b751 | ||
|
|
d25bd2f481 | ||
|
|
072974216b |
11
.github/workflows/docker.yml
vendored
@@ -15,6 +15,9 @@ jobs:
|
||||
name: Ubuntu
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
IMAGE_TAG: ghcr.io/${{ github.repository }}/centos_env:latest
|
||||
|
||||
steps:
|
||||
- name: Clone.
|
||||
uses: actions/checkout@v2
|
||||
@@ -22,4 +25,10 @@ jobs:
|
||||
submodules: recursive
|
||||
|
||||
- name: Docker image build.
|
||||
run: docker build -t telegram_desktop Telegram/build/docker/centos_env
|
||||
run: docker build -t $IMAGE_TAG --build-arg DEBUG= Telegram/build/docker/centos_env
|
||||
|
||||
- name: Push the Docker image.
|
||||
if: ${{ github.ref_name == github.event.repository.default_branch }}
|
||||
run: |
|
||||
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
|
||||
docker push $IMAGE_TAG
|
||||
|
||||
2
.github/workflows/linux.yml
vendored
@@ -46,7 +46,7 @@ jobs:
|
||||
name: CentOS 7
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker.pkg.github.com/telegramdesktop/tdesktop/centos_env
|
||||
image: ghcr.io/${{ github.repository }}/centos_env
|
||||
credentials:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
10
.github/workflows/mac.yml
vendored
@@ -51,6 +51,7 @@ jobs:
|
||||
env:
|
||||
UPLOAD_ARTIFACT: "false"
|
||||
ONLY_CACHE: "false"
|
||||
PREPARE_PATH: "Telegram/build/prepare/prepare.py"
|
||||
|
||||
steps:
|
||||
- name: Get repository name.
|
||||
@@ -65,8 +66,7 @@ jobs:
|
||||
- name: First set up.
|
||||
run: |
|
||||
sudo chown -R `whoami`:admin /usr/local/share
|
||||
brew install automake fdk-aac lame libass libtool libvorbis libvpx \
|
||||
ninja opus sdl shtool texi2html theora x264 xvid yasm pkg-config
|
||||
brew install automake
|
||||
|
||||
# Disable spotlight.
|
||||
sudo mdutil -a -i off
|
||||
@@ -78,14 +78,16 @@ jobs:
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ThirdParty
|
||||
key: ${{ runner.OS }}-third-party
|
||||
key: ${{ runner.OS }}-third-party-${{ hashFiles(format('{0}/{1}', env.REPO_NAME, env.PREPARE_PATH)) }}
|
||||
restore-keys: ${{ runner.OS }}-third-party-
|
||||
|
||||
- name: Libraries cache.
|
||||
id: cache-libs
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: Libraries
|
||||
key: ${{ runner.OS }}-libs
|
||||
key: ${{ runner.OS }}-libs-${{ hashFiles(format('{0}/{1}', env.REPO_NAME, env.PREPARE_PATH)) }}
|
||||
restore-keys: ${{ runner.OS }}-libs-
|
||||
|
||||
- name: Libraries.
|
||||
run: |
|
||||
|
||||
22
.github/workflows/win.yml
vendored
@@ -13,7 +13,7 @@ on:
|
||||
- '!.github/workflows/win.yml'
|
||||
- 'lib/xdg/**'
|
||||
- 'snap/**'
|
||||
- 'Telegram/build/**'
|
||||
- 'Telegram/build/docker/**'
|
||||
- 'Telegram/Resources/uwp/**'
|
||||
- 'Telegram/SourceFiles/platform/linux/**'
|
||||
- 'Telegram/SourceFiles/platform/mac/**'
|
||||
@@ -32,7 +32,7 @@ on:
|
||||
- '!.github/workflows/win.yml'
|
||||
- 'lib/xdg/**'
|
||||
- 'snap/**'
|
||||
- 'Telegram/build/**'
|
||||
- 'Telegram/build/docker/**'
|
||||
- 'Telegram/Resources/uwp/**'
|
||||
- 'Telegram/SourceFiles/platform/linux/**'
|
||||
- 'Telegram/SourceFiles/platform/mac/**'
|
||||
@@ -58,12 +58,12 @@ jobs:
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
working-directory: ${{ github.workspace }}
|
||||
|
||||
steps:
|
||||
- name: Prepare directories.
|
||||
run: |
|
||||
mkdir %userprofile%\TBuild\Libraries
|
||||
mkdir %userprofile%\TBuild Libraries
|
||||
mklink /d %userprofile%\TBuild\Libraries %GITHUB_WORKSPACE%\Libraries
|
||||
echo TBUILD=%userprofile%\TBuild>>%GITHUB_ENV%
|
||||
|
||||
- name: Get repository name.
|
||||
@@ -98,6 +98,8 @@ jobs:
|
||||
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."
|
||||
git config --global user.email "you@example.com"
|
||||
git config --global user.name "Sample"
|
||||
@@ -111,17 +113,15 @@ jobs:
|
||||
id: cache-libs
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.TBUILD }}/Libraries
|
||||
key: ${{ runner.OS }}-libs
|
||||
path: Libraries
|
||||
key: ${{ runner.OS }}-${{ matrix.arch }}-libs-${{ env.CACHE_KEY }}
|
||||
restore-keys: ${{ runner.OS }}-${{ matrix.arch }}-libs-
|
||||
|
||||
- name: Libraries.
|
||||
env:
|
||||
GYP_MSVS_OVERRIDE_PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\'
|
||||
GYP_MSVS_VERSION: 2022
|
||||
run: |
|
||||
C:
|
||||
cd %TBUILD%
|
||||
%REPO_NAME%/Telegram/build/prepare/win.bat skip-release silent
|
||||
run: '%TBUILD%\%REPO_NAME%\Telegram\build\prepare\win.bat skip-release silent'
|
||||
|
||||
- name: Read defines.
|
||||
shell: bash
|
||||
@@ -138,8 +138,6 @@ jobs:
|
||||
|
||||
- name: Free up some disk space.
|
||||
run: |
|
||||
C:
|
||||
cd %TBUILD%
|
||||
del /S Libraries\*.pdb
|
||||
del /S Libraries\*.pch
|
||||
del /S Libraries\*.obj
|
||||
|
||||
@@ -137,6 +137,8 @@ PRIVATE
|
||||
api/api_peer_photo.h
|
||||
api/api_polls.cpp
|
||||
api/api_polls.h
|
||||
api/api_report.cpp
|
||||
api/api_report.h
|
||||
api/api_ringtones.cpp
|
||||
api/api_ringtones.h
|
||||
api/api_self_destruct.cpp
|
||||
@@ -186,8 +188,6 @@ PRIVATE
|
||||
boxes/peers/edit_peer_invite_link.h
|
||||
boxes/peers/edit_peer_invite_links.cpp
|
||||
boxes/peers/edit_peer_invite_links.h
|
||||
boxes/peers/edit_peer_history_visibility_box.cpp
|
||||
boxes/peers/edit_peer_history_visibility_box.h
|
||||
boxes/peers/edit_peer_permissions_box.cpp
|
||||
boxes/peers/edit_peer_permissions_box.h
|
||||
boxes/peers/edit_peer_reactions.cpp
|
||||
@@ -258,6 +258,8 @@ PRIVATE
|
||||
boxes/pin_messages_box.h
|
||||
boxes/reactions_settings_box.cpp
|
||||
boxes/reactions_settings_box.h
|
||||
boxes/report_messages_box.cpp
|
||||
boxes/report_messages_box.h
|
||||
boxes/ringtones_box.cpp
|
||||
boxes/ringtones_box.h
|
||||
boxes/self_destruction_box.cpp
|
||||
@@ -988,6 +990,8 @@ PRIVATE
|
||||
platform/linux/notifications_manager_linux.h
|
||||
platform/linux/specific_linux.cpp
|
||||
platform/linux/specific_linux.h
|
||||
platform/linux/tray_linux.cpp
|
||||
platform/linux/tray_linux.h
|
||||
platform/mac/file_utilities_mac.mm
|
||||
platform/mac/file_utilities_mac.h
|
||||
platform/mac/launcher_mac.mm
|
||||
@@ -1003,6 +1007,8 @@ PRIVATE
|
||||
platform/mac/specific_mac.h
|
||||
platform/mac/specific_mac_p.mm
|
||||
platform/mac/specific_mac_p.h
|
||||
platform/mac/tray_mac.mm
|
||||
platform/mac/tray_mac.h
|
||||
platform/mac/window_title_mac.mm
|
||||
platform/mac/touchbar/items/mac_formatter_item.h
|
||||
platform/mac/touchbar/items/mac_formatter_item.mm
|
||||
@@ -1036,6 +1042,8 @@ PRIVATE
|
||||
platform/win/notifications_manager_win.h
|
||||
platform/win/specific_win.cpp
|
||||
platform/win/specific_win.h
|
||||
platform/win/tray_win.cpp
|
||||
platform/win/tray_win.h
|
||||
platform/win/windows_app_user_model_id.cpp
|
||||
platform/win/windows_app_user_model_id.h
|
||||
platform/win/windows_dlls.cpp
|
||||
@@ -1052,6 +1060,7 @@ PRIVATE
|
||||
platform/platform_main_window.h
|
||||
platform/platform_notifications_manager.h
|
||||
platform/platform_specific.h
|
||||
platform/platform_tray.h
|
||||
platform/platform_window_title.h
|
||||
profile/profile_back_button.cpp
|
||||
profile/profile_back_button.h
|
||||
@@ -1065,6 +1074,8 @@ PRIVATE
|
||||
profile/profile_cover_drop_area.h
|
||||
settings/settings_advanced.cpp
|
||||
settings/settings_advanced.h
|
||||
settings/settings_blocked_peers.cpp
|
||||
settings/settings_blocked_peers.h
|
||||
settings/settings_chat.cpp
|
||||
settings/settings_chat.h
|
||||
settings/settings_calls.cpp
|
||||
@@ -1256,6 +1267,8 @@ PRIVATE
|
||||
settings.cpp
|
||||
settings.h
|
||||
stdafx.h
|
||||
tray.cpp
|
||||
tray.h
|
||||
)
|
||||
|
||||
if (NOT build_winstore)
|
||||
|
||||
BIN
Telegram/Resources/animations/blocked_peers_empty.tgs
Normal file
1
Telegram/Resources/animations/filters.tgs
Normal file
BIN
Telegram/Resources/icons/folders/folders_airplane.png
Normal file
|
After Width: | Height: | Size: 635 B |
BIN
Telegram/Resources/icons/folders/folders_airplane@2x.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Telegram/Resources/icons/folders/folders_airplane@3x.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Telegram/Resources/icons/folders/folders_book.png
Normal file
|
After Width: | Height: | Size: 456 B |
BIN
Telegram/Resources/icons/folders/folders_book@2x.png
Normal file
|
After Width: | Height: | Size: 837 B |
BIN
Telegram/Resources/icons/folders/folders_book@3x.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Telegram/Resources/icons/folders/folders_light.png
Normal file
|
After Width: | Height: | Size: 691 B |
BIN
Telegram/Resources/icons/folders/folders_light@2x.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Telegram/Resources/icons/folders/folders_light@3x.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
Telegram/Resources/icons/folders/folders_like.png
Normal file
|
After Width: | Height: | Size: 797 B |
BIN
Telegram/Resources/icons/folders/folders_like@2x.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
Telegram/Resources/icons/folders/folders_like@3x.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
Telegram/Resources/icons/folders/folders_money.png
Normal file
|
After Width: | Height: | Size: 774 B |
BIN
Telegram/Resources/icons/folders/folders_money@2x.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Telegram/Resources/icons/folders/folders_money@3x.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
Telegram/Resources/icons/folders/folders_note.png
Normal file
|
After Width: | Height: | Size: 495 B |
BIN
Telegram/Resources/icons/folders/folders_note@2x.png
Normal file
|
After Width: | Height: | Size: 823 B |
BIN
Telegram/Resources/icons/folders/folders_note@3x.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Telegram/Resources/icons/folders/folders_palette.png
Normal file
|
After Width: | Height: | Size: 689 B |
BIN
Telegram/Resources/icons/folders/folders_palette@2x.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
Telegram/Resources/icons/folders/folders_palette@3x.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
Telegram/Resources/icons/folders/folders_poo.png
Normal file
|
After Width: | Height: | Size: 828 B |
BIN
Telegram/Resources/icons/folders/folders_poo@2x.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
Telegram/Resources/icons/folders/folders_poo@3x.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
Telegram/Resources/icons/info/edit/channel_manage_signature.png
Normal file
|
After Width: | Height: | Size: 503 B |
|
After Width: | Height: | Size: 901 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 477 B After Width: | Height: | Size: 432 B |
|
Before Width: | Height: | Size: 768 B After Width: | Height: | Size: 757 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 957 B After Width: | Height: | Size: 515 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 989 B |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 469 B |
|
After Width: | Height: | Size: 745 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 648 B After Width: | Height: | Size: 583 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1023 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 665 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 734 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 989 B After Width: | Height: | Size: 509 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 891 B |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.3 KiB |
BIN
Telegram/Resources/icons/info/edit/group_manage_type.png
Normal file
|
After Width: | Height: | Size: 494 B |
BIN
Telegram/Resources/icons/info/edit/group_manage_type@2x.png
Normal file
|
After Width: | Height: | Size: 925 B |
BIN
Telegram/Resources/icons/info/edit/group_manage_type@3x.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 650 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
BIN
Telegram/Resources/icons/settings/blocked.png
Normal file
|
After Width: | Height: | Size: 476 B |
BIN
Telegram/Resources/icons/settings/blocked@2x.png
Normal file
|
After Width: | Height: | Size: 789 B |
BIN
Telegram/Resources/icons/settings/blocked@3x.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Telegram/Resources/icons/settings/remove.png
Normal file
|
After Width: | Height: | Size: 193 B |
BIN
Telegram/Resources/icons/settings/remove@2x.png
Normal file
|
After Width: | Height: | Size: 233 B |
BIN
Telegram/Resources/icons/settings/remove@3x.png
Normal file
|
After Width: | Height: | Size: 294 B |
@@ -799,6 +799,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_blocked_list_confirm_text" = "Do you want to block {name} from messaging and calling you on Telegram?";
|
||||
"lng_blocked_list_confirm_clear" = "Delete this chat";
|
||||
"lng_blocked_list_confirm_ok" = "Block";
|
||||
"lng_blocked_list_empty_title" = "No blocked users";
|
||||
"lng_blocked_list_empty_description" = "You haven't blocked anyone yet.";
|
||||
"lng_blocked_list_subtitle#one" = "{count} blocked user";
|
||||
"lng_blocked_list_subtitle#other" = "{count} blocked users";
|
||||
|
||||
"lng_edit_privacy_everyone" = "Everybody";
|
||||
"lng_edit_privacy_contacts" = "My contacts";
|
||||
@@ -1141,6 +1145,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_report_group_title" = "Report group";
|
||||
"lng_report_bot_title" = "Report bot";
|
||||
"lng_report_message_title" = "Report message";
|
||||
"lng_report_profile_photo_title" = "Report profile photo";
|
||||
"lng_report_profile_video_title" = "Report profile video";
|
||||
"lng_report_please_select_messages" = "Please select messages to report.";
|
||||
"lng_report_select_messages" = "Select messages";
|
||||
"lng_report_messages_none" = "Select Messages";
|
||||
@@ -1974,7 +1980,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_try_other_contact" = "Try someone else";
|
||||
"lng_create_group_link" = "Link";
|
||||
"lng_create_group_invite_link" = "Invite link";
|
||||
"lng_create_group_description" = "Description (optional)";
|
||||
"lng_create_group_description" = "Add description...";
|
||||
|
||||
"lng_drag_images_here" = "Drop images here";
|
||||
"lng_drag_photos_here" = "Drop photos here";
|
||||
@@ -2053,6 +2059,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_mediaview_yesterday" = "yesterday at {time}";
|
||||
"lng_mediaview_date_time" = "{date} at {time}";
|
||||
"lng_mediaview_set_userpic" = "Set as Main";
|
||||
"lng_mediaview_report_profile_photo" = "Report";
|
||||
|
||||
"lng_mediaview_saved_to" = "Image was saved to your {downloads} folder";
|
||||
"lng_mediaview_downloads" = "Downloads";
|
||||
@@ -2145,6 +2152,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_payments_webview_install_webkit" = "Please install WebKitGTK (webkit2gtk-5.0/webkit2gtk-4.1/webkit2gtk-4.0) using your package manager.";
|
||||
"lng_payments_webview_switch_mutter" = "Qt's window embedding doesn't work well with Mutter window manager. Please switch to another window manager or desktop environment.";
|
||||
"lng_payments_webview_switch_wayland" = "There is no way to embed WebView window on Wayland. Please switch to X11.";
|
||||
"lng_payments_webview_update_windows" = "Please update your system to Windows 8.1 or later.";
|
||||
"lng_payments_sure_close" = "Are you sure you want to close this payment form? The changes you made will be lost.";
|
||||
"lng_payments_receipt_label" = "Receipt";
|
||||
"lng_payments_receipt_label_test" = "Test receipt";
|
||||
@@ -2657,7 +2665,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_admin_log_pinned_message" = "{from} pinned this message:";
|
||||
"lng_admin_log_unpinned_message" = "{from} unpinned this message";
|
||||
"lng_admin_log_edited_caption" = "{from} edited caption:";
|
||||
"lng_admin_log_removed_caption" = "{from} removed caption";
|
||||
"lng_admin_log_edited_media" = "{from} edited media:";
|
||||
"lng_admin_log_edited_media_and_caption" = "{from} edited media and caption:";
|
||||
"lng_admin_log_edited_media_and_removed_caption" = "{from} edited media and removed caption:";
|
||||
"lng_admin_log_removed_caption" = "{from} removed caption:";
|
||||
"lng_admin_log_previous_caption" = "Original caption";
|
||||
"lng_admin_log_edited_message" = "{from} edited this message:";
|
||||
"lng_admin_log_previous_message" = "Original message";
|
||||
|
||||
@@ -2,4 +2,10 @@
|
||||
<qresource prefix="/animations">
|
||||
<file alias="change_number.tgs">../../animations/change_number.tgs</file>
|
||||
</qresource>
|
||||
<qresource prefix="/animations">
|
||||
<file alias="blocked_peers_empty.tgs">../../animations/blocked_peers_empty.tgs</file>
|
||||
</qresource>
|
||||
<qresource prefix="/animations">
|
||||
<file alias="filters.tgs">../../animations/filters.tgs</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
|
||||
ProcessorArchitecture="ARCHITECTURE"
|
||||
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
|
||||
Version="3.6.3.0" />
|
||||
Version="3.7.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 3,6,3,0
|
||||
PRODUCTVERSION 3,6,3,0
|
||||
FILEVERSION 3,7,4,0
|
||||
PRODUCTVERSION 3,7,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", "3.6.3.0"
|
||||
VALUE "FileVersion", "3.7.4.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "3.6.3.0"
|
||||
VALUE "ProductVersion", "3.7.4.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,6,3,0
|
||||
PRODUCTVERSION 3,6,3,0
|
||||
FILEVERSION 3,7,4,0
|
||||
PRODUCTVERSION 3,7,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", "3.6.3.0"
|
||||
VALUE "FileVersion", "3.7.4.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "3.6.3.0"
|
||||
VALUE "ProductVersion", "3.7.4.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -83,7 +83,7 @@ MTPInputMedia PrepareUploadedPhoto(RemoteFileInfo info) {
|
||||
MTP_flags(flags),
|
||||
info.file,
|
||||
MTP_vector<MTPInputDocument>(
|
||||
ranges::to<QVector>(info.attachedStickers)),
|
||||
ranges::to<QVector<MTPInputDocument>>(info.attachedStickers)),
|
||||
MTP_int(0));
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ MTPInputMedia PrepareUploadedDocument(
|
||||
MTP_string(document->mimeString()),
|
||||
ComposeSendingDocumentAttributes(document),
|
||||
MTP_vector<MTPInputDocument>(
|
||||
ranges::to<QVector>(info.attachedStickers)),
|
||||
ranges::to<QVector<MTPInputDocument>>(info.attachedStickers)),
|
||||
MTP_int(0));
|
||||
}
|
||||
|
||||
|
||||
@@ -17,10 +17,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "main/main_session.h"
|
||||
|
||||
namespace Api {
|
||||
|
||||
namespace {
|
||||
|
||||
MessageIdsList HistoryItemsFromTL(
|
||||
[[nodiscard]] MessageIdsList HistoryItemsFromTL(
|
||||
not_null<Data::Session*> data,
|
||||
const QVector<MTPMessage> &messages) {
|
||||
auto result = MessageIdsList();
|
||||
@@ -45,8 +44,12 @@ MessageIdsList HistoryItemsFromTL(
|
||||
} // namespace
|
||||
|
||||
MessagesSearch::MessagesSearch(not_null<History*> history)
|
||||
: _history(history)
|
||||
, _api(&history->session().mtp()) {
|
||||
: _history(history) {
|
||||
}
|
||||
|
||||
MessagesSearch::~MessagesSearch() {
|
||||
_history->owner().histories().cancelRequest(
|
||||
base::take(_searchInHistoryRequest));
|
||||
}
|
||||
|
||||
void MessagesSearch::searchMessages(const QString &query, PeerData *from) {
|
||||
@@ -78,7 +81,7 @@ void MessagesSearch::searchRequest() {
|
||||
const auto flags = _from
|
||||
? MTP_flags(MTPmessages_Search::Flag::f_from_id)
|
||||
: MTP_flags(0);
|
||||
_requestId = _api.request(MTPmessages_Search(
|
||||
_requestId = _history->session().api().request(MTPmessages_Search(
|
||||
flags,
|
||||
_history->peer->input,
|
||||
MTP_string(_query),
|
||||
@@ -102,10 +105,11 @@ void MessagesSearch::searchRequest() {
|
||||
}).fail([=](const MTP::Error &error, mtpRequestId id) {
|
||||
_searchInHistoryRequest = 0;
|
||||
|
||||
if (_requestId == id) {
|
||||
_requestId = 0;
|
||||
}
|
||||
if (error.type() == u"SEARCH_QUERY_EMPTY"_q) {
|
||||
_messagesFounds.fire({ 0, MessageIdsList(), nextToken });
|
||||
} else if (_requestId == id) {
|
||||
_requestId = 0;
|
||||
}
|
||||
|
||||
finish();
|
||||
@@ -159,7 +163,7 @@ void MessagesSearch::searchReceived(
|
||||
owner.processChats(data.vchats());
|
||||
}
|
||||
auto items = HistoryItemsFromTL(&owner, data.vmessages().v);
|
||||
const auto total = int(data.vmessages().v.size());
|
||||
const auto total = int(data.vcount().v);
|
||||
return FoundMessages{ total, std::move(items), nextToken };
|
||||
}, [](const MTPDmessages_messagesNotModified &data) {
|
||||
return FoundMessages{};
|
||||
|
||||
@@ -7,8 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "mtproto/sender.h"
|
||||
|
||||
class HistoryItem;
|
||||
class History;
|
||||
class PeerData;
|
||||
@@ -24,6 +22,7 @@ struct FoundMessages {
|
||||
class MessagesSearch final {
|
||||
public:
|
||||
explicit MessagesSearch(not_null<History*> history);
|
||||
~MessagesSearch();
|
||||
|
||||
void searchMessages(const QString &query, PeerData *from);
|
||||
void searchMore();
|
||||
@@ -39,7 +38,6 @@ private:
|
||||
const QString &nextToken);
|
||||
|
||||
const not_null<History*> _history;
|
||||
MTP::Sender _api;
|
||||
|
||||
base::flat_map<QString, TLMessages> _cacheOfStartByToken;
|
||||
|
||||
|
||||
@@ -18,11 +18,10 @@ bool MessagesSearchMerged::RequestCompare::operator()(
|
||||
}
|
||||
|
||||
MessagesSearchMerged::MessagesSearchMerged(not_null<History*> history)
|
||||
: _apiSearch(history)
|
||||
, _migratedSearch(history->migrateFrom()
|
||||
? std::make_optional<MessagesSearch>(history->migrateFrom())
|
||||
: std::nullopt) {
|
||||
|
||||
: _apiSearch(history) {
|
||||
if (const auto migrated = history->migrateFrom()) {
|
||||
_migratedSearch.emplace(migrated);
|
||||
}
|
||||
const auto checkWaitingForTotal = [=] {
|
||||
if (_waitingForTotal) {
|
||||
if (_concatedFound.total >= 0 && _migratedFirstFound.total >= 0) {
|
||||
|
||||
78
Telegram/SourceFiles/api/api_report.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
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_report.h"
|
||||
|
||||
#include "apiwrap.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_session.h"
|
||||
#include "ui/boxes/report_box.h"
|
||||
#include "ui/toast/toast.h"
|
||||
|
||||
namespace Api {
|
||||
|
||||
namespace {
|
||||
|
||||
MTPreportReason ReasonToTL(const Ui::ReportReason &reason) {
|
||||
using Reason = Ui::ReportReason;
|
||||
switch (reason) {
|
||||
case Reason::Spam: return MTP_inputReportReasonSpam();
|
||||
case Reason::Fake: return MTP_inputReportReasonFake();
|
||||
case Reason::Violence: return MTP_inputReportReasonViolence();
|
||||
case Reason::ChildAbuse: return MTP_inputReportReasonChildAbuse();
|
||||
case Reason::Pornography: return MTP_inputReportReasonPornography();
|
||||
case Reason::Copyright: return MTP_inputReportReasonCopyright();
|
||||
case Reason::IllegalDrugs: return MTP_inputReportReasonIllegalDrugs();
|
||||
case Reason::PersonalDetails:
|
||||
return MTP_inputReportReasonPersonalDetails();
|
||||
case Reason::Other: return MTP_inputReportReasonOther();
|
||||
}
|
||||
Unexpected("Bad reason group value.");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void SendReport(
|
||||
not_null<QWidget*> toastParent,
|
||||
not_null<PeerData*> peer,
|
||||
Ui::ReportReason reason,
|
||||
const QString &comment,
|
||||
std::variant<v::null_t, MessageIdsList, not_null<PhotoData*>> data) {
|
||||
auto done = [=] {
|
||||
Ui::Toast::Show(toastParent, tr::lng_report_thanks(tr::now));
|
||||
};
|
||||
v::match(data, [&](v::null_t) {
|
||||
peer->session().api().request(MTPaccount_ReportPeer(
|
||||
peer->input,
|
||||
ReasonToTL(reason),
|
||||
MTP_string(comment)
|
||||
)).done(std::move(done)).send();
|
||||
}, [&](const MessageIdsList &ids) {
|
||||
auto apiIds = QVector<MTPint>();
|
||||
apiIds.reserve(ids.size());
|
||||
for (const auto &fullId : ids) {
|
||||
apiIds.push_back(MTP_int(fullId.msg));
|
||||
}
|
||||
peer->session().api().request(MTPmessages_Report(
|
||||
peer->input,
|
||||
MTP_vector<MTPint>(apiIds),
|
||||
ReasonToTL(reason),
|
||||
MTP_string(comment)
|
||||
)).done(std::move(done)).send();
|
||||
}, [&](not_null<PhotoData*> photo) {
|
||||
peer->session().api().request(MTPaccount_ReportProfilePhoto(
|
||||
peer->input,
|
||||
photo->mtpInput(),
|
||||
ReasonToTL(reason),
|
||||
MTP_string(comment)
|
||||
)).done(std::move(done)).send();
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
26
Telegram/SourceFiles/api/api_report.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
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
|
||||
|
||||
class PeerData;
|
||||
class PhotoData;
|
||||
|
||||
namespace Ui {
|
||||
enum class ReportReason;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Api {
|
||||
|
||||
void SendReport(
|
||||
not_null<QWidget*> toastParent,
|
||||
not_null<PeerData*> peer,
|
||||
Ui::ReportReason reason,
|
||||
const QString &comment,
|
||||
std::variant<v::null_t, MessageIdsList, not_null<PhotoData*>> data);
|
||||
|
||||
} // namespace Api
|
||||
@@ -146,7 +146,6 @@ void Ringtones::requestList() {
|
||||
document->forceToCache(true);
|
||||
_list.documents.emplace_back(document->id);
|
||||
}
|
||||
requestList();
|
||||
_list.updates.fire({});
|
||||
}, [&](const MTPDaccount_savedRingtonesNotModified &) {
|
||||
});
|
||||
|
||||
@@ -3570,7 +3570,7 @@ void ApiWrap::sendBotStart(
|
||||
}
|
||||
|
||||
auto &info = bot->botInfo;
|
||||
auto &token = chat ? startTokenForChat : info->startToken;
|
||||
const auto token = chat ? startTokenForChat : info->startToken;
|
||||
if (token.isEmpty()) {
|
||||
auto message = MessageToSend(
|
||||
Api::SendAction(_session->data().history(chat
|
||||
|
||||
@@ -1393,6 +1393,18 @@ void EditNameBox::prepare() {
|
||||
|
||||
connect(_first, &Ui::InputField::submitted, [=] { submit(); });
|
||||
connect(_last, &Ui::InputField::submitted, [=] { submit(); });
|
||||
|
||||
_first->customTab(true);
|
||||
_last->customTab(true);
|
||||
|
||||
QObject::connect(
|
||||
_first,
|
||||
&Ui::InputField::tabbed,
|
||||
[=] { _last->setFocus(); });
|
||||
QObject::connect(
|
||||
_last,
|
||||
&Ui::InputField::tabbed,
|
||||
[=] { _first->setFocus(); });
|
||||
}
|
||||
|
||||
void EditNameBox::setInnerFocus() {
|
||||
|
||||
@@ -602,6 +602,9 @@ changePhoneError: FlatLabel(changePhoneLabel) {
|
||||
textFg: boxTextFgError;
|
||||
}
|
||||
|
||||
blockedUsersListSubtitleAddPadding: margins(0px, 1px, 0px, -14px);
|
||||
blockedUsersListIconPadding: margins(0px, 34px, 0px, 5px);
|
||||
|
||||
adminLogFilterUserpicLeft: 15px;
|
||||
adminLogFilterLittleSkip: 16px;
|
||||
adminLogFilterCheckbox: Checkbox(defaultBoxCheckbox) {
|
||||
|
||||
@@ -510,7 +510,7 @@ void ChangePhone::setupContent() {
|
||||
}
|
||||
|
||||
void ChangePhone::showFinished() {
|
||||
_animate();
|
||||
_animate(anim::repeat::loop);
|
||||
}
|
||||
|
||||
} // namespace Settings
|
||||
|
||||
@@ -36,7 +36,7 @@ private:
|
||||
void setupContent();
|
||||
|
||||
const not_null<Window::SessionController*> _controller;
|
||||
Fn<void()> _animate;
|
||||
Fn<void(anim::repeat)> _animate;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_session.h"
|
||||
#include "ui/filter_icons.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
#include "ui/text/text_utilities.h" // Ui::Text::Bold
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
@@ -27,46 +26,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
namespace {
|
||||
|
||||
class FolderButton : public Ui::SettingsButton {
|
||||
public:
|
||||
FolderButton(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
const Data::ChatFilter &filter);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
private:
|
||||
const Ui::FilterIcon _icon;
|
||||
|
||||
};
|
||||
|
||||
FolderButton::FolderButton(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
const Data::ChatFilter &filter)
|
||||
: SettingsButton(
|
||||
parent,
|
||||
rpl::single(filter.title()),
|
||||
st::paymentsSectionButton)
|
||||
, _icon(Ui::ComputeFilterIcon(filter)) {
|
||||
}
|
||||
|
||||
void FolderButton::paintEvent(QPaintEvent *e) {
|
||||
SettingsButton::paintEvent(e);
|
||||
|
||||
Painter p(this);
|
||||
const auto over = isOver() || isDown();
|
||||
const auto icon = Ui::LookupFilterIcon(_icon).normal;
|
||||
icon->paint(
|
||||
p,
|
||||
st::settingsFilterIconLeft,
|
||||
(height() - icon->height()) / 2,
|
||||
width(),
|
||||
(over
|
||||
? st::dialogsUnreadBgMutedOver
|
||||
: st::dialogsUnreadBgMuted)->c);
|
||||
}
|
||||
|
||||
Data::ChatFilter ChangedFilter(
|
||||
const Data::ChatFilter &filter,
|
||||
not_null<History*> history,
|
||||
@@ -165,47 +124,6 @@ void ChooseFilterValidator::remove(FilterId filterId) const {
|
||||
ChangeFilterById(filterId, _history, false);
|
||||
}
|
||||
|
||||
void ChooseFilterBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<History*> history) {
|
||||
box->setTitle(tr::lng_filters_add_box_title());
|
||||
|
||||
const auto validator = ChooseFilterValidator(history);
|
||||
|
||||
const auto container = box->verticalLayout()->add(
|
||||
object_ptr<Ui::VerticalLayout>(box->verticalLayout()));
|
||||
|
||||
const auto rebuild = [=] {
|
||||
while (container->count()) {
|
||||
delete container->widgetAt(0);
|
||||
}
|
||||
for (const auto &filter : history->owner().chatsFilters().list()) {
|
||||
if (filter.contains(history)) {
|
||||
continue;
|
||||
}
|
||||
container->add(
|
||||
object_ptr<FolderButton>(box, filter),
|
||||
style::margins()
|
||||
)->setClickedCallback([=, id = filter.id()] {
|
||||
validator.add(id);
|
||||
box->closeBox();
|
||||
});
|
||||
}
|
||||
container->resizeToWidth(box->verticalLayout()->width());
|
||||
if (!container->count()) {
|
||||
box->closeBox();
|
||||
}
|
||||
};
|
||||
|
||||
history->owner().chatsFilters().changed(
|
||||
) | rpl::start_with_next([=] {
|
||||
rebuild();
|
||||
}, box->lifetime());
|
||||
rebuild();
|
||||
|
||||
box->addButton(tr::lng_close(), [=] { box->closeBox(); });
|
||||
}
|
||||
|
||||
void FillChooseFilterMenu(
|
||||
not_null<Ui::PopupMenu*> menu,
|
||||
not_null<History*> history) {
|
||||
|
||||
@@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#pragma once
|
||||
|
||||
namespace Ui {
|
||||
class GenericBox;
|
||||
class PopupMenu;
|
||||
} // namespace Ui
|
||||
|
||||
@@ -29,10 +28,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
void ChooseFilterBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<History*> history);
|
||||
|
||||
void FillChooseFilterMenu(
|
||||
not_null<Ui::PopupMenu*> menu,
|
||||
not_null<History*> history);
|
||||
|
||||
@@ -500,6 +500,7 @@ void EditFilterBox(
|
||||
const Data::ChatFilter &filter,
|
||||
Fn<void(const Data::ChatFilter &)> doneCallback) {
|
||||
const auto creating = filter.title().isEmpty();
|
||||
box->setWidth(st::boxWideWidth);
|
||||
box->setTitle(creating ? tr::lng_filters_new() : tr::lng_filters_edit());
|
||||
box->setCloseByOutsideClick(false);
|
||||
|
||||
@@ -571,8 +572,9 @@ void EditFilterBox(
|
||||
|
||||
const auto includeAdd = AddButton(
|
||||
content,
|
||||
tr::lng_filters_add_chats() | Ui::Text::ToUpper(),
|
||||
st::settingsUpdate);
|
||||
tr::lng_filters_add_chats(),
|
||||
st::settingsButtonActive,
|
||||
{ &st::settingsIconAdd, 0, IconType::Round, &st::windowBgActive });
|
||||
|
||||
const auto include = SetupChatsPreview(
|
||||
content,
|
||||
@@ -582,21 +584,16 @@ void EditFilterBox(
|
||||
&Data::ChatFilter::always);
|
||||
|
||||
AddSkip(content);
|
||||
content->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_filters_include_about(),
|
||||
st::boxDividerLabel),
|
||||
st::windowFilterAboutPadding);
|
||||
AddDivider(content);
|
||||
AddDividerText(content, tr::lng_filters_include_about());
|
||||
AddSkip(content);
|
||||
|
||||
AddSubsectionTitle(content, tr::lng_filters_exclude());
|
||||
|
||||
const auto excludeAdd = AddButton(
|
||||
content,
|
||||
tr::lng_filters_remove_chats() | Ui::Text::ToUpper(),
|
||||
st::settingsUpdate);
|
||||
tr::lng_filters_remove_chats(),
|
||||
st::settingsButtonActive,
|
||||
{ &st::settingsIconRemove, 0, IconType::Round, &st::windowBgActive });
|
||||
|
||||
const auto exclude = SetupChatsPreview(
|
||||
content,
|
||||
@@ -606,12 +603,7 @@ void EditFilterBox(
|
||||
&Data::ChatFilter::never);
|
||||
|
||||
AddSkip(content);
|
||||
content->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_filters_exclude_about(),
|
||||
st::boxDividerLabel),
|
||||
st::windowFilterAboutPadding);
|
||||
AddDividerText(content, tr::lng_filters_exclude_about());
|
||||
|
||||
const auto refreshPreviews = [=] {
|
||||
include->updateData(
|
||||
|
||||
@@ -20,10 +20,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/boxes/calendar_box.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||
#include "settings/settings_privacy_security.h"
|
||||
#include "ui/boxes/choose_date_time.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "boxes/passcode_box.h"
|
||||
#include "boxes/peers/add_bot_to_chat_box.h"
|
||||
@@ -510,7 +510,8 @@ not_null<Ui::SlideWrap<Ui::RpWidget>*> EditAdminBox::setupTransferButton(
|
||||
: tr::lng_rights_transfer_channel)(),
|
||||
rpl::single(QString()),
|
||||
[=] { transferOwnership(); },
|
||||
st::peerPermissionsButton));
|
||||
st::peerPermissionsButton,
|
||||
{}));
|
||||
|
||||
return wrap;
|
||||
}
|
||||
@@ -783,35 +784,33 @@ ChatRestrictionsInfo EditRestrictedBox::defaultRights() const {
|
||||
}
|
||||
|
||||
void EditRestrictedBox::showRestrictUntil() {
|
||||
auto tomorrow = QDate::currentDate().addDays(1);
|
||||
auto highlighted = isUntilForever()
|
||||
? tomorrow
|
||||
: base::unixtime::parse(getRealUntilValue()).date();
|
||||
auto month = highlighted;
|
||||
auto box = Box<Ui::CalendarBox>(Ui::CalendarBoxArgs{
|
||||
.month = month,
|
||||
.highlighted = highlighted,
|
||||
.callback = [=](const QDate &date) {
|
||||
setRestrictUntil(
|
||||
static_cast<int>(date.startOfDay().toSecsSinceEpoch()));
|
||||
},
|
||||
.finalize = [=](not_null<Ui::CalendarBox*> box) {
|
||||
box->addLeftButton(
|
||||
tr::lng_rights_chat_banned_forever(),
|
||||
[=] { setRestrictUntil(0); });
|
||||
},
|
||||
.minDate = tomorrow,
|
||||
.maxDate = QDate::currentDate().addDays(kMaxRestrictDelayDays),
|
||||
});
|
||||
_restrictUntilBox = Ui::MakeWeak(box.data());
|
||||
_show.showBox(std::move(box));
|
||||
_show.showBox(Box([=](not_null<Ui::GenericBox*> box) {
|
||||
const auto save = [=](TimeId result) {
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
setRestrictUntil(result);
|
||||
box->closeBox();
|
||||
};
|
||||
const auto now = base::unixtime::now();
|
||||
const auto time = isUntilForever()
|
||||
? (now + kSecondsInDay)
|
||||
: getRealUntilValue();
|
||||
ChooseDateTimeBox(box, {
|
||||
.title = tr::lng_rights_chat_banned_until_header(),
|
||||
.submit = tr::lng_settings_save(),
|
||||
.done = save,
|
||||
.min = [=] { return now; },
|
||||
.time = time,
|
||||
.max = [=] {
|
||||
return now + kSecondsInDay * kMaxRestrictDelayDays;
|
||||
},
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
void EditRestrictedBox::setRestrictUntil(TimeId until) {
|
||||
_until = until;
|
||||
if (_restrictUntilBox) {
|
||||
_restrictUntilBox->closeBox();
|
||||
}
|
||||
_untilVariants.clear();
|
||||
createUntilGroup();
|
||||
createUntilVariants();
|
||||
@@ -861,8 +860,7 @@ void EditRestrictedBox::createUntilVariants() {
|
||||
tr::lng_rights_chat_banned_custom_date(
|
||||
tr::now,
|
||||
lt_date,
|
||||
langDayOfMonthFull(
|
||||
base::unixtime::parse(until).date())));
|
||||
langDateTime(base::unixtime::parse(until))));
|
||||
}
|
||||
};
|
||||
auto addCurrentVariant = [&](TimeId from, TimeId to) {
|
||||
|
||||
@@ -17,7 +17,6 @@ class LinkButton;
|
||||
class Checkbox;
|
||||
class Radiobutton;
|
||||
class RadiobuttonGroup;
|
||||
class CalendarBox;
|
||||
class VerticalLayout;
|
||||
template <typename Widget>
|
||||
class SlideWrap;
|
||||
@@ -176,7 +175,6 @@ private:
|
||||
|
||||
std::shared_ptr<Ui::RadiobuttonGroup> _untilGroup;
|
||||
std::vector<base::unique_qptr<Ui::Radiobutton>> _untilVariants;
|
||||
QPointer<Ui::CalendarBox> _restrictUntilBox;
|
||||
|
||||
static constexpr auto kUntilOneDay = -1;
|
||||
static constexpr auto kUntilOneWeek = -2;
|
||||
|
||||
@@ -7,125 +7,56 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "boxes/peers/edit_peer_history_visibility_box.h"
|
||||
|
||||
#include "boxes/peers/edit_peer_permissions_box.h"
|
||||
#include "boxes/peers/edit_participants_box.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
namespace {
|
||||
void EditPeerHistoryVisibilityBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
bool isLegacy,
|
||||
Fn<void(HistoryVisibility)> savedCallback,
|
||||
HistoryVisibility historyVisibilitySavedValue) {
|
||||
const auto historyVisibility = std::make_shared<
|
||||
Ui::RadioenumGroup<HistoryVisibility>
|
||||
>(historyVisibilitySavedValue);
|
||||
|
||||
void AddRadioButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
HistoryVisibility value,
|
||||
const QString &groupText,
|
||||
rpl::producer<QString> groupAbout,
|
||||
std::shared_ptr<Ui::RadioenumGroup<HistoryVisibility>> historyVisibility) {
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
st::editPeerHistoryVisibilityTopSkip));
|
||||
container->add(object_ptr<Ui::Radioenum<HistoryVisibility>>(
|
||||
container,
|
||||
box->setTitle(tr::lng_manage_history_visibility_title());
|
||||
box->addButton(tr::lng_settings_save(), [=] {
|
||||
savedCallback(historyVisibility->value());
|
||||
box->closeBox();
|
||||
});
|
||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||
|
||||
box->addSkip(st::editPeerHistoryVisibilityTopSkip);
|
||||
box->addRow(object_ptr<Ui::Radioenum<HistoryVisibility>>(
|
||||
box,
|
||||
historyVisibility,
|
||||
value,
|
||||
groupText,
|
||||
st::defaultBoxCheckbox));
|
||||
container->add(object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
std::move(groupAbout),
|
||||
st::editPeerPrivacyLabel),
|
||||
st::editPeerPreHistoryLabelMargins));
|
||||
}
|
||||
|
||||
void FillContent(
|
||||
not_null<Ui::VerticalLayout*> parent,
|
||||
not_null<PeerData*> peer,
|
||||
std::shared_ptr<Ui::RadioenumGroup<HistoryVisibility>> historyVisibility,
|
||||
HistoryVisibility savedValue) {
|
||||
const auto canEdit = [&] {
|
||||
if (const auto chat = peer->asChat()) {
|
||||
return chat->canEditPreHistoryHidden();
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
return channel->canEditPreHistoryHidden();
|
||||
}
|
||||
Unexpected("User in HistoryVisibilityEdit.");
|
||||
}();
|
||||
if (!canEdit) {
|
||||
return;
|
||||
}
|
||||
|
||||
historyVisibility->setValue(savedValue);
|
||||
|
||||
const auto result = parent->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
parent,
|
||||
object_ptr<Ui::VerticalLayout>(parent),
|
||||
st::editPeerHistoryVisibilityMargins));
|
||||
const auto container = result->entity();
|
||||
|
||||
Assert(historyVisibility != nullptr);
|
||||
|
||||
AddRadioButton(
|
||||
container,
|
||||
HistoryVisibility::Visible,
|
||||
tr::lng_manage_history_visibility_shown(tr::now),
|
||||
tr::lng_manage_history_visibility_shown_about(),
|
||||
historyVisibility);
|
||||
AddRadioButton(
|
||||
container,
|
||||
st::defaultBoxCheckbox));
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
tr::lng_manage_history_visibility_shown_about(),
|
||||
st::editPeerPrivacyLabel),
|
||||
st::editPeerPreHistoryLabelMargins + st::boxRowPadding);
|
||||
|
||||
box->addSkip(st::editPeerHistoryVisibilityTopSkip);
|
||||
box->addRow(object_ptr<Ui::Radioenum<HistoryVisibility>>(
|
||||
box,
|
||||
historyVisibility,
|
||||
HistoryVisibility::Hidden,
|
||||
tr::lng_manage_history_visibility_hidden(tr::now),
|
||||
(peer->isChat()
|
||||
? tr::lng_manage_history_visibility_hidden_legacy
|
||||
: tr::lng_manage_history_visibility_hidden_about)(),
|
||||
historyVisibility);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EditPeerHistoryVisibilityBox::EditPeerHistoryVisibilityBox(
|
||||
QWidget*,
|
||||
not_null<PeerData*> peer,
|
||||
FnMut<void(HistoryVisibility)> savedCallback,
|
||||
HistoryVisibility historyVisibilitySavedValue)
|
||||
: _peer(peer)
|
||||
, _savedCallback(std::move(savedCallback))
|
||||
, _historyVisibilitySavedValue(historyVisibilitySavedValue)
|
||||
, _historyVisibility(
|
||||
std::make_shared<Ui::RadioenumGroup<HistoryVisibility>>(
|
||||
_historyVisibilitySavedValue)) {
|
||||
}
|
||||
|
||||
void EditPeerHistoryVisibilityBox::prepare() {
|
||||
_peer->updateFull();
|
||||
|
||||
setTitle(tr::lng_manage_history_visibility_title());
|
||||
addButton(tr::lng_settings_save(), [=] {
|
||||
auto local = std::move(_savedCallback);
|
||||
local(_historyVisibility->value());
|
||||
closeBox();
|
||||
});
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
setupContent();
|
||||
}
|
||||
|
||||
void EditPeerHistoryVisibilityBox::setupContent() {
|
||||
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||
FillContent(
|
||||
content,
|
||||
_peer,
|
||||
_historyVisibility,
|
||||
_historyVisibilitySavedValue);
|
||||
setDimensionsToContent(st::boxWidth, content);
|
||||
st::defaultBoxCheckbox));
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
(isLegacy
|
||||
? tr::lng_manage_history_visibility_hidden_legacy
|
||||
: tr::lng_manage_history_visibility_hidden_about)(),
|
||||
st::editPeerPrivacyLabel),
|
||||
st::editPeerPreHistoryLabelMargins + st::boxRowPadding);
|
||||
}
|
||||
|
||||
@@ -7,32 +7,17 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
namespace Ui {
|
||||
class GenericBox;
|
||||
} // namespace Ui
|
||||
|
||||
enum class HistoryVisibility {
|
||||
Visible,
|
||||
Hidden,
|
||||
};
|
||||
|
||||
class EditPeerHistoryVisibilityBox : public Ui::BoxContent {
|
||||
public:
|
||||
EditPeerHistoryVisibilityBox(
|
||||
QWidget*,
|
||||
not_null<PeerData*> peer,
|
||||
FnMut<void(HistoryVisibility)> savedCallback,
|
||||
HistoryVisibility historyVisibilitySavedValue);
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
||||
private:
|
||||
void setupContent();
|
||||
|
||||
not_null<PeerData*> _peer;
|
||||
FnMut<void(HistoryVisibility)> _savedCallback;
|
||||
|
||||
HistoryVisibility _historyVisibilitySavedValue;
|
||||
std::shared_ptr<Ui::RadioenumGroup<HistoryVisibility>> _historyVisibility;
|
||||
|
||||
};
|
||||
void EditPeerHistoryVisibilityBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
bool isLegacy,
|
||||
Fn<void(HistoryVisibility)> savedCallback,
|
||||
HistoryVisibility historyVisibilitySavedValue);
|
||||
|
||||
@@ -37,9 +37,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/admin_log/history_admin_log_section.h"
|
||||
#include "info/profile/info_profile_values.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "ui/toast/toast.h"
|
||||
@@ -53,22 +52,22 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "info/profile/info_profile_icon.h"
|
||||
#include "apiwrap.h"
|
||||
#include "api/api_invite_links.h"
|
||||
#include "facades.h"
|
||||
#include "facades.h" // Ui::showChatsList
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "styles/style_settings.h"
|
||||
|
||||
namespace {
|
||||
|
||||
auto ToPositiveNumberString() {
|
||||
[[nodiscard]] auto ToPositiveNumberString() {
|
||||
return rpl::map([](int count) {
|
||||
return count ? QString::number(count) : QString();
|
||||
});
|
||||
}
|
||||
|
||||
auto ToPositiveNumberStringRestrictions() {
|
||||
[[nodiscard]] auto ToPositiveNumberStringRestrictions() {
|
||||
return rpl::map([](int count) {
|
||||
return QString::number(count)
|
||||
+ QString("/")
|
||||
@@ -94,40 +93,29 @@ void AddButtonWithCount(
|
||||
rpl::producer<QString> &&text,
|
||||
rpl::producer<QString> &&count,
|
||||
Fn<void()> callback,
|
||||
const style::icon &icon) {
|
||||
Settings::IconDescriptor &&descriptor) {
|
||||
parent->add(EditPeerInfoBox::CreateButton(
|
||||
parent,
|
||||
std::move(text),
|
||||
std::move(count),
|
||||
std::move(callback),
|
||||
st::manageGroupButton,
|
||||
&icon));
|
||||
std::move(descriptor)));
|
||||
}
|
||||
|
||||
object_ptr<Ui::SettingsButton> CreateButtonWithText(
|
||||
not_null<QWidget*> parent,
|
||||
not_null<Ui::SettingsButton*> AddButtonWithText(
|
||||
not_null<Ui::VerticalLayout*> parent,
|
||||
rpl::producer<QString> &&text,
|
||||
rpl::producer<QString> &&label,
|
||||
Fn<void()> callback) {
|
||||
return EditPeerInfoBox::CreateButton(
|
||||
Fn<void()> callback,
|
||||
Settings::IconDescriptor &&descriptor) {
|
||||
return parent->add(EditPeerInfoBox::CreateButton(
|
||||
parent,
|
||||
std::move(text),
|
||||
std::move(label),
|
||||
std::move(callback),
|
||||
st::manageGroupTopButtonWithText,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
Ui::SettingsButton *AddButtonWithText(
|
||||
not_null<Ui::VerticalLayout*> parent,
|
||||
rpl::producer<QString> &&text,
|
||||
rpl::producer<QString> &&label,
|
||||
Fn<void()> callback) {
|
||||
return parent->add(CreateButtonWithText(
|
||||
parent,
|
||||
std::move(text),
|
||||
std::move(label),
|
||||
std::move(callback)));
|
||||
std::move(descriptor)));
|
||||
}
|
||||
|
||||
void AddButtonDelete(
|
||||
@@ -140,7 +128,7 @@ void AddButtonDelete(
|
||||
rpl::single(QString()),
|
||||
std::move(callback),
|
||||
st::manageDeleteGroupButton,
|
||||
nullptr));
|
||||
{}));
|
||||
}
|
||||
|
||||
void SaveDefaultRestrictions(
|
||||
@@ -262,7 +250,7 @@ public:
|
||||
not_null<Ui::BoxContent*> box,
|
||||
not_null<PeerData*> peer);
|
||||
|
||||
object_ptr<Ui::VerticalLayout> createContent();
|
||||
[[nodiscard]] object_ptr<Ui::VerticalLayout> createContent();
|
||||
void setFocus();
|
||||
|
||||
private:
|
||||
@@ -284,12 +272,12 @@ private:
|
||||
std::optional<ChannelData*> linkedChat;
|
||||
};
|
||||
|
||||
object_ptr<Ui::RpWidget> createPhotoAndTitleEdit();
|
||||
object_ptr<Ui::RpWidget> createTitleEdit();
|
||||
object_ptr<Ui::RpWidget> createPhotoEdit();
|
||||
object_ptr<Ui::RpWidget> createDescriptionEdit();
|
||||
object_ptr<Ui::RpWidget> createManageGroupButtons();
|
||||
object_ptr<Ui::RpWidget> createStickersEdit();
|
||||
[[nodiscard]] object_ptr<Ui::RpWidget> createPhotoAndTitleEdit();
|
||||
[[nodiscard]] object_ptr<Ui::RpWidget> createTitleEdit();
|
||||
[[nodiscard]] object_ptr<Ui::RpWidget> createPhotoEdit();
|
||||
[[nodiscard]] object_ptr<Ui::RpWidget> createDescriptionEdit();
|
||||
[[nodiscard]] object_ptr<Ui::RpWidget> createManageGroupButtons();
|
||||
[[nodiscard]] object_ptr<Ui::RpWidget> createStickersEdit();
|
||||
|
||||
[[nodiscard]] bool canEditInformation() const;
|
||||
[[nodiscard]] bool canEditReactions() const;
|
||||
@@ -310,14 +298,14 @@ private:
|
||||
void deleteWithConfirmation();
|
||||
void deleteChannel();
|
||||
|
||||
std::optional<Saving> validate() const;
|
||||
bool validateUsername(Saving &to) const;
|
||||
bool validateLinkedChat(Saving &to) const;
|
||||
bool validateTitle(Saving &to) const;
|
||||
bool validateDescription(Saving &to) const;
|
||||
bool validateHistoryVisibility(Saving &to) const;
|
||||
bool validateSignatures(Saving &to) const;
|
||||
bool validateForwards(Saving &to) const;
|
||||
[[nodiscard]] std::optional<Saving> validate() const;
|
||||
[[nodiscard]] bool validateUsername(Saving &to) const;
|
||||
[[nodiscard]] bool validateLinkedChat(Saving &to) const;
|
||||
[[nodiscard]] bool validateTitle(Saving &to) const;
|
||||
[[nodiscard]] bool validateDescription(Saving &to) const;
|
||||
[[nodiscard]] bool validateHistoryVisibility(Saving &to) const;
|
||||
[[nodiscard]] bool validateSignatures(Saving &to) const;
|
||||
[[nodiscard]] bool validateForwards(Saving &to) const;
|
||||
|
||||
void save();
|
||||
void saveUsername();
|
||||
@@ -522,7 +510,8 @@ object_ptr<Ui::RpWidget> Controller::createDescriptionEdit() {
|
||||
result->entity()->setInstantReplaces(Ui::InstantReplaces::Default());
|
||||
result->entity()->setInstantReplacesEnabled(
|
||||
Core::App().settings().replaceEmojiValue());
|
||||
result->entity()->setSubmitSettings(Core::App().settings().sendSubmitWay());
|
||||
result->entity()->setSubmitSettings(
|
||||
Core::App().settings().sendSubmitWay());
|
||||
Ui::Emoji::SuggestionsController::Init(
|
||||
_wrap->window(),
|
||||
result->entity(),
|
||||
@@ -555,38 +544,36 @@ object_ptr<Ui::RpWidget> Controller::createStickersEdit() {
|
||||
Expects(_wrap != nullptr);
|
||||
|
||||
const auto channel = _peer->asChannel();
|
||||
const auto bottomSkip = st::editPeerTopButtonsLayoutSkipCustomBottom;
|
||||
|
||||
auto result = object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
_wrap,
|
||||
object_ptr<Ui::VerticalLayout>(_wrap),
|
||||
st::editPeerInvitesMargins);
|
||||
object_ptr<Ui::VerticalLayout>(_wrap));
|
||||
const auto container = result->entity();
|
||||
|
||||
container->add(object_ptr<Ui::FlatLabel>(
|
||||
Settings::AddSubsectionTitle(
|
||||
container,
|
||||
tr::lng_group_stickers(),
|
||||
st::editPeerSectionLabel));
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
st::editPeerInviteLinkSkip));
|
||||
{ 0, st::settingsSubsectionTitlePadding.top() - bottomSkip, 0, 0 });
|
||||
|
||||
container->add(object_ptr<Ui::FlatLabel>(
|
||||
AddButtonWithCount(
|
||||
container,
|
||||
tr::lng_group_stickers_description(),
|
||||
st::editPeerPrivacyLabel));
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
st::editPeerInviteLinkSkip));
|
||||
tr::lng_group_stickers_add(),
|
||||
rpl::single(QString()), //Empty count.
|
||||
[=, controller = _navigation->parentController()] {
|
||||
controller->show(
|
||||
Box<StickersBox>(controller, channel),
|
||||
Ui::LayerOption::KeepOther);
|
||||
},
|
||||
{ &st::settingsIconStickers, Settings::kIconLightOrange });
|
||||
|
||||
container->add(object_ptr<Ui::LinkButton>(
|
||||
_wrap,
|
||||
tr::lng_group_stickers_add(tr::now),
|
||||
st::editPeerInviteLinkButton)
|
||||
)->addClickHandler([=] {
|
||||
_navigation->parentController()->show(
|
||||
Box<StickersBox>(_navigation->parentController(), channel),
|
||||
Ui::LayerOption::KeepOther);
|
||||
});
|
||||
Settings::AddSkip(container, bottomSkip);
|
||||
|
||||
Settings::AddDividerText(
|
||||
container,
|
||||
tr::lng_group_stickers_description());
|
||||
|
||||
Settings::AddSkip(container, bottomSkip);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -718,6 +705,9 @@ void Controller::fillPrivacyTypeButton() {
|
||||
_noForwardsSavedValue = !_peer->allowsForwarding();
|
||||
|
||||
const auto isGroup = (_peer->isChat() || _peer->isMegagroup());
|
||||
const auto icon = isGroup
|
||||
? &st::settingsIconGroup
|
||||
: &st::settingsIconChannel;
|
||||
AddButtonWithText(
|
||||
_controls.buttonsLayout,
|
||||
(hasLocation
|
||||
@@ -739,7 +729,8 @@ void Controller::fillPrivacyTypeButton() {
|
||||
? tr::lng_manage_private_group_title
|
||||
: tr::lng_manage_private_peer_title)();
|
||||
}) | rpl::flatten_latest(),
|
||||
[=] { showEditPeerTypeBox(); });
|
||||
[=] { showEditPeerTypeBox(); },
|
||||
{ icon, Settings::kIconLightBlue });
|
||||
|
||||
_privacyTypeUpdates.fire_copy(*_privacySavedValue);
|
||||
}
|
||||
@@ -781,7 +772,8 @@ void Controller::fillLinkedChatButton() {
|
||||
_controls.buttonsLayout,
|
||||
std::move(text),
|
||||
std::move(label),
|
||||
[=] { showEditLinkedChatBox(); });
|
||||
[=] { showEditLinkedChatBox(); },
|
||||
{ &st::settingsIconChat, Settings::kIconGreen });
|
||||
_linkedChatUpdates.fire_copy(*_linkedChatSavedValue);
|
||||
}
|
||||
//
|
||||
@@ -803,13 +795,16 @@ void Controller::fillSignaturesButton() {
|
||||
Expects(_controls.buttonsLayout != nullptr);
|
||||
|
||||
const auto channel = _peer->asChannel();
|
||||
if (!channel) return;
|
||||
if (!channel) {
|
||||
return;
|
||||
}
|
||||
|
||||
AddButtonWithText(
|
||||
_controls.buttonsLayout,
|
||||
tr::lng_edit_sign_messages(),
|
||||
rpl::single(QString()),
|
||||
[=] {}
|
||||
[] {},
|
||||
{ &st::infoIconSignature, Settings::kIconLightBlue }
|
||||
)->toggleOn(rpl::single(channel->addsSignature())
|
||||
)->toggledValue(
|
||||
) | rpl::start_with_next([=](bool toggled) {
|
||||
@@ -843,12 +838,23 @@ void Controller::fillHistoryVisibilityButton() {
|
||||
_historyVisibilitySavedValue = checked;
|
||||
});
|
||||
const auto buttonCallback = [=] {
|
||||
_navigation->parentController()->show(
|
||||
Box<EditPeerHistoryVisibilityBox>(
|
||||
_peer,
|
||||
boxCallback,
|
||||
*_historyVisibilitySavedValue),
|
||||
Ui::LayerOption::KeepOther);
|
||||
_peer->updateFull();
|
||||
const auto canEdit = [&] {
|
||||
if (const auto chat = _peer->asChat()) {
|
||||
return chat->canEditPreHistoryHidden();
|
||||
} else if (const auto channel = _peer->asChannel()) {
|
||||
return channel->canEditPreHistoryHidden();
|
||||
}
|
||||
Unexpected("User in HistoryVisibilityEdit.");
|
||||
}();
|
||||
if (!canEdit) {
|
||||
return;
|
||||
}
|
||||
_navigation->parentController()->show(Box(
|
||||
EditPeerHistoryVisibilityBox,
|
||||
_peer->isChat(),
|
||||
boxCallback,
|
||||
*_historyVisibilitySavedValue));
|
||||
};
|
||||
AddButtonWithText(
|
||||
container,
|
||||
@@ -859,7 +865,8 @@ void Controller::fillHistoryVisibilityButton() {
|
||||
? tr::lng_manage_history_visibility_shown
|
||||
: tr::lng_manage_history_visibility_hidden)();
|
||||
}) | rpl::flatten_latest(),
|
||||
buttonCallback);
|
||||
buttonCallback,
|
||||
{ &st::settingsIconChat, Settings::kIconGreen });
|
||||
|
||||
updateHistoryVisibility->fire_copy(*_historyVisibilitySavedValue);
|
||||
|
||||
@@ -970,6 +977,40 @@ void Controller::fillManageSection() {
|
||||
st::editPeerTopButtonsLayoutSkipCustomBottom);
|
||||
}
|
||||
|
||||
if (canEditReactions()) {
|
||||
const auto session = &_peer->session();
|
||||
auto reactionsCount = Info::Profile::MigratedOrMeValue(
|
||||
_peer
|
||||
) | rpl::map(
|
||||
Info::Profile::AllowedReactionsCountValue
|
||||
) | rpl::flatten_latest();
|
||||
auto fullCount = Info::Profile::FullReactionsCountValue(session);
|
||||
auto label = rpl::combine(
|
||||
std::move(reactionsCount),
|
||||
std::move(fullCount)
|
||||
) | rpl::map([=](int allowed, int total) {
|
||||
return allowed
|
||||
? QString::number(allowed) + " / " + QString::number(total)
|
||||
: tr::lng_manage_peer_reactions_off(tr::now);
|
||||
});
|
||||
const auto done = [=](const std::vector<QString> &chosen) {
|
||||
SaveAllowedReactions(_peer, chosen);
|
||||
};
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
tr::lng_manage_peer_reactions(),
|
||||
std::move(label),
|
||||
[=] {
|
||||
_navigation->parentController()->show(Box(
|
||||
EditAllowedReactionsBox,
|
||||
!_peer->isBroadcast(),
|
||||
session->data().reactions().list(
|
||||
Data::Reactions::Type::Active),
|
||||
*Data::PeerAllowedReactions(_peer),
|
||||
done));
|
||||
},
|
||||
{ &st::infoIconReactions, Settings::kIconRed });
|
||||
}
|
||||
if (canEditPermissions) {
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
@@ -981,7 +1022,7 @@ void Controller::fillManageSection() {
|
||||
) | rpl::flatten_latest(
|
||||
) | ToPositiveNumberStringRestrictions(),
|
||||
[=] { ShowEditPermissions(_navigation, _peer); },
|
||||
st::infoIconPermissions);
|
||||
{ &st::settingsIconKey, Settings::kIconGreen });
|
||||
}
|
||||
if (canEditInviteLinks) {
|
||||
auto count = Info::Profile::MigratedOrMeValue(
|
||||
@@ -1017,7 +1058,7 @@ void Controller::fillManageSection() {
|
||||
0),
|
||||
Ui::LayerOption::KeepOther);
|
||||
},
|
||||
st::infoIconInviteLinks);
|
||||
{ &st::infoIconInviteLinks, Settings::kIconLightOrange });
|
||||
|
||||
if (_privacySavedValue) {
|
||||
_privacyTypeUpdates.events_starting_with_copy(
|
||||
@@ -1029,40 +1070,6 @@ void Controller::fillManageSection() {
|
||||
}, wrap->lifetime());
|
||||
}
|
||||
}
|
||||
if (canEditReactions()) {
|
||||
const auto session = &_peer->session();
|
||||
auto reactionsCount = Info::Profile::MigratedOrMeValue(
|
||||
_peer
|
||||
) | rpl::map(
|
||||
Info::Profile::AllowedReactionsCountValue
|
||||
) | rpl::flatten_latest();
|
||||
auto fullCount = Info::Profile::FullReactionsCountValue(session);
|
||||
auto label = rpl::combine(
|
||||
std::move(reactionsCount),
|
||||
std::move(fullCount)
|
||||
) | rpl::map([=](int allowed, int total) {
|
||||
return allowed
|
||||
? QString::number(allowed) + " / " + QString::number(total)
|
||||
: tr::lng_manage_peer_reactions_off(tr::now);
|
||||
});
|
||||
const auto done = [=](const std::vector<QString> &chosen) {
|
||||
SaveAllowedReactions(_peer, chosen);
|
||||
};
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
tr::lng_manage_peer_reactions(),
|
||||
std::move(label),
|
||||
[=] {
|
||||
_navigation->parentController()->show(Box(
|
||||
EditAllowedReactionsBox,
|
||||
!_peer->isBroadcast(),
|
||||
session->data().reactions().list(
|
||||
Data::Reactions::Type::Active),
|
||||
*Data::PeerAllowedReactions(_peer),
|
||||
done));
|
||||
},
|
||||
st::infoIconReactions);
|
||||
}
|
||||
if (canViewAdmins) {
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
@@ -1079,12 +1086,14 @@ void Controller::fillManageSection() {
|
||||
_peer,
|
||||
ParticipantsBoxController::Role::Admins);
|
||||
},
|
||||
st::infoIconAdministrators);
|
||||
{ &st::infoIconAdministrators, Settings::kIconLightBlue });
|
||||
}
|
||||
if (canViewMembers) {
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
(_isGroup ? tr::lng_manage_peer_members() : tr::lng_manage_peer_subscribers()),
|
||||
(_isGroup
|
||||
? tr::lng_manage_peer_members()
|
||||
: tr::lng_manage_peer_subscribers()),
|
||||
Info::Profile::MigratedOrMeValue(
|
||||
_peer
|
||||
) | rpl::map(
|
||||
@@ -1097,7 +1106,7 @@ void Controller::fillManageSection() {
|
||||
_peer,
|
||||
ParticipantsBoxController::Role::Members);
|
||||
},
|
||||
st::infoIconMembers);
|
||||
{ &st::settingsIconGroup, Settings::kIconDarkBlue });
|
||||
}
|
||||
|
||||
fillPendingRequestsButton();
|
||||
@@ -1114,7 +1123,7 @@ void Controller::fillManageSection() {
|
||||
_peer,
|
||||
ParticipantsBoxController::Role::Kicked);
|
||||
},
|
||||
st::infoIconBlacklist);
|
||||
{ &st::settingsIconMinus, Settings::kIconRed });
|
||||
}
|
||||
if (hasRecentActions) {
|
||||
auto callback = [=] {
|
||||
@@ -1126,7 +1135,7 @@ void Controller::fillManageSection() {
|
||||
tr::lng_manage_peer_recent_actions(),
|
||||
rpl::single(QString()), //Empty count.
|
||||
std::move(callback),
|
||||
st::infoIconRecentActions);
|
||||
{ &st::infoIconRecentActions, Settings::kIconPurple });
|
||||
}
|
||||
|
||||
if (canEditStickers || canDeleteChannel) {
|
||||
@@ -1168,7 +1177,7 @@ void Controller::fillPendingRequestsButton() {
|
||||
: tr::lng_manage_peer_requests_channel()),
|
||||
rpl::duplicate(pendingRequestsCount) | ToPositiveNumberString(),
|
||||
[=] { RequestsBoxController::Start(_navigation, _peer); },
|
||||
st::infoIconRequests);
|
||||
{ &st::infoIconRequests, Settings::kIconRed });
|
||||
std::move(
|
||||
pendingRequestsCount
|
||||
) | rpl::start_with_next([=](int count) {
|
||||
@@ -1670,18 +1679,18 @@ object_ptr<Ui::SettingsButton> EditPeerInfoBox::CreateButton(
|
||||
rpl::producer<QString> &&count,
|
||||
Fn<void()> callback,
|
||||
const style::SettingsCountButton &st,
|
||||
const style::icon *icon) {
|
||||
Settings::IconDescriptor &&descriptor) {
|
||||
auto result = object_ptr<Ui::SettingsButton>(
|
||||
parent,
|
||||
rpl::duplicate(text),
|
||||
st.button);
|
||||
const auto button = result.data();
|
||||
button->addClickHandler(callback);
|
||||
if (icon) {
|
||||
Ui::CreateChild<Info::Profile::FloatingIcon>(
|
||||
if (descriptor) {
|
||||
AddButtonIcon(
|
||||
button,
|
||||
*icon,
|
||||
st.iconPosition);
|
||||
st.button,
|
||||
std::move(descriptor));
|
||||
}
|
||||
|
||||
auto labelText = rpl::combine(
|
||||
|
||||
@@ -7,8 +7,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <rpl/event_stream.h>
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "ui/layers/box_content.h"
|
||||
|
||||
namespace Settings {
|
||||
struct IconDescriptor;
|
||||
} // namespace Settings
|
||||
|
||||
namespace style {
|
||||
struct SettingsCountButton;
|
||||
@@ -42,7 +45,7 @@ public:
|
||||
rpl::producer<QString> &&count,
|
||||
Fn<void()> callback,
|
||||
const style::SettingsCountButton &st,
|
||||
const style::icon *icon = nullptr);
|
||||
Settings::IconDescriptor &&descriptor);
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
||||
@@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "main/main_session.h"
|
||||
#include "mainwindow.h"
|
||||
#include "apiwrap.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
@@ -612,7 +613,8 @@ void EditPeerPermissionsBox::addSuggestGigagroup(
|
||||
AboutGigagroupCallback(
|
||||
_peer->asChannel(),
|
||||
_navigation->parentController()),
|
||||
st::peerPermissionsButton));
|
||||
st::peerPermissionsButton,
|
||||
{}));
|
||||
|
||||
container->add(
|
||||
object_ptr<Ui::DividerLabel>(
|
||||
@@ -645,7 +647,8 @@ void EditPeerPermissionsBox::addBannedButtons(
|
||||
_peer,
|
||||
ParticipantsBoxController::Role::Restricted);
|
||||
},
|
||||
st::peerPermissionsButton));
|
||||
st::peerPermissionsButton,
|
||||
{}));
|
||||
if (channel) {
|
||||
container->add(EditPeerInfoBox::CreateButton(
|
||||
container,
|
||||
@@ -658,7 +661,8 @@ void EditPeerPermissionsBox::addBannedButtons(
|
||||
_peer,
|
||||
ParticipantsBoxController::Role::Kicked);
|
||||
},
|
||||
st::peerPermissionsButton));
|
||||
st::peerPermissionsButton,
|
||||
{}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,94 +7,28 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "boxes/peers/edit_peer_reactions.h"
|
||||
|
||||
#include "boxes/reactions_settings_box.h" // AddReactionLottieIcon
|
||||
#include "data/data_message_reactions.h"
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_document_media.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_session.h"
|
||||
#include "main/main_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "lottie/lottie_icon.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/layers/generic_box.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "info/profile/info_profile_icon.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "styles/style_settings.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using Data::Reaction;
|
||||
|
||||
void AddReactionIcon(
|
||||
not_null<Ui::RpWidget*> button,
|
||||
not_null<DocumentData*> document) {
|
||||
struct State {
|
||||
std::shared_ptr<Data::DocumentMedia> media;
|
||||
std::unique_ptr<Lottie::Icon> icon;
|
||||
QImage image;
|
||||
};
|
||||
|
||||
const auto size = st::editPeerReactionsPreview;
|
||||
const auto state = button->lifetime().make_state<State>(State{
|
||||
.media = document->createMediaView(),
|
||||
});
|
||||
const auto icon = Ui::CreateChild<Ui::RpWidget>(button.get());
|
||||
icon->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
icon->resize(size, size);
|
||||
button->sizeValue(
|
||||
) | rpl::start_with_next([=](QSize size) {
|
||||
icon->moveToLeft(
|
||||
st::editPeerReactionsIconLeft,
|
||||
(size.height() - icon->height()) / 2,
|
||||
size.width());
|
||||
}, icon->lifetime());
|
||||
|
||||
const auto initLottie = [=] {
|
||||
state->icon = Lottie::MakeIcon({
|
||||
.path = state->media->owner()->filepath(true),
|
||||
.json = state->media->bytes(),
|
||||
.sizeOverride = QSize(size, size),
|
||||
.frame = -1,
|
||||
});
|
||||
state->media = nullptr;
|
||||
};
|
||||
state->media->checkStickerLarge();
|
||||
if (state->media->loaded()) {
|
||||
initLottie();
|
||||
} else {
|
||||
document->session().downloaderTaskFinished(
|
||||
) | rpl::filter([=] {
|
||||
return state->media->loaded();
|
||||
}) | rpl::take(1) | rpl::start_with_next([=] {
|
||||
initLottie();
|
||||
icon->update();
|
||||
}, icon->lifetime());
|
||||
}
|
||||
|
||||
icon->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
QPainter p(icon);
|
||||
if (state->image.isNull() && state->icon) {
|
||||
state->image = state->icon->frame();
|
||||
crl::async([icon = std::move(state->icon)]{});
|
||||
}
|
||||
if (!state->image.isNull()) {
|
||||
p.drawImage(QRect(0, 0, size, size), state->image);
|
||||
}
|
||||
}, icon->lifetime());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void EditAllowedReactionsBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
bool isGroup,
|
||||
const std::vector<Reaction> &list,
|
||||
const std::vector<Data::Reaction> &list,
|
||||
const base::flat_set<QString> &selected,
|
||||
Fn<void(const std::vector<QString> &)> callback) {
|
||||
const auto iconHeight = st::editPeerReactionsPreview;
|
||||
box->setTitle(tr::lng_manage_peer_reactions());
|
||||
|
||||
struct State {
|
||||
@@ -123,10 +57,21 @@ void EditAllowedReactionsBox(
|
||||
container,
|
||||
tr::lng_manage_peer_reactions_enable(),
|
||||
st::manageGroupButton.button);
|
||||
Ui::CreateChild<Info::Profile::FloatingIcon>(
|
||||
enabled.get(),
|
||||
st::infoIconReactions,
|
||||
st::manageGroupButton.iconPosition);
|
||||
if (!list.empty()) {
|
||||
AddReactionLottieIcon(
|
||||
enabled,
|
||||
enabled->sizeValue(
|
||||
) | rpl::map([=](const QSize &size) {
|
||||
return QPoint(
|
||||
st::manageGroupButton.iconPosition.x(),
|
||||
(size.height() - iconHeight) / 2);
|
||||
}),
|
||||
iconHeight,
|
||||
list.front(),
|
||||
rpl::never<>(),
|
||||
rpl::never<>(),
|
||||
&enabled->lifetime());
|
||||
}
|
||||
enabled->toggleOn(state->anyToggled.value());
|
||||
enabled->toggledChanges(
|
||||
) | rpl::filter([=](bool value) {
|
||||
@@ -153,9 +98,22 @@ void EditAllowedReactionsBox(
|
||||
container,
|
||||
rpl::single(entry.title),
|
||||
st::manageGroupButton.button);
|
||||
AddReactionIcon(button, entry.centerIcon
|
||||
? entry.centerIcon
|
||||
: entry.appearAnimation.get());
|
||||
AddReactionLottieIcon(
|
||||
button,
|
||||
button->sizeValue(
|
||||
) | rpl::map([=](const QSize &size) {
|
||||
return QPoint(
|
||||
st::editPeerReactionsIconLeft,
|
||||
(size.height() - iconHeight) / 2);
|
||||
}),
|
||||
iconHeight,
|
||||
entry,
|
||||
button->events(
|
||||
) | rpl::filter([=](not_null<QEvent*> event) {
|
||||
return event->type() == QEvent::Enter;
|
||||
}) | rpl::to_empty,
|
||||
rpl::never<>(),
|
||||
&button->lifetime());
|
||||
state->toggles.emplace(entry.emoji, button);
|
||||
button->toggleOn(rpl::single(
|
||||
active(entry)
|
||||
@@ -190,7 +148,7 @@ void SaveAllowedReactions(
|
||||
const std::vector<QString> &allowed) {
|
||||
auto ids = allowed | ranges::views::transform([=](QString value) {
|
||||
return MTP_string(value);
|
||||
}) | ranges::to<QVector>;
|
||||
}) | ranges::to<QVector<MTPstring>>;
|
||||
|
||||
peer->session().api().request(MTPmessages_SetChatAvailableReactions(
|
||||
peer->input,
|
||||
|
||||
@@ -7,14 +7,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/layers/generic_box.h"
|
||||
|
||||
class PeerData;
|
||||
|
||||
namespace Data {
|
||||
struct Reaction;
|
||||
} // namespace Data
|
||||
|
||||
namespace Ui {
|
||||
class GenericBox;
|
||||
} // namespace Ui
|
||||
|
||||
void EditAllowedReactionsBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
bool isGroup,
|
||||
|
||||
@@ -7,8 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "boxes/peers/edit_peer_type_box.h"
|
||||
|
||||
#include "apiwrap.h"
|
||||
#include "api/api_invite_links.h"
|
||||
#include "main/main_session.h"
|
||||
#include "boxes/add_contact_box.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
@@ -19,7 +17,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/peers/edit_peer_invite_link.h"
|
||||
#include "boxes/peers/edit_peer_invite_links.h"
|
||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||
#include "core/application.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_peer.h"
|
||||
@@ -27,7 +24,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_changes.h"
|
||||
#include "info/profile/info_profile_values.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwindow.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/special_buttons.h"
|
||||
@@ -35,7 +31,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/widgets/box_content_divider.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
@@ -48,11 +43,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "styles/style_info.h"
|
||||
#include "styles/style_settings.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QClipboard>
|
||||
|
||||
#include <rpl/flatten_latest.h>
|
||||
|
||||
namespace {
|
||||
|
||||
class Controller : public base::has_weak_ptr {
|
||||
@@ -209,21 +199,22 @@ void Controller::createContent() {
|
||||
Ui::LayerOption::KeepOther);
|
||||
},
|
||||
st::manageGroupButton,
|
||||
&st::infoIconInviteLinks));
|
||||
{ &st::infoIconInviteLinks, Settings::kIconLightOrange }));
|
||||
AddSkip(_wrap.get());
|
||||
AddDividerText(_wrap.get(), tr::lng_group_invite_manage_about());
|
||||
|
||||
if (!_linkOnly) {
|
||||
AddSkip(_wrap.get());
|
||||
AddSubsectionTitle(_wrap.get(), tr::lng_manage_peer_no_forwards_title());
|
||||
AddSubsectionTitle(
|
||||
_wrap.get(),
|
||||
tr::lng_manage_peer_no_forwards_title());
|
||||
_controls.noForwards = _wrap->add(EditPeerInfoBox::CreateButton(
|
||||
_wrap.get(),
|
||||
tr::lng_manage_peer_no_forwards(),
|
||||
rpl::single(QString()),
|
||||
[=] {},
|
||||
st::manageGroupTopButtonWithText,
|
||||
nullptr
|
||||
));
|
||||
[] {},
|
||||
st::peerPermissionsButton,
|
||||
{}));
|
||||
_controls.noForwards->toggleOn(
|
||||
rpl::single(_noForwardsSavedValue.value_or(false))
|
||||
)->toggledValue(
|
||||
|
||||
@@ -7,8 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "base/timer.h"
|
||||
#include "ui/layers/box_content.h"
|
||||
|
||||
namespace style {
|
||||
struct SettingsCountButton;
|
||||
|
||||
@@ -43,6 +43,7 @@ constexpr auto kVisibleButtonsCount = 7;
|
||||
|
||||
PeerId GenerateUser(not_null<History*> history, const QString &name) {
|
||||
Expects(history->peer->isUser());
|
||||
|
||||
const auto peerId = Data::FakePeerIdForJustName(name);
|
||||
history->owner().processUser(MTP_user(
|
||||
MTP_flags(MTPDuser::Flag::f_first_name | MTPDuser::Flag::f_min),
|
||||
@@ -88,12 +89,13 @@ AdminLog::OwnedItem GenerateItem(
|
||||
}
|
||||
|
||||
void AddMessage(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
not_null<Window::SessionController*> controller,
|
||||
rpl::producer<QString> &&emojiValue) {
|
||||
rpl::producer<QString> &&emojiValue,
|
||||
int width) {
|
||||
|
||||
const auto widget = box->addRow(
|
||||
object_ptr<Ui::RpWidget>(box),
|
||||
const auto widget = container->add(
|
||||
object_ptr<Ui::RpWidget>(container),
|
||||
style::margins(
|
||||
0,
|
||||
st::settingsSectionSkip,
|
||||
@@ -120,11 +122,12 @@ void AddMessage(
|
||||
bool flag = false;
|
||||
} icons;
|
||||
};
|
||||
const auto state = box->lifetime().make_state<State>();
|
||||
const auto state = container->lifetime().make_state<State>();
|
||||
state->delegate = std::make_unique<Delegate>(
|
||||
controller,
|
||||
crl::guard(widget, [=] { widget->update(); }));
|
||||
state->style = std::make_unique<Ui::ChatStyle>();
|
||||
state->style->apply(controller->defaultChatTheme().get());
|
||||
state->icons.lifetimes = std::vector<rpl::lifetime>(2);
|
||||
|
||||
const auto history = controller->session().data().history(
|
||||
@@ -148,16 +151,18 @@ void AddMessage(
|
||||
|
||||
const auto padding = st::settingsForwardPrivacyPadding;
|
||||
|
||||
widget->widthValue(
|
||||
) | rpl::filter(
|
||||
rpl::mappers::_1 >= (st::historyMinimalWidth / 2)
|
||||
) | rpl::start_with_next([=](int width) {
|
||||
const auto updateWidgetSize = [=](int width) {
|
||||
const auto height = view->resizeGetHeight(width);
|
||||
const auto top = view->marginTop();
|
||||
const auto bottom = view->marginBottom();
|
||||
const auto full = padding + top + height + bottom + padding;
|
||||
widget->resize(width, full);
|
||||
}, widget->lifetime());
|
||||
};
|
||||
widget->widthValue(
|
||||
) | rpl::filter(
|
||||
rpl::mappers::_1 >= (st::historyMinimalWidth / 2)
|
||||
) | rpl::start_with_next(updateWidgetSize, widget->lifetime());
|
||||
updateWidgetSize(width);
|
||||
|
||||
const auto rightSize = st::settingsReactionCornerSize;
|
||||
const auto rightRect = [=] {
|
||||
@@ -215,14 +220,14 @@ void AddMessage(
|
||||
iconSize = st::settingsReactionMessageSize
|
||||
](const QString &emoji) {
|
||||
const auto &reactions = controller->session().data().reactions();
|
||||
for (const auto &r : reactions.list(Data::Reactions::Type::All)) {
|
||||
for (const auto &r : reactions.list(Data::Reactions::Type::Active)) {
|
||||
if (emoji != r.emoji) {
|
||||
continue;
|
||||
}
|
||||
const auto index = state->icons.flag ? 1 : 0;
|
||||
state->icons.lifetimes[index] = rpl::lifetime();
|
||||
AddReactionLottieIcon(
|
||||
box->verticalLayout(),
|
||||
container,
|
||||
widget->geometryValue(
|
||||
) | rpl::map([=](const QRect &r) {
|
||||
return widget->pos()
|
||||
@@ -232,7 +237,6 @@ void AddMessage(
|
||||
(rightSize.height() - iconSize) / 2);
|
||||
}),
|
||||
iconSize,
|
||||
&controller->session(),
|
||||
r,
|
||||
rpl::never<>(),
|
||||
rpl::duplicate(emojiValue) | rpl::skip(1) | rpl::to_empty,
|
||||
@@ -249,7 +253,6 @@ void AddReactionLottieIcon(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
rpl::producer<QPoint> iconPositionValue,
|
||||
int iconSize,
|
||||
not_null<Main::Session*> session,
|
||||
const Data::Reaction &reaction,
|
||||
rpl::producer<> &&selects,
|
||||
rpl::producer<> &&destroys,
|
||||
@@ -278,7 +281,7 @@ void AddReactionLottieIcon(
|
||||
state->appear.media->checkStickerLarge();
|
||||
state->select.media->checkStickerLarge();
|
||||
rpl::single() | rpl::then(
|
||||
session->downloaderTaskFinished()
|
||||
reaction.appearAnimation->session().downloaderTaskFinished()
|
||||
) | rpl::start_with_next([=] {
|
||||
const auto check = [&](State::Entry &entry) {
|
||||
if (!entry.media) {
|
||||
@@ -388,34 +391,19 @@ void ReactionsSettingsBox(
|
||||
const auto state = box->lifetime().make_state<State>();
|
||||
state->selectedEmoji = reactions.favorite();
|
||||
|
||||
AddMessage(box, controller, state->selectedEmoji.value());
|
||||
const auto pinnedToTop = box->setPinnedToTopContent(
|
||||
object_ptr<Ui::VerticalLayout>(box));
|
||||
|
||||
auto emojiValue = state->selectedEmoji.value();
|
||||
AddMessage(pinnedToTop, controller, std::move(emojiValue), box->width());
|
||||
|
||||
const auto container = box->verticalLayout();
|
||||
Settings::AddSubsectionTitle(
|
||||
container,
|
||||
pinnedToTop,
|
||||
tr::lng_settings_chat_reactions_subtitle());
|
||||
|
||||
const auto &stButton = st::settingsButton;
|
||||
const auto scrollContainer = box->addRow(
|
||||
object_ptr<Ui::FixedHeightWidget>(
|
||||
box,
|
||||
kVisibleButtonsCount
|
||||
* (stButton.height
|
||||
+ stButton.padding.top()
|
||||
+ stButton.padding.bottom())),
|
||||
style::margins());
|
||||
const auto scroll = Ui::CreateChild<Ui::ScrollArea>(
|
||||
scrollContainer,
|
||||
st::boxScroll);
|
||||
const auto buttonsContainer = scroll->setOwnedWidget(
|
||||
object_ptr<Ui::VerticalLayout>(scroll));
|
||||
scrollContainer->sizeValue(
|
||||
) | rpl::start_with_next([=](const QSize &s) {
|
||||
scroll->resize(s.width(), s.height());
|
||||
buttonsContainer->resizeToWidth(s.width());
|
||||
}, scroll->lifetime());
|
||||
const auto container = box->verticalLayout();
|
||||
|
||||
const auto check = Ui::CreateChild<Ui::RpWidget>(buttonsContainer.data());
|
||||
const auto check = Ui::CreateChild<Ui::RpWidget>(container.get());
|
||||
check->resize(st::settingsReactionCornerSize);
|
||||
check->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
check->paintRequest(
|
||||
@@ -430,11 +418,11 @@ void ReactionsSettingsBox(
|
||||
};
|
||||
|
||||
auto firstCheckedButton = (Ui::RpWidget*)(nullptr);
|
||||
for (const auto &r : reactions.list(Data::Reactions::Type::All)) {
|
||||
for (const auto &r : reactions.list(Data::Reactions::Type::Active)) {
|
||||
const auto button = Settings::AddButton(
|
||||
buttonsContainer,
|
||||
container,
|
||||
rpl::single<QString>(base::duplicate(r.title)),
|
||||
stButton);
|
||||
st::settingsButton);
|
||||
|
||||
const auto iconSize = st::settingsReactionSize;
|
||||
AddReactionLottieIcon(
|
||||
@@ -446,7 +434,6 @@ void ReactionsSettingsBox(
|
||||
(s.height() - iconSize) / 2);
|
||||
}),
|
||||
iconSize,
|
||||
&controller->session(),
|
||||
r,
|
||||
button->events(
|
||||
) | rpl::filter([=](not_null<QEvent*> event) {
|
||||
@@ -473,11 +460,6 @@ void ReactionsSettingsBox(
|
||||
}
|
||||
check->raise();
|
||||
|
||||
Ui::SetupShadowsToScrollContent(
|
||||
scrollContainer,
|
||||
scroll,
|
||||
buttonsContainer->heightValue());
|
||||
|
||||
box->setTitle(tr::lng_settings_chat_reactions_title());
|
||||
box->setWidth(st::boxWideWidth);
|
||||
box->addButton(tr::lng_settings_save(), [=] {
|
||||
|
||||
@@ -16,10 +16,6 @@ namespace Window {
|
||||
class SessionController;
|
||||
} // namespace Window
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
namespace Data {
|
||||
struct Reaction;
|
||||
} // namespace Data
|
||||
@@ -28,7 +24,6 @@ void AddReactionLottieIcon(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
rpl::producer<QPoint> iconPositionValue,
|
||||
int iconSize,
|
||||
not_null<Main::Session*> session,
|
||||
const Data::Reaction &reaction,
|
||||
rpl::producer<> &&selects,
|
||||
rpl::producer<> &&destroys,
|
||||
|
||||