mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-08 18:33:57 +01:00
Compare commits
57 Commits
v5.41.0-de
...
v5.41.1-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52c369576d | ||
|
|
28799a548a | ||
|
|
1c80774d79 | ||
|
|
7817885cff | ||
|
|
9afe9afc67 | ||
|
|
3a8091ae00 | ||
|
|
6192ece114 | ||
|
|
5d9971444e | ||
|
|
cdfa75dd5a | ||
|
|
6f92b6c50b | ||
|
|
1e023fa1f3 | ||
|
|
00477bfebc | ||
|
|
4be00d09b7 | ||
|
|
50aca3314f | ||
|
|
15a7e540de | ||
|
|
041f7e0140 | ||
|
|
3bd76d60d6 | ||
|
|
1587178ff8 | ||
|
|
8a69240d66 | ||
|
|
7a37d858fb | ||
|
|
0ed7067459 | ||
|
|
6102644194 | ||
|
|
a89556a017 | ||
|
|
2b555f67f0 | ||
|
|
fb87199514 | ||
|
|
dd4e2cd085 | ||
|
|
fadc66816d | ||
|
|
ffd933c673 | ||
|
|
69883530b7 | ||
|
|
39971291f3 | ||
|
|
51facf9321 | ||
|
|
b83d41ca88 | ||
|
|
bfbffbd1f5 | ||
|
|
ee4755646b | ||
|
|
d1a12930c3 | ||
|
|
dfac836a8c | ||
|
|
6fa404331b | ||
|
|
8bcb95adcd | ||
|
|
8af70fe2d1 | ||
|
|
191b9169ff | ||
|
|
212418b8db | ||
|
|
7dbc744be0 | ||
|
|
150a3e7c60 | ||
|
|
5027943470 | ||
|
|
fa9e590b3a | ||
|
|
5823f0e982 | ||
|
|
f506a67e4a | ||
|
|
ed6e1155f2 | ||
|
|
8c229954d7 | ||
|
|
c5eb88bbf6 | ||
|
|
ef514017f4 | ||
|
|
c72d99518c | ||
|
|
772df6eb73 | ||
|
|
dfb5407e67 | ||
|
|
6d5f6ecdd2 | ||
|
|
a0a62ddad2 | ||
|
|
512e50e892 |
163
CHANGELOG.md
163
CHANGELOG.md
@@ -1,3 +1,166 @@
|
||||
## [5.41.1-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.41.1-dev.1...v5.41.1-dev.2) (2025-09-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube Music - Hide cast button:** Fix patching error ([28799a5](https://github.com/ReVanced/revanced-patches/commit/28799a548a73651134ef304cb6cb542cf8e55abe))
|
||||
|
||||
## [5.41.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.41.0...v5.41.1-dev.1) (2025-09-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube Music - Hide cast button:** Resolve button not hiding ([7817885](https://github.com/ReVanced/revanced-patches/commit/7817885cffed66608039ab45881537cbd3069c9d))
|
||||
|
||||
# [5.41.0](https://github.com/ReVanced/revanced-patches/compare/v5.40.0...v5.41.0) (2025-09-27)
|
||||
|
||||
|
||||
### 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))
|
||||
* **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))
|
||||
* **TikTok:** Show correct dialog restart text, use correct font color for non-dark mode ([d1a1293](https://github.com/ReVanced/revanced-patches/commit/d1a12930c35f630793a0f240d4203c2ff9060158))
|
||||
* **Twitch - Settings:** Fix missing style resources ([#5970](https://github.com/ReVanced/revanced-patches/issues/5970)) ([8c22995](https://github.com/ReVanced/revanced-patches/commit/8c229954d7f232a7a472ca49f1b5e7cdc475bbcc))
|
||||
* **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))
|
||||
* **YouTube - Return YouTube Dislike:** Do not show error toast if API returns 401 status ([#5949](https://github.com/ReVanced/revanced-patches/issues/5949)) ([58d088a](https://github.com/ReVanced/revanced-patches/commit/58d088ab307440a6912a867246da799b7dd6499b))
|
||||
* **YouTube - Settings:** Handle on screen back swipe gesture ([#6002](https://github.com/ReVanced/revanced-patches/issues/6002)) ([6f92b6c](https://github.com/ReVanced/revanced-patches/commit/6f92b6c50beab091f5f7ef7386579eda38cb4c66))
|
||||
* **YouTube - Settings:** Use an overlay to show search results ([#5806](https://github.com/ReVanced/revanced-patches/issues/5806)) ([ece8076](https://github.com/ReVanced/revanced-patches/commit/ece8076f7cefd752b97515014bc50fe4fd80171e))
|
||||
* **YouTube - SponsorBlock:** Show category color dot in voting dialog menu ([4be00d0](https://github.com/ReVanced/revanced-patches/commit/4be00d09b7b87dcfac324de8709af06e9f730791))
|
||||
* **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))
|
||||
* **YouTube - Spoof video streams:** Update client side effects summary text ([a0a62dd](https://github.com/ReVanced/revanced-patches/commit/a0a62ddad26cfab3e04907fae5532e1ba1fdf710))
|
||||
|
||||
|
||||
### 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))
|
||||
* **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))
|
||||
* **YouTube - Hide layout components:** Add "Hide view count" and "Hide upload time" settings ([#5983](https://github.com/ReVanced/revanced-patches/issues/5983)) ([7a37d85](https://github.com/ReVanced/revanced-patches/commit/7a37d858fb937c6bdc2219103dac765b62600e6c))
|
||||
* **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))
|
||||
* **YouTube - Spoof app version:** Add spoof target `20.05.46` that fixes transcript functionality ([5823f0e](https://github.com/ReVanced/revanced-patches/commit/5823f0e982e87b4a35d30feeca8a7e16edfebc5f))
|
||||
* **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))
|
||||
* **YouTube Music:** Add `Sanitize sharing links` patch ([#5952](https://github.com/ReVanced/revanced-patches/issues/5952)) ([45c1ee8](https://github.com/ReVanced/revanced-patches/commit/45c1ee8a12dc777a371875d90741a05cf5d8e9dd))
|
||||
* **YouTube Music:** Add `Theme` patch ([#5984](https://github.com/ReVanced/revanced-patches/issues/5984)) ([3bd76d6](https://github.com/ReVanced/revanced-patches/commit/3bd76d60d664befff29c24c9de56dac1486a6e67))
|
||||
* **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.18](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.17...v5.41.0-dev.18) (2025-09-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Settings:** Handle on screen back swipe gesture ([#6002](https://github.com/ReVanced/revanced-patches/issues/6002)) ([6f92b6c](https://github.com/ReVanced/revanced-patches/commit/6f92b6c50beab091f5f7ef7386579eda38cb4c66))
|
||||
|
||||
# [5.41.0-dev.17](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.16...v5.41.0-dev.17) (2025-09-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - SponsorBlock:** Show category color dot in voting dialog menu ([4be00d0](https://github.com/ReVanced/revanced-patches/commit/4be00d09b7b87dcfac324de8709af06e9f730791))
|
||||
|
||||
# [5.41.0-dev.16](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.15...v5.41.0-dev.16) (2025-09-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube Music:** Add `Theme` patch ([#5984](https://github.com/ReVanced/revanced-patches/issues/5984)) ([3bd76d6](https://github.com/ReVanced/revanced-patches/commit/3bd76d60d664befff29c24c9de56dac1486a6e67))
|
||||
|
||||
# [5.41.0-dev.15](https://github.com/ReVanced/revanced-patches/compare/v5.41.0-dev.14...v5.41.0-dev.15) (2025-09-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube - Hide layout components:** Add "Hide view count" and "Hide upload time" settings ([#5983](https://github.com/ReVanced/revanced-patches/issues/5983)) ([7a37d85](https://github.com/ReVanced/revanced-patches/commit/7a37d858fb937c6bdc2219103dac765b62600e6c))
|
||||
|
||||
# [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)
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package app.revanced.extension.music.patches.theme;
|
||||
|
||||
import app.revanced.extension.shared.theme.BaseThemePatch;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ThemePatch extends BaseThemePatch {
|
||||
|
||||
// Color constants used in relation with litho components.
|
||||
private static final int[] DARK_VALUES = {
|
||||
0xFF212121, // Comments box background.
|
||||
0xFF030303, // Button container background in album.
|
||||
0xFF000000, // Button container background in playlist.
|
||||
};
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
* <p>
|
||||
* Change the color of Litho components.
|
||||
* If the color of the component matches one of the values, return the background color.
|
||||
*
|
||||
* @param originalValue The original color value.
|
||||
* @return The new or original color value.
|
||||
*/
|
||||
public static int getValue(int originalValue) {
|
||||
return processColorValue(originalValue, DARK_VALUES, null);
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package app.revanced.extension.shared.theme;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import app.revanced.extension.shared.Utils;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public abstract class BaseThemePatch {
|
||||
// Background colors.
|
||||
protected static final int BLACK_COLOR = Utils.getResourceColor("yt_black1");
|
||||
protected static final int WHITE_COLOR = Utils.getResourceColor("yt_white1");
|
||||
|
||||
/**
|
||||
* Check if a value matches any of the provided values.
|
||||
*
|
||||
* @param value The value to check.
|
||||
* @param of The array of values to compare against.
|
||||
* @return True if the value matches any of the provided values.
|
||||
*/
|
||||
protected static boolean anyEquals(int value, int... of) {
|
||||
for (int v : of) {
|
||||
if (value == v) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to process color values for Litho components.
|
||||
*
|
||||
* @param originalValue The original color value.
|
||||
* @param darkValues Array of dark mode color values to match.
|
||||
* @param lightValues Array of light mode color values to match.
|
||||
* @return The new or original color value.
|
||||
*/
|
||||
protected static int processColorValue(int originalValue, int[] darkValues, @Nullable int[] lightValues) {
|
||||
if (Utils.isDarkModeEnabled()) {
|
||||
if (anyEquals(originalValue, darkValues)) {
|
||||
return BLACK_COLOR;
|
||||
}
|
||||
} else if (lightValues != null && anyEquals(originalValue, lightValues)) {
|
||||
return WHITE_COLOR;
|
||||
}
|
||||
|
||||
return originalValue;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import app.revanced.extension.shared.Utils;
|
||||
import app.revanced.extension.shared.settings.Setting;
|
||||
import app.revanced.extension.youtube.settings.Settings;
|
||||
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
@SuppressWarnings({"unused", "SpellCheckingInspection"})
|
||||
public final class MiniplayerPatch {
|
||||
|
||||
/**
|
||||
@@ -129,7 +129,7 @@ public final class MiniplayerPatch {
|
||||
(CURRENT_TYPE.isModern() && Settings.MINIPLAYER_DOUBLE_TAP_ACTION.get());
|
||||
|
||||
private static final boolean DRAG_AND_DROP_ENABLED =
|
||||
CURRENT_TYPE.isModern() && Settings.MINIPLAYER_DRAG_AND_DROP.get();
|
||||
CURRENT_TYPE.isModern() && !Settings.MINIPLAYER_DISABLE_DRAG_AND_DROP.get();
|
||||
|
||||
private static final boolean HIDE_OVERLAY_BUTTONS_ENABLED =
|
||||
Settings.MINIPLAYER_HIDE_OVERLAY_BUTTONS.get()
|
||||
@@ -145,10 +145,10 @@ public final class MiniplayerPatch {
|
||||
&& (VersionCheckPatch.IS_19_34_OR_GREATER || Settings.MINIPLAYER_HIDE_REWIND_FORWARD.get());
|
||||
|
||||
private static final boolean MINIPLAYER_ROUNDED_CORNERS_ENABLED =
|
||||
CURRENT_TYPE.isModern() && Settings.MINIPLAYER_ROUNDED_CORNERS.get();
|
||||
CURRENT_TYPE.isModern() && !Settings.MINIPLAYER_DISABLE_ROUNDED_CORNERS.get();
|
||||
|
||||
private static final boolean MINIPLAYER_HORIZONTAL_DRAG_ENABLED =
|
||||
DRAG_AND_DROP_ENABLED && Settings.MINIPLAYER_HORIZONTAL_DRAG.get();
|
||||
DRAG_AND_DROP_ENABLED && !Settings.MINIPLAYER_DISABLE_HORIZONTAL_DRAG.get();
|
||||
|
||||
/**
|
||||
* Remove a broken and always present subtitle text that is only
|
||||
@@ -173,14 +173,14 @@ public final class MiniplayerPatch {
|
||||
public static final class MiniplayerHorizontalDragAvailability implements Setting.Availability {
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return Settings.MINIPLAYER_TYPE.get().isModern() && Settings.MINIPLAYER_DRAG_AND_DROP.get();
|
||||
return Settings.MINIPLAYER_TYPE.get().isModern() && !Settings.MINIPLAYER_DISABLE_DRAG_AND_DROP.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Setting<?>> getParentSettings() {
|
||||
return List.of(
|
||||
Settings.MINIPLAYER_TYPE,
|
||||
Settings.MINIPLAYER_DRAG_AND_DROP
|
||||
Settings.MINIPLAYER_DISABLE_DRAG_AND_DROP
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public final class MiniplayerPatch {
|
||||
return type == MODERN_4
|
||||
|| (!IS_19_20_OR_GREATER && (type == MODERN_1 || type == MODERN_3))
|
||||
|| (!IS_19_26_OR_GREATER && type == MODERN_1
|
||||
&& !Settings.MINIPLAYER_DOUBLE_TAP_ACTION.get() && !Settings.MINIPLAYER_DRAG_AND_DROP.get())
|
||||
&& !Settings.MINIPLAYER_DOUBLE_TAP_ACTION.get() && Settings.MINIPLAYER_DISABLE_DRAG_AND_DROP.get())
|
||||
|| (IS_19_29_OR_GREATER && type == MODERN_3);
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ public final class MiniplayerPatch {
|
||||
return List.of(
|
||||
Settings.MINIPLAYER_TYPE,
|
||||
Settings.MINIPLAYER_DOUBLE_TAP_ACTION,
|
||||
Settings.MINIPLAYER_DRAG_AND_DROP
|
||||
Settings.MINIPLAYER_DISABLE_DRAG_AND_DROP
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package app.revanced.extension.youtube.patches.components;
|
||||
import static app.revanced.extension.youtube.shared.NavigationBar.NavigationButton;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
@@ -500,4 +503,62 @@ public final class LayoutComponentsFilter extends Filter {
|
||||
// This check is important as the shelf layout is used for the library tab playlists.
|
||||
return NavigationButton.getSelectedNavigationButton() != NavigationButton.LIBRARY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*/
|
||||
public static SpannableString modifyFeedSubtitleSpan(SpannableString original, float truncationDimension) {
|
||||
try {
|
||||
final boolean hideViewCount = Settings.HIDE_VIEW_COUNT.get();
|
||||
final boolean hideUploadTime = Settings.HIDE_UPLOAD_TIME.get();
|
||||
if (!hideViewCount && !hideUploadTime) {
|
||||
return original;
|
||||
}
|
||||
|
||||
// Applies only for these specific dimensions.
|
||||
if (truncationDimension == 16f || truncationDimension == 42f) {
|
||||
String delimiter = " · ";
|
||||
final int delimiterLength = delimiter.length();
|
||||
|
||||
// Index includes the starting delimiter.
|
||||
final int viewCountStartIndex = TextUtils.indexOf(original, delimiter);
|
||||
if (viewCountStartIndex < 0) {
|
||||
return original;
|
||||
}
|
||||
|
||||
final int uploadTimeStartIndex = TextUtils.indexOf(original, delimiter,
|
||||
viewCountStartIndex + delimiterLength);
|
||||
if (uploadTimeStartIndex < 0) {
|
||||
return original;
|
||||
}
|
||||
|
||||
// Ensure there is exactly 2 delimiters.
|
||||
if (TextUtils.indexOf(original, delimiter,
|
||||
uploadTimeStartIndex + delimiterLength) >= 0) {
|
||||
return original;
|
||||
}
|
||||
|
||||
// Make a mutable copy that keeps existing span styling.
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(original);
|
||||
|
||||
// Remove the sections.
|
||||
if (hideUploadTime) {
|
||||
builder.delete(uploadTimeStartIndex, original.length());
|
||||
}
|
||||
|
||||
if (hideViewCount) {
|
||||
builder.delete(viewCountStartIndex, uploadTimeStartIndex);
|
||||
}
|
||||
|
||||
SpannableString replacement = new SpannableString(builder);
|
||||
Logger.printDebug(() -> "Replacing feed subtitle span: " + original + " with: " + replacement);
|
||||
|
||||
return replacement;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.printException(() -> "modifyFeedSubtitleSpan failure", ex);
|
||||
}
|
||||
|
||||
return original;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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_"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,13 @@
|
||||
package app.revanced.extension.youtube.patches.theme;
|
||||
|
||||
import static app.revanced.extension.youtube.patches.theme.ThemePatch.SplashScreenAnimationStyle.styleFromOrdinal;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import app.revanced.extension.shared.Logger;
|
||||
import app.revanced.extension.shared.Utils;
|
||||
import app.revanced.extension.shared.theme.BaseThemePatch;
|
||||
import app.revanced.extension.youtube.settings.Settings;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ThemePatch {
|
||||
|
||||
public class ThemePatch extends BaseThemePatch {
|
||||
public enum SplashScreenAnimationStyle {
|
||||
DEFAULT(0),
|
||||
FPS_60_ONE_SECOND(1),
|
||||
@@ -43,57 +40,39 @@ public class ThemePatch {
|
||||
}
|
||||
}
|
||||
|
||||
// color constants used in relation with litho components
|
||||
// Color constants used in relation with litho components.
|
||||
private static final int[] WHITE_VALUES = {
|
||||
-1, // comments chip background
|
||||
-394759, // music related results panel background
|
||||
-83886081, // video chapters list background
|
||||
0xFFFFFFFF, // Comments chip background.
|
||||
0xFFF9F9F9, // Music related results panel background.
|
||||
0xFAFFFFFF, // Video chapters list background.
|
||||
};
|
||||
|
||||
private static final int[] DARK_VALUES = {
|
||||
-14145496, // explore drawer background
|
||||
-14606047, // comments chip background
|
||||
-15198184, // music related results panel background
|
||||
-15790321, // comments chip background (new layout)
|
||||
-98492127 // video chapters list background
|
||||
0xFF282828, // Explore drawer background.
|
||||
0xFF212121, // Comments chip background.
|
||||
0xFF181818, // Music related results panel background.
|
||||
0xFF0F0F0F, // Comments chip background (new layout).
|
||||
0xFA212121, // Video chapters list background.
|
||||
};
|
||||
|
||||
// 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();
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*
|
||||
* <p>
|
||||
* Change the color of Litho components.
|
||||
* If the color of the component matches one of the values, return the background color .
|
||||
* If the color of the component matches one of the values, return the background color.
|
||||
*
|
||||
* @param originalValue The original color value.
|
||||
* @return The new or original color value
|
||||
* @return The new or original color value.
|
||||
*/
|
||||
public static int getValue(int originalValue) {
|
||||
if (Utils.isDarkModeEnabled()) {
|
||||
if (anyEquals(originalValue, DARK_VALUES)) return BLACK_COLOR;
|
||||
} else {
|
||||
if (anyEquals(originalValue, WHITE_VALUES)) return WHITE_COLOR;
|
||||
}
|
||||
|
||||
return originalValue;
|
||||
}
|
||||
|
||||
private static boolean anyEquals(int value, int... of) {
|
||||
for (int v : of) if (value == v) return true;
|
||||
|
||||
return false;
|
||||
return processColorValue(originalValue, DARK_VALUES, WHITE_VALUES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*/
|
||||
public static boolean gradientLoadingScreenEnabled(boolean original) {
|
||||
return GRADIENT_LOADING_SCREEN_ENABLED;
|
||||
return Settings.GRADIENT_LOADING_SCREEN.get();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,7 +87,7 @@ public class ThemePatch {
|
||||
final int replacement = style.style;
|
||||
if (original != replacement) {
|
||||
Logger.printDebug(() -> "Overriding splash screen style from: "
|
||||
+ styleFromOrdinal(original) + " to: " + style);
|
||||
+ SplashScreenAnimationStyle.styleFromOrdinal(original) + " to: " + style);
|
||||
}
|
||||
|
||||
return replacement;
|
||||
|
||||
@@ -11,6 +11,10 @@ import static app.revanced.extension.youtube.patches.ChangeHeaderPatch.HeaderLog
|
||||
import static app.revanced.extension.youtube.patches.ChangeStartPagePatch.ChangeStartPageTypeAvailability;
|
||||
import static app.revanced.extension.youtube.patches.ChangeStartPagePatch.StartPage;
|
||||
import static app.revanced.extension.youtube.patches.ExitFullscreenPatch.FullscreenMode;
|
||||
import static app.revanced.extension.youtube.patches.MiniplayerPatch.MiniplayerAnyModernAvailability;
|
||||
import static app.revanced.extension.youtube.patches.MiniplayerPatch.MiniplayerHideOverlayButtonsAvailability;
|
||||
import static app.revanced.extension.youtube.patches.MiniplayerPatch.MiniplayerHideRewindOrOverlayOpacityAvailability;
|
||||
import static app.revanced.extension.youtube.patches.MiniplayerPatch.MiniplayerHideSubtextsAvailability;
|
||||
import static app.revanced.extension.youtube.patches.MiniplayerPatch.MiniplayerHorizontalDragAvailability;
|
||||
import static app.revanced.extension.youtube.patches.MiniplayerPatch.MiniplayerType;
|
||||
import static app.revanced.extension.youtube.patches.MiniplayerPatch.MiniplayerType.MINIMAL;
|
||||
@@ -48,6 +52,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 +63,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);
|
||||
@@ -111,7 +116,9 @@ public class Settings extends BaseSettings {
|
||||
public static final BooleanSetting HIDE_SHOW_MORE_BUTTON = new BooleanSetting("revanced_hide_show_more_button", TRUE, true);
|
||||
public static final BooleanSetting HIDE_SURVEYS = new BooleanSetting("revanced_hide_surveys", TRUE);
|
||||
public static final BooleanSetting HIDE_TICKET_SHELF = new BooleanSetting("revanced_hide_ticket_shelf", FALSE);
|
||||
public static final BooleanSetting HIDE_UPLOAD_TIME = new BooleanSetting("revanced_hide_upload_time", FALSE, "revanced_hide_upload_time_user_dialog_message");
|
||||
public static final BooleanSetting HIDE_VIDEO_RECOMMENDATION_LABELS = new BooleanSetting("revanced_hide_video_recommendation_labels", TRUE);
|
||||
public static final BooleanSetting HIDE_VIEW_COUNT = new BooleanSetting("revanced_hide_view_count", FALSE, "revanced_hide_view_count_user_dialog_message");
|
||||
|
||||
// Alternative thumbnails
|
||||
public static final EnumSetting<ThumbnailOption> ALT_THUMBNAIL_HOME = new EnumSetting<>("revanced_alt_thumbnail_home", ThumbnailOption.ORIGINAL);
|
||||
@@ -174,15 +181,15 @@ public class Settings extends BaseSettings {
|
||||
|
||||
// Miniplayer
|
||||
public static final EnumSetting<MiniplayerType> MINIPLAYER_TYPE = new EnumSetting<>("revanced_miniplayer_type", MiniplayerType.DEFAULT, true);
|
||||
public static final BooleanSetting MINIPLAYER_DOUBLE_TAP_ACTION = new BooleanSetting("revanced_miniplayer_double_tap_action", TRUE, true, new MiniplayerPatch.MiniplayerAnyModernAvailability());
|
||||
public static final BooleanSetting MINIPLAYER_DRAG_AND_DROP = new BooleanSetting("revanced_miniplayer_drag_and_drop", TRUE, true, new MiniplayerPatch.MiniplayerAnyModernAvailability());
|
||||
public static final BooleanSetting MINIPLAYER_HORIZONTAL_DRAG = new BooleanSetting("revanced_miniplayer_horizontal_drag", FALSE, true, new MiniplayerHorizontalDragAvailability());
|
||||
public static final BooleanSetting MINIPLAYER_HIDE_OVERLAY_BUTTONS = new BooleanSetting("revanced_miniplayer_hide_overlay_buttons", FALSE, true, new MiniplayerPatch.MiniplayerHideOverlayButtonsAvailability());
|
||||
public static final BooleanSetting MINIPLAYER_HIDE_SUBTEXT = new BooleanSetting("revanced_miniplayer_hide_subtext", FALSE, true, new MiniplayerPatch.MiniplayerHideSubtextsAvailability());
|
||||
public static final BooleanSetting MINIPLAYER_DISABLE_DRAG_AND_DROP = new BooleanSetting("revanced_miniplayer_disable_drag_and_drop", FALSE, true, new MiniplayerAnyModernAvailability());
|
||||
public static final BooleanSetting MINIPLAYER_DISABLE_HORIZONTAL_DRAG = new BooleanSetting("revanced_miniplayer_disable_horizontal_drag", FALSE, true, new MiniplayerHorizontalDragAvailability());
|
||||
public static final BooleanSetting MINIPLAYER_DISABLE_ROUNDED_CORNERS = new BooleanSetting("revanced_miniplayer_disable_rounded_corners", FALSE, true, new MiniplayerAnyModernAvailability());
|
||||
public static final BooleanSetting MINIPLAYER_DOUBLE_TAP_ACTION = new BooleanSetting("revanced_miniplayer_double_tap_action", TRUE, true, new MiniplayerAnyModernAvailability());
|
||||
public static final BooleanSetting MINIPLAYER_HIDE_OVERLAY_BUTTONS = new BooleanSetting("revanced_miniplayer_hide_overlay_buttons", FALSE, true, new MiniplayerHideOverlayButtonsAvailability());
|
||||
public static final BooleanSetting MINIPLAYER_HIDE_SUBTEXT = new BooleanSetting("revanced_miniplayer_hide_subtext", FALSE, true, new MiniplayerHideSubtextsAvailability());
|
||||
public static final BooleanSetting MINIPLAYER_HIDE_REWIND_FORWARD = new BooleanSetting("revanced_miniplayer_hide_rewind_forward", TRUE, true, new MiniplayerPatch.MiniplayerHideRewindOrOverlayOpacityAvailability());
|
||||
public static final BooleanSetting MINIPLAYER_ROUNDED_CORNERS = new BooleanSetting("revanced_miniplayer_rounded_corners", TRUE, true, new MiniplayerPatch.MiniplayerAnyModernAvailability());
|
||||
public static final IntegerSetting MINIPLAYER_WIDTH_DIP = new IntegerSetting("revanced_miniplayer_width_dip", 192, true, new MiniplayerPatch.MiniplayerAnyModernAvailability());
|
||||
public static final IntegerSetting MINIPLAYER_OPACITY = new IntegerSetting("revanced_miniplayer_opacity", 100, true, new MiniplayerPatch.MiniplayerHideRewindOrOverlayOpacityAvailability());
|
||||
public static final IntegerSetting MINIPLAYER_WIDTH_DIP = new IntegerSetting("revanced_miniplayer_width_dip", 192, true, new MiniplayerAnyModernAvailability());
|
||||
public static final IntegerSetting MINIPLAYER_OPACITY = new IntegerSetting("revanced_miniplayer_opacity", 100, true, new MiniplayerHideRewindOrOverlayOpacityAvailability());
|
||||
|
||||
// External downloader
|
||||
public static final BooleanSetting EXTERNAL_DOWNLOADER = new BooleanSetting("revanced_external_downloader", FALSE);
|
||||
@@ -198,9 +205,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 +348,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 +451,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);
|
||||
|
||||
@@ -152,7 +152,7 @@ public class YouTubeActivityHook extends BaseActivityHook {
|
||||
* @return if the original activity finish method should be allowed to run.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static boolean handleFinish() {
|
||||
public static boolean handleBackPress() {
|
||||
return YouTubeSearchViewController.handleFinish(searchViewController);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
@@ -302,7 +302,7 @@ public class SponsorBlockUtils {
|
||||
|
||||
SpannableStringBuilder spannableBuilder = new SpannableStringBuilder();
|
||||
|
||||
spannableBuilder.append(segment.category.getTitle().toString());
|
||||
spannableBuilder.append(segment.category.getTitleWithColorDot());
|
||||
spannableBuilder.append('\n');
|
||||
|
||||
String startTime = formatSegmentTime(segment.start);
|
||||
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.1-dev.2
|
||||
|
||||
@@ -388,6 +388,10 @@ public final class app/revanced/patches/music/layout/premium/HideGetPremiumPatch
|
||||
public static final fun getHideGetPremiumPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/music/layout/theme/ThemePatchKt {
|
||||
public static final fun getThemePatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/music/layout/upgradebutton/HideUpgradeButtonPatchKt {
|
||||
public static final fun getHideUpgradeButton ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
public static final fun getRemoveUpgradeButton ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
@@ -405,6 +409,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;
|
||||
}
|
||||
@@ -729,6 +737,11 @@ public final class app/revanced/patches/serviceportalbund/detection/root/RootDet
|
||||
public static final fun getRootDetectionPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/shared/layout/theme/LithoColorHookPatchKt {
|
||||
public static final fun getLithoColorHookPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
public static final fun getLithoColorOverrideHook ()Lkotlin/jvm/functions/Function2;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/shared/misc/checks/BaseCheckEnvironmentPatchKt {
|
||||
public static final fun checkEnvironmentPatch (Lapp/revanced/patcher/Fingerprint;Lapp/revanced/patcher/patch/Patch;[Ljava/lang/String;)Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
@@ -1169,6 +1182,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 +1627,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 +1736,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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||
import app.revanced.patches.music.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.music.misc.settings.PreferenceScreen
|
||||
import app.revanced.patches.music.misc.settings.settingsPatch
|
||||
import app.revanced.patches.shared.misc.mapping.get
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappings
|
||||
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
|
||||
@@ -29,6 +32,7 @@ val hideCastButton = bytecodePatch(
|
||||
sharedExtensionPatch,
|
||||
settingsPatch,
|
||||
addResourcesPatch,
|
||||
resourceMappingPatch
|
||||
)
|
||||
|
||||
compatibleWith(
|
||||
@@ -39,6 +43,8 @@ val hideCastButton = bytecodePatch(
|
||||
)
|
||||
|
||||
execute {
|
||||
playerOverlayChip = resourceMappings["id", "player_overlay_chip"]
|
||||
|
||||
addResources("music", "layout.castbutton.hideCastButton")
|
||||
|
||||
PreferenceScreen.GENERAL.addPreferences(
|
||||
@@ -59,7 +65,7 @@ val hideCastButton = bytecodePatch(
|
||||
|
||||
playerOverlayChipFingerprint.method.apply {
|
||||
val resourceIndex = indexOfFirstLiteralInstructionOrThrow(playerOverlayChip)
|
||||
val targetIndex = indexOfFirstInstructionOrThrow(resourceIndex, Opcode.MOVE_RESULT)
|
||||
val targetIndex = indexOfFirstInstructionOrThrow(resourceIndex, Opcode.MOVE_RESULT_OBJECT)
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
|
||||
@@ -4,6 +4,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
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.music.misc.extension.sharedExtensionPatch
|
||||
@@ -35,7 +36,23 @@ val navigationBarPatch = bytecodePatch(
|
||||
resourceMappingPatch,
|
||||
sharedExtensionPatch,
|
||||
settingsPatch,
|
||||
addResourcesPatch
|
||||
addResourcesPatch,
|
||||
resourcePatch {
|
||||
execute {
|
||||
// Ensure the first ImageView has 'layout_weight' to stay properly sized
|
||||
// when the TextView is hidden.
|
||||
document("res/layout/image_with_text_tab.xml").use { document ->
|
||||
val imageView = document.getElementsByTagName("ImageView").item(0)
|
||||
imageView?.let {
|
||||
if (it.attributes.getNamedItem("android:layout_weight") == null) {
|
||||
val attr = document.createAttribute("android:layout_weight")
|
||||
attr.value = "0.5"
|
||||
it.attributes.setNamedItem(attr)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
compatibleWith(
|
||||
@@ -46,10 +63,7 @@ val navigationBarPatch = bytecodePatch(
|
||||
)
|
||||
|
||||
execute {
|
||||
text1 = resourceMappings[
|
||||
"id",
|
||||
"text1",
|
||||
]
|
||||
text1 = resourceMappings["id", "text1"]
|
||||
|
||||
addResources("music", "layout.navigationbar.navigationBarPatch")
|
||||
|
||||
@@ -71,9 +85,7 @@ val navigationBarPatch = bytecodePatch(
|
||||
)
|
||||
|
||||
tabLayoutTextFingerprint.method.apply {
|
||||
/**
|
||||
* Hide navigation labels.
|
||||
*/
|
||||
// Hide navigation labels.
|
||||
val constIndex = indexOfFirstLiteralInstructionOrThrow(text1)
|
||||
val targetIndex = indexOfFirstInstructionOrThrow(constIndex, Opcode.CHECK_CAST)
|
||||
val targetParameter = getInstruction<ReferenceInstruction>(targetIndex).reference
|
||||
@@ -87,9 +99,7 @@ val navigationBarPatch = bytecodePatch(
|
||||
"invoke-static { v$targetRegister }, $EXTENSION_CLASS_DESCRIPTOR->hideNavigationLabel(Landroid/widget/TextView;)V"
|
||||
)
|
||||
|
||||
/**
|
||||
* Set navigation enum and hide navigation buttons.
|
||||
*/
|
||||
// Set navigation enum and hide navigation buttons.
|
||||
val enumIndex = tabLayoutTextFingerprint.patternMatch!!.startIndex + 3
|
||||
val enumRegister = getInstruction<OneRegisterInstruction>(enumIndex).registerA
|
||||
val insertEnumIndex = indexOfFirstInstructionOrThrow(Opcode.AND_INT_LIT8) - 2
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package app.revanced.patches.music.layout.theme
|
||||
|
||||
import app.revanced.patches.music.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.shared.layout.theme.THEME_DEFAULT_DARK_COLOR_NAMES
|
||||
import app.revanced.patches.shared.layout.theme.baseThemePatch
|
||||
import app.revanced.patches.shared.layout.theme.baseThemeResourcePatch
|
||||
import app.revanced.patches.shared.layout.theme.darkThemeBackgroundColorOption
|
||||
import app.revanced.patches.shared.misc.settings.overrideThemeColors
|
||||
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/music/patches/theme/ThemePatch;"
|
||||
|
||||
@Suppress("unused")
|
||||
val themePatch = baseThemePatch(
|
||||
extensionClassDescriptor = EXTENSION_CLASS_DESCRIPTOR,
|
||||
|
||||
block = {
|
||||
dependsOn(
|
||||
sharedExtensionPatch,
|
||||
baseThemeResourcePatch(
|
||||
darkColorNames = THEME_DEFAULT_DARK_COLOR_NAMES + setOf(
|
||||
"yt_black_pure",
|
||||
"yt_black_pure_opacity80",
|
||||
"ytm_color_grey_12",
|
||||
"material_grey_800"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
compatibleWith(
|
||||
"com.google.android.apps.youtube.music"(
|
||||
"7.29.52",
|
||||
"8.10.52"
|
||||
)
|
||||
)
|
||||
},
|
||||
|
||||
executeBlock = {
|
||||
overrideThemeColors(
|
||||
null,
|
||||
darkThemeBackgroundColorOption.value!!
|
||||
)
|
||||
}
|
||||
)
|
||||
@@ -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
|
||||
)
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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()
|
||||
@@ -106,7 +108,8 @@ val settingsPatch = bytecodePatch(
|
||||
modifyActivityForSettingsInjection(
|
||||
googleApiActivityFingerprint.classDef,
|
||||
googleApiActivityFingerprint.method,
|
||||
GOOGLE_API_ACTIVITY_HOOK_CLASS_DESCRIPTOR
|
||||
GOOGLE_API_ACTIVITY_HOOK_CLASS_DESCRIPTOR,
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package app.revanced.patches.shared.layout.theme
|
||||
|
||||
import app.revanced.patcher.patch.BytecodePatchBuilder
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.resourcePatch
|
||||
import app.revanced.patcher.patch.stringOption
|
||||
import app.revanced.util.childElementsSequence
|
||||
import java.util.Locale
|
||||
|
||||
internal const val THEME_COLOR_OPTION_DESCRIPTION = "Can be a hex color (#RRGGBB) or a color resource reference."
|
||||
|
||||
internal val THEME_DEFAULT_DARK_COLOR_NAMES = setOf(
|
||||
"yt_black0", "yt_black1", "yt_black1_opacity95", "yt_black1_opacity98",
|
||||
"yt_black2", "yt_black3", "yt_black4", "yt_status_bar_background_dark",
|
||||
"material_grey_850"
|
||||
)
|
||||
|
||||
internal val THEME_DEFAULT_LIGHT_COLOR_NAMES = setOf(
|
||||
"yt_white1", "yt_white1_opacity95", "yt_white1_opacity98",
|
||||
"yt_white2", "yt_white3", "yt_white4"
|
||||
)
|
||||
|
||||
/**
|
||||
* @param colorString #AARRGGBB #RRGGBB, or an Android color resource name.
|
||||
*/
|
||||
internal fun validateColorName(colorString: String): Boolean {
|
||||
if (colorString.startsWith("#")) {
|
||||
// #RRGGBB or #AARRGGBB
|
||||
val hex = colorString.substring(1).uppercase(Locale.US)
|
||||
|
||||
if (hex.length == 8) {
|
||||
// Transparent colors will crash the app.
|
||||
if (hex[0] != 'F' || hex[1] != 'F') {
|
||||
return false
|
||||
}
|
||||
} else if (hex.length != 6) {
|
||||
return false
|
||||
}
|
||||
|
||||
return hex.all { it.isDigit() || it in 'A'..'F' }
|
||||
}
|
||||
|
||||
if (colorString.startsWith("@android:color/")) {
|
||||
// Cannot easily validate Android built-in colors, so assume it's a correct color.
|
||||
return true
|
||||
}
|
||||
|
||||
// Allow any color name, because if it's invalid it will
|
||||
// throw an exception during resource compilation.
|
||||
return colorString.startsWith("@color/")
|
||||
}
|
||||
|
||||
/**
|
||||
* Dark theme color option for YouTube and YT Music Theme patches.
|
||||
*/
|
||||
internal val darkThemeBackgroundColorOption = stringOption(
|
||||
key = "darkThemeBackgroundColor",
|
||||
default = "@android:color/black",
|
||||
values = mapOf(
|
||||
"Pure black" to "@android:color/black",
|
||||
"Material You" to "@android:color/system_neutral1_900",
|
||||
"Classic (old YouTube)" to "#212121",
|
||||
"Catppuccin (Mocha)" to "#181825",
|
||||
"Dark pink" to "#290025",
|
||||
"Dark blue" to "#001029",
|
||||
"Dark green" to "#002905",
|
||||
"Dark yellow" to "#282900",
|
||||
"Dark orange" to "#291800",
|
||||
"Dark red" to "#290000",
|
||||
),
|
||||
title = "Dark theme background color",
|
||||
description = THEME_COLOR_OPTION_DESCRIPTION
|
||||
)
|
||||
|
||||
/**
|
||||
* Shared theme patch for YouTube and YT Music.
|
||||
*/
|
||||
internal fun baseThemePatch(
|
||||
extensionClassDescriptor: String,
|
||||
block: BytecodePatchBuilder.() -> Unit = {},
|
||||
executeBlock: BytecodePatchContext.() -> Unit = {}
|
||||
) = bytecodePatch(
|
||||
name = "Theme",
|
||||
description = "Adds options for theming and applies a custom background theme " +
|
||||
"(dark background theme defaults to pure black).",
|
||||
) {
|
||||
darkThemeBackgroundColorOption()
|
||||
|
||||
block()
|
||||
|
||||
dependsOn(lithoColorHookPatch)
|
||||
|
||||
execute {
|
||||
executeBlock()
|
||||
|
||||
lithoColorOverrideHook(extensionClassDescriptor, "getValue")
|
||||
}
|
||||
}
|
||||
|
||||
internal fun baseThemeResourcePatch(
|
||||
darkColorNames: Set<String> = THEME_DEFAULT_DARK_COLOR_NAMES,
|
||||
lightColorNames: Set<String> = THEME_DEFAULT_LIGHT_COLOR_NAMES,
|
||||
lightColorReplacement: (() -> String)? = null
|
||||
) = resourcePatch {
|
||||
|
||||
execute {
|
||||
// After patch option validators are fixed https://github.com/ReVanced/revanced-patcher/issues/372
|
||||
// This should changed to a patch option validator.
|
||||
val darkColor by darkThemeBackgroundColorOption
|
||||
if (!validateColorName(darkColor!!)) {
|
||||
throw PatchException("Invalid dark theme color: $darkColor")
|
||||
}
|
||||
|
||||
val lightColor = lightColorReplacement?.invoke()
|
||||
if (lightColor != null && !validateColorName(lightColor)) {
|
||||
throw PatchException("Invalid light theme color: $lightColor")
|
||||
}
|
||||
|
||||
document("res/values/colors.xml").use { document ->
|
||||
val resourcesNode = document.getElementsByTagName("resources").item(0)
|
||||
|
||||
resourcesNode.childElementsSequence().forEach { node ->
|
||||
val name = node.getAttribute("name")
|
||||
when {
|
||||
name in darkColorNames -> node.textContent = darkColor
|
||||
lightColor != null && name in lightColorNames -> node.textContent = lightColor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package app.revanced.patches.shared.layout.theme
|
||||
|
||||
import app.revanced.patcher.fingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val lithoOnBoundsChangeFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.PROTECTED, AccessFlags.FINAL)
|
||||
returns("V")
|
||||
parameters("Landroid/graphics/Rect;")
|
||||
opcodes(
|
||||
Opcode.IGET,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.RETURN_VOID,
|
||||
)
|
||||
custom { method, _ ->
|
||||
method.name == "onBoundsChange"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package app.revanced.patches.shared.layout.theme
|
||||
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
|
||||
lateinit var lithoColorOverrideHook: (targetMethodClass: String, targetMethodName: String) -> Unit
|
||||
private set
|
||||
|
||||
val lithoColorHookPatch = bytecodePatch(
|
||||
description = "Adds a hook to set color of Litho components.",
|
||||
) {
|
||||
|
||||
execute {
|
||||
var insertionIndex = lithoOnBoundsChangeFingerprint.patternMatch!!.endIndex - 1
|
||||
|
||||
lithoColorOverrideHook = { targetMethodClass, targetMethodName ->
|
||||
lithoOnBoundsChangeFingerprint.method.addInstructions(
|
||||
insertionIndex,
|
||||
"""
|
||||
invoke-static { p1 }, $targetMethodClass->$targetMethodName(I)I
|
||||
move-result p1
|
||||
"""
|
||||
)
|
||||
insertionIndex += 2
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ internal fun sanitizeSharingLinksPatch(
|
||||
replaceMusicLinksWithYouTube: Boolean = false
|
||||
) = bytecodePatch(
|
||||
name = "Sanitize sharing links",
|
||||
description = "Adds an option to remove the tracking parameter from links you share.",
|
||||
description = "Adds an option to remove the tracking query parameter from shared links.",
|
||||
) {
|
||||
block()
|
||||
|
||||
|
||||
@@ -18,32 +18,34 @@ 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>,
|
||||
) = settingsPatch(listOf(rootPreference), preferences)
|
||||
|
||||
private var themeForegroundColor : String? = null
|
||||
private var themeBackgroundColor : String? = null
|
||||
private var lightThemeColor : String? = null
|
||||
private var darkThemeColor : String? = null
|
||||
|
||||
/**
|
||||
* Sets the default theme colors used in various ReVanced specific settings menus.
|
||||
* By default these colors are white and black, but instead can be set to the
|
||||
* same color the target app uses for it's own settings.
|
||||
*/
|
||||
fun overrideThemeColors(foregroundColor: String, backgroundColor: String) {
|
||||
themeForegroundColor = foregroundColor
|
||||
themeBackgroundColor = backgroundColor
|
||||
fun overrideThemeColors(lightThemeColorString: String?, darkThemeColorString: String) {
|
||||
lightThemeColor = lightThemeColorString
|
||||
darkThemeColor = darkThemeColorString
|
||||
}
|
||||
|
||||
private val settingsColorPatch = bytecodePatch {
|
||||
finalize {
|
||||
if (themeForegroundColor != null) {
|
||||
themeLightColorResourceNameFingerprint.method.returnEarly(themeForegroundColor!!)
|
||||
if (lightThemeColor != null) {
|
||||
themeLightColorResourceNameFingerprint.method.returnEarly(lightThemeColor!!)
|
||||
}
|
||||
if (themeBackgroundColor != null) {
|
||||
themeDarkColorResourceNameFingerprint.method.returnEarly(themeBackgroundColor!!)
|
||||
if (darkThemeColor != null) {
|
||||
themeDarkColorResourceNameFingerprint.method.returnEarly(darkThemeColor!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -147,3 +147,17 @@ internal val showFloatingMicrophoneButtonFingerprint = fingerprint {
|
||||
)
|
||||
literal { fabButtonId }
|
||||
}
|
||||
|
||||
internal val hideViewCountFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.STATIC)
|
||||
returns("Ljava/lang/CharSequence;")
|
||||
|
||||
opcodes(
|
||||
Opcode.RETURN_OBJECT,
|
||||
Opcode.CONST_STRING,
|
||||
Opcode.RETURN_OBJECT,
|
||||
)
|
||||
strings(
|
||||
"Has attachmentRuns but drawableRequester is missing.",
|
||||
)
|
||||
}
|
||||
@@ -36,6 +36,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
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.MethodReference
|
||||
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
|
||||
|
||||
var expandButtonDownId = -1L
|
||||
private set
|
||||
@@ -127,7 +128,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 +162,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,
|
||||
),
|
||||
@@ -240,6 +240,8 @@ val hideLayoutComponentsPatch = bytecodePatch(
|
||||
SwitchPreference("revanced_hide_surveys"),
|
||||
SwitchPreference("revanced_hide_ticket_shelf"),
|
||||
SwitchPreference("revanced_hide_video_recommendation_labels"),
|
||||
SwitchPreference("revanced_hide_view_count"),
|
||||
SwitchPreference("revanced_hide_upload_time"),
|
||||
SwitchPreference("revanced_hide_doodles"),
|
||||
)
|
||||
|
||||
@@ -398,6 +400,39 @@ val hideLayoutComponentsPatch = bytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
|
||||
// region hide view count
|
||||
|
||||
hideViewCountFingerprint.method.apply {
|
||||
val startIndex = hideViewCountFingerprint.patternMatch!!.startIndex
|
||||
var returnStringRegister = getInstruction<OneRegisterInstruction>(startIndex).registerA
|
||||
|
||||
// Find the instruction where the text dimension is retrieved.
|
||||
val applyDimensionIndex = indexOfFirstInstructionReversedOrThrow {
|
||||
val reference = getReference<MethodReference>()
|
||||
opcode == Opcode.INVOKE_STATIC &&
|
||||
reference?.definingClass == "Landroid/util/TypedValue;" &&
|
||||
reference.returnType == "F" &&
|
||||
reference.name == "applyDimension" &&
|
||||
reference.parameterTypes == listOf("I", "F", "Landroid/util/DisplayMetrics;")
|
||||
}
|
||||
|
||||
// A float value is passed which is used to determine subtitle text size.
|
||||
val floatDimensionRegister = getInstruction<OneRegisterInstruction>(
|
||||
applyDimensionIndex + 1
|
||||
).registerA
|
||||
|
||||
addInstructions(
|
||||
applyDimensionIndex - 1,
|
||||
"""
|
||||
invoke-static { v$returnStringRegister, v$floatDimensionRegister }, $LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR->modifyFeedSubtitleSpan(Landroid/text/SpannableString;F)Landroid/text/SpannableString;
|
||||
move-result-object v$returnStringRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region hide filter bar
|
||||
|
||||
/**
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
@@ -187,15 +186,15 @@ val miniplayerPatch = bytecodePatch(
|
||||
if (!is_19_29_or_greater) {
|
||||
preferences += SwitchPreference("revanced_miniplayer_double_tap_action")
|
||||
}
|
||||
preferences += SwitchPreference("revanced_miniplayer_drag_and_drop")
|
||||
preferences += SwitchPreference("revanced_miniplayer_disable_drag_and_drop")
|
||||
}
|
||||
|
||||
if (is_19_43_or_greater) {
|
||||
preferences += SwitchPreference("revanced_miniplayer_horizontal_drag")
|
||||
preferences += SwitchPreference("revanced_miniplayer_disable_horizontal_drag")
|
||||
}
|
||||
|
||||
if (is_19_36_or_greater) {
|
||||
preferences += SwitchPreference("revanced_miniplayer_rounded_corners")
|
||||
preferences += SwitchPreference("revanced_miniplayer_disable_rounded_corners")
|
||||
}
|
||||
|
||||
preferences += SwitchPreference("revanced_miniplayer_hide_subtext")
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -10,13 +10,12 @@ import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.resourcePatch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patches.shared.layout.theme.lithoColorHookPatch
|
||||
import app.revanced.patches.shared.layout.theme.lithoColorOverrideHook
|
||||
import app.revanced.patches.shared.misc.mapping.get
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappings
|
||||
import app.revanced.patches.youtube.layout.theme.lithoColorHookPatch
|
||||
import app.revanced.patches.youtube.layout.theme.lithoColorOverrideHook
|
||||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_25_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_34_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_46_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_49_or_greater
|
||||
@@ -108,11 +107,6 @@ private val seekbarColorResourcePatch = resourcePatch {
|
||||
scaleNode.replaceChild(replacementNode, shapeNode)
|
||||
}
|
||||
|
||||
|
||||
if (!is_19_25_or_greater) {
|
||||
return@execute
|
||||
}
|
||||
|
||||
ytYoutubeMagentaColorId = resourceMappings[
|
||||
"color",
|
||||
"yt_youtube_magenta",
|
||||
@@ -260,10 +254,6 @@ val seekbarColorPatch = bytecodePatch(
|
||||
|
||||
lithoColorOverrideHook(EXTENSION_CLASS_DESCRIPTOR, "getLithoColor")
|
||||
|
||||
if (!is_19_25_or_greater) {
|
||||
return@execute
|
||||
}
|
||||
|
||||
// 19.25+ changes
|
||||
|
||||
arrayOf(
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -3,27 +3,6 @@ package app.revanced.patches.youtube.layout.theme
|
||||
import app.revanced.patcher.fingerprint
|
||||
import app.revanced.patches.youtube.shared.YOUTUBE_MAIN_ACTIVITY_CLASS_TYPE
|
||||
import app.revanced.util.literal
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal val lithoThemeFingerprint = fingerprint {
|
||||
accessFlags(AccessFlags.PROTECTED, AccessFlags.FINAL)
|
||||
returns("V")
|
||||
parameters("Landroid/graphics/Rect;")
|
||||
opcodes(
|
||||
Opcode.IGET,
|
||||
Opcode.IF_EQZ,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT,
|
||||
Opcode.IF_NEZ,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.RETURN_VOID,
|
||||
)
|
||||
custom { method, _ ->
|
||||
method.name == "onBoundsChange"
|
||||
}
|
||||
}
|
||||
|
||||
internal const val GRADIENT_LOADING_SCREEN_AB_CONSTANT = 45412406L
|
||||
|
||||
|
||||
@@ -1,28 +1,19 @@
|
||||
package app.revanced.patches.youtube.layout.theme
|
||||
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
|
||||
|
||||
@Deprecated("Function was moved", ReplaceWith("app.revanced.patches.shared.layout.theme.lithoColorOverrideHook"))
|
||||
@Suppress("unused")
|
||||
lateinit var lithoColorOverrideHook: (targetMethodClass: String, targetMethodName: String) -> Unit
|
||||
private set
|
||||
|
||||
val lithoColorHookPatch = bytecodePatch(
|
||||
description = "Adds a hook to set color of Litho components.",
|
||||
) {
|
||||
@Deprecated("Patch was moved", ReplaceWith("app.revanced.patches.shared.layout.theme.lithoColorHookPatch"))
|
||||
@Suppress("unused")
|
||||
val lithoColorHookPatch = bytecodePatch{
|
||||
dependsOn(app.revanced.patches.shared.layout.theme.lithoColorHookPatch)
|
||||
|
||||
execute {
|
||||
|
||||
var insertionIndex = lithoThemeFingerprint.patternMatch!!.endIndex - 1
|
||||
|
||||
lithoColorOverrideHook = { targetMethodClass, targetMethodName ->
|
||||
lithoThemeFingerprint.method.addInstructions(
|
||||
insertionIndex,
|
||||
"""
|
||||
invoke-static { p1 }, $targetMethodClass->$targetMethodName(I)I
|
||||
move-result p1
|
||||
""",
|
||||
)
|
||||
insertionIndex += 2
|
||||
}
|
||||
lithoColorOverrideHook = app.revanced.patches.shared.layout.theme.lithoColorOverrideHook
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package app.revanced.patches.youtube.layout.theme
|
||||
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.resourcePatch
|
||||
import app.revanced.patcher.patch.stringOption
|
||||
import app.revanced.patches.all.misc.resources.addResources
|
||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||
import app.revanced.patches.shared.layout.theme.THEME_COLOR_OPTION_DESCRIPTION
|
||||
import app.revanced.patches.shared.layout.theme.baseThemePatch
|
||||
import app.revanced.patches.shared.layout.theme.baseThemeResourcePatch
|
||||
import app.revanced.patches.shared.layout.theme.darkThemeBackgroundColorOption
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
||||
import app.revanced.patches.shared.misc.settings.overrideThemeColors
|
||||
import app.revanced.patches.shared.misc.settings.preference.BasePreference
|
||||
import app.revanced.patches.shared.misc.settings.preference.InputType
|
||||
import app.revanced.patches.shared.misc.settings.preference.ListPreference
|
||||
import app.revanced.patches.shared.misc.settings.preference.PreferenceCategory
|
||||
@@ -17,126 +19,54 @@ import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
||||
import app.revanced.patches.shared.misc.settings.preference.TextPreference
|
||||
import app.revanced.patches.youtube.layout.seekbar.seekbarColorPatch
|
||||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_25_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_47_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
|
||||
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
||||
import app.revanced.util.childElementsSequence
|
||||
import app.revanced.util.forEachChildElement
|
||||
import app.revanced.util.insertLiteralOverride
|
||||
import org.w3c.dom.Element
|
||||
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/theme/ThemePatch;"
|
||||
|
||||
val themePatch = bytecodePatch(
|
||||
name = "Theme",
|
||||
description = "Adds options for theming and applies a custom background theme " +
|
||||
"(dark background theme defaults to amoled black).",
|
||||
) {
|
||||
val amoledBlackColor = "@android:color/black"
|
||||
val whiteColor = "@android:color/white"
|
||||
val themePatch = baseThemePatch(
|
||||
extensionClassDescriptor = EXTENSION_CLASS_DESCRIPTOR,
|
||||
|
||||
val darkThemeBackgroundColor by stringOption(
|
||||
key = "darkThemeBackgroundColor",
|
||||
default = amoledBlackColor,
|
||||
values = mapOf(
|
||||
"Amoled black" to amoledBlackColor,
|
||||
"Material You" to "@android:color/system_neutral1_900",
|
||||
"Classic (old YouTube)" to "#FF212121",
|
||||
"Catppuccin (Mocha)" to "#FF181825",
|
||||
"Dark pink" to "#FF290025",
|
||||
"Dark blue" to "#FF001029",
|
||||
"Dark green" to "#FF002905",
|
||||
"Dark yellow" to "#FF282900",
|
||||
"Dark orange" to "#FF291800",
|
||||
"Dark red" to "#FF290000",
|
||||
),
|
||||
title = "Dark theme background color",
|
||||
description = "Can be a hex color (#AARRGGBB) or a color resource reference.",
|
||||
)
|
||||
block = {
|
||||
val lightThemeBackgroundColor by stringOption(
|
||||
key = "lightThemeBackgroundColor",
|
||||
default = "@android:color/white",
|
||||
values = mapOf(
|
||||
"White" to "@android:color/white",
|
||||
"Material You" to "@android:color/system_neutral1_50",
|
||||
"Catppuccin (Latte)" to "#E6E9EF",
|
||||
"Light pink" to "#FCCFF3",
|
||||
"Light blue" to "#D1E0FF",
|
||||
"Light green" to "#CCFFCC",
|
||||
"Light yellow" to "#FDFFCC",
|
||||
"Light orange" to "#FFE6CC",
|
||||
"Light red" to "#FFD6D6",
|
||||
),
|
||||
title = "Light theme background color",
|
||||
description = THEME_COLOR_OPTION_DESCRIPTION
|
||||
)
|
||||
|
||||
val lightThemeBackgroundColor by stringOption(
|
||||
key = "lightThemeBackgroundColor",
|
||||
default = whiteColor,
|
||||
values = mapOf(
|
||||
"White" to whiteColor,
|
||||
"Material You" to "@android:color/system_neutral1_50",
|
||||
"Catppuccin (Latte)" to "#FFE6E9EF",
|
||||
"Light pink" to "#FFFCCFF3",
|
||||
"Light blue" to "#FFD1E0FF",
|
||||
"Light green" to "#FFCCFFCC",
|
||||
"Light yellow" to "#FFFDFFCC",
|
||||
"Light orange" to "#FFFFE6CC",
|
||||
"Light red" to "#FFFFD6D6",
|
||||
),
|
||||
title = "Light theme background color",
|
||||
description = "Can be a hex color (#AARRGGBB) or a color resource reference.",
|
||||
)
|
||||
|
||||
dependsOn(
|
||||
sharedExtensionPatch,
|
||||
settingsPatch,
|
||||
addResourcesPatch,
|
||||
lithoColorHookPatch,
|
||||
seekbarColorPatch,
|
||||
versionCheckPatch,
|
||||
resourcePatch {
|
||||
dependsOn(
|
||||
settingsPatch,
|
||||
resourceMappingPatch,
|
||||
)
|
||||
val themeResourcePatch = resourcePatch {
|
||||
dependsOn(resourceMappingPatch)
|
||||
|
||||
execute {
|
||||
val preferences = mutableSetOf<BasePreference>(
|
||||
SwitchPreference("revanced_seekbar_custom_color"),
|
||||
TextPreference("revanced_seekbar_custom_color_primary",
|
||||
tag = "app.revanced.extension.shared.settings.preference.ColorPickerPreference",
|
||||
inputType = InputType.TEXT_CAP_CHARACTERS),
|
||||
overrideThemeColors(
|
||||
lightThemeBackgroundColor!!,
|
||||
darkThemeBackgroundColorOption.value!!
|
||||
)
|
||||
|
||||
if (is_19_25_or_greater) {
|
||||
preferences += TextPreference("revanced_seekbar_custom_color_accent",
|
||||
tag = "app.revanced.extension.shared.settings.preference.ColorPickerPreference",
|
||||
inputType = InputType.TEXT_CAP_CHARACTERS)
|
||||
}
|
||||
|
||||
PreferenceScreen.SEEKBAR.addPreferences(
|
||||
PreferenceCategory(
|
||||
titleKey = null,
|
||||
sorting = Sorting.UNSORTED,
|
||||
tag = "app.revanced.extension.shared.settings.preference.NoTitlePreferenceCategory",
|
||||
preferences = preferences
|
||||
)
|
||||
)
|
||||
|
||||
overrideThemeColors(lightThemeBackgroundColor!!, darkThemeBackgroundColor!!)
|
||||
|
||||
// Edit theme colors via resources.
|
||||
document("res/values/colors.xml").use { document ->
|
||||
val resourcesNode = document.getElementsByTagName("resources").item(0) as Element
|
||||
|
||||
resourcesNode.childElementsSequence().forEach { node ->
|
||||
when (node.getAttribute("name")) {
|
||||
"yt_black0", "yt_black1", "yt_black1_opacity95", "yt_black1_opacity98",
|
||||
"yt_black2", "yt_black3", "yt_black4", "yt_status_bar_background_dark",
|
||||
"material_grey_850",
|
||||
-> node.textContent = darkThemeBackgroundColor
|
||||
|
||||
"yt_white1", "yt_white1_opacity95", "yt_white1_opacity98",
|
||||
"yt_white2", "yt_white3", "yt_white4",
|
||||
-> node.textContent = lightThemeBackgroundColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun addColorResource(
|
||||
resourceFile: String,
|
||||
colorName: String,
|
||||
colorValue: String,
|
||||
) {
|
||||
document(resourceFile).use { document ->
|
||||
val resourcesNode = document.getElementsByTagName("resources").item(0) as Element
|
||||
val resourcesNode =
|
||||
document.getElementsByTagName("resources").item(0) as Element
|
||||
|
||||
resourcesNode.appendChild(
|
||||
document.createElement("color").apply {
|
||||
@@ -150,18 +80,31 @@ val themePatch = bytecodePatch(
|
||||
|
||||
// Add a dynamic background color to the colors.xml file.
|
||||
val splashBackgroundColorKey = "revanced_splash_background_color"
|
||||
addColorResource("res/values/colors.xml", splashBackgroundColorKey, lightThemeBackgroundColor!!)
|
||||
addColorResource("res/values-night/colors.xml", splashBackgroundColorKey, darkThemeBackgroundColor!!)
|
||||
addColorResource(
|
||||
"res/values/colors.xml",
|
||||
splashBackgroundColorKey,
|
||||
lightThemeBackgroundColor!!
|
||||
)
|
||||
addColorResource(
|
||||
"res/values-night/colors.xml",
|
||||
splashBackgroundColorKey,
|
||||
darkThemeBackgroundColorOption.value!!
|
||||
)
|
||||
|
||||
// Edit splash screen files and change the background color,
|
||||
// Edit splash screen files and change the background color.
|
||||
arrayOf(
|
||||
"res/drawable/quantum_launchscreen_youtube.xml",
|
||||
"res/drawable-sw600dp/quantum_launchscreen_youtube.xml",
|
||||
).forEach editSplashScreen@{ resourceFileName ->
|
||||
document(resourceFileName).use { document ->
|
||||
document.getElementsByTagName("layer-list").item(0).forEachChildElement { node ->
|
||||
document.getElementsByTagName(
|
||||
"layer-list"
|
||||
).item(0).forEachChildElement { node ->
|
||||
if (node.hasAttribute("android:drawable")) {
|
||||
node.setAttribute("android:drawable", "@color/$splashBackgroundColorKey")
|
||||
node.setAttribute(
|
||||
"android:drawable",
|
||||
"@color/$splashBackgroundColorKey"
|
||||
)
|
||||
return@editSplashScreen
|
||||
}
|
||||
}
|
||||
@@ -172,7 +115,6 @@ val themePatch = bytecodePatch(
|
||||
|
||||
// Fix the splash screen dark mode background color.
|
||||
// In 19.32+ the dark mode splash screen is white and fades to black.
|
||||
// Maybe it's a bug in YT, or maybe it intentionally. Who knows.
|
||||
document("res/values-night-v27/styles.xml").use { document ->
|
||||
// Create a night mode specific override for the splash screen background.
|
||||
val style = document.createElement("style")
|
||||
@@ -195,30 +137,63 @@ val themePatch = bytecodePatch(
|
||||
style.appendChild(styleItem)
|
||||
}
|
||||
|
||||
val resourcesNode = document.getElementsByTagName("resources").item(0) as Element
|
||||
val resourcesNode =
|
||||
document.getElementsByTagName("resources").item(0) as Element
|
||||
resourcesNode.appendChild(style)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
compatibleWith(
|
||||
"com.google.android.youtube"(
|
||||
"19.34.42",
|
||||
"19.43.41",
|
||||
"20.07.39",
|
||||
"20.13.41",
|
||||
"20.14.43",
|
||||
dependsOn(
|
||||
sharedExtensionPatch,
|
||||
settingsPatch,
|
||||
addResourcesPatch,
|
||||
seekbarColorPatch,
|
||||
baseThemeResourcePatch(
|
||||
lightColorReplacement = { lightThemeBackgroundColor!! }
|
||||
),
|
||||
themeResourcePatch
|
||||
)
|
||||
)
|
||||
|
||||
execute {
|
||||
compatibleWith(
|
||||
"com.google.android.youtube"(
|
||||
"19.34.42",
|
||||
"20.07.39",
|
||||
"20.13.41",
|
||||
"20.14.43",
|
||||
)
|
||||
)
|
||||
},
|
||||
|
||||
executeBlock = {
|
||||
addResources("youtube", "layout.theme.themePatch")
|
||||
|
||||
PreferenceScreen.GENERAL_LAYOUT.addPreferences(
|
||||
SwitchPreference("revanced_gradient_loading_screen")
|
||||
)
|
||||
|
||||
val preferences = mutableSetOf(
|
||||
SwitchPreference("revanced_seekbar_custom_color"),
|
||||
TextPreference(
|
||||
"revanced_seekbar_custom_color_primary",
|
||||
tag = "app.revanced.extension.shared.settings.preference.ColorPickerPreference",
|
||||
inputType = InputType.TEXT_CAP_CHARACTERS
|
||||
),
|
||||
TextPreference(
|
||||
"revanced_seekbar_custom_color_accent",
|
||||
tag = "app.revanced.extension.shared.settings.preference.ColorPickerPreference",
|
||||
inputType = InputType.TEXT_CAP_CHARACTERS
|
||||
)
|
||||
)
|
||||
|
||||
PreferenceScreen.SEEKBAR.addPreferences(
|
||||
PreferenceCategory(
|
||||
titleKey = null,
|
||||
sorting = Sorting.UNSORTED,
|
||||
tag = "app.revanced.extension.shared.settings.preference.NoTitlePreferenceCategory",
|
||||
preferences = preferences
|
||||
)
|
||||
)
|
||||
|
||||
if (is_19_47_or_greater) {
|
||||
PreferenceScreen.GENERAL_LAYOUT.addPreferences(
|
||||
ListPreference("revanced_splash_screen_animation_style")
|
||||
@@ -237,7 +212,5 @@ val themePatch = bytecodePatch(
|
||||
"$EXTENSION_CLASS_DESCRIPTOR->getLoadingScreenType(I)I"
|
||||
)
|
||||
}
|
||||
|
||||
lithoColorOverrideHook(EXTENSION_CLASS_DESCRIPTOR, "getValue")
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user