@@ -40,20 +40,22 @@ public final class ShortsFilter extends Filter {
40
40
41
41
private static WeakReference <PivotBar > pivotBarRef = new WeakReference <>(null );
42
42
43
- private final StringFilterGroup shortsCompactFeedVideoPath ;
43
+ private final StringFilterGroup shortsCompactFeedVideo ;
44
44
private final ByteArrayFilterGroup shortsCompactFeedVideoBuffer ;
45
+ private final StringFilterGroup useSoundButton ;
46
+ private final ByteArrayFilterGroup useSoundButtonBuffer ;
45
47
46
48
private final StringFilterGroup subscribeButton ;
47
49
private final StringFilterGroup joinButton ;
48
50
private final StringFilterGroup paidPromotionButton ;
49
51
private final StringFilterGroup shelfHeader ;
50
52
51
53
private final StringFilterGroup suggestedAction ;
52
- private final ByteArrayFilterGroupList suggestedActionsGroupList = new ByteArrayFilterGroupList ();
54
+ private final ByteArrayFilterGroupList suggestedActionsBuffer = new ByteArrayFilterGroupList ();
53
55
54
56
private final StringFilterGroup shortsActionBar ;
55
- private final StringFilterGroup actionButton ;
56
- private final ByteArrayFilterGroupList videoActionButtonGroupList = new ByteArrayFilterGroupList ();
57
+ private final StringFilterGroup videoActionButton ;
58
+ private final ByteArrayFilterGroupList videoActionButtonBuffer = new ByteArrayFilterGroupList ();
57
59
58
60
public ShortsFilter () {
59
61
//
@@ -82,7 +84,7 @@ public ShortsFilter() {
82
84
// Path components.
83
85
//
84
86
85
- shortsCompactFeedVideoPath = new StringFilterGroup (null ,
87
+ shortsCompactFeedVideo = new StringFilterGroup (null ,
86
88
// Shorts that appear in the feed/search when the device is using tablet layout.
87
89
"compact_video.eml" ,
88
90
// 'video_lockup_with_attachment.eml' is shown instead of 'compact_video.eml' for some users
@@ -174,7 +176,18 @@ public ShortsFilter() {
174
176
"reel_action_bar.eml"
175
177
);
176
178
177
- actionButton = new StringFilterGroup (
179
+ useSoundButton = new StringFilterGroup (
180
+ Settings .HIDE_SHORTS_USE_SOUND_BUTTON ,
181
+ "floating_action_button.eml" ,
182
+ REEL_METAPANEL_PATH
183
+ );
184
+
185
+ useSoundButtonBuffer = new ByteArrayFilterGroup (
186
+ null ,
187
+ "yt_outline_camera_"
188
+ );
189
+
190
+ videoActionButton = new StringFilterGroup (
178
191
null ,
179
192
// Can be simply 'button.eml', 'shorts_video_action_button.eml' or 'reel_action_button.eml'
180
193
"button.eml"
@@ -186,16 +199,16 @@ public ShortsFilter() {
186
199
);
187
200
188
201
addPathCallbacks (
189
- shortsCompactFeedVideoPath , joinButton , subscribeButton , paidPromotionButton ,
202
+ shortsCompactFeedVideo , joinButton , subscribeButton , paidPromotionButton ,
190
203
shortsActionBar , suggestedAction , pausedOverlayButtons , channelBar ,
191
- fullVideoLinkLabel , videoTitle , reelSoundMetadata , soundButton , infoPanel ,
204
+ fullVideoLinkLabel , videoTitle , useSoundButton , reelSoundMetadata , soundButton , infoPanel ,
192
205
stickers , likeFountain , likeButton , dislikeButton
193
206
);
194
207
195
208
//
196
209
// All other action buttons.
197
210
//
198
- videoActionButtonGroupList .addAll (
211
+ videoActionButtonBuffer .addAll (
199
212
new ByteArrayFilterGroup (
200
213
Settings .HIDE_SHORTS_COMMENTS_BUTTON ,
201
214
"reel_comment_button" ,
@@ -216,7 +229,7 @@ public ShortsFilter() {
216
229
//
217
230
// Suggested actions.
218
231
//
219
- suggestedActionsGroupList .addAll (
232
+ suggestedActionsBuffer .addAll (
220
233
new ByteArrayFilterGroup (
221
234
Settings .HIDE_SHORTS_PREVIEW_COMMENT ,
222
235
// Preview comment that can popup while a Short is playing.
@@ -242,10 +255,7 @@ public ShortsFilter() {
242
255
"yt_outline_bookmark_" ,
243
256
// 'Save sound' button. It seems this has been removed and only 'Save music' is used.
244
257
// Still hide this in case it's still present.
245
- "yt_outline_list_add_" ,
246
- // 'Use this sound' button. It seems this has been removed and only 'Save music' is used.
247
- // Still hide this in case it's still present.
248
- "yt_outline_camera_"
258
+ "yt_outline_list_add_"
249
259
),
250
260
new ByteArrayFilterGroup (
251
261
Settings .HIDE_SHORTS_SEARCH_SUGGESTIONS ,
@@ -279,7 +289,7 @@ public ShortsFilter() {
279
289
}
280
290
281
291
private boolean isEverySuggestedActionFilterEnabled () {
282
- for (ByteArrayFilterGroup group : suggestedActionsGroupList ) {
292
+ for (ByteArrayFilterGroup group : suggestedActionsBuffer ) {
283
293
if (!group .isEnabled ()) {
284
294
return false ;
285
295
}
@@ -297,15 +307,19 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
297
307
return path .startsWith (REEL_CHANNEL_BAR_PATH ) || path .startsWith (REEL_METAPANEL_PATH );
298
308
}
299
309
300
- if (matchedGroup == shortsCompactFeedVideoPath ) {
310
+ if (matchedGroup == useSoundButton ) {
311
+ return useSoundButtonBuffer .check (protobufBufferArray ).isFiltered ();
312
+ }
313
+
314
+ if (matchedGroup == shortsCompactFeedVideo ) {
301
315
return shouldHideShortsFeedItems () && shortsCompactFeedVideoBuffer .check (protobufBufferArray ).isFiltered ();
302
316
}
303
317
304
318
// Video action buttons (comment, share, remix) have the same path.
305
319
// Like and dislike are separate path filters and don't require buffer searching.
306
320
if (matchedGroup == shortsActionBar ) {
307
- return actionButton .check (path ).isFiltered ()
308
- && videoActionButtonGroupList .check (protobufBufferArray ).isFiltered ();
321
+ return videoActionButton .check (path ).isFiltered ()
322
+ && videoActionButtonBuffer .check (protobufBufferArray ).isFiltered ();
309
323
}
310
324
311
325
if (matchedGroup == suggestedAction ) {
@@ -316,7 +330,7 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
316
330
return true ;
317
331
}
318
332
319
- return suggestedActionsGroupList .check (protobufBufferArray ).isFiltered ();
333
+ return suggestedActionsBuffer .check (protobufBufferArray ).isFiltered ();
320
334
}
321
335
322
336
return true ;
0 commit comments