Compare commits

..

35 Commits

Author SHA1 Message Date
semantic-release-bot
a89556a017 chore: Release v5.41.0-dev.14 [skip ci]
# [5.41.0-dev.14](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.13...v5.41.0-dev.14) (2025-09-24)

### Features

* **YouTube - Hide layout components:** Add "Hide Emoji and Timestamp buttons" setting ([#5992](https://github.com/ReVanced/revanced-patches/issues/5992)) ([2b555f6](2b555f67f0))
2025-09-24 20:21:22 +00:00
ILoveOpenSourceApplications
2b555f67f0 feat(YouTube - Hide layout components): Add "Hide Emoji and Timestamp buttons" setting (#5992) 2025-09-25 00:17:08 +04:00
semantic-release-bot
fb87199514 chore: Release v5.41.0-dev.13 [skip ci]
# [5.41.0-dev.13](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.12...v5.41.0-dev.13) (2025-09-24)

### Bug Fixes

* **YouTube - Hide Shorts components:** Fix "Hide preview comment" ([#5990](https://github.com/ReVanced/revanced-patches/issues/5990)) ([dd4e2cd](dd4e2cd085))
2025-09-24 19:44:03 +00:00
ILoveOpenSourceApplications
dd4e2cd085 fix(YouTube - Hide Shorts components): Fix "Hide preview comment" (#5990) 2025-09-24 23:41:15 +04:00
semantic-release-bot
fadc66816d chore: Release v5.41.0-dev.12 [skip ci]
# [5.41.0-dev.12](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.11...v5.41.0-dev.12) (2025-09-24)

### Bug Fixes

* **YouTube - SponsorBlock:** Show category color in create new segment menu ([#5987](https://github.com/ReVanced/revanced-patches/issues/5987)) ([ffd933c](ffd933c673))
2025-09-24 13:53:25 +00:00
MarcaD
ffd933c673 fix(YouTube - SponsorBlock): Show category color in create new segment menu (#5987) 2025-09-24 17:50:46 +04:00
github-actions[bot]
69883530b7 chore: Sync translations (#5989) 2025-09-24 17:49:49 +04:00
LisoUseInAIKyrios
39971291f3 chore: Fix typo 2025-09-24 15:56:29 +04:00
LisoUseInAIKyrios
51facf9321 chore(YouTube): Adjust UI dialog message 2025-09-24 09:46:37 +04:00
semantic-release-bot
b83d41ca88 chore: Release v5.41.0-dev.11 [skip ci]
# [5.41.0-dev.11](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.10...v5.41.0-dev.11) (2025-09-23)

### Features

* **YouTube:** Add `Disable video codecs` patch ([#5981](https://github.com/ReVanced/revanced-patches/issues/5981)) ([bfbffbd](bfbffbd1f5))
2025-09-23 18:10:52 +00:00
LisoUseInAIKyrios
bfbffbd1f5 feat(YouTube): Add Disable video codecs patch (#5981) 2025-09-23 22:06:02 +04:00
semantic-release-bot
ee4755646b chore: Release v5.41.0-dev.10 [skip ci]
# [5.41.0-dev.10](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.9...v5.41.0-dev.10) (2025-09-23)

### Bug Fixes

* **TikTok:** Show correct dialog restart text, use correct font color for non-dark mode ([d1a1293](d1a12930c3))
2025-09-23 17:46:05 +00:00
LisoUseInAIKyrios
d1a12930c3 fix(TikTok): Show correct dialog restart text, use correct font color for non-dark mode 2025-09-23 21:43:04 +04:00
semantic-release-bot
dfac836a8c chore: Release v5.41.0-dev.9 [skip ci]
# [5.41.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.8...v5.41.0-dev.9) (2025-09-23)

### Bug Fixes

* **Instagram - Hide navigation buttons:** Remove button based on name ([#5971](https://github.com/ReVanced/revanced-patches/issues/5971)) ([6fa4043](6fa404331b))
2025-09-23 10:28:29 +00:00
brosssh
6fa404331b fix(Instagram - Hide navigation buttons): Remove button based on name (#5971) 2025-09-23 12:25:36 +02:00
semantic-release-bot
8bcb95adcd chore: Release v5.41.0-dev.8 [skip ci]
# [5.41.0-dev.8](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.7...v5.41.0-dev.8) (2025-09-23)

### Features

* **YouTube Music:** Add `Check watch history domain name resolution` ([#5979](https://github.com/ReVanced/revanced-patches/issues/5979)) ([8af70fe](8af70fe2d1))
2025-09-23 09:38:14 +00:00
LisoUseInAIKyrios
8af70fe2d1 feat(YouTube Music): Add Check watch history domain name resolution (#5979) 2025-09-23 13:34:00 +04:00
semantic-release-bot
191b9169ff chore: Release v5.41.0-dev.7 [skip ci]
# [5.41.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.6...v5.41.0-dev.7) (2025-09-23)

### Features

* **Tumblr:** Add `Disable Tumblr TV` patch ([#5959](https://github.com/ReVanced/revanced-patches/issues/5959)) ([212418b](212418b8db))
2025-09-23 06:24:06 +00:00
Temm
212418b8db feat(Tumblr): Add Disable Tumblr TV patch (#5959) 2025-09-23 10:19:58 +04:00
github-actions[bot]
7dbc744be0 chore: Sync translations (#5978) 2025-09-23 10:18:20 +04:00
LisoUseInAIKyrios
150a3e7c60 chore(YouTube Music - GmsCore support): Add missing supported versions 2025-09-23 10:17:25 +04:00
semantic-release-bot
5027943470 chore: Release v5.41.0-dev.6 [skip ci]
# [5.41.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.5...v5.41.0-dev.6) (2025-09-22)

### Features

* **YouTube - Spoof app version:** Add spoof target `20.05.46` that fixes transcript functionality ([5823f0e](5823f0e982))
2025-09-22 18:04:18 +00:00
github-actions[bot]
fa9e590b3a chore: Sync translations (#5972) 2025-09-22 22:01:33 +04:00
LisoUseInAIKyrios
5823f0e982 feat(YouTube - Spoof app version): Add spoof target 20.05.46 that fixes transcript functionality 2025-09-22 22:01:14 +04:00
LisoUseInAIKyrios
f506a67e4a chore(YouTube): Drop 19.43.41
Playback speed has a patch error. Don't want to fix. Most users want the latest or the oldest app target, and don't care about anything in-between.
2025-09-22 21:57:42 +04:00
semantic-release-bot
ed6e1155f2 chore: Release v5.41.0-dev.5 [skip ci]
# [5.41.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.4...v5.41.0-dev.5) (2025-09-22)

### Bug Fixes

* **Twitch - Settings:** Fix missing style resources ([#5970](https://github.com/ReVanced/revanced-patches/issues/5970)) ([8c22995](8c229954d7))
2025-09-22 16:05:55 +00:00
MarcaD
8c229954d7 fix(Twitch - Settings): Fix missing style resources (#5970) 2025-09-22 20:02:34 +04:00
semantic-release-bot
c5eb88bbf6 chore: Release v5.41.0-dev.4 [skip ci]
# [5.41.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.3...v5.41.0-dev.4) (2025-09-22)

### Bug Fixes

* **Instagram - Limit feed to followed profiles:** Preserve favorites feed ([#5963](https://github.com/ReVanced/revanced-patches/issues/5963)) ([ef51401](ef514017f4))
2025-09-22 09:35:02 +00:00
brosssh
ef514017f4 fix(Instagram - Limit feed to followed profiles): Preserve favorites feed (#5963) 2025-09-22 13:32:30 +04:00
github-actions[bot]
c72d99518c chore: Sync translations (#5968) 2025-09-22 13:32:12 +04:00
semantic-release-bot
772df6eb73 chore: Release v5.41.0-dev.3 [skip ci]
# [5.41.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.2...v5.41.0-dev.3) (2025-09-22)

### Features

* **YouTube - Loop video:** Add player button to change loop video state ([#5961](https://github.com/ReVanced/revanced-patches/issues/5961)) ([dfb5407](dfb5407e67))
2025-09-22 08:57:43 +00:00
MarcaD
dfb5407e67 feat(YouTube - Loop video): Add player button to change loop video state (#5961) 2025-09-22 12:54:09 +04:00
semantic-release-bot
6d5f6ecdd2 chore: Release v5.41.0-dev.2 [skip ci]
# [5.41.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.1...v5.41.0-dev.2) (2025-09-21)

### Bug Fixes

* **YouTube - Spoof video streams:** Update client side effects summary text ([a0a62dd](a0a62ddad2))
2025-09-21 19:45:41 +00:00
LisoUseInAIKyrios
a0a62ddad2 fix(YouTube - Spoof video streams): Update client side effects summary text 2025-09-21 23:41:38 +04:00
github-actions[bot]
512e50e892 chore: Sync translations (#5955) 2025-09-21 23:03:49 +04:00
186 changed files with 3144 additions and 1622 deletions

View File

@@ -1,3 +1,94 @@
# [5.41.0-dev.14](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.13...v5.41.0-dev.14) (2025-09-24)
### Features
* **YouTube - Hide layout components:** Add "Hide Emoji and Timestamp buttons" setting ([#5992](https://github.com/ReVanced/revanced-patches/issues/5992)) ([2b555f6](https://github.com/ReVanced/revanced-patches/commit/2b555f67f07e0de5703c630888ce2fbba3145192))
# [5.41.0-dev.13](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.12...v5.41.0-dev.13) (2025-09-24)
### Bug Fixes
* **YouTube - Hide Shorts components:** Fix "Hide preview comment" ([#5990](https://github.com/ReVanced/revanced-patches/issues/5990)) ([dd4e2cd](https://github.com/ReVanced/revanced-patches/commit/dd4e2cd0855ccc51b94593004fdd8150ac3b41cc))
# [5.41.0-dev.12](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.11...v5.41.0-dev.12) (2025-09-24)
### Bug Fixes
* **YouTube - SponsorBlock:** Show category color in create new segment menu ([#5987](https://github.com/ReVanced/revanced-patches/issues/5987)) ([ffd933c](https://github.com/ReVanced/revanced-patches/commit/ffd933c6734274cdde5aaec0159b67f173f9228c))
# [5.41.0-dev.11](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.10...v5.41.0-dev.11) (2025-09-23)
### Features
* **YouTube:** Add `Disable video codecs` patch ([#5981](https://github.com/ReVanced/revanced-patches/issues/5981)) ([bfbffbd](https://github.com/ReVanced/revanced-patches/commit/bfbffbd1f5aa867027053e25b343a51a606216a3))
# [5.41.0-dev.10](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.9...v5.41.0-dev.10) (2025-09-23)
### Bug Fixes
* **TikTok:** Show correct dialog restart text, use correct font color for non-dark mode ([d1a1293](https://github.com/ReVanced/revanced-patches/commit/d1a12930c35f630793a0f240d4203c2ff9060158))
# [5.41.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.8...v5.41.0-dev.9) (2025-09-23)
### Bug Fixes
* **Instagram - Hide navigation buttons:** Remove button based on name ([#5971](https://github.com/ReVanced/revanced-patches/issues/5971)) ([6fa4043](https://github.com/ReVanced/revanced-patches/commit/6fa404331b5162682d83fba5f38ed570c31495fc))
# [5.41.0-dev.8](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.7...v5.41.0-dev.8) (2025-09-23)
### Features
* **YouTube Music:** Add `Check watch history domain name resolution` ([#5979](https://github.com/ReVanced/revanced-patches/issues/5979)) ([8af70fe](https://github.com/ReVanced/revanced-patches/commit/8af70fe2d10c0f4da2d7e53bd00f5b3979775d5d))
# [5.41.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.6...v5.41.0-dev.7) (2025-09-23)
### Features
* **Tumblr:** Add `Disable Tumblr TV` patch ([#5959](https://github.com/ReVanced/revanced-patches/issues/5959)) ([212418b](https://github.com/ReVanced/revanced-patches/commit/212418b8db9a730ae9efa89ad2bef24952afbadd))
# [5.41.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.5...v5.41.0-dev.6) (2025-09-22)
### Features
* **YouTube - Spoof app version:** Add spoof target `20.05.46` that fixes transcript functionality ([5823f0e](https://github.com/ReVanced/revanced-patches/commit/5823f0e982e87b4a35d30feeca8a7e16edfebc5f))
# [5.41.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.4...v5.41.0-dev.5) (2025-09-22)
### Bug Fixes
* **Twitch - Settings:** Fix missing style resources ([#5970](https://github.com/ReVanced/revanced-patches/issues/5970)) ([8c22995](https://github.com/ReVanced/revanced-patches/commit/8c229954d7f232a7a472ca49f1b5e7cdc475bbcc))
# [5.41.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.3...v5.41.0-dev.4) (2025-09-22)
### Bug Fixes
* **Instagram - Limit feed to followed profiles:** Preserve favorites feed ([#5963](https://github.com/ReVanced/revanced-patches/issues/5963)) ([ef51401](https://github.com/ReVanced/revanced-patches/commit/ef514017f46025d9aef6884424caeb0670514e7a))
# [5.41.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.2...v5.41.0-dev.3) (2025-09-22)
### Features
* **YouTube - Loop video:** Add player button to change loop video state ([#5961](https://github.com/ReVanced/revanced-patches/issues/5961)) ([dfb5407](https://github.com/ReVanced/revanced-patches/commit/dfb5407e67222e80e23c8935e04b6dbf1a43d757))
# [5.41.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.1...v5.41.0-dev.2) (2025-09-21)
### Bug Fixes
* **YouTube - Spoof video streams:** Update client side effects summary text ([a0a62dd](https://github.com/ReVanced/revanced-patches/commit/a0a62ddad26cfab3e04907fae5532e1ba1fdf710))
# [5.41.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.40.1-dev.1...v5.41.0-dev.1) (2025-09-21)

View File

@@ -10,9 +10,17 @@ public class LimitFeedToFollowedProfiles {
* Injection point.
*/
public static Map<String, String> setFollowingHeader(Map<String, String> requestHeaderMap) {
String paginationHeaderName = "pagination_source";
// Patch the header only if it's trying to fetch the default feed
String currentHeader = requestHeaderMap.get(paginationHeaderName);
if (currentHeader != null && !currentHeader.equals("feed_recs")) {
return requestHeaderMap;
}
// Create new map as original is unmodifiable.
Map<String, String> patchedRequestHeaderMap = new HashMap<>(requestHeaderMap);
patchedRequestHeaderMap.put("pagination_source", "following");
patchedRequestHeaderMap.put(paginationHeaderName, "following");
return patchedRequestHeaderMap;
}
}

View File

@@ -0,0 +1,33 @@
package app.revanced.extension.instagram.hide.navigation;
import java.lang.reflect.Field;
import java.util.List;
@SuppressWarnings("unused")
public class HideNavigationButtonsPatch {
/**
* Injection point.
* @param navigationButtonsList the list of navigation buttons, as an (obfuscated) Enum type
* @param buttonNameToRemove the name of the button we want to remove
* @param enumNameField the field in the nav button enum class which contains the name of the button
* @return the patched list of navigation buttons
*/
public static List<Object> removeNavigationButtonByName(
List<Object> navigationButtonsList,
String buttonNameToRemove,
String enumNameField
)
throws IllegalAccessException, NoSuchFieldException {
for (Object button : navigationButtonsList) {
Field f = button.getClass().getDeclaredField(enumNameField);
String currentButtonEnumName = (String) f.get(button);
if (buttonNameToRemove.equals(currentButtonEnumName)) {
navigationButtonsList.remove(button);
break;
}
}
return navigationButtonsList;
}
}

View File

@@ -1,4 +1,4 @@
package app.revanced.extension.youtube.patches;
package app.revanced.extension.shared.patches;
import static app.revanced.extension.shared.StringRef.str;
@@ -13,8 +13,8 @@ import java.net.UnknownHostException;
import app.revanced.extension.shared.Logger;
import app.revanced.extension.shared.Utils;
import app.revanced.extension.shared.settings.BaseSettings;
import app.revanced.extension.shared.ui.CustomDialog;
import app.revanced.extension.youtube.settings.Settings;
@SuppressWarnings("unused")
public class CheckWatchHistoryDomainNameResolutionPatch {
@@ -49,7 +49,7 @@ public class CheckWatchHistoryDomainNameResolutionPatch {
* Checks if s.youtube.com is blacklisted and playback history will fail to work.
*/
public static void checkDnsResolver(Activity context) {
if (!Utils.isNetworkConnected() || !Settings.CHECK_WATCH_HISTORY_DOMAIN_NAME.get()) return;
if (!Utils.isNetworkConnected() || !BaseSettings.CHECK_WATCH_HISTORY_DOMAIN_NAME.get()) return;
Utils.runOnBackgroundThread(() -> {
try {
@@ -61,8 +61,8 @@ public class CheckWatchHistoryDomainNameResolutionPatch {
// Prevent this false positive by verify youtube.com resolves.
// If youtube.com does not resolve, then it's not a watch history domain resolving error
// because the entire app will not work since no domains are resolving.
if (domainResolvesToValidIP(HISTORY_TRACKING_ENDPOINT)
|| !domainResolvesToValidIP("youtube.com")) {
if (!domainResolvesToValidIP("youtube.com")
|| domainResolvesToValidIP(HISTORY_TRACKING_ENDPOINT)) {
return;
}
@@ -78,7 +78,7 @@ public class CheckWatchHistoryDomainNameResolutionPatch {
() -> {}, // OK button action (just dismiss).
() -> {}, // Cancel button action (just dismiss).
str("revanced_check_watch_history_domain_name_dialog_ignore"), // Neutral button text.
() -> Settings.CHECK_WATCH_HISTORY_DOMAIN_NAME.save(false), // Neutral button action (Ignore).
() -> BaseSettings.CHECK_WATCH_HISTORY_DOMAIN_NAME.save(false), // Neutral button action (Ignore).
true // Dismiss dialog on Neutral button click.
);

View File

@@ -28,10 +28,16 @@ public class BaseSettings {
public static final BooleanSetting SETTINGS_SEARCH_HISTORY = new BooleanSetting("revanced_settings_search_history", TRUE, true);
public static final StringSetting SETTINGS_SEARCH_ENTRIES = new StringSetting("revanced_settings_search_entries", "");
//
// Settings shared by YouTube and YouTube Music.
//
public static final BooleanSetting SPOOF_VIDEO_STREAMS = new BooleanSetting("revanced_spoof_video_streams", TRUE, true, "revanced_spoof_video_streams_user_dialog_message");
public static final EnumSetting<AppLanguage> SPOOF_VIDEO_STREAMS_LANGUAGE = new EnumSetting<>("revanced_spoof_video_streams_language", AppLanguage.DEFAULT, new AudioStreamLanguageOverrideAvailability());
public static final BooleanSetting SPOOF_STREAMING_DATA_STATS_FOR_NERDS = new BooleanSetting("revanced_spoof_streaming_data_stats_for_nerds", TRUE, parent(SPOOF_VIDEO_STREAMS));
public static final BooleanSetting SANITIZE_SHARED_LINKS = new BooleanSetting("revanced_sanitize_sharing_links", TRUE);
public static final BooleanSetting REPLACE_MUSIC_LINKS_WITH_YOUTUBE = new BooleanSetting("revanced_replace_music_with_youtube", FALSE);
public static final BooleanSetting CHECK_WATCH_HISTORY_DOMAIN_NAME = new BooleanSetting("revanced_check_watch_history_domain_name", TRUE, false, false);
}

View File

@@ -53,7 +53,7 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragment {
* Set by subclasses if Strings cannot be added as a resource.
*/
@Nullable
protected static String restartDialogButtonText, restartDialogTitle, confirmDialogTitle, restartDialogMessage;
protected static CharSequence restartDialogTitle, restartDialogMessage, restartDialogButtonText, confirmDialogTitle;
private final SharedPreferences.OnSharedPreferenceChangeListener listener = (sharedPreferences, str) -> {
try {
@@ -125,10 +125,13 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragment {
showingUserDialogMessage = true;
CharSequence message = BulletPointPreference.formatIntoBulletPoints(
Objects.requireNonNull(setting.userDialogMessage).toString());
Pair<Dialog, LinearLayout> dialogPair = CustomDialog.create(
context,
confirmDialogTitle, // Title.
Objects.requireNonNull(setting.userDialogMessage).toString(), // No message.
message,
null, // No EditText.
null, // OK button text.
() -> {
@@ -152,6 +155,7 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragment {
);
dialogPair.first.setOnDismissListener(d -> showingUserDialogMessage = false);
dialogPair.first.setCancelable(false);
// Show the dialog.
dialogPair.first.show();

View File

@@ -15,7 +15,15 @@ import android.util.AttributeSet;
@SuppressWarnings({"unused", "deprecation"})
public class BulletPointPreference extends Preference {
public static SpannedString formatIntoBulletPoints(CharSequence source) {
/**
* Replaces bullet points with styled spans.
*/
public static CharSequence formatIntoBulletPoints(CharSequence source) {
final char bulletPoint = '•';
if (TextUtils.indexOf(source, bulletPoint) < 0) {
return source; // Nothing to do.
}
SpannableStringBuilder builder = new SpannableStringBuilder(source);
int lineStart = 0;
@@ -26,7 +34,7 @@ public class BulletPointPreference extends Preference {
if (lineEnd < 0) lineEnd = length;
// Apply BulletSpan only if the line starts with the '•' character.
if (lineEnd > lineStart && builder.charAt(lineStart) == '•') {
if (lineEnd > lineStart && builder.charAt(lineStart) == bulletPoint) {
int deleteEnd = lineStart + 1; // remove the bullet itself
// If there's a single space right after the bullet, remove that too.

View File

@@ -5,12 +5,15 @@ import static app.revanced.extension.shared.Utils.getResourceIdentifierOrThrow;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Build;
import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
@@ -23,6 +26,7 @@ import android.widget.SearchView;
import android.widget.Toolbar;
import androidx.annotation.ColorInt;
import androidx.annotation.RequiresApi;
import java.util.ArrayList;
import java.util.Collections;
@@ -118,6 +122,14 @@ public abstract class BaseSearchViewController {
searchView.setBackground(createBackgroundDrawable());
searchView.setQueryHint(str("revanced_settings_search_hint"));
// Set text size.
searchEditText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
// Set cursor color.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
setCursorColor(searchEditText);
}
// Configure RTL support based on app language.
AppLanguage appLanguage = BaseSettings.REVANCED_LANGUAGE.get();
if (Utils.isRightToLeftLocale(appLanguage.getLocale())) {
@@ -126,6 +138,24 @@ public abstract class BaseSearchViewController {
}
}
/**
* Sets the cursor color (for Android 10+ devices).
*/
@RequiresApi(api = Build.VERSION_CODES.Q)
private void setCursorColor(EditText editText) {
// Get the cursor color based on the current theme.
final int cursorColor = Utils.isDarkModeEnabled() ? Color.WHITE : Color.BLACK;
// Create cursor drawable.
GradientDrawable cursorDrawable = new GradientDrawable();
cursorDrawable.setShape(GradientDrawable.RECTANGLE);
cursorDrawable.setSize(Utils.dipToPixels(2), -1); // Width: 2dp, Height: match text height.
cursorDrawable.setColor(cursorColor);
// Set cursor drawable.
editText.setTextCursorDrawable(cursorDrawable);
}
/**
* Initializes the overlay container for displaying search results and history.
*/

View File

@@ -42,11 +42,8 @@ final class PlayerRoutes {
JSONObject context = new JSONObject();
AppLanguage language = SpoofVideoStreamsPatch.getLanguageOverride();
if (language == null || clientType == ANDROID_VR_1_43_32) {
if (language == null) {
// Force original audio has not overrode the language.
// Or if YT has fallen over to the last unauthenticated client (VR 1.43), then
// always use the app language because forcing an audio stream of specific languages
// can sometimes fail so it's better to try and load something rather than nothing.
language = BaseSettings.SPOOF_VIDEO_STREAMS_LANGUAGE.get();
}
//noinspection ExtractMethodRecommender

View File

@@ -58,10 +58,10 @@ public class CustomDialog {
* @param dismissDialogOnNeutralClick If the dialog should be dismissed when the Neutral button is clicked.
* @return The Dialog and its main LinearLayout container.
*/
public static Pair<Dialog, LinearLayout> create(Context context, String title, CharSequence message,
@Nullable EditText editText, String okButtonText,
public static Pair<Dialog, LinearLayout> create(Context context, CharSequence title, CharSequence message,
@Nullable EditText editText, CharSequence okButtonText,
Runnable onOkClick, Runnable onCancelClick,
@Nullable String neutralButtonText,
@Nullable CharSequence neutralButtonText,
@Nullable Runnable onNeutralClick,
boolean dismissDialogOnNeutralClick) {
Logger.printDebug(() -> "Creating custom dialog with title: " + title);
@@ -85,9 +85,9 @@ public class CustomDialog {
* @param onNeutralClick Action to perform when the Neutral button is clicked, or null if no Neutral button is needed.
* @param dismissDialogOnNeutralClick If the dialog should be dismissed when the Neutral button is clicked.
*/
private CustomDialog(Context context, String title, CharSequence message, @Nullable EditText editText,
String okButtonText, Runnable onOkClick, Runnable onCancelClick,
@Nullable String neutralButtonText, @Nullable Runnable onNeutralClick,
private CustomDialog(Context context, CharSequence title, CharSequence message, @Nullable EditText editText,
CharSequence okButtonText, Runnable onOkClick, Runnable onCancelClick,
@Nullable CharSequence neutralButtonText, @Nullable Runnable onNeutralClick,
boolean dismissDialogOnNeutralClick) {
this.context = context;
this.dialog = new Dialog(context);
@@ -139,7 +139,7 @@ public class CustomDialog {
*
* @param title The title text to display.
*/
private void addTitle(String title) {
private void addTitle(CharSequence title) {
if (TextUtils.isEmpty(title)) return;
TextView titleView = new TextView(context);
@@ -232,8 +232,8 @@ public class CustomDialog {
* @param onNeutralClick Action for the Neutral button click, or null if no Neutral button.
* @param dismissDialogOnNeutralClick If the dialog should dismiss on Neutral button click.
*/
private void addButtons(String okButtonText, Runnable onOkClick, Runnable onCancelClick,
@Nullable String neutralButtonText, @Nullable Runnable onNeutralClick,
private void addButtons(CharSequence okButtonText, Runnable onOkClick, Runnable onCancelClick,
@Nullable CharSequence neutralButtonText, @Nullable Runnable onNeutralClick,
boolean dismissDialogOnNeutralClick) {
// Button container.
LinearLayout buttonContainer = new LinearLayout(context);
@@ -280,7 +280,7 @@ public class CustomDialog {
* @param dismissDialog If the dialog should dismiss when the button is clicked.
* @return The created Button.
*/
private Button createButton(String text, Runnable onClick, boolean isOkButton, boolean dismissDialog) {
private Button createButton(CharSequence text, Runnable onClick, boolean isOkButton, boolean dismissDialog) {
Button button = new Button(context, null, 0);
button.setText(text);
button.setTextSize(14);

View File

@@ -2,12 +2,15 @@ package app.revanced.extension.tiktok.settings.preference;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import androidx.annotation.NonNull;
import app.revanced.extension.shared.Utils;
import app.revanced.extension.shared.settings.Setting;
import app.revanced.extension.shared.settings.preference.AbstractPreferenceFragment;
import app.revanced.extension.tiktok.settings.preference.categories.DownloadsPreferenceCategory;
import app.revanced.extension.tiktok.settings.preference.categories.FeedFilterPreferenceCategory;
import app.revanced.extension.tiktok.settings.preference.categories.ExtensionPreferenceCategory;
import app.revanced.extension.tiktok.settings.preference.categories.FeedFilterPreferenceCategory;
import app.revanced.extension.tiktok.settings.preference.categories.SimSpoofPreferenceCategory;
/**
@@ -37,10 +40,14 @@ public class TikTokPreferenceFragment extends AbstractPreferenceFragment {
// Currently no resources can be compiled for TikTok (fails with aapt error).
// So all TikTok Strings are hard coded in the extension.
restartDialogTitle = "Refresh and restart";
restartDialogTitle = "Restart required";
restartDialogMessage = "Restart the app for this change to take effect.";
restartDialogButtonText = "Restart";
confirmDialogTitle = "Do you wish to proceed?";
// App does not use dark mode.
Utils.setIsDarkModeEnabled(false);
PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(context);
setPreferenceScreen(preferenceScreen);

View File

@@ -1,11 +0,0 @@
package app.revanced.extension.youtube.patches;
import app.revanced.extension.youtube.settings.Settings;
@SuppressWarnings("unused")
public class AutoRepeatPatch {
//Used by app.revanced.patches.youtube.layout.autorepeat.patch.AutoRepeatPatch
public static boolean shouldAutoRepeat() {
return Settings.AUTO_REPEAT.get();
}
}

View File

@@ -5,7 +5,7 @@ import android.view.Display;
import app.revanced.extension.youtube.settings.Settings;
@SuppressWarnings("unused")
public class DisableHdrPatch {
public class DisableVideoCodecsPatch {
/**
* Injection point.
@@ -15,5 +15,12 @@ public class DisableHdrPatch {
? new int[0]
: capabilities.getSupportedHdrTypes();
}
/**
* Injection point.
*/
public static boolean allowVP9() {
return !Settings.FORCE_AVC_CODEC.get();
}
}

View File

@@ -15,7 +15,8 @@ public class ForceOriginalAudioPatch {
*/
public static void setPreferredLanguage() {
if (Settings.FORCE_ORIGINAL_AUDIO.get()
&& SpoofVideoStreamsPatch.spoofingToClientWithNoMultiAudioStreams()) {
&& SpoofVideoStreamsPatch.spoofingToClientWithNoMultiAudioStreams()
&& !Settings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get().useAuth) {
// If client spoofing does not use authentication and lacks multi-audio streams,
// then can use any language code for the request and if that requested language is
// not available YT uses the original audio language. Authenticated requests ignore

View File

@@ -0,0 +1,13 @@
package app.revanced.extension.youtube.patches;
import app.revanced.extension.youtube.settings.Settings;
@SuppressWarnings("unused")
public class LoopVideoPatch {
/**
* Injection point
*/
public static boolean shouldLoopVideo() {
return Settings.LOOP_VIDEO.get();
}
}

View File

@@ -6,8 +6,11 @@ import app.revanced.extension.youtube.shared.PlayerType;
@SuppressWarnings("unused")
final class CommentsFilter extends Filter {
private static final String COMMENT_COMPOSER_PATH = "comment_composer.eml";
private final StringFilterGroup chipBar;
private final ByteArrayFilterGroup aiCommentsSummary;
private final StringFilterGroup emojiAndTimestampButtons;
public CommentsFilter() {
var chatSummary = new StringFilterGroup(
@@ -52,6 +55,11 @@ final class CommentsFilter extends Filter {
"composer_short_creation_button.eml"
);
emojiAndTimestampButtons = new StringFilterGroup(
Settings.HIDE_COMMENTS_EMOJI_AND_TIMESTAMP_BUTTONS,
"|CellType|ContainerType|ContainerType|ContainerType|ContainerType|ContainerType|"
);
var previewComment = new StringFilterGroup(
Settings.HIDE_COMMENTS_PREVIEW_COMMENT,
"|carousel_item",
@@ -64,11 +72,6 @@ final class CommentsFilter extends Filter {
"super_thanks_button.eml"
);
StringFilterGroup timestampButton = new StringFilterGroup(
Settings.HIDE_COMMENTS_TIMESTAMP_BUTTON,
"composer_timestamp_button.eml"
);
addPathCallbacks(
channelGuidelines,
chatSummary,
@@ -77,9 +80,9 @@ final class CommentsFilter extends Filter {
comments,
communityGuidelines,
createAShort,
emojiAndTimestampButtons,
previewComment,
thanksButton,
timestampButton
thanksButton
);
}
@@ -93,6 +96,10 @@ final class CommentsFilter extends Filter {
&& aiCommentsSummary.check(buffer).isFiltered();
}
if (matchedGroup == emojiAndTimestampButtons) {
return path.startsWith(COMMENT_COMPOSER_PATH);
}
return true;
}
}

View File

@@ -154,6 +154,13 @@ public final class ShortsFilter extends Filter {
"reel_dislike_button.eml"
);
StringFilterGroup previewComment = new StringFilterGroup(
Settings.HIDE_SHORTS_PREVIEW_COMMENT,
// Preview comment that can popup while a Short is playing.
// Uses no bundled icons, and instead the users profile photo is shown.
"participation_bar.eml"
);
joinButton = new StringFilterGroup(
Settings.HIDE_SHORTS_JOIN_BUTTON,
"sponsor_button"
@@ -213,7 +220,7 @@ public final class ShortsFilter extends Filter {
addPathCallbacks(
shortsCompactFeedVideo, joinButton, subscribeButton, paidPromotionButton,
shortsActionBar, suggestedAction, pausedOverlayButtons, channelBar,
shortsActionBar, suggestedAction, pausedOverlayButtons, channelBar, previewComment,
fullVideoLinkLabel, videoTitle, useSoundButton, reelSoundMetadata, soundButton, infoPanel,
stickers, likeFountain, likeButton, dislikeButton
);
@@ -243,12 +250,6 @@ public final class ShortsFilter extends Filter {
// Suggested actions.
//
suggestedActionsBuffer.addAll(
new ByteArrayFilterGroup(
Settings.HIDE_SHORTS_PREVIEW_COMMENT,
// Preview comment that can popup while a Short is playing.
// Uses no bundled icons, and instead the users profile photo is shown.
"shorts-comments-panel"
),
new ByteArrayFilterGroup(
Settings.HIDE_SHORTS_SHOP_BUTTON,
"yt_outline_bag_"

View File

@@ -18,7 +18,22 @@ public class SpoofVideoStreamsPatch {
* Injection point.
*/
public static void setClientOrderToUse() {
List<ClientType> availableClients = List.of(
final boolean forceAVC = Settings.FORCE_AVC_CODEC.get();
// VR 1.61 uses VP9/AV1, and cannot force AVC.
ClientType client = Settings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get();
if (forceAVC && client == ANDROID_VR_1_61_48) {
client = ANDROID_VR_1_43_32; // Use VR 1.43 instead.
}
List<ClientType> availableClients = forceAVC
? List.of(
ANDROID_VR_1_43_32,
VISIONOS,
ANDROID_CREATOR,
ANDROID_VR_1_61_48,
IPADOS)
: List.of(
ANDROID_VR_1_61_48,
VISIONOS,
ANDROID_CREATOR,
@@ -27,6 +42,6 @@ public class SpoofVideoStreamsPatch {
);
app.revanced.extension.shared.spoof.SpoofVideoStreamsPatch.setClientsToUse(
availableClients, Settings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get());
availableClients, client);
}
}

View File

@@ -48,6 +48,9 @@ import app.revanced.extension.youtube.swipecontrols.SwipeControlsConfigurationPr
public class Settings extends BaseSettings {
// Video
public static final BooleanSetting ADVANCED_VIDEO_QUALITY_MENU = new BooleanSetting("revanced_advanced_video_quality_menu", TRUE);
public static final BooleanSetting DISABLE_HDR_VIDEO = new BooleanSetting("revanced_disable_hdr_video", FALSE);
public static final BooleanSetting FORCE_AVC_CODEC = new BooleanSetting("revanced_force_avc_codec", FALSE, true, "revanced_force_avc_codec_user_dialog_message");
public static final IntegerSetting VIDEO_QUALITY_DEFAULT_WIFI = new IntegerSetting("revanced_video_quality_default_wifi", -2);
public static final IntegerSetting VIDEO_QUALITY_DEFAULT_MOBILE = new IntegerSetting("revanced_video_quality_default_mobile", -2);
public static final BooleanSetting REMEMBER_VIDEO_QUALITY_LAST_SELECTED = new BooleanSetting("revanced_remember_video_quality_last_selected", FALSE);
@@ -56,8 +59,6 @@ public class Settings extends BaseSettings {
public static final BooleanSetting REMEMBER_SHORTS_QUALITY_LAST_SELECTED = new BooleanSetting("revanced_remember_shorts_quality_last_selected", FALSE);
public static final BooleanSetting REMEMBER_VIDEO_QUALITY_LAST_SELECTED_TOAST = new BooleanSetting("revanced_remember_video_quality_last_selected_toast", TRUE, false,
parentsAny(REMEMBER_VIDEO_QUALITY_LAST_SELECTED, REMEMBER_SHORTS_QUALITY_LAST_SELECTED));
public static final BooleanSetting ADVANCED_VIDEO_QUALITY_MENU = new BooleanSetting("revanced_advanced_video_quality_menu", TRUE);
public static final BooleanSetting DISABLE_HDR_VIDEO = new BooleanSetting("revanced_disable_hdr_video", FALSE);
// Speed
public static final FloatSetting SPEED_TAP_AND_HOLD = new FloatSetting("revanced_speed_tap_and_hold", 2.0f, true);
@@ -198,9 +199,9 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_COMMENTS_COMMUNITY_GUIDELINES = new BooleanSetting("revanced_hide_comments_community_guidelines", TRUE);
public static final BooleanSetting HIDE_COMMENTS_CREATE_A_SHORT_BUTTON = new BooleanSetting("revanced_hide_comments_create_a_short_button", TRUE);
public static final BooleanSetting HIDE_COMMENTS_PREVIEW_COMMENT = new BooleanSetting("revanced_hide_comments_preview_comment", FALSE);
public static final BooleanSetting HIDE_COMMENTS_EMOJI_AND_TIMESTAMP_BUTTONS = new BooleanSetting("revanced_hide_comments_emoji_and_timestamp_buttons", FALSE);
public static final BooleanSetting HIDE_COMMENTS_SECTION = new BooleanSetting("revanced_hide_comments_section", FALSE);
public static final BooleanSetting HIDE_COMMENTS_THANKS_BUTTON = new BooleanSetting("revanced_hide_comments_thanks_button", TRUE);
public static final BooleanSetting HIDE_COMMENTS_TIMESTAMP_BUTTON = new BooleanSetting("revanced_hide_comments_timestamp_button", FALSE);
// Description
public static final BooleanSetting HIDE_AI_GENERATED_VIDEO_SUMMARY_SECTION = new BooleanSetting("revanced_hide_ai_generated_video_summary_section", FALSE);
@@ -341,9 +342,9 @@ public class Settings extends BaseSettings {
// Miscellaneous
public static final BooleanSetting ANNOUNCEMENTS = new BooleanSetting("revanced_announcements", TRUE);
public static final IntegerSetting ANNOUNCEMENT_LAST_ID = new IntegerSetting("revanced_announcement_last_id", -1, false, false);
public static final BooleanSetting AUTO_REPEAT = new BooleanSetting("revanced_auto_repeat", FALSE);
public static final BooleanSetting LOOP_VIDEO = new BooleanSetting("revanced_loop_video", FALSE);
public static final BooleanSetting LOOP_VIDEO_BUTTON = new BooleanSetting("revanced_loop_video_button", FALSE);
public static final BooleanSetting BYPASS_URL_REDIRECTS = new BooleanSetting("revanced_bypass_url_redirects", TRUE);
public static final BooleanSetting CHECK_WATCH_HISTORY_DOMAIN_NAME = new BooleanSetting("revanced_check_watch_history_domain_name", TRUE, false, false);
public static final BooleanSetting DISABLE_HAPTIC_FEEDBACK_CHAPTERS = new BooleanSetting("revanced_disable_haptic_feedback_chapters", FALSE);
public static final BooleanSetting DISABLE_HAPTIC_FEEDBACK_PRECISE_SEEKING = new BooleanSetting("revanced_disable_haptic_feedback_precise_seeking", FALSE);
public static final BooleanSetting DISABLE_HAPTIC_FEEDBACK_SEEK_UNDO = new BooleanSetting("revanced_disable_haptic_feedback_seek_undo", FALSE);
@@ -444,28 +445,30 @@ public class Settings extends BaseSettings {
public static final StringSetting SB_CATEGORY_UNSUBMITTED_COLOR = new StringSetting("sb_unsubmitted_color", "#FFFFFFFF", false, false);
// Deprecated migrations
private static final BooleanSetting DEPRECATED_AUTO_REPEAT = new BooleanSetting("revanced_auto_repeat", FALSE);
private static final BooleanSetting DEPRECATED_HIDE_PLAYER_BUTTONS = new BooleanSetting("revanced_hide_player_buttons", FALSE, true);
private static final BooleanSetting DEPRECATED_HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER = new BooleanSetting("revanced_hide_video_quality_menu_footer", FALSE);
private static final IntegerSetting DEPRECATED_SWIPE_OVERLAY_BACKGROUND_ALPHA = new IntegerSetting("revanced_swipe_overlay_background_alpha", 127);
private static final StringSetting DEPRECATED_SEEKBAR_CUSTOM_COLOR_PRIMARY = new StringSetting("revanced_seekbar_custom_color_value", "#FF0033");
private static final StringSetting DEPRECATED_SEEKBAR_CUSTOM_COLOR_PRIMARY = new StringSetting("revanced_seekbar_custom_color_value", "#FF0033");
private static final BooleanSetting DEPRECATED_DISABLE_SUGGESTED_VIDEO_END_SCREEN = new BooleanSetting("revanced_disable_suggested_video_end_screen", FALSE);
private static final BooleanSetting DEPRECATED_RESTORE_OLD_VIDEO_QUALITY_MENU = new BooleanSetting("revanced_restore_old_video_quality_menu", TRUE);
private static final BooleanSetting DEPRECATED_AUTO_CAPTIONS = new BooleanSetting("revanced_auto_captions", FALSE);
public static final FloatSetting DEPRECATED_SB_CATEGORY_SPONSOR_OPACITY = new FloatSetting("sb_sponsor_opacity", 0.8f, false, false);
public static final FloatSetting DEPRECATED_SB_CATEGORY_SELF_PROMO_OPACITY = new FloatSetting("sb_selfpromo_opacity", 0.8f, false, false);
public static final FloatSetting DEPRECATED_SB_CATEGORY_INTERACTION_OPACITY = new FloatSetting("sb_interaction_opacity", 0.8f, false, false);
public static final FloatSetting DEPRECATED_SB_CATEGORY_HIGHLIGHT_OPACITY = new FloatSetting("sb_highlight_opacity", 0.8f, false, false);
public static final FloatSetting DEPRECATED_SB_CATEGORY_HOOK_OPACITY = new FloatSetting("sb_hook_opacity", 0.8f, false, false);
public static final FloatSetting DEPRECATED_SB_CATEGORY_INTRO_OPACITY = new FloatSetting("sb_intro_opacity", 0.8f, false, false);
public static final FloatSetting DEPRECATED_SB_CATEGORY_OUTRO_OPACITY = new FloatSetting("sb_outro_opacity", 0.8f, false, false);
public static final FloatSetting DEPRECATED_SB_CATEGORY_PREVIEW_OPACITY = new FloatSetting("sb_preview_opacity", 0.8f, false, false);
public static final FloatSetting DEPRECATED_SB_CATEGORY_FILLER_OPACITY = new FloatSetting("sb_filler_opacity", 0.8f, false, false);
public static final FloatSetting DEPRECATED_SB_CATEGORY_MUSIC_OFFTOPIC_OPACITY = new FloatSetting("sb_music_offtopic_opacity", 0.8f, false, false);
private static final FloatSetting DEPRECATED_SB_CATEGORY_SPONSOR_OPACITY = new FloatSetting("sb_sponsor_opacity", 0.8f, false, false);
private static final FloatSetting DEPRECATED_SB_CATEGORY_SELF_PROMO_OPACITY = new FloatSetting("sb_selfpromo_opacity", 0.8f, false, false);
private static final FloatSetting DEPRECATED_SB_CATEGORY_INTERACTION_OPACITY = new FloatSetting("sb_interaction_opacity", 0.8f, false, false);
private static final FloatSetting DEPRECATED_SB_CATEGORY_HIGHLIGHT_OPACITY = new FloatSetting("sb_highlight_opacity", 0.8f, false, false);
private static final FloatSetting DEPRECATED_SB_CATEGORY_HOOK_OPACITY = new FloatSetting("sb_hook_opacity", 0.8f, false, false);
private static final FloatSetting DEPRECATED_SB_CATEGORY_INTRO_OPACITY = new FloatSetting("sb_intro_opacity", 0.8f, false, false);
private static final FloatSetting DEPRECATED_SB_CATEGORY_OUTRO_OPACITY = new FloatSetting("sb_outro_opacity", 0.8f, false, false);
private static final FloatSetting DEPRECATED_SB_CATEGORY_PREVIEW_OPACITY = new FloatSetting("sb_preview_opacity", 0.8f, false, false);
private static final FloatSetting DEPRECATED_SB_CATEGORY_FILLER_OPACITY = new FloatSetting("sb_filler_opacity", 0.8f, false, false);
private static final FloatSetting DEPRECATED_SB_CATEGORY_MUSIC_OFFTOPIC_OPACITY = new FloatSetting("sb_music_offtopic_opacity", 0.8f, false, false);
static {
// region Migration
migrateOldSettingToNew(DEPRECATED_AUTO_REPEAT, LOOP_VIDEO);
migrateOldSettingToNew(DEPRECATED_HIDE_PLAYER_BUTTONS, HIDE_PLAYER_PREVIOUS_NEXT_BUTTONS);
migrateOldSettingToNew(DEPRECATED_HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER, HIDE_PLAYER_FLYOUT_VIDEO_QUALITY_FOOTER);
migrateOldSettingToNew(DEPRECATED_DISABLE_SUGGESTED_VIDEO_END_SCREEN, HIDE_END_SCREEN_SUGGESTED_VIDEO);

View File

@@ -80,24 +80,29 @@ public class SpoofStreamingDataSideEffectsPreference extends Preference {
Logger.printDebug(() -> "Updating spoof stream side effects preference");
setEnabled(BaseSettings.SPOOF_VIDEO_STREAMS.get());
setTitle(str("revanced_spoof_video_streams_about_title"));
String summary = str("revanced_spoof_video_streams_about_no_audio_tracks");
String summary = str(clientType == ClientType.IPADOS
? "revanced_spoof_video_streams_about_ipados_summary"
// Same base side effects for Android VR, Android Studio, and visionOS.
: "revanced_spoof_video_streams_about_android_summary");
switch (clientType) {
case ANDROID_VR_1_61_48 ->
summary += '\n' + str("revanced_spoof_video_streams_about_no_stable_volume");
case ANDROID_CREATOR ->
summary += '\n' + str("revanced_spoof_video_streams_about_no_av1")
+ '\n' + str("revanced_spoof_video_streams_about_no_stable_volume")
+ '\n' + str("revanced_spoof_video_streams_about_no_force_original_audio");
case IPADOS ->
summary = str("revanced_spoof_video_streams_about_playback_failure")
+ '\n' + str("revanced_spoof_video_streams_about_no_av1");
case VISIONOS ->
summary = str("revanced_spoof_video_streams_about_experimental")
+ '\n' + summary
+ '\n' + str("revanced_spoof_video_streams_about_no_av1");
}
if (clientType == ClientType.IPADOS) {
summary += '\n' + str("revanced_spoof_video_streams_about_no_av1");
} else if (clientType == ClientType.VISIONOS) {
summary = str("revanced_spoof_video_streams_about_experimental")
+ '\n' + summary
+ '\n' + str("revanced_spoof_video_streams_about_no_av1")
+ '\n' + str("revanced_spoof_video_streams_about_kids_videos");
} else if (clientType == ClientType.ANDROID_CREATOR) {
summary += '\n' + str("revanced_spoof_video_streams_about_no_av1")
+ '\n' + str("revanced_spoof_video_streams_about_no_force_original_audio")
+ '\n' + str("revanced_spoof_video_streams_about_kids_videos");
// Only iPadOS can play children videos in incognito, but it commonly fails at 1 minute
// or doesn't even start playback at all. List the side effect for other clients
// since they will fall over to iPadOS.
if (clientType != ClientType.IPADOS) {
summary += '\n' + str("revanced_spoof_video_streams_about_kids_videos");
}
// Use better formatting for bullet points.

View File

@@ -96,7 +96,7 @@ public class SponsorBlockUtils {
SegmentCategory[] categories = SegmentCategory.categoriesWithoutHighlights();
CharSequence[] titles = new CharSequence[categories.length];
for (int i = 0, length = categories.length; i < length; i++) {
titles[i] = categories[i].getTitle().toString();
titles[i] = categories[i].getTitleWithColorDot();
}
newUserCreatedSegmentCategory = null;
@@ -336,8 +336,8 @@ public class SponsorBlockUtils {
Utils.verifyOnMainThread();
final SegmentCategory[] values = SegmentCategory.categoriesWithoutHighlights();
CharSequence[] titles = new CharSequence[values.length];
for (int i = 0, length = values.length; i < length; i++) {
titles[i] = values[i].getTitle().toString();
for (int i = 0; i < values.length; i++) {
titles[i] = values[i].getTitleWithColorDot();
}
new AlertDialog.Builder(context)

View File

@@ -5,8 +5,12 @@ import static app.revanced.extension.youtube.settings.Settings.*;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.text.style.RelativeSizeSpan;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -83,6 +87,8 @@ public enum SegmentCategory {
MUSIC_OFFTOPIC,
};
public static final String COLOR_DOT_STRING = "";
public static final float CATEGORY_DEFAULT_OPACITY = 0.7f;
private static final Map<String, SegmentCategory> mValuesMap = new HashMap<>(2 * categoriesWithoutUnsubmitted.length);
@@ -324,6 +330,32 @@ public enum SegmentCategory {
return title;
}
/**
* Creates a {@link SpannableString} that starts with a colored dot followed by the provided text.
*/
private static SpannableString getCategoryColorDotSpan(String text, @ColorInt int color) {
SpannableString dotSpan = new SpannableString(COLOR_DOT_STRING + text);
dotSpan.setSpan(new ForegroundColorSpan(color), 0, 1,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
dotSpan.setSpan(new RelativeSizeSpan(1.5f), 0, 1,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
return dotSpan;
}
/**
* Returns the category title with a colored dot.
*/
public SpannableString getTitleWithColorDot(@ColorInt int categoryColor) {
return getCategoryColorDotSpan(" " + title, categoryColor);
}
/**
* Returns the category title with a colored dot.
*/
public SpannableString getTitleWithColorDot() {
return getTitleWithColorDot(color);
}
/**
* Gets the skip button text based on segment position.
*

View File

@@ -0,0 +1,83 @@
package app.revanced.extension.youtube.videoplayer;
import static app.revanced.extension.shared.StringRef.str;
import android.view.View;
import androidx.annotation.Nullable;
import app.revanced.extension.shared.Logger;
import app.revanced.extension.shared.Utils;
import app.revanced.extension.youtube.settings.Settings;
@SuppressWarnings("unused")
public class LoopVideoButton {
@Nullable
private static PlayerControlButton instance;
private static final int LOOP_VIDEO_ON = Utils.getResourceIdentifierOrThrow(
"revanced_loop_video_button_on", "drawable");
private static final int LOOP_VIDEO_OFF = Utils.getResourceIdentifierOrThrow(
"revanced_loop_video_button_off", "drawable");
/**
* Injection point.
*/
public static void initializeButton(View controlsView) {
try {
instance = new PlayerControlButton(
controlsView,
"revanced_loop_video_button",
null,
Settings.LOOP_VIDEO_BUTTON::get,
v -> updateButtonAppearance(),
null
);
} catch (Exception ex) {
Logger.printException(() -> "initializeButton failure", ex);
}
}
/**
* injection point.
*/
public static void setVisibilityNegatedImmediate() {
if (instance != null) instance.setVisibilityNegatedImmediate();
}
/**
* injection point.
*/
public static void setVisibilityImmediate(boolean visible) {
if (instance != null) instance.setVisibilityImmediate(visible);
}
/**
* injection point.
*/
public static void setVisibility(boolean visible, boolean animated) {
if (instance != null) instance.setVisibility(visible, animated);
}
/**
* Updates the button's appearance.
*/
private static void updateButtonAppearance() {
if (instance == null) return;
try {
Utils.verifyOnMainThread();
final boolean currentState = Settings.LOOP_VIDEO.get();
final boolean newState = !currentState;
Settings.LOOP_VIDEO.save(newState);
instance.setIcon(newState
? LOOP_VIDEO_ON
: LOOP_VIDEO_OFF);
Utils.showToastShort(str(newState
? "revanced_loop_video_button_toast_on"
: "revanced_loop_video_button_toast_off"));
} catch (Exception ex) {
Logger.printException(() -> "updateButtonAppearance failure", ex);
}
}
}

View File

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

View File

@@ -405,6 +405,10 @@ public final class app/revanced/patches/music/misc/debugging/EnableDebuggingPatc
public static final fun getEnableDebuggingPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/music/misc/dns/CheckWatchHistoryDomainNameResolutionPatchKt {
public static final fun getCheckWatchHistoryDomainNameResolutionPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/music/misc/extension/SharedExtensionPatchKt {
public static final fun getSharedExtensionPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
@@ -1169,6 +1173,10 @@ public final class app/revanced/patches/tumblr/annoyances/popups/DisableGiftMess
public static final fun getDisableGiftMessagePopupPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/tumblr/annoyances/tv/DisableTumblrTvPatchKt {
public static final fun getDisableTumblrTvPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatchKt {
public static final fun getOverrideFeatureFlagsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
@@ -1610,6 +1618,10 @@ public final class app/revanced/patches/youtube/misc/litho/filter/LithoFilterPat
public static final fun getLithoFilterPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/youtube/misc/loopvideo/LoopVideoPatchKt {
public static final fun getLoopVideoPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatchKt {
public static field hookNavigationButtonCreated Lkotlin/jvm/functions/Function1;
public static final fun getHookNavigationButtonCreated ()Lkotlin/jvm/functions/Function1;
@@ -1715,6 +1727,10 @@ public final class app/revanced/patches/youtube/video/audio/ForceOriginalAudioPa
public static final fun getForceOriginalAudioPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/youtube/video/codecs/DisableVideoCodecsPatchKt {
public static final fun getDisableVideoCodecsPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}
public final class app/revanced/patches/youtube/video/hdr/DisableHdrPatchKt {
public static final fun getDisableHdrPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}

View File

@@ -2,28 +2,22 @@
package app.revanced.patches.instagram.hide.navigation
import app.revanced.patcher.fingerprint
import com.android.tools.smali.dexlib2.Opcode
import app.revanced.patcher.patch.BytecodePatchContext
internal val tabCreateButtonsLoopStartFingerprint = fingerprint {
returns("V")
strings("InstagramMainActivity.createTabButtons")
opcodes(
//Loop Start
Opcode.IF_GE, // Check if index is finished (index, size)
//Injection
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT
)
internal val initializeNavigationButtonsListFingerprint = fingerprint {
strings("Nav3")
parameters("Lcom/instagram/common/session/UserSession;", "Z")
returns("Ljava/util/List;")
}
internal val tabCreateButtonsLoopEndFingerprint = fingerprint {
returns("V")
strings("InstagramMainActivity.createTabButtons")
opcodes(
Opcode.IPUT_OBJECT,
// Injection Jump
Opcode.ADD_INT_LIT8, //Increase Index
Opcode.GOTO // Jump to loopStart
// LoopEnd
)
private val navigationButtonsEnumClassDef = fingerprint {
strings("FEED", "fragment_feed", "SEARCH", "fragment_search")
}
context(BytecodePatchContext)
internal val navigationButtonsEnumInitFingerprint get() = fingerprint {
custom { method, classDef ->
method.name == "<init>"
&& classDef == navigationButtonsEnumClassDef.classDef
}
}

View File

@@ -1,21 +1,28 @@
package app.revanced.patches.instagram.hide.navigation
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.booleanOption
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.util.addInstructionsAtControlFlowLabel
import app.revanced.util.findFreeRegister
import app.revanced.util.getReference
import app.revanced.util.indexOfFirstInstructionOrThrow
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
import java.util.logging.Logger
private const val EXTENSION_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/instagram/hide/navigation/HideNavigationButtonsPatch;"
@Suppress("unused")
val hideNavigationButtonsPatch = bytecodePatch(
name = "Hide navigation buttons",
description = "Hides navigation bar buttons, such as the Reels and Create button.",
use = false
) {
compatibleWith("com.instagram.android"("397.1.0.52.81"))
compatibleWith("com.instagram.android")
val hideReels by booleanOption(
key = "hideReels",
@@ -38,43 +45,44 @@ val hideNavigationButtonsPatch = bytecodePatch(
)
}
tabCreateButtonsLoopStartFingerprint.method.apply {
// Check the current loop index, and skip over adding the
// navigation button view if the index matches a given button.
val enumNameField: String
val startIndex = tabCreateButtonsLoopStartFingerprint.patternMatch!!.startIndex
val endIndex = tabCreateButtonsLoopEndFingerprint.patternMatch!!.endIndex
val insertIndex = startIndex + 1
val loopIndexRegister = getInstruction<TwoRegisterInstruction>(startIndex).registerA
val freeRegister = findFreeRegister(insertIndex, loopIndexRegister)
val instruction = getInstruction(endIndex - 1)
val instructions = buildString {
if (hideCreate!!) {
appendLine(
"""
const v$freeRegister, 0x2
if-eq v$freeRegister, v$loopIndexRegister, :skipAddView
"""
)
}
if (hideReels!!) {
appendLine(
"""
const v$freeRegister, 0x3
if-eq v$freeRegister, v$loopIndexRegister, :skipAddView
"""
)
}
}
addInstructionsWithLabels(
insertIndex,
instructions,
ExternalLabel("skipAddView", instruction)
)
// Get the field name which contains the name of the enum for the navigation button ("fragment_clips", "fragment_share", ...)
with(navigationButtonsEnumInitFingerprint.method) {
enumNameField = indexOfFirstInstructionOrThrow {
opcode == Opcode.IPUT_OBJECT &&
(this as TwoRegisterInstruction).registerA == 2 // The p2 register
}.let {
getInstruction(it).getReference<FieldReference>()!!.name
}
}
}
initializeNavigationButtonsListFingerprint.method.apply {
val returnIndex = indexOfFirstInstructionOrThrow(Opcode.RETURN_OBJECT)
val buttonsListRegister = getInstruction<OneRegisterInstruction>(returnIndex).registerA
val freeRegister = findFreeRegister(returnIndex)
val freeRegister2 = findFreeRegister(returnIndex, freeRegister)
fun instructionsRemoveButtonByName(buttonEnumName: String): String {
return """
const-string v$freeRegister, "$buttonEnumName"
const-string v$freeRegister2, "$enumNameField"
invoke-static { v$buttonsListRegister, v$freeRegister, v$freeRegister2 }, $EXTENSION_CLASS_DESCRIPTOR->removeNavigationButtonByName(Ljava/util/List;Ljava/lang/String;Ljava/lang/String;)Ljava/util/List;
move-result-object v$buttonsListRegister
"""
}
if (hideReels!!)
addInstructionsAtControlFlowLabel(
returnIndex,
instructionsRemoveButtonByName("fragment_clips")
)
if (hideCreate!!)
addInstructionsAtControlFlowLabel(
returnIndex,
instructionsRemoveButtonByName("fragment_share")
)
}
}
}

View File

@@ -0,0 +1,22 @@
package app.revanced.patches.music.misc.dns
import app.revanced.patches.music.misc.extension.sharedExtensionPatch
import app.revanced.patches.music.shared.mainActivityOnCreateFingerprint
import app.revanced.patches.shared.misc.dns.checkWatchHistoryDomainNameResolutionPatch
val checkWatchHistoryDomainNameResolutionPatch = checkWatchHistoryDomainNameResolutionPatch(
block = {
dependsOn(
sharedExtensionPatch
)
compatibleWith(
"com.google.android.apps.youtube.music"(
"7.29.52",
"8.10.52"
)
)
},
mainActivityFingerprint = mainActivityOnCreateFingerprint
)

View File

@@ -1,9 +1,10 @@
package app.revanced.patches.music.misc.extension
import app.revanced.patches.music.misc.extension.hooks.applicationInitHook
import app.revanced.patches.music.misc.extension.hooks.applicationInitOnCreateHook
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
val sharedExtensionPatch = sharedExtensionPatch(
"music",
applicationInitHook,
applicationInitHook, applicationInitOnCreateHook
)

View File

@@ -1,5 +1,6 @@
package app.revanced.patches.music.misc.extension.hooks
import app.revanced.patches.music.shared.YOUTUBE_MUSIC_MAIN_ACTIVITY_CLASS_TYPE
import app.revanced.patches.shared.misc.extension.extensionHook
internal val applicationInitHook = extensionHook {
@@ -8,3 +9,11 @@ internal val applicationInitHook = extensionHook {
strings("activity")
custom { method, _ -> method.name == "onCreate" }
}
internal val applicationInitOnCreateHook = extensionHook {
returns("V")
parameters("Landroid/os/Bundle;")
custom { method, classDef ->
method.name == "onCreate" && classDef.type == YOUTUBE_MUSIC_MAIN_ACTIVITY_CLASS_TYPE
}
}

View File

@@ -28,7 +28,12 @@ val gmsCoreSupportPatch = gmsCoreSupportPatch(
) {
dependsOn(spoofVideoStreamsPatch)
compatibleWith(MUSIC_PACKAGE_NAME)
compatibleWith(
MUSIC_PACKAGE_NAME(
"7.29.52",
"8.10.52"
)
)
}
private fun gmsCoreSupportResourcePatch(

View File

@@ -42,6 +42,8 @@ private val settingsResourcePatch = resourcePatch {
execute {
// Set the style for the ReVanced settings to follow the style of the music settings,
// namely: action bar height, menu item padding and remove horizontal dividers.
val targetResource = "values/styles.xml"
inputStreamFromBundledResource(
"settings/music",
@@ -53,7 +55,7 @@ private val settingsResourcePatch = resourcePatch {
).close()
}
// Remove horizontal divider from the settings Preferences.
// Remove horizontal dividers from the music settings.
val styleFile = get("res/values/styles.xml")
styleFile.writeText(
styleFile.readText()

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.music.shared
import app.revanced.patcher.fingerprint
internal const val YOUTUBE_MUSIC_MAIN_ACTIVITY_CLASS_TYPE = "Lcom/google/android/apps/youtube/music/activities/MusicActivity;"
internal val mainActivityOnCreateFingerprint = fingerprint {
returns("V")
parameters("Landroid/os/Bundle;")
custom { method, classDef ->
method.name == "onCreate" && classDef.type == YOUTUBE_MUSIC_MAIN_ACTIVITY_CLASS_TYPE
}
}

View File

@@ -0,0 +1,36 @@
package app.revanced.patches.shared.misc.dns
import app.revanced.patcher.Fingerprint
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatchBuilder
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.all.misc.resources.addResources
private const val EXTENSION_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/shared/patches/CheckWatchHistoryDomainNameResolutionPatch;"
/**
* Patch shared with YouTube and YT Music.
*/
internal fun checkWatchHistoryDomainNameResolutionPatch(
block: BytecodePatchBuilder.() -> Unit = {},
executeBlock: BytecodePatchContext.() -> Unit = {},
mainActivityFingerprint: Fingerprint
) = bytecodePatch(
name = "Check watch history domain name resolution",
description = "Checks if the device DNS server is preventing user watch history from being saved.",
) {
block()
execute {
executeBlock()
addResources("shared", "misc.dns.checkWatchHistoryDomainNameResolutionPatch")
mainActivityFingerprint.method.addInstruction(
0,
"invoke-static/range { p0 .. p0 }, $EXTENSION_CLASS_DESCRIPTOR->checkDnsResolver(Landroid/app/Activity;)V",
)
}
}

View File

@@ -18,7 +18,9 @@ import app.revanced.util.returnEarly
import org.w3c.dom.Node
// TODO: Delete this on next major version bump.
@Deprecated("Use non deprecated settings patch function")
@Deprecated("Use non deprecated settings patch function",
ReplaceWith("settingsPatch(listOf(rootPreference), preferences)")
)
fun settingsPatch (
rootPreference: Pair<IntentPreference, String>,
preferences: Set<BasePreference>,
@@ -69,8 +71,8 @@ fun settingsPatch (
ResourceGroup("drawable",
// CustomListPreference resources.
"revanced_ic_dialog_alert.xml",
// Search resources.
"revanced_settings_arrow_time.xml",
"revanced_settings_cursor.xml",
"revanced_settings_custom_checkmark.xml",
"revanced_settings_search_icon.xml",
"revanced_settings_search_remove.xml",

View File

@@ -0,0 +1,19 @@
package app.revanced.patches.tumblr.annoyances.tv
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.tumblr.featureflags.addFeatureFlagOverride
import app.revanced.patches.tumblr.featureflags.overrideFeatureFlagsPatch
@Suppress("unused")
val disableTumblrTvPatch = bytecodePatch(
name = "Disable Tumblr TV",
description = "Removes the Tumblr TV navigation button from the bottom navigation bar.",
) {
dependsOn(overrideFeatureFlagsPatch)
compatibleWith("com.tumblr")
execute {
addFeatureFlagOverride("tumblrTvMobileNav", "false")
}
}

View File

@@ -77,7 +77,6 @@ val hideAdsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -26,7 +26,6 @@ val hideGetPremiumPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -24,7 +24,6 @@ val videoAdsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -54,7 +54,6 @@ val copyVideoUrlPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -25,7 +25,6 @@ val removeViewerDiscretionDialogPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -75,7 +75,6 @@ val downloadsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -21,7 +21,6 @@ val seekbarPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -89,7 +89,6 @@ val swipeControlsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -25,7 +25,6 @@ val autoCaptionsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -44,7 +44,6 @@ val customBrandingPatch = resourcePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -94,7 +94,6 @@ val changeHeaderPatch = resourcePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -23,7 +23,6 @@ val hideButtonsPatch = resourcePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -41,7 +41,6 @@ val navigationButtonsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -59,7 +59,6 @@ val hidePlayerOverlayButtonsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -34,7 +34,6 @@ val changeFormFactorPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -60,7 +60,6 @@ val hideEndscreenCardsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -32,7 +32,6 @@ val hideEndScreenSuggestedVideoPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -30,7 +30,6 @@ val disableFullscreenAmbientModePatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -127,7 +127,6 @@ val hideLayoutComponentsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",
@@ -162,9 +161,9 @@ val hideLayoutComponentsPatch = bytecodePatch(
SwitchPreference("revanced_hide_comments_section"),
SwitchPreference("revanced_hide_comments_community_guidelines"),
SwitchPreference("revanced_hide_comments_create_a_short_button"),
SwitchPreference("revanced_hide_comments_emoji_and_timestamp_buttons"),
SwitchPreference("revanced_hide_comments_preview_comment"),
SwitchPreference("revanced_hide_comments_thanks_button"),
SwitchPreference("revanced_hide_comments_timestamp_button"),
),
sorting = PreferenceScreenPreference.Sorting.UNSORTED,
),

View File

@@ -58,7 +58,6 @@ val hideInfoCardsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -25,7 +25,6 @@ val hidePlayerFlyoutMenuPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -49,7 +49,6 @@ val hideRelatedVideoOverlayPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -30,7 +30,6 @@ val disableRollingNumberAnimationPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -173,7 +173,6 @@ val hideShortsComponentsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -32,7 +32,6 @@ val disableSignInToTvPopupPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -22,7 +22,6 @@ val hideTimestampPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -154,7 +154,6 @@ val miniplayerPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -22,7 +22,6 @@ val playerPopupPanelsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -9,8 +9,8 @@ import app.revanced.patches.youtube.misc.playercontrols.playerControlsPatch
import app.revanced.patches.youtube.misc.playertype.playerTypeHookPatch
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.misc.settings.settingsPatch
import app.revanced.patches.youtube.shared.autoRepeatFingerprint
import app.revanced.patches.youtube.shared.autoRepeatParentFingerprint
import app.revanced.patches.youtube.shared.loopVideoFingerprint
import app.revanced.patches.youtube.shared.loopVideoParentFingerprint
import app.revanced.util.addInstructionsAtControlFlowLabel
@Suppress("unused")
@@ -22,7 +22,6 @@ internal val exitFullscreenPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",
@@ -50,7 +49,7 @@ internal val exitFullscreenPatch = bytecodePatch(
ListPreference("revanced_exit_fullscreen")
)
autoRepeatFingerprint.match(autoRepeatParentFingerprint.originalClassDef).method.apply {
loopVideoFingerprint.match(loopVideoParentFingerprint.originalClassDef).method.apply {
addInstructionsAtControlFlowLabel(
implementation!!.instructions.lastIndex,
"invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->endOfVideoReached()V",

View File

@@ -53,7 +53,6 @@ val customPlayerOverlayOpacityPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -62,7 +62,6 @@ val returnYouTubeDislikePatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -67,7 +67,6 @@ val wideSearchbarPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -45,7 +45,6 @@ val shortsAutoplayPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -65,7 +65,6 @@ val openShortsInRegularPlayerPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -127,7 +127,6 @@ val sponsorBlockPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -60,7 +60,6 @@ val spoofAppVersionPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -33,7 +33,6 @@ val changeStartPagePatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -35,7 +35,6 @@ val disableResumingShortsOnStartupPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -205,7 +205,6 @@ val themePatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -34,7 +34,6 @@ val alternativeThumbnailsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -28,7 +28,6 @@ val bypassImageRegionRestrictionsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -24,7 +24,6 @@ val announcementsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -1,62 +1,9 @@
package app.revanced.patches.youtube.misc.autorepeat
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.instructions
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.all.misc.resources.addResources
import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.shared.autoRepeatFingerprint
import app.revanced.patches.youtube.shared.autoRepeatParentFingerprint
import app.revanced.patches.youtube.misc.loopvideo.loopVideoPatch
// TODO: Rename this patch to AlwaysRepeatPatch (as well as strings and references in the extension).
val autoRepeatPatch = bytecodePatch(
name = "Always repeat",
description = "Adds an option to always repeat videos when they end.",
) {
dependsOn(
sharedExtensionPatch,
addResourcesPatch,
)
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",
)
)
execute {
addResources("youtube", "misc.autorepeat.autoRepeatPatch")
PreferenceScreen.MISC.addPreferences(
SwitchPreference("revanced_auto_repeat"),
)
autoRepeatFingerprint.match(autoRepeatParentFingerprint.originalClassDef).method.apply {
val playMethod = autoRepeatParentFingerprint.method
val index = instructions.lastIndex
// Remove return-void.
removeInstruction(index)
// Add own instructions there.
addInstructionsWithLabels(
index,
"""
invoke-static {}, Lapp/revanced/extension/youtube/patches/AutoRepeatPatch;->shouldAutoRepeat()Z
move-result v0
if-eqz v0, :noautorepeat
invoke-virtual { p0 }, $playMethod
:noautorepeat
return-void
""",
)
}
}
@Deprecated("Patch was renamed", ReplaceWith("looVideoPatch"))
val autoRepeatPatch = bytecodePatch {
dependsOn(loopVideoPatch)
}

View File

@@ -52,7 +52,6 @@ val backgroundPlaybackPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -18,7 +18,6 @@ val enableDebuggingPatch = enableDebuggingPatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -25,7 +25,6 @@ val spoofDeviceDimensionsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -1,40 +1,23 @@
package app.revanced.patches.youtube.misc.dns
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.all.misc.resources.addResources
import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.shared.misc.dns.checkWatchHistoryDomainNameResolutionPatch
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.shared.mainActivityOnCreateFingerprint
private const val EXTENSION_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/youtube/patches/CheckWatchHistoryDomainNameResolutionPatch;"
val checkWatchHistoryDomainNameResolutionPatch = bytecodePatch(
name = "Check watch history domain name resolution",
description = "Checks if the device DNS server is preventing user watch history from being saved.",
) {
dependsOn(
sharedExtensionPatch,
addResourcesPatch
)
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",
val checkWatchHistoryDomainNameResolutionPatch = checkWatchHistoryDomainNameResolutionPatch(
block = {
dependsOn(
sharedExtensionPatch
)
)
execute {
addResources("youtube", "misc.dns.checkWatchHistoryDomainNameResolutionPatch")
mainActivityOnCreateFingerprint.method.addInstruction(
0,
"invoke-static/range { p0 .. p0 }, $EXTENSION_CLASS_DESCRIPTOR->checkDnsResolver(Landroid/app/Activity;)V",
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"20.07.39",
"20.13.41",
"20.14.43",
)
)
}
}
},
mainActivityFingerprint = mainActivityOnCreateFingerprint
)

View File

@@ -36,7 +36,6 @@ val gmsCoreSupportPatch = gmsCoreSupportPatch(
compatibleWith(
YOUTUBE_PACKAGE_NAME(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -27,7 +27,6 @@ val disableHapticFeedbackPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -33,7 +33,6 @@ val bypassURLRedirectsPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -42,7 +42,6 @@ val openLinksExternallyPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -0,0 +1,61 @@
package app.revanced.patches.youtube.misc.loopvideo
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.all.misc.resources.addResources
import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.loopvideo.button.loopVideoButtonPatch
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.shared.loopVideoFingerprint
import app.revanced.patches.youtube.shared.loopVideoParentFingerprint
import app.revanced.util.addInstructionsAtControlFlowLabel
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
import com.android.tools.smali.dexlib2.Opcode
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/LoopVideoPatch;"
val loopVideoPatch = bytecodePatch(
name = "Loop video",
description = "Adds an option to loop videos and display loop video button in the video player.",
) {
dependsOn(
sharedExtensionPatch,
addResourcesPatch,
loopVideoButtonPatch
)
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"20.07.39",
"20.13.41",
"20.14.43",
)
)
execute {
addResources("youtube", "misc.loopvideo.loopVideoPatch")
PreferenceScreen.MISC.addPreferences(
SwitchPreference("revanced_loop_video"),
)
loopVideoFingerprint.match(loopVideoParentFingerprint.originalClassDef).method.apply {
val playMethod = loopVideoParentFingerprint.method
val insertIndex = indexOfFirstInstructionReversedOrThrow(Opcode.RETURN_VOID)
addInstructionsAtControlFlowLabel(
insertIndex,
"""
invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->shouldLoopVideo()Z
move-result v0
if-eqz v0, :do_not_loop
invoke-virtual { p0 }, $playMethod
:do_not_loop
nop
"""
)
}
}
}

View File

@@ -0,0 +1,57 @@
package app.revanced.patches.youtube.misc.loopvideo.button
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.patch.resourcePatch
import app.revanced.patches.all.misc.resources.addResources
import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.playercontrols.*
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.misc.settings.settingsPatch
import app.revanced.util.ResourceGroup
import app.revanced.util.copyResources
private val loopVideoButtonResourcePatch = resourcePatch {
dependsOn(playerControlsResourcePatch)
execute {
copyResources(
"loopvideobutton",
ResourceGroup(
"drawable",
"revanced_loop_video_button_on.xml",
"revanced_loop_video_button_off.xml"
)
)
addBottomControl("loopvideobutton")
}
}
private const val LOOP_VIDEO_BUTTON_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/youtube/videoplayer/LoopVideoButton;"
internal val loopVideoButtonPatch = bytecodePatch(
description = "Adds the option to display loop video button in the video player.",
) {
dependsOn(
sharedExtensionPatch,
settingsPatch,
addResourcesPatch,
loopVideoButtonResourcePatch,
playerControlsPatch,
)
execute {
addResources("youtube", "misc.loopvideo.button.loopVideoButtonPatch")
PreferenceScreen.PLAYER.addPreferences(
SwitchPreference("revanced_loop_video_button"),
)
// Initialize the button using standard approach.
initializeBottomControl(LOOP_VIDEO_BUTTON_CLASS_DESCRIPTOR)
injectVisibilityCheckCall(LOOP_VIDEO_BUTTON_CLASS_DESCRIPTOR)
}
}

View File

@@ -15,7 +15,6 @@ val sanitizeSharingLinksPatch = sanitizeSharingLinksPatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -95,20 +95,6 @@ private val settingsResourcePatch = resourcePatch {
)
)
// Copy style properties used to fix over-sized copy menu that appear in EditTextPreference.
// For a full explanation of how this fixes the issue, see the comments in this style file
// and the comments in the extension code.
val targetResource = "values/styles.xml"
inputStreamFromBundledResource(
"settings/youtube",
targetResource,
)!!.let { inputStream ->
"resources".copyXmlNode(
document(inputStream),
document("res/$targetResource"),
).close()
}
// Remove horizontal divider from the settings Preferences
// To better match the appearance of the stock YouTube settings.
document("res/values/styles.xml").use { document ->

View File

@@ -23,7 +23,6 @@ val spoofVideoStreamsPatch = spoofVideoStreamsPatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",
@@ -58,7 +57,8 @@ val spoofVideoStreamsPatch = spoofVideoStreamsPatch(
ListPreference("revanced_spoof_video_streams_client_type"),
NonInteractivePreference(
// Requires a key and title but the actual text is chosen at runtime.
key = "revanced_spoof_video_streams_about_android",
key = "revanced_spoof_video_streams_about",
summaryKey = null,
tag = "app.revanced.extension.youtube.settings.preference.SpoofStreamingDataSideEffectsPreference"
),
ListPreference(

View File

@@ -21,7 +21,10 @@ internal val conversionContextFingerprintToString = fingerprint {
}
}
internal val autoRepeatFingerprint = fingerprint {
/**
* Resolves to class found in [loopVideoParentFingerprint].
*/
internal val loopVideoFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returns("V")
parameters()
@@ -30,7 +33,7 @@ internal val autoRepeatFingerprint = fingerprint {
}
}
internal val autoRepeatParentFingerprint = fingerprint {
internal val loopVideoParentFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returns("V")
strings(

View File

@@ -45,7 +45,6 @@ val forceOriginalAudioPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -0,0 +1,87 @@
package app.revanced.patches.youtube.video.codecs
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.all.misc.resources.addResources
import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
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.getReference
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
private const val EXTENSION_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/youtube/patches/DisableVideoCodecsPatch;"
@Suppress("unused")
val disableVideoCodecsPatch = bytecodePatch(
name = "Disable video codecs",
description = "Adds options to disable HDR and VP9 codecs.",
) {
dependsOn(
sharedExtensionPatch,
settingsPatch,
addResourcesPatch,
/**
* Override all calls of `getSupportedHdrTypes`.
*/
transformInstructionsPatch(
filterMap = filterMap@{ classDef, _, instruction, instructionIndex ->
if (classDef.type.startsWith("Lapp/revanced/")) {
return@filterMap null
}
val reference = instruction.getReference<MethodReference>()
if (reference?.definingClass =="Landroid/view/Display\$HdrCapabilities;"
&& reference.name == "getSupportedHdrTypes") {
return@filterMap instruction to instructionIndex
}
return@filterMap null
},
transform = { method, entry ->
val (instruction, index) = entry
val register = (instruction as FiveRegisterInstruction).registerC
method.replaceInstruction(
index,
"invoke-static/range { v$register .. v$register }, $EXTENSION_CLASS_DESCRIPTOR->" +
"disableHdrVideo(Landroid/view/Display\$HdrCapabilities;)[I",
)
}
)
)
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"20.07.39",
"20.13.41",
"20.14.43",
)
)
execute {
addResources("youtube", "video.codecs.disableVideoCodecsPatch")
PreferenceScreen.VIDEO.addPreferences(
SwitchPreference("revanced_disable_hdr_video"),
SwitchPreference("revanced_force_avc_codec")
)
vp9CapabilityFingerprint.method.addInstructionsWithLabels(
0,
"""
invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->allowVP9()Z
move-result v0
if-nez v0, :default
return v0
:default
nop
"""
)
}
}

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.youtube.video.codecs
import app.revanced.patcher.fingerprint
import com.android.tools.smali.dexlib2.AccessFlags
internal val vp9CapabilityFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returns("Z")
strings(
"vp9_supported",
"video/x-vnd.on2.vp9"
)
}

View File

@@ -1,72 +1,10 @@
package app.revanced.patches.youtube.video.hdr
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patches.all.misc.resources.addResources
import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
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.getReference
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
private const val EXTENSION_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/youtube/patches/DisableHdrPatch;"
import app.revanced.patches.youtube.video.codecs.disableVideoCodecsPatch
@Deprecated("Patch was renamed", ReplaceWith("disableVideoCodecsPatch"))
@Suppress("unused")
val disableHdrPatch = bytecodePatch(
name = "Disable HDR video",
description = "Adds an option to disable video HDR.",
) {
dependsOn(
sharedExtensionPatch,
settingsPatch,
addResourcesPatch,
// Override all calls of `getSupportedHdrTypes`.
transformInstructionsPatch(
filterMap = filterMap@{ classDef, _, instruction, instructionIndex ->
if (classDef.type.startsWith("Lapp/revanced/")) {
return@filterMap null
}
val reference = instruction.getReference<MethodReference>()
if (reference?.definingClass =="Landroid/view/Display\$HdrCapabilities;"
&& reference.name == "getSupportedHdrTypes") {
return@filterMap instruction to instructionIndex
}
return@filterMap null
},
transform = { method, entry ->
val (instruction, index) = entry
val register = (instruction as FiveRegisterInstruction).registerC
method.replaceInstruction(
index,
"invoke-static/range { v$register .. v$register }, $EXTENSION_CLASS_DESCRIPTOR->" +
"disableHdrVideo(Landroid/view/Display\$HdrCapabilities;)[I",
)
}
)
)
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",
)
)
execute {
addResources("youtube", "video.hdr.disableHdrPatch")
PreferenceScreen.VIDEO.addPreferences(
SwitchPreference("revanced_disable_hdr_video")
)
}
}
val disableHdrPatch = bytecodePatch{
dependsOn(disableVideoCodecsPatch)
}

View File

@@ -26,7 +26,6 @@ internal val videoQualityItemOnClickFingerprint = fingerprint {
}
}
internal val videoQualityMenuOptionsFingerprint = fingerprint {
accessFlags(AccessFlags.STATIC)
returns("[L")

View File

@@ -14,18 +14,18 @@ internal val settingsMenuVideoQualityGroup = mutableSetOf<BasePreference>()
@Suppress("unused")
val videoQualityPatch = bytecodePatch(
name = "Video quality",
description = "Adds options to use the advanced video quality menu and set default video qualities."
description = "Adds options to use the advanced video quality menu, set default video qualities, " +
"and disable video codecs such as VP9/HDR."
) {
dependsOn(
rememberVideoQualityPatch,
advancedVideoQualityMenuPatch,
videoQualityDialogButtonPatch,
videoQualityDialogButtonPatch
)
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

View File

@@ -29,7 +29,6 @@ val playbackSpeedPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.34.42",
"19.43.41",
"20.07.39",
"20.13.41",
"20.14.43",

Some files were not shown because too many files have changed in this diff Show More