Repository navigation
Expand file tree
/
Copy path0038-feat-turn-off-animated-userpics.patch
More file actions
293 lines (283 loc) · 12.2 KB
/
Copy path0038-feat-turn-off-animated-userpics.patch
File metadata and controls
293 lines (283 loc) · 12.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nitreojs <hello@starkow.dev>
Date: Sun, 27 Sep 2026 07:50:01 +0300
Subject: [PATCH] feat: turn off animated userpics
---
.../boxes/peers/prepare_short_info_box.cpp | 5 +--
.../dialogs/dialogs_inner_widget.cpp | 9 ++++-
.../history/history_inner_widget.cpp | 8 ++++-
.../history/view/history_view_list_widget.cpp | 9 ++++-
.../info/profile/info_profile_top_bar.cpp | 9 ++++-
.../SourceFiles/settings/settings_tele.cpp | 2 ++
Telegram/SourceFiles/tele/tele_options.cpp | 33 +++++++++++++++++++
Telegram/SourceFiles/tele/tele_options.h | 6 ++++
.../ui/controls/userpic_button.cpp | 5 ++-
9 files changed, 79 insertions(+), 7 deletions(-)
diff --git a/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp b/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp
index e2d4aa8a76b68d2fcfe6337daf50724a89b9f969..5b968bc452c5d6d6428b09666c6794afa6e171a8 100644
--- a/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp
+++ b/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp
@@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "info/profile/info_profile_values.h"
#include "lang/lang_keys.h"
#include "main/main_session.h"
+#include "tele/tele_options.h"
#include "ui/delayed_activation.h" // PreventDelayedActivation
#include "ui/text/format_values.h"
#include "ui/widgets/menu/menu_add_action_callback.h"
@@ -118,7 +119,7 @@ void Preload(
? peer->userpicPhotoOrigin()
: Data::FileOriginUserPhoto(peerToUser(peer->id), photo->id);
state->photoPreloads.push_back(photo->createMediaView());
- if (photo->hasVideo()) {
+ if (photo->hasVideo() && !::Tele::StaticUserpicsChats()) {
state->photoPreloads.back()->videoWanted(
Data::PhotoSize::Large,
origin);
@@ -150,7 +151,7 @@ void ProcessFullPhoto(
not_null<PhotoData*> photo) {
using PhotoSize = Data::PhotoSize;
const auto current = (peer->userpicPhotoId() == photo->id);
- const auto video = photo->hasVideo();
+ const auto video = photo->hasVideo() && !::Tele::StaticUserpicsChats();
const auto originCurrent = peer->userpicPhotoOrigin();
const auto originOther = peer->isUser()
? Data::FileOriginUserPhoto(peerToUser(peer->id), photo->id)
diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp
index 2f0a620c68c44f8e640f794892aceab4d80017bb..38d4d6741cffa08185a8eae84336f4a74fabe169 100644
--- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp
+++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp
@@ -86,6 +86,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/filters/edit_filter_box.h"
#include "boxes/peers/edit_forum_topic_box.h"
#include "boxes/peer_list_box.h"
+#include "tele/tele_options.h"
#include "api/api_chat_filters.h"
#include "base/qt/qt_common_adapters.h"
#include "styles/style_dialogs.h"
@@ -315,6 +316,11 @@ InnerWidget::InnerWidget(
_communityViewable.setRepaint([=] { update(); });
+ ::Tele::StaticUserpicsListChanges(
+ ) | rpl::on_next([=] {
+ update();
+ }, lifetime());
+
style::PaletteChanged(
) | rpl::on_next([=] {
_topicJumpCache = nullptr;
@@ -1783,7 +1789,8 @@ Ui::VideoUserpic *InnerWidget::validateVideoUserpic(
|| peer->userpicPhotoUnknown()
|| !peer->userpicHasVideo()
|| peer->isSelf()
- || peer->isRepliesChat()) {
+ || peer->isRepliesChat()
+ || ::Tele::StaticUserpicsList()) {
_videoUserpics.remove(peer);
return nullptr;
}
diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp
index 8edee3d69ccb48eca52dee99d174924083a113f0..b0625adf278e8755aa00eb54d2d0ba9fbcf4cbda 100644
--- a/Telegram/SourceFiles/history/history_inner_widget.cpp
+++ b/Telegram/SourceFiles/history/history_inner_widget.cpp
@@ -135,6 +135,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "tele/tele_ignored.h"
#include "tele/tele_secret_media.h"
#include "tele/tele_message_menu.h"
+#include "tele/tele_options.h"
#include "styles/style_chat.h"
#include "styles/style_menu_icons.h"
@@ -441,6 +442,10 @@ HistoryInner::HistoryInner(
update();
}
}, lifetime());
+ ::Tele::StaticUserpicsChatsChanges(
+ ) | rpl::on_next([=] {
+ update();
+ }, lifetime());
using PlayRequest = ChatHelpers::EmojiInteractionPlayRequest;
_controller->emojiInteractions().playRequests(
@@ -1887,7 +1892,8 @@ HistoryInner::VideoUserpic *HistoryInner::validateVideoUserpic(
not_null<PeerData*> peer) {
if (!peer->isPremium()
|| peer->userpicPhotoUnknown()
- || !peer->userpicHasVideo()) {
+ || !peer->userpicHasVideo()
+ || ::Tele::StaticUserpicsChats()) {
_videoUserpics.remove(peer);
return nullptr;
}
diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp
index 3c78c837ba4f4b969755ae172f21025b0d6e124a..c9cabc4e122350081ebe2775c5d783c1f4ed1eb4 100644
--- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp
+++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp
@@ -102,6 +102,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_message_reactions.h"
#include "data/data_peer_values.h"
#include "tele/tele_ignored.h"
+#include "tele/tele_options.h"
#include "styles/style_chat.h"
#include "styles/style_window.h" // columnMaximalWidthLeft
@@ -665,6 +666,11 @@ ListWidget::ListWidget(
update();
}, lifetime());
+ ::Tele::StaticUserpicsChatsChanges(
+ ) | rpl::on_next([=] {
+ update();
+ }, lifetime());
+
_session->data().peerDecorationsUpdated(
) | rpl::on_next([=] {
update();
@@ -3317,7 +3323,8 @@ ListWidget::VideoUserpic *ListWidget::validateVideoUserpic(
not_null<PeerData*> peer) {
if (!peer->isPremium()
|| peer->userpicPhotoUnknown()
- || !peer->userpicHasVideo()) {
+ || !peer->userpicHasVideo()
+ || ::Tele::StaticUserpicsChats()) {
_videoUserpics.remove(peer);
return nullptr;
}
diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp
index bd0acd8bfe99cbaed0a289e1a09385437e617617..018c43acb11c56a89443acf471a36e41e1da3c65 100644
--- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp
+++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp
@@ -552,6 +552,11 @@ TopBar::TopBar(
[=] { update(); });
} else if (!_savedMessages) {
updateVideoUserpic();
+ Tele::StaticUserpicsChatsChanges(
+ ) | rpl::on_next([=] {
+ updateVideoUserpic();
+ update();
+ }, lifetime());
}
rpl::merge(
windowActiveValue() | rpl::to_empty,
@@ -3191,7 +3196,9 @@ void TopBar::updateVideoUserpic() {
return;
}
const auto photo = _peer->owner().photo(id);
- if (!photo->date() || !photo->videoCanBePlayed()) {
+ if (!photo->date()
+ || !photo->videoCanBePlayed()
+ || Tele::StaticUserpicsChats()) {
_videoUserpicPlayer = nullptr;
return;
}
diff --git a/Telegram/SourceFiles/settings/settings_tele.cpp b/Telegram/SourceFiles/settings/settings_tele.cpp
index ee42faab20b039a07644c60cb67292777f2d25d3..fd16672872cda51f4aeb2f42397923388bb254a5 100644
--- a/Telegram/SourceFiles/settings/settings_tele.cpp
+++ b/Telegram/SourceFiles/settings/settings_tele.cpp
@@ -782,6 +782,8 @@ void TeleSection::setupContent() {
AddOptionToggle(content, controller(), ::Tele::kOptionNoLinkWarning);
AddOptionToggle(content, controller(), ::Tele::kOptionHideAllChats);
AddOptionToggle(content, controller(), ::Tele::kOptionJumpToFirst);
+ AddOptionToggle(content, controller(), ::Tele::kOptionStaticUserpicsList);
+ AddOptionToggle(content, controller(), ::Tele::kOptionStaticUserpicsChats);
Ui::AddSkip(content);
Ui::AddDivider(content);
Ui::AddSkip(content);
diff --git a/Telegram/SourceFiles/tele/tele_options.cpp b/Telegram/SourceFiles/tele/tele_options.cpp
index 8f0dba04e7649271c518ccbebf15266ae1c1455c..e5468c25b9ac16e91c59790f5ef48dd09d13a29f 100644
--- a/Telegram/SourceFiles/tele/tele_options.cpp
+++ b/Telegram/SourceFiles/tele/tele_options.cpp
@@ -25,6 +25,8 @@ const char kOptionHideProxySponsor[] = "tele-hide-proxy-sponsor";
const char kOptionNoLinkWarning[] = "tele-no-link-warning";
const char kOptionHideAllChats[] = "tele-hide-all-chats";
const char kOptionJumpToFirst[] = "tele-jump-to-first";
+const char kOptionStaticUserpicsList[] = "tele-static-userpics-list";
+const char kOptionStaticUserpicsChats[] = "tele-static-userpics-chats";
const char kOptionShowGiftIds[] = "tele-show-gift-ids";
const char kOptionPeerIdsWithoutSpaces[] = "tele-peer-ids-without-spaces";
const char kOptionBotApiPeerIds[] = "tele-bot-api-peer-ids";
@@ -215,6 +217,21 @@ base::options::toggle JumpToFirstOption({
"the top bar. It scrolls the chat or topic to its very start.",
});
+base::options::toggle StaticUserpicsListOption({
+ .id = kOptionStaticUserpicsList,
+ .name = "Static userpics in the chat list",
+ .description = "Animated profile photos in the chat list, folders "
+ "and search results show as still pictures.",
+});
+
+base::options::toggle StaticUserpicsChatsOption({
+ .id = kOptionStaticUserpicsChats,
+ .name = "Static userpics in chats and profiles",
+ .description = "Animated profile photos next to messages, in "
+ "profiles and profile previews show as still pictures. "
+ "Opening the photo still plays it.",
+});
+
base::options::toggle ShowGiftIdsOption({
.id = kOptionShowGiftIds,
.name = "Show gift IDs",
@@ -483,6 +500,22 @@ bool JumpToFirst() {
return JumpToFirstOption.value();
}
+bool StaticUserpicsList() {
+ return StaticUserpicsListOption.value();
+}
+
+rpl::producer<> StaticUserpicsListChanges() {
+ return StaticUserpicsListOption.changes();
+}
+
+bool StaticUserpicsChats() {
+ return StaticUserpicsChatsOption.value();
+}
+
+rpl::producer<> StaticUserpicsChatsChanges() {
+ return StaticUserpicsChatsOption.changes();
+}
+
bool ShowGiftIds() {
return ShowGiftIdsOption.value();
}
diff --git a/Telegram/SourceFiles/tele/tele_options.h b/Telegram/SourceFiles/tele/tele_options.h
index 5e3233b8828f44e56fcf10f681cb04eccad3f717..ef996ff5bde12f6bf9a11857779a8c35d0910ae4 100644
--- a/Telegram/SourceFiles/tele/tele_options.h
+++ b/Telegram/SourceFiles/tele/tele_options.h
@@ -23,6 +23,8 @@ extern const char kOptionHideProxySponsor[];
extern const char kOptionNoLinkWarning[];
extern const char kOptionHideAllChats[];
extern const char kOptionJumpToFirst[];
+extern const char kOptionStaticUserpicsList[];
+extern const char kOptionStaticUserpicsChats[];
extern const char kOptionShowGiftIds[];
extern const char kOptionPeerIdsWithoutSpaces[];
extern const char kOptionBotApiPeerIds[];
@@ -69,6 +71,10 @@ void SetGhostChats(const QString &value);
[[nodiscard]] bool HideAllChats();
[[nodiscard]] rpl::producer<> HideAllChatsChanges();
[[nodiscard]] bool JumpToFirst();
+[[nodiscard]] bool StaticUserpicsList();
+[[nodiscard]] rpl::producer<> StaticUserpicsListChanges();
+[[nodiscard]] bool StaticUserpicsChats();
+[[nodiscard]] rpl::producer<> StaticUserpicsChatsChanges();
[[nodiscard]] bool ShowGiftIds();
[[nodiscard]] bool PeerIdsWithoutSpaces();
[[nodiscard]] bool BotApiPeerIds();
diff --git a/Telegram/SourceFiles/ui/controls/userpic_button.cpp b/Telegram/SourceFiles/ui/controls/userpic_button.cpp
index cc76eac5ea71fb3e2bbab42adfea90f47589e80f..ef39e4684c4885b7d8a19a3ec10cefbffcf5d3fb 100644
--- a/Telegram/SourceFiles/ui/controls/userpic_button.cpp
+++ b/Telegram/SourceFiles/ui/controls/userpic_button.cpp
@@ -44,6 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "media/streaming/media_streaming_document.h"
#include "settings/sections/settings_calls.h" // AddCameraSubsection.
#include "settings/settings_privacy_controllers.h"
+#include "tele/tele_options.h"
#include "webrtc/webrtc_environment.h"
#include "webrtc/webrtc_video_track.h"
#include "ui/widgets/popup_menu.h"
@@ -922,7 +923,9 @@ void UserpicButton::updateVideo() {
return;
}
const auto photo = _peer->owner().photo(id);
- if (!photo->date() || !photo->videoCanBePlayed()) {
+ if (!photo->date()
+ || !photo->videoCanBePlayed()
+ || ::Tele::StaticUserpicsChats()) {
clearStreaming();
return;
} else if (_streamed && _streamedPhoto == photo) {