Compare commits

...

4 Commits

Author SHA1 Message Date
semantic-release-bot
bc3c61a6a0 chore: Release v5.0.0-dev.2 [skip ci]
# [5.0.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.0.0-dev.1...v5.0.0-dev.2) (2024-11-09)

### Bug Fixes

* **YouTube - Return YouTube Dislike:** Show Shorts dislikes with new A/B button icons ([a0c227f](a0c227f1a0))
2024-11-09 01:21:00 +00:00
LisoUseInAIKyrios
a0c227f1a0 fix(YouTube - Return YouTube Dislike): Show Shorts dislikes with new A/B button icons 2024-11-08 21:17:02 -04:00
LisoUseInAIKyrios
87fcf3135d refactor(YouTube - Theme): Cleanup 2024-11-07 08:27:20 -04:00
LisoUseInAIKyrios
4b4670cd4f refactor(YouTube - Theme): Use more robust gradient theme insert index 2024-11-07 08:20:39 -04:00
6 changed files with 38 additions and 35 deletions

View File

@@ -1,3 +1,10 @@
# [5.0.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.0.0-dev.1...v5.0.0-dev.2) (2024-11-09)
### Bug Fixes
* **YouTube - Return YouTube Dislike:** Show Shorts dislikes with new A/B button icons ([084e0a5](https://github.com/ReVanced/revanced-patches/commit/084e0a527b1c75d1ef15dc706c429aa48d0ffe6b))
# [5.0.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.18.0-dev.6...v5.0.0-dev.1) (2024-11-06)

View File

@@ -76,15 +76,10 @@ public final class ReturnYouTubeDislikeFilterPatch extends Filter {
new StringFilterGroup(null, "|shorts_dislike_button.eml")
);
// After the likes icon name is some binary data and then the video id for that specific short.
// After the button identifiers is binary data and then the video id for that specific short.
videoIdFilterGroup.addAll(
// on_shadowed = Video was previously like/disliked before opening.
// off_shadowed = Video was not previously liked/disliked before opening.
new ByteArrayFilterGroup(null, "ic_right_like_on_shadowed"),
new ByteArrayFilterGroup(null, "ic_right_like_off_shadowed"),
new ByteArrayFilterGroup(null, "ic_right_dislike_on_shadowed"),
new ByteArrayFilterGroup(null, "ic_right_dislike_off_shadowed")
new ByteArrayFilterGroup(null, "id.reel_like_button"),
new ByteArrayFilterGroup(null, "id.reel_dislike_button")
);
}

View File

@@ -1,8 +1,8 @@
package app.revanced.extension.youtube.patches.theme;
import app.revanced.extension.youtube.settings.Settings;
import app.revanced.extension.shared.Utils;
import app.revanced.extension.youtube.ThemeHelper;
import app.revanced.extension.youtube.settings.Settings;
@SuppressWarnings("unused")
public class ThemePatch {
@@ -21,12 +21,15 @@ public class ThemePatch {
-98492127 // video chapters list background
};
// background colors
private static int whiteColor = 0;
private static int blackColor = 0;
// Background colors.
private static final int WHITE_COLOR = Utils.getResourceColor("yt_white1");
private static final int BLACK_COLOR = Utils.getResourceColor("yt_black1");
private static final boolean GRADIENT_LOADING_SCREEN_ENABLED = Settings.GRADIENT_LOADING_SCREEN.get();
// Used by app.revanced.patches.youtube.layout.theme.patch.LithoThemePatch
/**
* Injection point.
*
* Change the color of Litho components.
* If the color of the component matches one of the values, return the background color .
*
@@ -35,29 +38,24 @@ public class ThemePatch {
*/
public static int getValue(int originalValue) {
if (ThemeHelper.isDarkTheme()) {
if (anyEquals(originalValue, DARK_VALUES)) return getBlackColor();
if (anyEquals(originalValue, DARK_VALUES)) return BLACK_COLOR;
} else {
if (anyEquals(originalValue, WHITE_VALUES)) return getWhiteColor();
if (anyEquals(originalValue, WHITE_VALUES)) return WHITE_COLOR;
}
return originalValue;
}
public static boolean gradientLoadingScreenEnabled() {
return Settings.GRADIENT_LOADING_SCREEN.get();
}
private static int getBlackColor() {
if (blackColor == 0) blackColor = Utils.getResourceColor("yt_black1");
return blackColor;
}
private static int getWhiteColor() {
if (whiteColor == 0) whiteColor = Utils.getResourceColor("yt_white1");
return whiteColor;
}
private static boolean anyEquals(int value, int... of) {
for (int v : of) if (value == v) return true;
return false;
}
/**
* Injection point.
*/
public static boolean gradientLoadingScreenEnabled() {
return GRADIENT_LOADING_SCREEN_ENABLED;
}
}

View File

@@ -80,7 +80,7 @@ public class Settings extends BaseSettings {
// Uncategorized layout related settings. Do not add to this section, and instead move these out and categorize them.
public static final BooleanSetting DISABLE_SUGGESTED_VIDEO_END_SCREEN = new BooleanSetting("revanced_disable_suggested_video_end_screen", FALSE, true);
public static final BooleanSetting GRADIENT_LOADING_SCREEN = new BooleanSetting("revanced_gradient_loading_screen", FALSE);
public static final BooleanSetting GRADIENT_LOADING_SCREEN = new BooleanSetting("revanced_gradient_loading_screen", FALSE, true);
public static final BooleanSetting HIDE_HORIZONTAL_SHELVES = new BooleanSetting("revanced_hide_horizontal_shelves", TRUE);
public static final BooleanSetting HIDE_CAPTIONS_BUTTON = new BooleanSetting("revanced_hide_captions_button", FALSE);
public static final BooleanSetting HIDE_CHANNEL_BAR = new BooleanSetting("revanced_hide_channel_bar", FALSE);

View File

@@ -3,4 +3,4 @@ org.gradle.jvmargs = -Xms512M -Xmx2048M
org.gradle.parallel = true
android.useAndroidX = true
kotlin.code.style = official
version = 5.0.0-dev.1
version = 5.0.0-dev.2

View File

@@ -17,7 +17,9 @@ import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.misc.settings.settingsPatch
import app.revanced.util.forEachChildElement
import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import org.w3c.dom.Element
@@ -210,18 +212,19 @@ val themePatch = bytecodePatch(
)
useGradientLoadingScreenFingerprint.method.apply {
val isEnabledIndex = indexOfFirstLiteralInstructionOrThrow(GRADIENT_LOADING_SCREEN_AB_CONSTANT) + 3
val isEnabledRegister = getInstruction<OneRegisterInstruction>(isEnabledIndex - 1).registerA
val literalIndex = indexOfFirstLiteralInstructionOrThrow(GRADIENT_LOADING_SCREEN_AB_CONSTANT)
val isEnabledIndex = indexOfFirstInstructionOrThrow(literalIndex, Opcode.MOVE_RESULT)
val isEnabledRegister = getInstruction<OneRegisterInstruction>(isEnabledIndex).registerA
addInstructions(
isEnabledIndex,
isEnabledIndex + 1,
"""
invoke-static { }, $EXTENSION_CLASS_DESCRIPTOR->gradientLoadingScreenEnabled()Z
move-result v$isEnabledRegister
""",
)
}
mapOf(
themeHelperLightColorFingerprint to lightThemeBackgroundColor,
themeHelperDarkColorFingerprint to darkThemeBackgroundColor,