Compare commits
141 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5bc567eb8 | ||
|
|
5f91a97778 | ||
|
|
63aa3576d8 | ||
|
|
7749794d6b | ||
|
|
368468447f | ||
|
|
54fa16424d | ||
|
|
fc7f1991dd | ||
|
|
910d0a7e47 | ||
|
|
6e8fb2ec06 | ||
|
|
94d943f3af | ||
|
|
41e6e32962 | ||
|
|
2f58a7d3c4 | ||
|
|
e364b80d0a | ||
|
|
f3efa85206 | ||
|
|
42f2f3c99f | ||
|
|
a6d0367d71 | ||
|
|
bcbf009a62 | ||
|
|
fedd8bece3 | ||
|
|
031525e7e3 | ||
|
|
4d5cb6398e | ||
|
|
3ef352b63c | ||
|
|
9809c12fb8 | ||
|
|
3e4ac35913 | ||
|
|
a72953411b | ||
|
|
3967e58627 | ||
|
|
db46f84f2c | ||
|
|
9a57347973 | ||
|
|
c9c988e5f4 | ||
|
|
5e2acdeaa3 | ||
|
|
5a4d1a1e85 | ||
|
|
fbd9437775 | ||
|
|
2eaa17b938 | ||
|
|
01eacadca5 | ||
|
|
9f155e0053 | ||
|
|
2f9dc6ca2a | ||
|
|
3d6f6cdd8f | ||
|
|
7e3c54f8d0 | ||
|
|
540ee0bc44 | ||
|
|
627170520a | ||
|
|
77d50d9177 | ||
|
|
c47140c62d | ||
|
|
546dfb08ef | ||
|
|
376b592e5a | ||
|
|
c27db754a7 | ||
|
|
5fb71cb165 | ||
|
|
972666440e | ||
|
|
549d7c77e5 | ||
|
|
de3b30ed7d | ||
|
|
a4f5e3f411 | ||
|
|
df19b62e92 | ||
|
|
caf2be13b3 | ||
|
|
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 |
@@ -188,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
|
||||
@@ -992,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
|
||||
@@ -1007,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
|
||||
@@ -1040,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
|
||||
@@ -1056,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
|
||||
@@ -1067,8 +1072,24 @@ PRIVATE
|
||||
profile/profile_block_widget.h
|
||||
profile/profile_cover_drop_area.cpp
|
||||
profile/profile_cover_drop_area.h
|
||||
settings/cloud_password/settings_cloud_password_common.cpp
|
||||
settings/cloud_password/settings_cloud_password_common.h
|
||||
settings/cloud_password/settings_cloud_password_email.cpp
|
||||
settings/cloud_password/settings_cloud_password_email.h
|
||||
settings/cloud_password/settings_cloud_password_email_confirm.cpp
|
||||
settings/cloud_password/settings_cloud_password_email_confirm.h
|
||||
settings/cloud_password/settings_cloud_password_hint.cpp
|
||||
settings/cloud_password/settings_cloud_password_hint.h
|
||||
settings/cloud_password/settings_cloud_password_input.cpp
|
||||
settings/cloud_password/settings_cloud_password_input.h
|
||||
settings/cloud_password/settings_cloud_password_manage.cpp
|
||||
settings/cloud_password/settings_cloud_password_manage.h
|
||||
settings/cloud_password/settings_cloud_password_start.cpp
|
||||
settings/cloud_password/settings_cloud_password_start.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
|
||||
@@ -1085,6 +1106,8 @@ PRIVATE
|
||||
settings/settings_information.h
|
||||
settings/settings_intro.cpp
|
||||
settings/settings_intro.h
|
||||
settings/settings_local_passcode.cpp
|
||||
settings/settings_local_passcode.h
|
||||
settings/settings_main.cpp
|
||||
settings/settings_main.h
|
||||
settings/settings_notifications.cpp
|
||||
@@ -1260,6 +1283,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
BIN
Telegram/Resources/animations/cloud_password/email.tgs
Normal file
BIN
Telegram/Resources/animations/cloud_password/hint.tgs
Normal file
BIN
Telegram/Resources/animations/cloud_password/intro.tgs
Normal file
BIN
Telegram/Resources/animations/cloud_password/password_input.tgs
Normal file
BIN
Telegram/Resources/animations/filters.tgs
Normal file
BIN
Telegram/Resources/animations/local_passcode_enter.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 |
@@ -490,8 +490,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_settings_forwards_privacy" = "Forwarded messages";
|
||||
"lng_settings_profile_photo_privacy" = "Profile photo";
|
||||
"lng_settings_sessions_about" = "Control your sessions on other devices.";
|
||||
"lng_settings_passcode_disable" = "Disable passcode";
|
||||
"lng_settings_password_disable" = "Disable cloud password";
|
||||
"lng_settings_passcode_disable" = "Disable Passcode";
|
||||
"lng_settings_passcode_disable_sure" = "Are you sure you want to disable passcode?";
|
||||
"lng_settings_password_disable" = "Disable Cloud Password";
|
||||
"lng_settings_password_abort" = "Abort two-step verification setup";
|
||||
"lng_settings_password_reenter_email" = "Re-enter recovery email";
|
||||
"lng_settings_about_bio" = "Any details such as age, occupation or city.\nExample: 23 y.o. designer from San Francisco";
|
||||
@@ -540,6 +541,31 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_settings_security_bots" = "Bots and websites";
|
||||
"lng_settings_clear_payment_info" = "Clear Payment and Shipping Info";
|
||||
|
||||
"lng_settings_cloud_password_on" = "On";
|
||||
"lng_settings_cloud_password_off" = "Off";
|
||||
"lng_settings_cloud_password_start_title" = "Two-Step Verification";
|
||||
"lng_settings_cloud_password_password_title" = "Password";
|
||||
"lng_settings_cloud_password_hint_title" = "Password Hint";
|
||||
"lng_settings_cloud_password_email_title" = "Recovery Email";
|
||||
"lng_settings_cloud_password_start_about" = "Protect your Telegram account with an additional password.";
|
||||
"lng_settings_cloud_password_hint_about" = "You can create a hint for your password.";
|
||||
"lng_settings_cloud_password_email_about" = "Please enter your new recovery email. It is the only way to recover a forgotten password.";
|
||||
"lng_settings_cloud_password_password_subtitle" = "Create Password";
|
||||
"lng_settings_cloud_password_check_subtitle" = "Your Password";
|
||||
"lng_settings_cloud_password_hint_subtitle" = "Add Password Hint";
|
||||
"lng_settings_cloud_password_email_subtitle" = "Add Recovery Email";
|
||||
"lng_settings_cloud_password_email_recovery_subtitle" = "Password Recovery";
|
||||
"lng_settings_cloud_password_manage_about1" = "You have Two-Step Verification enabled, so your account is protected with an additional password.";
|
||||
"lng_settings_cloud_password_manage_about2" = "This email is the only way to recover a forgotten password.";
|
||||
"lng_settings_cloud_password_manage_disable_sure" = "Are you sure you want to disable your password?";
|
||||
"lng_settings_cloud_password_manage_email_new" = "Set Recovery Email";
|
||||
"lng_settings_cloud_password_manage_email_change" = "Change Recovery Email";
|
||||
"lng_settings_cloud_password_manage_password_change" = "Change Password";
|
||||
"lng_settings_cloud_password_skip_hint" = "Skip hint";
|
||||
"lng_settings_cloud_password_save" = "Save and Finish";
|
||||
"lng_settings_cloud_password_email_confirm" = "Confirm and Finish";
|
||||
"lng_settings_cloud_password_reset_in" = "You can reset your password in {duration}.";
|
||||
|
||||
"lng_clear_payment_info_title" = "Clear payment info";
|
||||
"lng_clear_payment_info_sure" = "Are you sure you want to clear your payment and shipping info?";
|
||||
"lng_clear_payment_info_shipping" = "Shipping info";
|
||||
@@ -634,7 +660,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_passcode_remove_button" = "Remove";
|
||||
|
||||
"lng_passcode_turn_on" = "Turn on local passcode";
|
||||
"lng_passcode_change" = "Change local passcode";
|
||||
"lng_passcode_change" = "Change Passcode";
|
||||
"lng_passcode_create" = "Local passcode";
|
||||
"lng_passcode_remove" = "Remove local passcode";
|
||||
"lng_passcode_turn_off" = "Turn off";
|
||||
@@ -647,6 +673,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_passcode_enter_new" = "Enter new passcode";
|
||||
"lng_passcode_confirm_new" = "Re-enter new passcode";
|
||||
"lng_passcode_about" = "When a local passcode is set, a lock icon appears at the top of your chats list. Click it to lock the app.\n\nNote: if you forget your local passcode, you'll need to relogin in Telegram Desktop.";
|
||||
"lng_passcode_about1" = "When a local passcode is set, a lock icon appears at the top of your chats list.";
|
||||
"lng_passcode_about2" = "Click it to lock Telegram Desktop.";
|
||||
"lng_passcode_about3" = "Note: if you forget your passcode, you'll need to log out of Telegram Desktop and log in again.";
|
||||
"lng_passcode_differ" = "Passcodes are different";
|
||||
"lng_passcode_wrong" = "Wrong passcode";
|
||||
"lng_passcode_is_same" = "Passcode was not changed";
|
||||
@@ -655,6 +684,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_passcode_submit" = "Submit";
|
||||
"lng_passcode_logout" = "Log out";
|
||||
"lng_passcode_need_unblock" = "You need to unlock me first.";
|
||||
"lng_passcode_create_button" = "Save Passcode";
|
||||
"lng_passcode_check_button" = "Submit";
|
||||
"lng_passcode_change_button" = "Save Passcode";
|
||||
"lng_passcode_create_title" = "Create Local Passcode";
|
||||
"lng_passcode_check_title" = "Enter Passcode";
|
||||
"lng_passcode_change_title" = "Enter Passcode";
|
||||
|
||||
"lng_cloud_password_waiting_code" = "Confirmation code sent to {email}...";
|
||||
"lng_cloud_password_confirm" = "Confirm recovery email";
|
||||
@@ -668,12 +703,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_cloud_password_reset_cancel" = "Cancel password reset";
|
||||
"lng_cloud_password_enter_old" = "Enter current password";
|
||||
"lng_cloud_password_enter_first" = "Enter a password";
|
||||
"lng_cloud_password_enter_new" = "Enter new password";
|
||||
"lng_cloud_password_confirm_new" = "Re-enter new password";
|
||||
"lng_cloud_password_hint" = "Enter password hint";
|
||||
"lng_cloud_password_enter_new" = "Enter password";
|
||||
"lng_cloud_password_confirm_new" = "Re-enter password";
|
||||
"lng_cloud_password_hint" = "Enter Password Hint";
|
||||
"lng_cloud_password_change_hint" = "Enter new password hint";
|
||||
"lng_cloud_password_bad" = "Password and hint cannot be the same.";
|
||||
"lng_cloud_password_email" = "Enter recovery email";
|
||||
"lng_cloud_password_email" = "Enter Email";
|
||||
"lng_cloud_password_bad_email" = "Incorrect email, please try other.";
|
||||
"lng_cloud_password_about" = "This password will be asked when you log in on a new device in addition to the SMS code.";
|
||||
"lng_cloud_password_about_recover" = "Warning! Are you sure you don't want to\nadd a password recovery email?\n\nIf you forget your password, you will\nlose access to your Telegram account.";
|
||||
@@ -695,6 +730,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_cloud_password_reset_cancel_title" = "Cancel reset";
|
||||
"lng_cloud_password_reset_cancel_sure" = "Cancel the password reset process? If you request a new reset later, it will take another 7 days.";
|
||||
"lng_cloud_password_reset_later" = "You recently requested a password reset that was cancelled. Please wait {duration} before making a new request.";
|
||||
"lng_cloud_password_expired" = "Please re-enter your password.";
|
||||
|
||||
"lng_connection_auto_connecting" = "Default (connecting...)";
|
||||
"lng_connection_auto" = "Default ({transport} used)";
|
||||
@@ -799,6 +835,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";
|
||||
@@ -1976,7 +2016,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";
|
||||
@@ -2661,7 +2701,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";
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<RCC>
|
||||
<qresource prefix="/animations">
|
||||
<file alias="change_number.tgs">../../animations/change_number.tgs</file>
|
||||
<file alias="blocked_peers_empty.tgs">../../animations/blocked_peers_empty.tgs</file>
|
||||
<file alias="filters.tgs">../../animations/filters.tgs</file>
|
||||
<file alias="local_passcode_enter.tgs">../../animations/local_passcode_enter.tgs</file>
|
||||
<file alias="cloud_password/intro.tgs">../../animations/cloud_password/intro.tgs</file>
|
||||
<file alias="cloud_password/password_input.tgs">../../animations/cloud_password/password_input.tgs</file>
|
||||
<file alias="cloud_password/hint.tgs">../../animations/cloud_password/hint.tgs</file>
|
||||
<file alias="cloud_password/email.tgs">../../animations/cloud_password/email.tgs</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -125,7 +125,7 @@ userStatusLastMonth#77ebc742 = UserStatus;
|
||||
chatEmpty#29562865 id:long = Chat;
|
||||
chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true noforwards:flags.25?true id:long title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;
|
||||
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 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;
|
||||
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;
|
||||
@@ -414,9 +414,9 @@ photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo;
|
||||
upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File;
|
||||
upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector<FileHash> = upload.File;
|
||||
|
||||
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 id:int ip_address:string port:int secret:flags.10?bytes = DcOption;
|
||||
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 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#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;
|
||||
|
||||
nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
|
||||
|
||||
@@ -874,7 +874,7 @@ phoneCallAccepted#3660c311 flags:# video:flags.6?true id:long access_hash:long d
|
||||
phoneCall#967f7c67 flags:# p2p_allowed:flags.5?true video:flags.6?true id:long access_hash:long date:int admin_id:long participant_id:long g_a_or_b:bytes key_fingerprint:long protocol:PhoneCallProtocol connections:Vector<PhoneConnection> start_date:int = PhoneCall;
|
||||
phoneCallDiscarded#50ca4de1 flags:# need_rating:flags.2?true need_debug:flags.3?true video:flags.6?true id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = PhoneCall;
|
||||
|
||||
phoneConnection#9d4c17c0 id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection;
|
||||
phoneConnection#9cc123c7 flags:# tcp:flags.0?true id:long ip:string ipv6:string port:int peer_tag:bytes = PhoneConnection;
|
||||
phoneConnectionWebrtc#635fe375 flags:# turn:flags.0?true stun:flags.1?true id:long ip:string ipv6:string port:int username:string password:string = PhoneConnection;
|
||||
|
||||
phoneCallProtocol#fc878fc8 flags:# udp_p2p:flags.0?true udp_reflector:flags.1?true min_layer:int max_layer:int library_versions:Vector<string> = PhoneCallProtocol;
|
||||
@@ -1227,7 +1227,7 @@ messages.messageViews#b6c4f543 views:Vector<MessageViews> chats:Vector<Chat> use
|
||||
|
||||
messages.discussionMessage#a6341782 flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
|
||||
|
||||
messageReplyHeader#a6d57763 flags:# reply_to_msg_id:int reply_to_peer_id:flags.0?Peer reply_to_top_id:flags.1?int = MessageReplyHeader;
|
||||
messageReplyHeader#a6d57763 flags:# reply_to_scheduled:flags.2?true reply_to_msg_id:int reply_to_peer_id:flags.0?Peer reply_to_top_id:flags.1?int = MessageReplyHeader;
|
||||
|
||||
messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies;
|
||||
|
||||
@@ -1295,7 +1295,7 @@ account.resetPasswordFailedWait#e3779861 retry_date:int = account.ResetPasswordR
|
||||
account.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswordResult;
|
||||
account.resetPasswordOk#e926d63e = account.ResetPasswordResult;
|
||||
|
||||
sponsoredMessage#3a836df8 flags:# random_id:bytes from_id:flags.3?Peer chat_invite:flags.4?ChatInvite chat_invite_hash:flags.4?string channel_post:flags.2?int start_param:flags.0?string message:string entities:flags.1?Vector<MessageEntity> = SponsoredMessage;
|
||||
sponsoredMessage#3a836df8 flags:# recommended:flags.5?true random_id:bytes from_id:flags.3?Peer chat_invite:flags.4?ChatInvite chat_invite_hash:flags.4?string channel_post:flags.2?int start_param:flags.0?string message:string entities:flags.1?Vector<MessageEntity> = SponsoredMessage;
|
||||
|
||||
messages.sponsoredMessages#65a4c7d5 messages:Vector<SponsoredMessage> chats:Vector<Chat> users:Vector<User> = messages.SponsoredMessages;
|
||||
|
||||
@@ -1807,6 +1807,7 @@ phone.joinGroupCallPresentation#cbea6bc4 call:InputGroupCall params:DataJSON = U
|
||||
phone.leaveGroupCallPresentation#1c50d144 call:InputGroupCall = Updates;
|
||||
phone.getGroupCallStreamChannels#1ab21940 call:InputGroupCall = phone.GroupCallStreamChannels;
|
||||
phone.getGroupCallStreamRtmpUrl#deb3abbf peer:InputPeer revoke:Bool = phone.GroupCallStreamRtmpUrl;
|
||||
phone.saveCallLog#41248786 peer:InputPhoneCall file:InputFile = Bool;
|
||||
|
||||
langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;
|
||||
langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>;
|
||||
@@ -1823,4 +1824,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 140
|
||||
// LAYER 142
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
|
||||
ProcessorArchitecture="ARCHITECTURE"
|
||||
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
|
||||
Version="3.7.1.0" />
|
||||
Version="3.7.5.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,7,1,0
|
||||
PRODUCTVERSION 3,7,1,0
|
||||
FILEVERSION 3,7,5,0
|
||||
PRODUCTVERSION 3,7,5,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.7.1.0"
|
||||
VALUE "FileVersion", "3.7.5.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "3.7.1.0"
|
||||
VALUE "ProductVersion", "3.7.5.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,7,1,0
|
||||
PRODUCTVERSION 3,7,1,0
|
||||
FILEVERSION 3,7,5,0
|
||||
PRODUCTVERSION 3,7,5,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.7.1.0"
|
||||
VALUE "FileVersion", "3.7.5.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "3.7.1.0"
|
||||
VALUE "ProductVersion", "3.7.5.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -7,18 +7,37 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "api/api_cloud_password.h"
|
||||
|
||||
#include "apiwrap.h"
|
||||
#include "base/random.h"
|
||||
#include "core/core_cloud_password.h"
|
||||
#include "apiwrap.h"
|
||||
#include "passport/passport_encryption.h"
|
||||
|
||||
namespace Api {
|
||||
namespace {
|
||||
|
||||
// #TODO Add ability to set recovery email separately.
|
||||
[[nodiscard]] Core::CloudPasswordState ProcessMtpState(
|
||||
const MTPaccount_password &state) {
|
||||
return state.match([&](const MTPDaccount_password &data) {
|
||||
base::RandomAddSeed(bytes::make_span(data.vsecure_random().v));
|
||||
return Core::ParseCloudPasswordState(data);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CloudPassword::CloudPassword(not_null<ApiWrap*> api)
|
||||
: _api(&api->instance()) {
|
||||
}
|
||||
|
||||
void CloudPassword::apply(Core::CloudPasswordState state) {
|
||||
if (_state) {
|
||||
*_state = std::move(state);
|
||||
} else {
|
||||
_state = std::make_unique<Core::CloudPasswordState>(std::move(state));
|
||||
}
|
||||
_stateChanges.fire_copy(*_state);
|
||||
}
|
||||
|
||||
void CloudPassword::reload() {
|
||||
if (_requestId) {
|
||||
return;
|
||||
@@ -26,16 +45,7 @@ void CloudPassword::reload() {
|
||||
_requestId = _api.request(MTPaccount_GetPassword(
|
||||
)).done([=](const MTPaccount_Password &result) {
|
||||
_requestId = 0;
|
||||
result.match([&](const MTPDaccount_password &data) {
|
||||
base::RandomAddSeed(bytes::make_span(data.vsecure_random().v));
|
||||
if (_state) {
|
||||
*_state = Core::ParseCloudPasswordState(data);
|
||||
} else {
|
||||
_state = std::make_unique<Core::CloudPasswordState>(
|
||||
Core::ParseCloudPasswordState(data));
|
||||
}
|
||||
_stateChanges.fire_copy(*_state);
|
||||
});
|
||||
apply(ProcessMtpState(result));
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
@@ -109,4 +119,426 @@ auto CloudPassword::cancelResetPassword()
|
||||
};
|
||||
}
|
||||
|
||||
rpl::producer<CloudPassword::SetOk, QString> CloudPassword::set(
|
||||
const QString &oldPassword,
|
||||
const QString &newPassword,
|
||||
const QString &hint,
|
||||
bool hasRecoveryEmail,
|
||||
const QString &recoveryEmail) {
|
||||
|
||||
const auto generatePasswordCheck = [=](
|
||||
const Core::CloudPasswordState &latestState) {
|
||||
if (oldPassword.isEmpty() || !latestState.hasPassword) {
|
||||
return Core::CloudPasswordResult{
|
||||
MTP_inputCheckPasswordEmpty()
|
||||
};
|
||||
}
|
||||
const auto hash = Core::ComputeCloudPasswordHash(
|
||||
latestState.mtp.request.algo,
|
||||
bytes::make_span(oldPassword.toUtf8()));
|
||||
return Core::ComputeCloudPasswordCheck(
|
||||
latestState.mtp.request,
|
||||
hash);
|
||||
};
|
||||
|
||||
const auto finish = [=](auto consumer, int unconfirmedEmailLengthCode) {
|
||||
_api.request(MTPaccount_GetPassword(
|
||||
)).done([=](const MTPaccount_Password &result) {
|
||||
apply(ProcessMtpState(result));
|
||||
if (unconfirmedEmailLengthCode) {
|
||||
consumer.put_next(SetOk{ unconfirmedEmailLengthCode });
|
||||
} else {
|
||||
consumer.put_done();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).handleFloodErrors().send();
|
||||
};
|
||||
|
||||
const auto sendMTPaccountUpdatePasswordSettings = [=](
|
||||
const Core::CloudPasswordState &latestState,
|
||||
const QByteArray &secureSecret,
|
||||
auto consumer) {
|
||||
const auto newPasswordBytes = newPassword.toUtf8();
|
||||
const auto newPasswordHash = Core::ComputeCloudPasswordDigest(
|
||||
latestState.mtp.newPassword,
|
||||
bytes::make_span(newPasswordBytes));
|
||||
if (!newPassword.isEmpty() && newPasswordHash.modpow.empty()) {
|
||||
consumer.put_error("INTERNAL_SERVER_ERROR");
|
||||
return;
|
||||
}
|
||||
using Flag = MTPDaccount_passwordInputSettings::Flag;
|
||||
const auto flags = Flag::f_new_algo
|
||||
| Flag::f_new_password_hash
|
||||
| Flag::f_hint
|
||||
| (secureSecret.isEmpty() ? Flag(0) : Flag::f_new_secure_settings)
|
||||
| ((!hasRecoveryEmail) ? Flag(0) : Flag::f_email);
|
||||
|
||||
auto newSecureSecret = bytes::vector();
|
||||
auto newSecureSecretId = 0ULL;
|
||||
if (!secureSecret.isEmpty()) {
|
||||
newSecureSecretId = Passport::CountSecureSecretId(
|
||||
bytes::make_span(secureSecret));
|
||||
newSecureSecret = Passport::EncryptSecureSecret(
|
||||
bytes::make_span(secureSecret),
|
||||
Core::ComputeSecureSecretHash(
|
||||
latestState.mtp.newSecureSecret,
|
||||
bytes::make_span(newPasswordBytes)));
|
||||
}
|
||||
const auto settings = MTP_account_passwordInputSettings(
|
||||
MTP_flags(flags),
|
||||
Core::PrepareCloudPasswordAlgo(newPassword.isEmpty()
|
||||
? v::null
|
||||
: latestState.mtp.newPassword),
|
||||
newPassword.isEmpty()
|
||||
? MTP_bytes()
|
||||
: MTP_bytes(newPasswordHash.modpow),
|
||||
MTP_string(hint),
|
||||
MTP_string(recoveryEmail),
|
||||
MTP_secureSecretSettings(
|
||||
Core::PrepareSecureSecretAlgo(
|
||||
latestState.mtp.newSecureSecret),
|
||||
MTP_bytes(newSecureSecret),
|
||||
MTP_long(newSecureSecretId)));
|
||||
_api.request(MTPaccount_UpdatePasswordSettings(
|
||||
generatePasswordCheck(latestState).result,
|
||||
settings
|
||||
)).done([=] {
|
||||
finish(consumer, 0);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
const auto prefix = u"EMAIL_UNCONFIRMED_"_q;
|
||||
if (type.startsWith(prefix)) {
|
||||
const auto codeLength = base::StringViewMid(
|
||||
type,
|
||||
prefix.size()).toInt();
|
||||
|
||||
finish(consumer, codeLength);
|
||||
} else {
|
||||
consumer.put_error_copy(type);
|
||||
}
|
||||
}).handleFloodErrors().send();
|
||||
};
|
||||
|
||||
return [=](auto consumer) {
|
||||
_api.request(MTPaccount_GetPassword(
|
||||
)).done([=](const MTPaccount_Password &result) {
|
||||
const auto latestState = ProcessMtpState(result);
|
||||
|
||||
if (latestState.hasPassword
|
||||
&& !oldPassword.isEmpty()
|
||||
&& !newPassword.isEmpty()) {
|
||||
|
||||
_api.request(MTPaccount_GetPasswordSettings(
|
||||
generatePasswordCheck(latestState).result
|
||||
)).done([=](const MTPaccount_PasswordSettings &result) {
|
||||
using Settings = MTPDaccount_passwordSettings;
|
||||
const auto &data = result.match([&](
|
||||
const Settings &data) -> const Settings & {
|
||||
return data;
|
||||
});
|
||||
auto secureSecret = QByteArray();
|
||||
if (const auto wrapped = data.vsecure_settings()) {
|
||||
using Secure = MTPDsecureSecretSettings;
|
||||
const auto &settings = wrapped->match([](
|
||||
const Secure &data) -> const Secure & {
|
||||
return data;
|
||||
});
|
||||
const auto passwordUtf = oldPassword.toUtf8();
|
||||
const auto secret = Passport::DecryptSecureSecret(
|
||||
bytes::make_span(settings.vsecure_secret().v),
|
||||
Core::ComputeSecureSecretHash(
|
||||
Core::ParseSecureSecretAlgo(
|
||||
settings.vsecure_algo()),
|
||||
bytes::make_span(passwordUtf)));
|
||||
if (secret.empty()) {
|
||||
LOG(("API Error: "
|
||||
"Failed to decrypt secure secret."));
|
||||
consumer.put_error("SUGGEST_SECRET_RESET");
|
||||
return;
|
||||
} else if (Passport::CountSecureSecretId(secret)
|
||||
!= settings.vsecure_secret_id().v) {
|
||||
LOG(("API Error: Wrong secure secret id."));
|
||||
consumer.put_error("SUGGEST_SECRET_RESET");
|
||||
return;
|
||||
} else {
|
||||
secureSecret = QByteArray(
|
||||
reinterpret_cast<const char*>(secret.data()),
|
||||
secret.size());
|
||||
}
|
||||
}
|
||||
_api.request(MTPaccount_GetPassword(
|
||||
)).done([=](const MTPaccount_Password &result) {
|
||||
const auto latestState = ProcessMtpState(result);
|
||||
sendMTPaccountUpdatePasswordSettings(
|
||||
latestState,
|
||||
secureSecret,
|
||||
consumer);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).send();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).send();
|
||||
} else {
|
||||
sendMTPaccountUpdatePasswordSettings(
|
||||
latestState,
|
||||
QByteArray(),
|
||||
consumer);
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).send();
|
||||
return rpl::lifetime();
|
||||
};
|
||||
}
|
||||
|
||||
rpl::producer<rpl::no_value, QString> CloudPassword::check(
|
||||
const QString &password) {
|
||||
return [=](auto consumer) {
|
||||
_api.request(MTPaccount_GetPassword(
|
||||
)).done([=](const MTPaccount_Password &result) {
|
||||
const auto latestState = ProcessMtpState(result);
|
||||
const auto input = [&] {
|
||||
if (password.isEmpty()) {
|
||||
return Core::CloudPasswordResult{
|
||||
MTP_inputCheckPasswordEmpty()
|
||||
};
|
||||
}
|
||||
const auto hash = Core::ComputeCloudPasswordHash(
|
||||
latestState.mtp.request.algo,
|
||||
bytes::make_span(password.toUtf8()));
|
||||
return Core::ComputeCloudPasswordCheck(
|
||||
latestState.mtp.request,
|
||||
hash);
|
||||
}();
|
||||
|
||||
_api.request(MTPaccount_GetPasswordSettings(
|
||||
input.result
|
||||
)).done([=](const MTPaccount_PasswordSettings &result) {
|
||||
consumer.put_done();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).send();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).send();
|
||||
|
||||
return rpl::lifetime();
|
||||
};
|
||||
}
|
||||
|
||||
rpl::producer<rpl::no_value, QString> CloudPassword::confirmEmail(
|
||||
const QString &code) {
|
||||
return [=](auto consumer) {
|
||||
_api.request(MTPaccount_ConfirmPasswordEmail(
|
||||
MTP_string(code)
|
||||
)).done([=] {
|
||||
_api.request(MTPaccount_GetPassword(
|
||||
)).done([=](const MTPaccount_Password &result) {
|
||||
apply(ProcessMtpState(result));
|
||||
consumer.put_done();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).send();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).handleFloodErrors().send();
|
||||
|
||||
return rpl::lifetime();
|
||||
};
|
||||
}
|
||||
|
||||
rpl::producer<rpl::no_value, QString> CloudPassword::resendEmailCode() {
|
||||
return [=](auto consumer) {
|
||||
_api.request(MTPaccount_ResendPasswordEmail(
|
||||
)).done([=] {
|
||||
_api.request(MTPaccount_GetPassword(
|
||||
)).done([=](const MTPaccount_Password &result) {
|
||||
apply(ProcessMtpState(result));
|
||||
consumer.put_done();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).send();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).handleFloodErrors().send();
|
||||
|
||||
return rpl::lifetime();
|
||||
};
|
||||
}
|
||||
|
||||
rpl::producer<CloudPassword::SetOk, QString> CloudPassword::setEmail(
|
||||
const QString &oldPassword,
|
||||
const QString &recoveryEmail) {
|
||||
const auto generatePasswordCheck = [=](
|
||||
const Core::CloudPasswordState &latestState) {
|
||||
if (oldPassword.isEmpty() || !latestState.hasPassword) {
|
||||
return Core::CloudPasswordResult{
|
||||
MTP_inputCheckPasswordEmpty()
|
||||
};
|
||||
}
|
||||
const auto hash = Core::ComputeCloudPasswordHash(
|
||||
latestState.mtp.request.algo,
|
||||
bytes::make_span(oldPassword.toUtf8()));
|
||||
return Core::ComputeCloudPasswordCheck(
|
||||
latestState.mtp.request,
|
||||
hash);
|
||||
};
|
||||
|
||||
const auto finish = [=](auto consumer, int unconfirmedEmailLengthCode) {
|
||||
_api.request(MTPaccount_GetPassword(
|
||||
)).done([=](const MTPaccount_Password &result) {
|
||||
apply(ProcessMtpState(result));
|
||||
if (unconfirmedEmailLengthCode) {
|
||||
consumer.put_next(SetOk{ unconfirmedEmailLengthCode });
|
||||
} else {
|
||||
consumer.put_done();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).handleFloodErrors().send();
|
||||
};
|
||||
|
||||
const auto sendMTPaccountUpdatePasswordSettings = [=](
|
||||
const Core::CloudPasswordState &latestState,
|
||||
auto consumer) {
|
||||
const auto settings = MTP_account_passwordInputSettings(
|
||||
MTP_flags(MTPDaccount_passwordInputSettings::Flag::f_email),
|
||||
MTP_passwordKdfAlgoUnknown(),
|
||||
MTP_bytes(),
|
||||
MTP_string(),
|
||||
MTP_string(recoveryEmail),
|
||||
MTPSecureSecretSettings());
|
||||
_api.request(MTPaccount_UpdatePasswordSettings(
|
||||
generatePasswordCheck(latestState).result,
|
||||
settings
|
||||
)).done([=] {
|
||||
finish(consumer, 0);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
const auto prefix = u"EMAIL_UNCONFIRMED_"_q;
|
||||
if (type.startsWith(prefix)) {
|
||||
const auto codeLength = base::StringViewMid(
|
||||
type,
|
||||
prefix.size()).toInt();
|
||||
|
||||
finish(consumer, codeLength);
|
||||
} else {
|
||||
consumer.put_error_copy(type);
|
||||
}
|
||||
}).handleFloodErrors().send();
|
||||
};
|
||||
|
||||
return [=](auto consumer) {
|
||||
_api.request(MTPaccount_GetPassword(
|
||||
)).done([=](const MTPaccount_Password &result) {
|
||||
const auto latestState = ProcessMtpState(result);
|
||||
sendMTPaccountUpdatePasswordSettings(latestState, consumer);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).send();
|
||||
return rpl::lifetime();
|
||||
};
|
||||
}
|
||||
|
||||
rpl::producer<rpl::no_value, QString> CloudPassword::recoverPassword(
|
||||
const QString &code,
|
||||
const QString &newPassword,
|
||||
const QString &newHint) {
|
||||
|
||||
const auto finish = [=](auto consumer) {
|
||||
_api.request(MTPaccount_GetPassword(
|
||||
)).done([=](const MTPaccount_Password &result) {
|
||||
apply(ProcessMtpState(result));
|
||||
consumer.put_done();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).handleFloodErrors().send();
|
||||
};
|
||||
|
||||
const auto sendMTPaccountUpdatePasswordSettings = [=](
|
||||
const Core::CloudPasswordState &latestState,
|
||||
auto consumer) {
|
||||
const auto newPasswordBytes = newPassword.toUtf8();
|
||||
const auto newPasswordHash = Core::ComputeCloudPasswordDigest(
|
||||
latestState.mtp.newPassword,
|
||||
bytes::make_span(newPasswordBytes));
|
||||
if (!newPassword.isEmpty() && newPasswordHash.modpow.empty()) {
|
||||
consumer.put_error("INTERNAL_SERVER_ERROR");
|
||||
return;
|
||||
}
|
||||
using Flag = MTPDaccount_passwordInputSettings::Flag;
|
||||
const auto flags = Flag::f_new_algo
|
||||
| Flag::f_new_password_hash
|
||||
| Flag::f_hint;
|
||||
|
||||
const auto settings = MTP_account_passwordInputSettings(
|
||||
MTP_flags(flags),
|
||||
Core::PrepareCloudPasswordAlgo(newPassword.isEmpty()
|
||||
? v::null
|
||||
: latestState.mtp.newPassword),
|
||||
newPassword.isEmpty()
|
||||
? MTP_bytes()
|
||||
: MTP_bytes(newPasswordHash.modpow),
|
||||
MTP_string(newHint),
|
||||
MTP_string(),
|
||||
MTPSecureSecretSettings());
|
||||
|
||||
_api.request(MTPauth_RecoverPassword(
|
||||
MTP_flags(newPassword.isEmpty()
|
||||
? MTPauth_RecoverPassword::Flags(0)
|
||||
: MTPauth_RecoverPassword::Flag::f_new_settings),
|
||||
MTP_string(code),
|
||||
settings
|
||||
)).done([=](const MTPauth_Authorization &result) {
|
||||
finish(consumer);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
consumer.put_error_copy(type);
|
||||
}).handleFloodErrors().send();
|
||||
};
|
||||
|
||||
return [=](auto consumer) {
|
||||
_api.request(MTPaccount_GetPassword(
|
||||
)).done([=](const MTPaccount_Password &result) {
|
||||
const auto latestState = ProcessMtpState(result);
|
||||
sendMTPaccountUpdatePasswordSettings(latestState, consumer);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).send();
|
||||
return rpl::lifetime();
|
||||
};
|
||||
}
|
||||
|
||||
rpl::producer<QString, QString> CloudPassword::requestPasswordRecovery() {
|
||||
return [=](auto consumer) {
|
||||
_api.request(MTPauth_RequestPasswordRecovery(
|
||||
)).done([=](const MTPauth_PasswordRecovery &result) {
|
||||
result.match([&](const MTPDauth_passwordRecovery &data) {
|
||||
consumer.put_next(qs(data.vemail_pattern().v));
|
||||
});
|
||||
consumer.put_done();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).send();
|
||||
return rpl::lifetime();
|
||||
};
|
||||
}
|
||||
|
||||
auto CloudPassword::checkRecoveryEmailAddressCode(const QString &code)
|
||||
-> rpl::producer<rpl::no_value, QString> {
|
||||
return [=](auto consumer) {
|
||||
_api.request(MTPauth_CheckRecoveryPassword(
|
||||
MTP_string(code)
|
||||
)).done([=] {
|
||||
consumer.put_done();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
consumer.put_error_copy(error.type());
|
||||
}).handleFloodErrors().send();
|
||||
|
||||
return rpl::lifetime();
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace Api
|
||||
|
||||
@@ -23,6 +23,10 @@ namespace Api {
|
||||
|
||||
class CloudPassword final {
|
||||
public:
|
||||
struct SetOk {
|
||||
int unconfirmedEmailLengthCode = 0;
|
||||
};
|
||||
|
||||
using ResetRetryDate = int;
|
||||
explicit CloudPassword(not_null<ApiWrap*> api);
|
||||
|
||||
@@ -34,7 +38,31 @@ public:
|
||||
rpl::producer<ResetRetryDate, QString> resetPassword();
|
||||
rpl::producer<rpl::no_value, QString> cancelResetPassword();
|
||||
|
||||
rpl::producer<SetOk, QString> set(
|
||||
const QString &oldPassword,
|
||||
const QString &newPassword,
|
||||
const QString &hint,
|
||||
bool hasRecoveryEmail,
|
||||
const QString &recoveryEmail);
|
||||
rpl::producer<rpl::no_value, QString> check(const QString &password);
|
||||
|
||||
rpl::producer<rpl::no_value, QString> confirmEmail(const QString &code);
|
||||
rpl::producer<rpl::no_value, QString> resendEmailCode();
|
||||
rpl::producer<SetOk, QString> setEmail(
|
||||
const QString &oldPassword,
|
||||
const QString &recoveryEmail);
|
||||
|
||||
rpl::producer<rpl::no_value, QString> recoverPassword(
|
||||
const QString &code,
|
||||
const QString &newPassword,
|
||||
const QString &newHint);
|
||||
rpl::producer<QString, QString> requestPasswordRecovery();
|
||||
rpl::producer<rpl::no_value, QString> checkRecoveryEmailAddressCode(
|
||||
const QString &code);
|
||||
|
||||
private:
|
||||
void apply(Core::CloudPasswordState state);
|
||||
|
||||
MTP::Sender _api;
|
||||
mtpRequestId _requestId = 0;
|
||||
std::unique_ptr<Core::CloudPasswordState> _state;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -154,9 +154,10 @@ void StartPendingReset(
|
||||
PasscodeBox::CloudFields PasscodeBox::CloudFields::From(
|
||||
const Core::CloudPasswordState ¤t) {
|
||||
auto result = CloudFields();
|
||||
result.curRequest = current.request;
|
||||
result.newAlgo = current.newPassword;
|
||||
result.newSecureSecretAlgo = current.newSecureSecret;
|
||||
result.hasPassword = current.hasPassword;
|
||||
result.mtp.curRequest = current.mtp.request;
|
||||
result.mtp.newAlgo = current.mtp.newPassword;
|
||||
result.mtp.newSecureSecretAlgo = current.mtp.newSecureSecret;
|
||||
result.hasRecovery = current.hasRecovery;
|
||||
result.notEmptyPassport = current.notEmptyPassport;
|
||||
result.hint = current.hint;
|
||||
@@ -200,21 +201,21 @@ PasscodeBox::PasscodeBox(
|
||||
, _newPasscode(
|
||||
this,
|
||||
st::defaultInputField,
|
||||
(fields.curRequest
|
||||
(fields.hasPassword
|
||||
? tr::lng_cloud_password_enter_new()
|
||||
: tr::lng_cloud_password_enter_first()))
|
||||
, _reenterPasscode(this, st::defaultInputField, tr::lng_cloud_password_confirm_new())
|
||||
, _passwordHint(
|
||||
this,
|
||||
st::defaultInputField,
|
||||
(fields.curRequest
|
||||
(fields.hasPassword
|
||||
? tr::lng_cloud_password_change_hint()
|
||||
: tr::lng_cloud_password_hint()))
|
||||
, _recoverEmail(this, st::defaultInputField, tr::lng_cloud_password_email())
|
||||
, _recover(this, tr::lng_signin_recover(tr::now))
|
||||
, _showRecoverLink(_cloudFields.hasRecovery || !_cloudFields.pendingResetDate) {
|
||||
Expects(session != nullptr || !fields.fromRecoveryCode.isEmpty());
|
||||
Expects(!_turningOff || _cloudFields.curRequest);
|
||||
Expects(!_turningOff || _cloudFields.hasPassword);
|
||||
|
||||
if (!_cloudFields.hint.isEmpty()) {
|
||||
_hintText.setText(
|
||||
@@ -248,7 +249,7 @@ rpl::producer<MTPauth_Authorization> PasscodeBox::newAuthorization() const {
|
||||
|
||||
bool PasscodeBox::currentlyHave() const {
|
||||
return _cloudPwd
|
||||
? (!!_cloudFields.curRequest)
|
||||
? _cloudFields.hasPassword
|
||||
: _session->domain().local().hasLocalPasscode();
|
||||
}
|
||||
|
||||
@@ -609,7 +610,7 @@ void PasscodeBox::handleSrpIdInvalid() {
|
||||
const auto now = crl::now();
|
||||
if (_lastSrpIdInvalidTime > 0
|
||||
&& now - _lastSrpIdInvalidTime < Core::kHandleSrpIdInvalidTimeout) {
|
||||
_cloudFields.curRequest.id = 0;
|
||||
_cloudFields.mtp.curRequest.id = 0;
|
||||
_oldError = Lang::Hard::ServerError();
|
||||
update();
|
||||
} else {
|
||||
@@ -743,14 +744,14 @@ void PasscodeBox::checkPassword(
|
||||
CheckPasswordCallback callback) {
|
||||
const auto passwordUtf = oldPassword.toUtf8();
|
||||
_checkPasswordHash = Core::ComputeCloudPasswordHash(
|
||||
_cloudFields.curRequest.algo,
|
||||
_cloudFields.mtp.curRequest.algo,
|
||||
bytes::make_span(passwordUtf));
|
||||
checkPasswordHash(std::move(callback));
|
||||
}
|
||||
|
||||
void PasscodeBox::checkPasswordHash(CheckPasswordCallback callback) {
|
||||
_checkPasswordCallback = std::move(callback);
|
||||
if (_cloudFields.curRequest.id) {
|
||||
if (_cloudFields.mtp.curRequest.id) {
|
||||
passwordChecked();
|
||||
} else {
|
||||
requestPasswordData();
|
||||
@@ -758,16 +759,16 @@ void PasscodeBox::checkPasswordHash(CheckPasswordCallback callback) {
|
||||
}
|
||||
|
||||
void PasscodeBox::passwordChecked() {
|
||||
if (!_cloudFields.curRequest || !_cloudFields.curRequest.id || !_checkPasswordCallback) {
|
||||
if (!_cloudFields.mtp.curRequest || !_cloudFields.mtp.curRequest.id || !_checkPasswordCallback) {
|
||||
return serverError();
|
||||
}
|
||||
const auto check = Core::ComputeCloudPasswordCheck(
|
||||
_cloudFields.curRequest,
|
||||
_cloudFields.mtp.curRequest,
|
||||
_checkPasswordHash);
|
||||
if (!check) {
|
||||
return serverError();
|
||||
}
|
||||
_cloudFields.curRequest.id = 0;
|
||||
_cloudFields.mtp.curRequest.id = 0;
|
||||
_checkPasswordCallback(check);
|
||||
}
|
||||
|
||||
@@ -782,7 +783,7 @@ void PasscodeBox::requestPasswordData() {
|
||||
).done([=](const MTPaccount_Password &result) {
|
||||
_setRequest = 0;
|
||||
result.match([&](const MTPDaccount_password &data) {
|
||||
_cloudFields.curRequest = Core::ParseCloudPasswordCheckRequest(data);
|
||||
_cloudFields.mtp.curRequest = Core::ParseCloudPasswordCheckRequest(data);
|
||||
passwordChecked();
|
||||
});
|
||||
}).send();
|
||||
@@ -820,7 +821,7 @@ void PasscodeBox::sendClearCloudPassword(
|
||||
check.result,
|
||||
MTP_account_passwordInputSettings(
|
||||
MTP_flags(flags),
|
||||
Core::PrepareCloudPasswordAlgo(_cloudFields.newAlgo),
|
||||
Core::PrepareCloudPasswordAlgo(_cloudFields.mtp.newAlgo),
|
||||
MTP_bytes(), // new_password_hash
|
||||
MTP_string(hint),
|
||||
MTP_string(email),
|
||||
@@ -835,7 +836,7 @@ void PasscodeBox::sendClearCloudPassword(
|
||||
void PasscodeBox::setNewCloudPassword(const QString &newPassword) {
|
||||
const auto newPasswordBytes = newPassword.toUtf8();
|
||||
const auto newPasswordHash = Core::ComputeCloudPasswordDigest(
|
||||
_cloudFields.newAlgo,
|
||||
_cloudFields.mtp.newAlgo,
|
||||
bytes::make_span(newPasswordBytes));
|
||||
if (newPasswordHash.modpow.empty()) {
|
||||
return serverError();
|
||||
@@ -851,7 +852,7 @@ void PasscodeBox::setNewCloudPassword(const QString &newPassword) {
|
||||
|
||||
const auto settings = MTP_account_passwordInputSettings(
|
||||
MTP_flags(flags),
|
||||
Core::PrepareCloudPasswordAlgo(_cloudFields.newAlgo),
|
||||
Core::PrepareCloudPasswordAlgo(_cloudFields.mtp.newAlgo),
|
||||
MTP_bytes(newPasswordHash.modpow),
|
||||
MTP_string(hint),
|
||||
MTP_string(email),
|
||||
@@ -989,7 +990,7 @@ void PasscodeBox::sendChangeCloudPassword(
|
||||
const QByteArray &secureSecret) {
|
||||
const auto newPasswordBytes = newPassword.toUtf8();
|
||||
const auto newPasswordHash = Core::ComputeCloudPasswordDigest(
|
||||
_cloudFields.newAlgo,
|
||||
_cloudFields.mtp.newAlgo,
|
||||
bytes::make_span(newPasswordBytes));
|
||||
if (newPasswordHash.modpow.empty()) {
|
||||
return serverError();
|
||||
@@ -1007,19 +1008,19 @@ void PasscodeBox::sendChangeCloudPassword(
|
||||
newSecureSecret = Passport::EncryptSecureSecret(
|
||||
bytes::make_span(secureSecret),
|
||||
Core::ComputeSecureSecretHash(
|
||||
_cloudFields.newSecureSecretAlgo,
|
||||
_cloudFields.mtp.newSecureSecretAlgo,
|
||||
bytes::make_span(newPasswordBytes)));
|
||||
}
|
||||
_setRequest = _api.request(MTPaccount_UpdatePasswordSettings(
|
||||
check.result,
|
||||
MTP_account_passwordInputSettings(
|
||||
MTP_flags(flags),
|
||||
Core::PrepareCloudPasswordAlgo(_cloudFields.newAlgo),
|
||||
Core::PrepareCloudPasswordAlgo(_cloudFields.mtp.newAlgo),
|
||||
MTP_bytes(newPasswordHash.modpow),
|
||||
MTP_string(hint),
|
||||
MTPstring(), // email is not changing
|
||||
MTP_secureSecretSettings(
|
||||
Core::PrepareSecureSecretAlgo(_cloudFields.newSecureSecretAlgo),
|
||||
Core::PrepareSecureSecretAlgo(_cloudFields.mtp.newSecureSecretAlgo),
|
||||
MTP_bytes(newSecureSecret),
|
||||
MTP_long(newSecureSecretId)))
|
||||
)).done([=] {
|
||||
@@ -1294,7 +1295,8 @@ void RecoverBox::proceedToChange(const QString &code) {
|
||||
fields.hasRecovery = false;
|
||||
// we could've been turning off, no need to force new password then
|
||||
// like if (_cloudFields.turningOff) { just RecoverPassword else Check }
|
||||
fields.curRequest = {};
|
||||
fields.mtp.curRequest = {};
|
||||
fields.hasPassword = false;
|
||||
auto box = Box<PasscodeBox>(_session, fields);
|
||||
|
||||
box->boxClosing(
|
||||
|
||||
@@ -36,13 +36,17 @@ public:
|
||||
struct CloudFields {
|
||||
static CloudFields From(const Core::CloudPasswordState ¤t);
|
||||
|
||||
Core::CloudPasswordCheckRequest curRequest;
|
||||
Core::CloudPasswordAlgo newAlgo;
|
||||
struct Mtp {
|
||||
Core::CloudPasswordCheckRequest curRequest;
|
||||
Core::CloudPasswordAlgo newAlgo;
|
||||
Core::SecureSecretAlgo newSecureSecretAlgo;
|
||||
};
|
||||
Mtp mtp;
|
||||
bool hasPassword = false;
|
||||
bool hasRecovery = false;
|
||||
QString fromRecoveryCode;
|
||||
bool notEmptyPassport = false;
|
||||
QString hint;
|
||||
Core::SecureSecretAlgo newSecureSecretAlgo;
|
||||
bool turningOff = false;
|
||||
TimeId pendingResetDate = 0;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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::infoRoundedIconSignature, 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::infoRoundedIconReactions, 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::infoRoundedIconInviteLinks, 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::infoRoundedIconAdministrators, 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::infoRoundedIconRecentActions, 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::infoRoundedIconRequests, 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,
|
||||
{}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ 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 "info/profile/info_profile_icon.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "styles/style_settings.h"
|
||||
#include "styles/style_info.h"
|
||||
@@ -29,6 +28,7 @@ void EditAllowedReactionsBox(
|
||||
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 {
|
||||
@@ -57,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) {
|
||||
@@ -87,7 +98,6 @@ void EditAllowedReactionsBox(
|
||||
container,
|
||||
rpl::single(entry.title),
|
||||
st::manageGroupButton.button);
|
||||
const auto iconHeight = st::editPeerReactionsPreview;
|
||||
AddReactionLottieIcon(
|
||||
button,
|
||||
button->sizeValue(
|
||||
@@ -138,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,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::infoRoundedIconInviteLinks, 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;
|
||||
|
||||
@@ -89,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,
|
||||
@@ -121,7 +122,7 @@ 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(); }));
|
||||
@@ -150,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 = [=] {
|
||||
@@ -224,7 +227,7 @@ void AddMessage(
|
||||
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()
|
||||
@@ -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(
|
||||
@@ -432,9 +420,9 @@ void ReactionsSettingsBox(
|
||||
auto firstCheckedButton = (Ui::RpWidget*)(nullptr);
|
||||
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(
|
||||
@@ -472,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(), [=] {
|
||||
|
||||
@@ -39,7 +39,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "styles/style_menu_icons.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_window.h"
|
||||
#include "styles/style_settings.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -276,7 +276,7 @@ void RingtonesBox(
|
||||
tr::lng_ringtones_box_upload_button(),
|
||||
st::ringtonesBoxButton,
|
||||
{
|
||||
&st::mainMenuAddAccount,
|
||||
&st::settingsIconAdd,
|
||||
0,
|
||||
Settings::IconType::Round,
|
||||
&st::windowBgActive
|
||||
|
||||
@@ -37,6 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
namespace tgcalls {
|
||||
class InstanceImpl;
|
||||
class InstanceV2Impl;
|
||||
class InstanceV2ReferenceImpl;
|
||||
class InstanceV2_4_0_0Impl;
|
||||
class InstanceImplLegacy;
|
||||
void SetLegacyGlobalServerConfig(const std::string &serverConfig);
|
||||
@@ -53,14 +54,28 @@ const auto kDefaultVersion = "2.4.4"_q;
|
||||
|
||||
const auto Register = tgcalls::Register<tgcalls::InstanceImpl>();
|
||||
const auto RegisterV2 = tgcalls::Register<tgcalls::InstanceV2Impl>();
|
||||
const auto RegV2Ref = tgcalls::Register<tgcalls::InstanceV2ReferenceImpl>();
|
||||
const auto RegisterV240 = tgcalls::Register<tgcalls::InstanceV2_4_0_0Impl>();
|
||||
const auto RegisterLegacy = tgcalls::Register<tgcalls::InstanceImplLegacy>();
|
||||
|
||||
[[nodiscard]] base::flat_set<int64> CollectEndpointIds(
|
||||
const QVector<MTPPhoneConnection> &list) {
|
||||
auto result = base::flat_set<int64>();
|
||||
result.reserve(list.size());
|
||||
for (const auto &connection : list) {
|
||||
connection.match([&](const MTPDphoneConnection &data) {
|
||||
result.emplace(int64(data.vid().v));
|
||||
}, [](const MTPDphoneConnectionWebrtc &) {
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void AppendEndpoint(
|
||||
std::vector<tgcalls::Endpoint> &list,
|
||||
const MTPPhoneConnection &connection) {
|
||||
connection.match([&](const MTPDphoneConnection &data) {
|
||||
if (data.vpeer_tag().v.length() != 16) {
|
||||
if (data.vpeer_tag().v.length() != 16 || data.is_tcp()) {
|
||||
return;
|
||||
}
|
||||
tgcalls::Endpoint endpoint = {
|
||||
@@ -82,8 +97,41 @@ void AppendEndpoint(
|
||||
|
||||
void AppendServer(
|
||||
std::vector<tgcalls::RtcServer> &list,
|
||||
const MTPPhoneConnection &connection) {
|
||||
const MTPPhoneConnection &connection,
|
||||
const base::flat_set<int64> &ids) {
|
||||
connection.match([&](const MTPDphoneConnection &data) {
|
||||
const auto hex = [](const QByteArray &value) {
|
||||
const auto digit = [](uchar c) {
|
||||
return char((c < 10) ? ('0' + c) : ('a' + c - 10));
|
||||
};
|
||||
auto result = std::string();
|
||||
result.reserve(value.size() * 2);
|
||||
for (const auto ch : value) {
|
||||
result += digit(uchar(ch) / 16);
|
||||
result += digit(uchar(ch) % 16);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
const auto host = data.vip().v;
|
||||
const auto hostv6 = data.vipv6().v;
|
||||
const auto port = uint16_t(data.vport().v);
|
||||
const auto username = std::string("reflector");
|
||||
const auto password = hex(data.vpeer_tag().v);
|
||||
const auto i = ids.find(int64(data.vid().v));
|
||||
Assert(i != end(ids));
|
||||
const auto id = uint8_t((i - begin(ids)) + 1);
|
||||
const auto pushTurn = [&](const QString &host) {
|
||||
list.push_back(tgcalls::RtcServer{
|
||||
.id = id,
|
||||
.host = host.toStdString(),
|
||||
.port = port,
|
||||
.login = username,
|
||||
.password = password,
|
||||
.isTurn = true,
|
||||
});
|
||||
};
|
||||
pushTurn(host);
|
||||
pushTurn(hostv6);
|
||||
}, [&](const MTPDphoneConnectionWebrtc &data) {
|
||||
const auto host = qs(data.vip());
|
||||
const auto hostv6 = qs(data.vipv6());
|
||||
@@ -780,10 +828,20 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
|
||||
kAuthKeySize>>();
|
||||
memcpy(encryptionKeyValue->data(), _authKey.data(), kAuthKeySize);
|
||||
|
||||
const auto &settings = Core::App().settings();
|
||||
const auto version = call.vprotocol().match([&](
|
||||
const MTPDphoneCallProtocol &data) {
|
||||
return data.vlibrary_versions().v;
|
||||
}).value(0, MTP_bytes(kDefaultVersion)).v;
|
||||
|
||||
LOG(("Call Info: Creating instance with version '%1', allowP2P: %2").arg(
|
||||
QString::fromUtf8(version),
|
||||
Logs::b(call.is_p2p_allowed())));
|
||||
|
||||
const auto versionString = version.toStdString();
|
||||
const auto &settings = Core::App().settings();
|
||||
const auto weak = base::make_weak(this);
|
||||
tgcalls::Descriptor descriptor = {
|
||||
.version = versionString,
|
||||
.config = tgcalls::Config{
|
||||
.initializationTimeout =
|
||||
serverConfig.callConnectTimeoutMs / 1000.,
|
||||
@@ -849,11 +907,12 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
|
||||
QDir().mkpath(callLogFolder);
|
||||
}
|
||||
|
||||
const auto ids = CollectEndpointIds(call.vconnections().v);
|
||||
for (const auto &connection : call.vconnections().v) {
|
||||
AppendEndpoint(descriptor.endpoints, connection);
|
||||
}
|
||||
for (const auto &connection : call.vconnections().v) {
|
||||
AppendServer(descriptor.rtcServers, connection);
|
||||
AppendServer(descriptor.rtcServers, connection, ids);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -871,18 +930,7 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const auto version = call.vprotocol().match([&](
|
||||
const MTPDphoneCallProtocol &data) {
|
||||
return data.vlibrary_versions().v;
|
||||
}).value(0, MTP_bytes(kDefaultVersion)).v;
|
||||
|
||||
LOG(("Call Info: Creating instance with version '%1', allowP2P: %2").arg(
|
||||
QString::fromUtf8(version),
|
||||
Logs::b(descriptor.config.enableP2P)));
|
||||
_instance = tgcalls::Meta::Create(
|
||||
version.toStdString(),
|
||||
std::move(descriptor));
|
||||
_instance = tgcalls::Meta::Create(versionString, std::move(descriptor));
|
||||
if (!_instance) {
|
||||
LOG(("Call Error: Wrong library version: %1."
|
||||
).arg(QString::fromUtf8(version)));
|
||||
|
||||
@@ -1065,6 +1065,7 @@ void GroupCall::start(TimeId scheduleDate, bool rtmp) {
|
||||
MTPstring(), // title
|
||||
MTP_int(scheduleDate)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_reloadedStaleCall = true;
|
||||
_acceptFields = true;
|
||||
_peer->session().api().applyUpdates(result);
|
||||
_acceptFields = false;
|
||||
@@ -1393,6 +1394,13 @@ void GroupCall::rejoin(not_null<PeerData*> as) {
|
||||
sendSelfUpdate(SendUpdateType::CameraPaused);
|
||||
}
|
||||
sendPendingSelfUpdates();
|
||||
if (!_reloadedStaleCall
|
||||
&& _state.current() != State::Joining) {
|
||||
if (const auto real = lookupReal()) {
|
||||
_reloadedStaleCall = true;
|
||||
real->reloadIfStale();
|
||||
}
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_joinState.finish();
|
||||
|
||||
|
||||
@@ -674,6 +674,7 @@ private:
|
||||
bool _hadJoinedState = false;
|
||||
bool _listenersHidden = false;
|
||||
bool _rtmp = false;
|
||||
bool _reloadedStaleCall = false;
|
||||
int _rtmpVolume = 0;
|
||||
|
||||
std::unique_ptr<Webrtc::MediaDevices> _mediaDevices;
|
||||
|
||||