forked from ReVanced/revanced-patches-template
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into revanced-extended
- Loading branch information
Showing
255 changed files
with
11,472 additions
and
4,018 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
...ed/src/main/java/app/revanced/extension/music/patches/components/ActionButtonsFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package app.revanced.extension.music.patches.components; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import app.revanced.extension.music.settings.Settings; | ||
import app.revanced.extension.shared.patches.components.ByteArrayFilterGroup; | ||
import app.revanced.extension.shared.patches.components.ByteArrayFilterGroupList; | ||
import app.revanced.extension.shared.patches.components.Filter; | ||
import app.revanced.extension.shared.patches.components.StringFilterGroup; | ||
|
||
@SuppressWarnings("unused") | ||
public final class ActionButtonsFilter extends Filter { | ||
private static final String VIDEO_ACTION_BAR_PATH_PREFIX = "video_action_bar.eml"; | ||
|
||
private final StringFilterGroup actionBarRule; | ||
private final StringFilterGroup bufferFilterPathRule; | ||
private final ByteArrayFilterGroupList bufferButtonsGroupList = new ByteArrayFilterGroupList(); | ||
|
||
public ActionButtonsFilter() { | ||
actionBarRule = new StringFilterGroup( | ||
null, | ||
VIDEO_ACTION_BAR_PATH_PREFIX | ||
); | ||
addIdentifierCallbacks(actionBarRule); | ||
|
||
bufferFilterPathRule = new StringFilterGroup( | ||
null, | ||
"|ContainerType|button.eml|" | ||
); | ||
final StringFilterGroup downloadButton = new StringFilterGroup( | ||
Settings.HIDE_ACTION_BUTTON_DOWNLOAD, | ||
"music_download_button.eml" | ||
); | ||
final StringFilterGroup likeDislikeContainer = new StringFilterGroup( | ||
Settings.HIDE_ACTION_BUTTON_LIKE_DISLIKE, | ||
"segmented_like_dislike_button.eml" | ||
); | ||
addPathCallbacks( | ||
bufferFilterPathRule, | ||
downloadButton, | ||
likeDislikeContainer | ||
); | ||
|
||
bufferButtonsGroupList.addAll( | ||
new ByteArrayFilterGroup( | ||
Settings.HIDE_ACTION_BUTTON_COMMENT, | ||
"yt_outline_message_bubble" | ||
), | ||
new ByteArrayFilterGroup( | ||
Settings.HIDE_ACTION_BUTTON_ADD_TO_PLAYLIST, | ||
"yt_outline_list_add" | ||
), | ||
new ByteArrayFilterGroup( | ||
Settings.HIDE_ACTION_BUTTON_SHARE, | ||
"yt_outline_share" | ||
), | ||
new ByteArrayFilterGroup( | ||
Settings.HIDE_ACTION_BUTTON_RADIO, | ||
"yt_outline_youtube_mix" | ||
) | ||
); | ||
} | ||
|
||
private boolean isEveryFilterGroupEnabled() { | ||
for (StringFilterGroup group : pathCallbacks) | ||
if (!group.isEnabled()) return false; | ||
|
||
for (ByteArrayFilterGroup group : bufferButtonsGroupList) | ||
if (!group.isEnabled()) return false; | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isFiltered(String path, @Nullable String identifier, String allValue, byte[] protobufBufferArray, | ||
StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) { | ||
if (!path.startsWith(VIDEO_ACTION_BAR_PATH_PREFIX)) { | ||
return false; | ||
} | ||
if (matchedGroup == actionBarRule && !isEveryFilterGroupEnabled()) { | ||
return false; | ||
} | ||
if (matchedGroup == bufferFilterPathRule && !bufferButtonsGroupList.check(protobufBufferArray).isFiltered()) { | ||
return false; | ||
} | ||
|
||
return super.isFiltered(path, identifier, allValue, protobufBufferArray, matchedGroup, contentType, contentIndex); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
extensions/shared/src/main/java/app/revanced/extension/music/patches/misc/DrcAudioPatch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package app.revanced.extension.music.patches.misc; | ||
|
||
import app.revanced.extension.music.settings.Settings; | ||
|
||
@SuppressWarnings("unused") | ||
public class DrcAudioPatch { | ||
|
||
public static float disableDrcAudio(float original) { | ||
if (!Settings.DISABLE_DRC_AUDIO.get()) { | ||
return original; | ||
} | ||
return 0f; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.