Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Merge branch dev to main #3909

Merged
merged 23 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6ccf114
fix(YouTube - Change header): Apply header changes to A/B layout (#3907)
LisoUseInAIKyrios Nov 13, 2024
612facb
chore: Release v5.0.3-dev.1 [skip ci]
semantic-release-bot Nov 13, 2024
31af587
refactor(YouTube - Hide mix playlist): Do not search path or buffer u…
LisoUseInAIKyrios Nov 13, 2024
9e18eca
fix(YouTube - Spoof app version): Remove broken spoof targets when pa…
LisoUseInAIKyrios Nov 15, 2024
1ebe787
chore: Sync translations (#3920)
github-actions[bot] Nov 15, 2024
e435a9e
chore: Release v5.0.3-dev.2 [skip ci]
semantic-release-bot Nov 15, 2024
497739e
fix(YouTube - Playback speed): Add 'Auto' speed. Always override spee…
LisoUseInAIKyrios Nov 15, 2024
083e4d7
chore: Release v5.0.3-dev.3 [skip ci]
semantic-release-bot Nov 15, 2024
f5794c1
fix(YouTube - Spoof app version): Adjust legacy spoof targets (#3934)
LisoUseInAIKyrios Nov 18, 2024
6a8bf95
chore: Release v5.0.3-dev.4 [skip ci]
semantic-release-bot Nov 18, 2024
3429286
chore: Sync translations (#3936)
github-actions[bot] Nov 18, 2024
0d78815
fix(YouTube - Hide Shorts components): Do not hide Shorts action butt…
LisoUseInAIKyrios Nov 18, 2024
774a707
chore: Release v5.0.3-dev.5 [skip ci]
semantic-release-bot Nov 18, 2024
3691fe6
refactor(YouTube): Use consistent language for 'auto' speed and quality
LisoUseInAIKyrios Nov 19, 2024
7c4e3fe
feat(YouTube): Support version `19.45.38` (#3938)
LisoUseInAIKyrios Nov 20, 2024
1cb8450
chore: Release v5.1.0-dev.1 [skip ci]
semantic-release-bot Nov 20, 2024
a0da377
fix(YouTube - SponsorBlock): Fix create new segment crash on tablet c…
LisoUseInAIKyrios Nov 21, 2024
52f4dbb
chore: Release v5.1.0-dev.2 [skip ci]
semantic-release-bot Nov 21, 2024
71af1f8
refactor(YouTube - Announcements): Do not include announcement settin…
LisoUseInAIKyrios Nov 21, 2024
e565cdb
feat(YouTube - Miniplayer): Add option to disable miniplayer (#3961)
LisoUseInAIKyrios Nov 22, 2024
3b24e53
chore: Sync translations (#3962)
github-actions[bot] Nov 22, 2024
fac5484
chore: Release v5.1.0-dev.3 [skip ci]
semantic-release-bot Nov 22, 2024
8266c37
chore: Move Sync video downloads patch to correct package
1fexd Nov 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,59 @@
# [5.1.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v5.1.0-dev.2...v5.1.0-dev.3) (2024-11-22)


### Features

* **YouTube - Miniplayer:** Add option to disable miniplayer ([#3961](https://github.com/ReVanced/revanced-patches/issues/3961)) ([e565cdb](https://github.com/ReVanced/revanced-patches/commit/e565cdb583aacfc0052d12c430f56fd9abd5bf00))

# [5.1.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.1.0-dev.1...v5.1.0-dev.2) (2024-11-21)


### Bug Fixes

* **YouTube - SponsorBlock:** Fix create new segment crash on tablet custom roms ([#3946](https://github.com/ReVanced/revanced-patches/issues/3946)) ([a0da377](https://github.com/ReVanced/revanced-patches/commit/a0da377ba8f90ba39e905ed9730b3e819633bd50))

# [5.1.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.0.3-dev.5...v5.1.0-dev.1) (2024-11-20)


### Features

* **YouTube:** Support version `19.45.38` ([#3938](https://github.com/ReVanced/revanced-patches/issues/3938)) ([7c4e3fe](https://github.com/ReVanced/revanced-patches/commit/7c4e3fe97e8cbbb8cf16a2fb95f64223ca2bd7ef))

## [5.0.3-dev.5](https://github.com/ReVanced/revanced-patches/compare/v5.0.3-dev.4...v5.0.3-dev.5) (2024-11-18)


### Bug Fixes

* **YouTube - Hide Shorts components:** Do not hide Shorts action buttons on app first launch ([#3933](https://github.com/ReVanced/revanced-patches/issues/3933)) ([0d78815](https://github.com/ReVanced/revanced-patches/commit/0d78815e33bf2ae216e519f067fb773df0f2084e))

## [5.0.3-dev.4](https://github.com/ReVanced/revanced-patches/compare/v5.0.3-dev.3...v5.0.3-dev.4) (2024-11-18)


### Bug Fixes

* **YouTube - Spoof app version:** Adjust legacy spoof targets ([#3934](https://github.com/ReVanced/revanced-patches/issues/3934)) ([f5794c1](https://github.com/ReVanced/revanced-patches/commit/f5794c1f896c331d76fdfc299e31a2773f2209ca))

## [5.0.3-dev.3](https://github.com/ReVanced/revanced-patches/compare/v5.0.3-dev.2...v5.0.3-dev.3) (2024-11-15)


### Bug Fixes

* **YouTube - Playback speed:** Add 'Auto' speed. Always override speed if default is set to 1.0x ([#3914](https://github.com/ReVanced/revanced-patches/issues/3914)) ([497739e](https://github.com/ReVanced/revanced-patches/commit/497739e8ce6933c1f1ea46edffc102e56b985623))

## [5.0.3-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.0.3-dev.1...v5.0.3-dev.2) (2024-11-15)


### Bug Fixes

* **YouTube - Spoof app version:** Remove broken spoof targets when patching 19.25+ ([#3915](https://github.com/ReVanced/revanced-patches/issues/3915)) ([9e18eca](https://github.com/ReVanced/revanced-patches/commit/9e18ecab1877dd33a3ad0fe216e6b91a8daaf1f8))

## [5.0.3-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.0.2...v5.0.3-dev.1) (2024-11-13)


### Bug Fixes

* **YouTube - Change header:** Apply header changes to A/B layout ([#3907](https://github.com/ReVanced/revanced-patches/issues/3907)) ([6ccf114](https://github.com/ReVanced/revanced-patches/commit/6ccf11426ec9e9cd9c8e89a2443f0d0645cc78b1))

## [5.0.2](https://github.com/ReVanced/revanced-patches/compare/v5.0.1...v5.0.2) (2024-11-12)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package app.revanced.extension.shared.checks;

// Fields are set by the patch. Do not modify.
// Fields are not final, because the compiler is inlining them.
/**
* Fields are set by the patch. Do not modify.
* Fields are not final, because the compiler is inlining them.
*
* @noinspection CanBeFinal
*/
final class PatchInfo {
static long PATCH_TIME = 0L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;

public class ShowOnLockscreenPatch {
/**
* @noinspection deprecation
*/
public static Window getWindow(AppCompatActivity activity, float brightness) {
Window window = activity.getWindow();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,20 @@ public final class MiniplayerPatch {
* Mini player type. Null fields indicates to use the original un-patched value.
*/
public enum MiniplayerType {
/**
* Disabled. When swiped down the miniplayer is immediately closed.
* Only available with 19.43+
*/
DISABLED(false, null),
/** Unmodified type, and same as un-patched. */
ORIGINAL(null, null),
/**
* Exactly the same as MINIMAL, and only here for migration of user settings.
* Eventually this should be deleted.
*/
@Deprecated
PHONE(false, null),
MINIMAL(false, null),
TABLET(true, null),
MODERN_1(null, 1),
MODERN_2(null, 2),
Expand Down Expand Up @@ -164,6 +175,18 @@ public boolean isAvailable() {
OPACITY_LEVEL = (opacity * 255) / 100;
}

/**
* Injection point.
*
* Enables a handler that immediately closes the miniplayer when the video is minimized,
* effectively disabling the miniplayer.
*/
public static boolean getMiniplayerOnCloseHandler(boolean original) {
return CURRENT_TYPE == ORIGINAL
? original
: CURRENT_TYPE == DISABLED;
}

/**
* Injection point.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class LayoutComponentsFilter extends Filter {
"cell_description_body"
);
private static final ByteArrayFilterGroup mixPlaylists = new ByteArrayFilterGroup(
Settings.HIDE_MIX_PLAYLISTS,
null,
"&list="
);

Expand Down Expand Up @@ -344,6 +344,10 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
*/
public static boolean filterMixPlaylists(final Object conversionContext, @Nullable final byte[] bytes) {
try {
if (!Settings.HIDE_MIX_PLAYLISTS.get()) {
return false;
}

if (bytes == null) {
Logger.printDebug(() -> "bytes is null");
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
@SuppressWarnings("unused")
public final class ShortsFilter extends Filter {
private static final boolean HIDE_SHORTS_NAVIGATION_BAR = Settings.HIDE_SHORTS_NAVIGATION_BAR.get();
private final static String REEL_CHANNEL_BAR_PATH = "reel_channel_bar.eml";
private static final String REEL_CHANNEL_BAR_PATH = "reel_channel_bar.eml";

/**
* For paid promotion label and subscribe button that appears in the channel bar.
*/
private final static String REEL_METAPANEL_PATH = "reel_metapanel.eml";
private static final String REEL_METAPANEL_PATH = "reel_metapanel.eml";

/**
* Tags that appears when opening the Shorts player.
Expand All @@ -52,7 +52,7 @@ public final class ShortsFilter extends Filter {
private final StringFilterGroup suggestedAction;
private final ByteArrayFilterGroupList suggestedActionsGroupList = new ByteArrayFilterGroupList();

private final StringFilterGroup actionBar;
private final StringFilterGroup actionButton;
private final ByteArrayFilterGroupList videoActionButtonGroupList = new ByteArrayFilterGroupList();

public ShortsFilter() {
Expand Down Expand Up @@ -156,9 +156,9 @@ public ShortsFilter() {
"reel_player_disclosure.eml"
);

actionBar = new StringFilterGroup(
actionButton = new StringFilterGroup(
null,
"shorts_action_bar"
"shorts_video_action_button.eml"
);

suggestedAction = new StringFilterGroup(
Expand All @@ -167,7 +167,7 @@ public ShortsFilter() {
);

addPathCallbacks(
shortsCompactFeedVideoPath, suggestedAction, actionBar, joinButton, subscribeButton,
shortsCompactFeedVideoPath, suggestedAction, actionButton, joinButton, subscribeButton,
paidPromotionButton, pausedOverlayButtons, channelBar, fullVideoLinkLabel, videoTitle,
reelSoundMetadata, soundButton, infoPanel, stickers, likeFountain
);
Expand Down Expand Up @@ -287,7 +287,7 @@ boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBuff
}

// Video action buttons (like, dislike, comment, share, remix) have the same path.
if (matchedGroup == actionBar) {
if (matchedGroup == actionButton) {
if (videoActionButtonGroupList.check(protobufBufferArray).isFiltered()) {
return super.isFiltered(identifier, path, protobufBufferArray, matchedGroup, contentType, contentIndex);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package app.revanced.extension.youtube.patches.playback.speed;

import static app.revanced.extension.shared.StringRef.sf;
import static app.revanced.extension.shared.StringRef.str;

import android.preference.ListPreference;
Expand All @@ -10,23 +11,26 @@

import androidx.annotation.NonNull;

import app.revanced.extension.youtube.patches.components.PlaybackSpeedMenuFilterPatch;
import app.revanced.extension.youtube.settings.Settings;
import java.util.Arrays;

import app.revanced.extension.shared.Logger;
import app.revanced.extension.shared.Utils;

import java.util.Arrays;
import app.revanced.extension.youtube.patches.components.PlaybackSpeedMenuFilterPatch;
import app.revanced.extension.youtube.settings.Settings;

@SuppressWarnings("unused")
public class CustomPlaybackSpeedPatch {

private static final float PLAYBACK_SPEED_AUTO = Settings.PLAYBACK_SPEED_DEFAULT.defaultValue;

/**
* Maximum playback speed, exclusive value. Custom speeds must be less than this value.
*
* Going over 8x does not increase the actual playback speed any higher,
* and the UI selector starts flickering and acting weird.
* Over 10x and the speeds show up out of order in the UI selector.
*/
public static final float MAXIMUM_PLAYBACK_SPEED = 8;
public static final float PLAYBACK_SPEED_MAXIMUM = 8;

/**
* Custom playback speeds.
Expand Down Expand Up @@ -69,8 +73,8 @@ private static void loadCustomSpeeds() {
throw new IllegalArgumentException();
}

if (speedFloat >= MAXIMUM_PLAYBACK_SPEED) {
resetCustomSpeeds(str("revanced_custom_playback_speeds_invalid", MAXIMUM_PLAYBACK_SPEED));
if (speedFloat >= PLAYBACK_SPEED_MAXIMUM) {
resetCustomSpeeds(str("revanced_custom_playback_speeds_invalid", PLAYBACK_SPEED_MAXIMUM));
loadCustomSpeeds();
return;
}
Expand Down Expand Up @@ -98,10 +102,15 @@ private static boolean arrayContains(float[] array, float value) {
@SuppressWarnings("deprecation")
public static void initializeListPreference(ListPreference preference) {
if (preferenceListEntries == null) {
preferenceListEntries = new String[customPlaybackSpeeds.length];
preferenceListEntryValues = new String[customPlaybackSpeeds.length];
final int numberOfEntries = customPlaybackSpeeds.length + 1;
preferenceListEntries = new String[numberOfEntries];
preferenceListEntryValues = new String[numberOfEntries];

int i = 0;
// Auto speed (same behavior as unpatched).
preferenceListEntries[0] = sf("revanced_custom_playback_speeds_auto").toString();
preferenceListEntryValues[0] = String.valueOf(PLAYBACK_SPEED_AUTO);

int i = 1;
for (float speed : customPlaybackSpeeds) {
String speedString = String.valueOf(speed);
preferenceListEntries[i] = speedString + "x";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void userSelectedPlaybackSpeed(float playbackSpeed) {
// With the 0.05x menu, if the speed is set by integrations to higher than 2.0x
// then the menu will allow increasing without bounds but the max speed is
// still capped to under 8.0x.
playbackSpeed = Math.min(playbackSpeed, CustomPlaybackSpeedPatch.MAXIMUM_PLAYBACK_SPEED - 0.05f);
playbackSpeed = Math.min(playbackSpeed, CustomPlaybackSpeedPatch.PLAYBACK_SPEED_MAXIMUM - 0.05f);

// Prevent toast spamming if using the 0.05x adjustments.
// Show exactly one toast after the user stops interacting with the speed menu.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ private ReturnYouTubeDislikeApi() {
*/
private static void randomlyWaitIfLocallyDebugging() {
final boolean DEBUG_RANDOMLY_DELAY_NETWORK_CALLS = false; // set true to debug UI
//noinspection ConstantValue
if (DEBUG_RANDOMLY_DELAY_NETWORK_CALLS) {
final long amountOfTimeToWaste = (long) (Math.random()
* (API_GET_VOTES_TCP_TIMEOUT_MILLISECONDS + API_GET_VOTES_HTTP_TIMEOUT_MILLISECONDS));
Expand Down Expand Up @@ -187,6 +188,7 @@ private static boolean checkIfRateLimitInEffect(String apiEndPointName) {
*/
private static boolean checkIfRateLimitWasHit(int httpResponseCode) {
final boolean DEBUG_RATE_LIMIT = false; // set to true, to verify rate limit works
//noinspection ConstantValue
if (DEBUG_RATE_LIMIT) {
final double RANDOM_RATE_LIMIT_PERCENTAGE = 0.2; // 20% chance of a triggering a rate limit
if (Math.random() < RANDOM_RATE_LIMIT_PERCENTAGE) {
Expand Down
Loading
Loading