chore: Merge branch dev to main (#4437)

This commit is contained in:
LisoUseInAIKyrios 2025-02-17 08:20:23 +02:00 committed by GitHub
commit 21f3d1f5db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
185 changed files with 958 additions and 595 deletions

View File

@ -1,3 +1,57 @@
# [5.12.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v5.12.0-dev.6...v5.12.0-dev.7) (2025-02-16)
### Bug Fixes
* **YouTube - Spoof video streams:** Change default client to `Android TV` ([#4465](https://github.com/ReVanced/revanced-patches/issues/4465)) ([0412c79](https://github.com/ReVanced/revanced-patches/commit/0412c7901dc8599b6079d9c3ba26452f88af642b))
### Features
* **YouTube Music:** Support version `8.05.51` ([128441e](https://github.com/ReVanced/revanced-patches/commit/128441e78bc0d096c3fc2f57782ab90c39c3ae4b))
# [5.12.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v5.12.0-dev.5...v5.12.0-dev.6) (2025-02-16)
### Bug Fixes
* Allow changing default settings for existing app installs ([#4464](https://github.com/ReVanced/revanced-patches/issues/4464)) ([1bd7986](https://github.com/ReVanced/revanced-patches/commit/1bd7986823e774a929c8a9102a7cc96e245d5274))
# [5.12.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v5.12.0-dev.4...v5.12.0-dev.5) (2025-02-13)
### Bug Fixes
* **YouTube:** Remove obsolete 18.x targets ([#4454](https://github.com/ReVanced/revanced-patches/issues/4454)) ([a006758](https://github.com/ReVanced/revanced-patches/commit/a0067581d0f877e1b4eb1f888a25786f09676b2e))
# [5.12.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v5.12.0-dev.3...v5.12.0-dev.4) (2025-02-11)
### Features
* **YouTube Music:** Support version `8.05.50` ([#4439](https://github.com/ReVanced/revanced-patches/issues/4439)) ([b31fed9](https://github.com/ReVanced/revanced-patches/commit/b31fed98901fcda1bce6f05eb0de63280c689fa0))
# [5.12.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v5.12.0-dev.2...v5.12.0-dev.3) (2025-02-11)
### Bug Fixes
* **Windy.app:** Remove obsolete `Unlock pro` patch ([#4428](https://github.com/ReVanced/revanced-patches/issues/4428)) ([83d116e](https://github.com/ReVanced/revanced-patches/commit/83d116e8fd3935ee431cfdf0b8e095d04ee77259))
# [5.12.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.12.0-dev.1...v5.12.0-dev.2) (2025-02-11)
### Features
* **Return YouTube Dislike:** add `Show estimated likes` setting ([#4443](https://github.com/ReVanced/revanced-patches/issues/4443)) ([9a88b42](https://github.com/ReVanced/revanced-patches/commit/9a88b4239fd63d5f91105fec8e7d59d318a5d09a))
# [5.12.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.11.0...v5.12.0-dev.1) (2025-02-10)
### Features
* **YouTube - SponsorBlock:** Redesign skip buttons ([#4427](https://github.com/ReVanced/revanced-patches/issues/4427)) ([8f4883f](https://github.com/ReVanced/revanced-patches/commit/8f4883fc002420bfb4056401e23445c99e1d3fce))
# [5.11.0](https://github.com/ReVanced/revanced-patches/compare/v5.10.0...v5.11.0) (2025-02-07) # [5.11.0](https://github.com/ReVanced/revanced-patches/compare/v5.10.0...v5.11.0) (2025-02-07)

View File

@ -29,6 +29,6 @@ public class BaseSettings {
public static final BooleanSetting SPOOF_VIDEO_STREAMS_IOS_FORCE_AVC = new BooleanSetting("revanced_spoof_video_streams_ios_force_avc", FALSE, true, public static final BooleanSetting SPOOF_VIDEO_STREAMS_IOS_FORCE_AVC = new BooleanSetting("revanced_spoof_video_streams_ios_force_avc", FALSE, true,
"revanced_spoof_video_streams_ios_force_avc_user_dialog_message", new SpoofiOSAvailability()); "revanced_spoof_video_streams_ios_force_avc_user_dialog_message", new SpoofiOSAvailability());
// Client type must be last spoof setting due to cyclic references. // Client type must be last spoof setting due to cyclic references.
public static final EnumSetting<ClientType> SPOOF_VIDEO_STREAMS_CLIENT_TYPE = new EnumSetting<>("revanced_spoof_video_streams_client_type", ClientType.ANDROID_VR, true, parent(SPOOF_VIDEO_STREAMS)); public static final EnumSetting<ClientType> SPOOF_VIDEO_STREAMS_CLIENT_TYPE = new EnumSetting<>("revanced_spoof_video_streams_client_type", ClientType.ANDROID_UNPLUGGED, true, parent(SPOOF_VIDEO_STREAMS));
} }

View File

@ -47,6 +47,10 @@ public class BooleanSetting extends Setting<Boolean> {
*/ */
public static void privateSetValue(@NonNull BooleanSetting setting, @NonNull Boolean newValue) { public static void privateSetValue(@NonNull BooleanSetting setting, @NonNull Boolean newValue) {
setting.value = Objects.requireNonNull(newValue); setting.value = Objects.requireNonNull(newValue);
if (setting.isSetToDefault()) {
setting.removeFromPreferences();
}
} }
@Override @Override
@ -65,10 +69,8 @@ public class BooleanSetting extends Setting<Boolean> {
} }
@Override @Override
public void save(@NonNull Boolean newValue) { public void saveToPreferences() {
// Must set before saving to preferences (otherwise importing fails to update UI correctly). preferences.saveBoolean(key, value);
value = Objects.requireNonNull(newValue);
preferences.saveBoolean(key, newValue);
} }
@NonNull @NonNull

View File

@ -89,10 +89,8 @@ public class EnumSetting<T extends Enum<?>> extends Setting<T> {
} }
@Override @Override
public void save(@NonNull T newValue) { public void saveToPreferences() {
// Must set before saving to preferences (otherwise importing fails to update UI correctly). preferences.saveEnumAsString(key, value);
value = Objects.requireNonNull(newValue);
preferences.saveEnumAsString(key, newValue);
} }
@NonNull @NonNull

View File

@ -55,10 +55,8 @@ public class FloatSetting extends Setting<Float> {
} }
@Override @Override
public void save(@NonNull Float newValue) { public void saveToPreferences() {
// Must set before saving to preferences (otherwise importing fails to update UI correctly). preferences.saveFloatString(key, value);
value = Objects.requireNonNull(newValue);
preferences.saveFloatString(key, newValue);
} }
@NonNull @NonNull

View File

@ -55,10 +55,8 @@ public class IntegerSetting extends Setting<Integer> {
} }
@Override @Override
public void save(@NonNull Integer newValue) { public void saveToPreferences() {
// Must set before saving to preferences (otherwise importing fails to update UI correctly). preferences.saveIntegerString(key, value);
value = Objects.requireNonNull(newValue);
preferences.saveIntegerString(key, newValue);
} }
@NonNull @NonNull

View File

@ -55,10 +55,8 @@ public class LongSetting extends Setting<Long> {
} }
@Override @Override
public void save(@NonNull Long newValue) { public void saveToPreferences() {
// Must set before saving to preferences (otherwise importing fails to update UI correctly). preferences.saveLongString(key, value);
value = Objects.requireNonNull(newValue);
preferences.saveLongString(key, newValue);
} }
@NonNull @NonNull

View File

@ -14,7 +14,6 @@ import java.util.*;
import static app.revanced.extension.shared.StringRef.str; import static app.revanced.extension.shared.StringRef.str;
@SuppressWarnings("unused")
public abstract class Setting<T> { public abstract class Setting<T> {
/** /**
@ -288,6 +287,13 @@ public abstract class Setting<T> {
*/ */
public static void privateSetValueFromString(@NonNull Setting<?> setting, @NonNull String newValue) { public static void privateSetValueFromString(@NonNull Setting<?> setting, @NonNull String newValue) {
setting.setValueFromString(newValue); setting.setValueFromString(newValue);
// Clear the preference value since default is used, to allow changing
// the changing the default for a future release. Without this after upgrading
// the saved value will be whatever was the default when the app was first installed.
if (setting.isSetToDefault()) {
setting.removeFromPreferences();
}
} }
/** /**
@ -303,7 +309,33 @@ public abstract class Setting<T> {
/** /**
* Persistently saves the value. * Persistently saves the value.
*/ */
public abstract void save(@NonNull T newValue); public final void save(@NonNull T newValue) {
if (value.equals(newValue)) {
return;
}
// Must set before saving to preferences (otherwise importing fails to update UI correctly).
value = Objects.requireNonNull(newValue);
if (defaultValue.equals(newValue)) {
removeFromPreferences();
} else {
saveToPreferences();
}
}
/**
* Save {@link #value} to {@link #preferences}.
*/
protected abstract void saveToPreferences();
/**
* Remove {@link #value} from {@link #preferences}.
*/
protected final void removeFromPreferences() {
Logger.printDebug(() -> "Clearing stored preference value (reset to default): " + key);
preferences.removeKey(key);
}
@NonNull @NonNull
public abstract T get(); public abstract T get();

View File

@ -55,10 +55,8 @@ public class StringSetting extends Setting<String> {
} }
@Override @Override
public void save(@NonNull String newValue) { public void saveToPreferences() {
// Must set before saving to preferences (otherwise importing fails to update UI correctly). preferences.saveString(key, value);
value = Objects.requireNonNull(newValue);
preferences.saveString(key, newValue);
} }
@NonNull @NonNull

View File

@ -66,22 +66,6 @@ public enum ClientType {
true, true,
"Android Creator" "Android Creator"
), ),
ANDROID_VR(
ANDROID_VR_NO_AUTH.id,
ANDROID_VR_NO_AUTH.clientName,
ANDROID_VR_NO_AUTH.packageName,
ANDROID_VR_NO_AUTH.deviceMake,
ANDROID_VR_NO_AUTH.deviceModel,
ANDROID_VR_NO_AUTH.osName,
ANDROID_VR_NO_AUTH.osVersion,
ANDROID_VR_NO_AUTH.androidSdkVersion,
ANDROID_VR_NO_AUTH.buildId,
ANDROID_VR_NO_AUTH.cronetVersion,
ANDROID_VR_NO_AUTH.clientVersion,
ANDROID_VR_NO_AUTH.requiresAuth,
true,
"Android VR"
),
IOS_UNPLUGGED( IOS_UNPLUGGED(
33, 33,
"IOS_UNPLUGGED", "IOS_UNPLUGGED",
@ -112,6 +96,22 @@ public enum ClientType {
forceAVC() forceAVC()
? "iOS TV Force AVC" ? "iOS TV Force AVC"
: "iOS TV" : "iOS TV"
),
ANDROID_VR_AUTH(
ANDROID_VR_NO_AUTH.id,
ANDROID_VR_NO_AUTH.clientName,
ANDROID_VR_NO_AUTH.packageName,
ANDROID_VR_NO_AUTH.deviceMake,
ANDROID_VR_NO_AUTH.deviceModel,
ANDROID_VR_NO_AUTH.osName,
ANDROID_VR_NO_AUTH.osVersion,
ANDROID_VR_NO_AUTH.androidSdkVersion,
ANDROID_VR_NO_AUTH.buildId,
ANDROID_VR_NO_AUTH.cronetVersion,
ANDROID_VR_NO_AUTH.clientVersion,
ANDROID_VR_NO_AUTH.requiresAuth,
true,
"Android VR"
); );
private static boolean forceAVC() { private static boolean forceAVC() {

View File

@ -234,6 +234,12 @@ public class ReturnYouTubeDislike {
// example video: https://www.youtube.com/watch?v=UnrU5vxCHxw // example video: https://www.youtube.com/watch?v=UnrU5vxCHxw
// RYD data: https://returnyoutubedislikeapi.com/votes?videoId=UnrU5vxCHxw // RYD data: https://returnyoutubedislikeapi.com/votes?videoId=UnrU5vxCHxw
// //
if (!Settings.RYD_ESTIMATED_LIKE.get()) {
// Change the "Likes" string to show that likes and dislikes are hidden.
String hiddenMessageString = str("revanced_ryd_video_likes_hidden_by_video_owner");
return newSpanUsingStylingOfAnotherSpan(oldSpannable, hiddenMessageString);
}
Logger.printDebug(() -> "Using estimated likes"); Logger.printDebug(() -> "Using estimated likes");
oldLikes = formatDislikeCount(voteData.getLikeCount()); oldLikes = formatDislikeCount(voteData.getLikeCount());
} }
@ -542,6 +548,15 @@ public class ReturnYouTubeDislike {
} }
if (spanIsForLikes) { if (spanIsForLikes) {
if (!Utils.containsNumber(original)) {
if (!Settings.RYD_ESTIMATED_LIKE.get()) {
Logger.printDebug(() -> "Likes are hidden");
return original;
} else {
Logger.printDebug(() -> "Using estimated likes");
}
}
// Scrolling Shorts does not cause the Spans to be reloaded, // Scrolling Shorts does not cause the Spans to be reloaded,
// so there is no need to cache the likes for this situations. // so there is no need to cache the likes for this situations.
Logger.printDebug(() -> "Creating likes span for: " + votingData.videoId); Logger.printDebug(() -> "Creating likes span for: " + votingData.videoId);

View File

@ -333,6 +333,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting RYD_SHORTS = new BooleanSetting("ryd_shorts", TRUE, parent(RYD_ENABLED)); public static final BooleanSetting RYD_SHORTS = new BooleanSetting("ryd_shorts", TRUE, parent(RYD_ENABLED));
public static final BooleanSetting RYD_DISLIKE_PERCENTAGE = new BooleanSetting("ryd_dislike_percentage", FALSE, parent(RYD_ENABLED)); public static final BooleanSetting RYD_DISLIKE_PERCENTAGE = new BooleanSetting("ryd_dislike_percentage", FALSE, parent(RYD_ENABLED));
public static final BooleanSetting RYD_COMPACT_LAYOUT = new BooleanSetting("ryd_compact_layout", FALSE, parent(RYD_ENABLED)); public static final BooleanSetting RYD_COMPACT_LAYOUT = new BooleanSetting("ryd_compact_layout", FALSE, parent(RYD_ENABLED));
public static final BooleanSetting RYD_ESTIMATED_LIKE = new BooleanSetting("ryd_estimated_like", TRUE, parent(RYD_ENABLED));
public static final BooleanSetting RYD_TOAST_ON_CONNECTION_ERROR = new BooleanSetting("ryd_toast_on_connection_error", TRUE, parent(RYD_ENABLED)); public static final BooleanSetting RYD_TOAST_ON_CONNECTION_ERROR = new BooleanSetting("ryd_toast_on_connection_error", TRUE, parent(RYD_ENABLED));
// SponsorBlock // SponsorBlock
@ -344,13 +345,14 @@ public class Settings extends BaseSettings {
public static final IntegerSetting SB_CREATE_NEW_SEGMENT_STEP = new IntegerSetting("sb_create_new_segment_step", 150, parent(SB_ENABLED)); public static final IntegerSetting SB_CREATE_NEW_SEGMENT_STEP = new IntegerSetting("sb_create_new_segment_step", 150, parent(SB_ENABLED));
public static final BooleanSetting SB_VOTING_BUTTON = new BooleanSetting("sb_voting_button", FALSE, parent(SB_ENABLED)); public static final BooleanSetting SB_VOTING_BUTTON = new BooleanSetting("sb_voting_button", FALSE, parent(SB_ENABLED));
public static final BooleanSetting SB_CREATE_NEW_SEGMENT = new BooleanSetting("sb_create_new_segment", FALSE, parent(SB_ENABLED)); public static final BooleanSetting SB_CREATE_NEW_SEGMENT = new BooleanSetting("sb_create_new_segment", FALSE, parent(SB_ENABLED));
public static final BooleanSetting SB_SQUARE_LAYOUT = new BooleanSetting("sb_square_layout", FALSE, parent(SB_ENABLED));
public static final BooleanSetting SB_COMPACT_SKIP_BUTTON = new BooleanSetting("sb_compact_skip_button", FALSE, parent(SB_ENABLED)); public static final BooleanSetting SB_COMPACT_SKIP_BUTTON = new BooleanSetting("sb_compact_skip_button", FALSE, parent(SB_ENABLED));
public static final BooleanSetting SB_AUTO_HIDE_SKIP_BUTTON = new BooleanSetting("sb_auto_hide_skip_button", TRUE, parent(SB_ENABLED)); public static final BooleanSetting SB_AUTO_HIDE_SKIP_BUTTON = new BooleanSetting("sb_auto_hide_skip_button", TRUE, parent(SB_ENABLED));
public static final BooleanSetting SB_TOAST_ON_SKIP = new BooleanSetting("sb_toast_on_skip", TRUE, parent(SB_ENABLED)); public static final BooleanSetting SB_TOAST_ON_SKIP = new BooleanSetting("sb_toast_on_skip", TRUE, parent(SB_ENABLED));
public static final BooleanSetting SB_TOAST_ON_CONNECTION_ERROR = new BooleanSetting("sb_toast_on_connection_error", TRUE, parent(SB_ENABLED)); public static final BooleanSetting SB_TOAST_ON_CONNECTION_ERROR = new BooleanSetting("sb_toast_on_connection_error", TRUE, parent(SB_ENABLED));
public static final BooleanSetting SB_TRACK_SKIP_COUNT = new BooleanSetting("sb_track_skip_count", TRUE, parent(SB_ENABLED)); public static final BooleanSetting SB_TRACK_SKIP_COUNT = new BooleanSetting("sb_track_skip_count", TRUE, parent(SB_ENABLED));
public static final FloatSetting SB_SEGMENT_MIN_DURATION = new FloatSetting("sb_min_segment_duration", 0F, parent(SB_ENABLED)); public static final FloatSetting SB_SEGMENT_MIN_DURATION = new FloatSetting("sb_min_segment_duration", 0F, parent(SB_ENABLED));
public static final BooleanSetting SB_VIDEO_LENGTH_WITHOUT_SEGMENTS = new BooleanSetting("sb_video_length_without_segments", TRUE, parent(SB_ENABLED)); public static final BooleanSetting SB_VIDEO_LENGTH_WITHOUT_SEGMENTS = new BooleanSetting("sb_video_length_without_segments", FALSE, parent(SB_ENABLED));
public static final StringSetting SB_API_URL = new StringSetting("sb_api_url", "https://sponsor.ajay.app"); public static final StringSetting SB_API_URL = new StringSetting("sb_api_url", "https://sponsor.ajay.app");
public static final BooleanSetting SB_USER_IS_VIP = new BooleanSetting("sb_user_is_vip", FALSE); public static final BooleanSetting SB_USER_IS_VIP = new BooleanSetting("sb_user_is_vip", FALSE);
public static final IntegerSetting SB_LOCAL_TIME_SAVED_NUMBER_SEGMENTS = new IntegerSetting("sb_local_time_saved_number_segments", 0); public static final IntegerSetting SB_LOCAL_TIME_SAVED_NUMBER_SEGMENTS = new IntegerSetting("sb_local_time_saved_number_segments", 0);

View File

@ -39,6 +39,11 @@ public class ReturnYouTubeDislikePreferenceFragment extends PreferenceFragment {
*/ */
private SwitchPreference compactLayoutPreference; private SwitchPreference compactLayoutPreference;
/**
* If hidden likes are replaced with an estimated value.
*/
private SwitchPreference estimatedLikesPreference;
/** /**
* If segmented like/dislike button uses smaller compact layout. * If segmented like/dislike button uses smaller compact layout.
*/ */
@ -48,6 +53,7 @@ public class ReturnYouTubeDislikePreferenceFragment extends PreferenceFragment {
shortsPreference.setEnabled(Settings.RYD_SHORTS.isAvailable()); shortsPreference.setEnabled(Settings.RYD_SHORTS.isAvailable());
percentagePreference.setEnabled(Settings.RYD_DISLIKE_PERCENTAGE.isAvailable()); percentagePreference.setEnabled(Settings.RYD_DISLIKE_PERCENTAGE.isAvailable());
compactLayoutPreference.setEnabled(Settings.RYD_COMPACT_LAYOUT.isAvailable()); compactLayoutPreference.setEnabled(Settings.RYD_COMPACT_LAYOUT.isAvailable());
estimatedLikesPreference.setEnabled(Settings.RYD_ESTIMATED_LIKE.isAvailable());
toastOnRYDNotAvailable.setEnabled(Settings.RYD_TOAST_ON_CONNECTION_ERROR.isAvailable()); toastOnRYDNotAvailable.setEnabled(Settings.RYD_TOAST_ON_CONNECTION_ERROR.isAvailable());
} }
@ -117,6 +123,19 @@ public class ReturnYouTubeDislikePreferenceFragment extends PreferenceFragment {
}); });
preferenceScreen.addPreference(compactLayoutPreference); preferenceScreen.addPreference(compactLayoutPreference);
estimatedLikesPreference = new SwitchPreference(context);
estimatedLikesPreference.setChecked(Settings.RYD_ESTIMATED_LIKE.get());
estimatedLikesPreference.setTitle(str("revanced_ryd_estimated_like_title"));
estimatedLikesPreference.setSummaryOn(str("revanced_ryd_estimated_like_summary_on"));
estimatedLikesPreference.setSummaryOff(str("revanced_ryd_estimated_like_summary_off"));
estimatedLikesPreference.setOnPreferenceChangeListener((pref, newValue) -> {
Settings.RYD_ESTIMATED_LIKE.save((Boolean) newValue);
ReturnYouTubeDislike.clearAllUICaches();
updateUIState();
return true;
});
preferenceScreen.addPreference(estimatedLikesPreference);
toastOnRYDNotAvailable = new SwitchPreference(context); toastOnRYDNotAvailable = new SwitchPreference(context);
toastOnRYDNotAvailable.setChecked(Settings.RYD_TOAST_ON_CONNECTION_ERROR.get()); toastOnRYDNotAvailable.setChecked(Settings.RYD_TOAST_ON_CONNECTION_ERROR.get());
toastOnRYDNotAvailable.setTitle(str("revanced_ryd_toast_on_connection_error_title")); toastOnRYDNotAvailable.setTitle(str("revanced_ryd_toast_on_connection_error_title"));

View File

@ -36,8 +36,9 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
private SwitchPreference sbEnabled; private SwitchPreference sbEnabled;
private SwitchPreference addNewSegment; private SwitchPreference addNewSegment;
private SwitchPreference votingEnabled; private SwitchPreference votingEnabled;
private SwitchPreference compactSkipButton;
private SwitchPreference autoHideSkipSegmentButton; private SwitchPreference autoHideSkipSegmentButton;
private SwitchPreference compactSkipButton;
private SwitchPreference squareLayout;
private SwitchPreference showSkipToast; private SwitchPreference showSkipToast;
private SwitchPreference trackSkips; private SwitchPreference trackSkips;
private SwitchPreference showTimeWithoutSegments; private SwitchPreference showTimeWithoutSegments;
@ -61,7 +62,9 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
} else if (!Settings.SB_CREATE_NEW_SEGMENT.get()) { } else if (!Settings.SB_CREATE_NEW_SEGMENT.get()) {
SponsorBlockViewController.hideNewSegmentLayout(); SponsorBlockViewController.hideNewSegmentLayout();
} }
// Voting and add new segment buttons automatically shows/hide themselves. // Voting and add new segment buttons automatically show/hide themselves.
SponsorBlockViewController.updateLayout();
sbEnabled.setChecked(enabled); sbEnabled.setChecked(enabled);
@ -71,11 +74,14 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
votingEnabled.setChecked(Settings.SB_VOTING_BUTTON.get()); votingEnabled.setChecked(Settings.SB_VOTING_BUTTON.get());
votingEnabled.setEnabled(enabled); votingEnabled.setEnabled(enabled);
autoHideSkipSegmentButton.setEnabled(enabled);
autoHideSkipSegmentButton.setChecked(Settings.SB_AUTO_HIDE_SKIP_BUTTON.get());
compactSkipButton.setChecked(Settings.SB_COMPACT_SKIP_BUTTON.get()); compactSkipButton.setChecked(Settings.SB_COMPACT_SKIP_BUTTON.get());
compactSkipButton.setEnabled(enabled); compactSkipButton.setEnabled(enabled);
autoHideSkipSegmentButton.setChecked(Settings.SB_AUTO_HIDE_SKIP_BUTTON.get()); squareLayout.setChecked(Settings.SB_SQUARE_LAYOUT.get());
autoHideSkipSegmentButton.setEnabled(enabled); squareLayout.setEnabled(enabled);
showSkipToast.setChecked(Settings.SB_TOAST_ON_SKIP.get()); showSkipToast.setChecked(Settings.SB_TOAST_ON_SKIP.get());
showSkipToast.setEnabled(enabled); showSkipToast.setEnabled(enabled);
@ -175,6 +181,17 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
return true; return true;
}); });
autoHideSkipSegmentButton = new SwitchPreference(context);
autoHideSkipSegmentButton.setTitle(str("revanced_sb_enable_auto_hide_skip_segment_button"));
autoHideSkipSegmentButton.setSummaryOn(str("revanced_sb_enable_auto_hide_skip_segment_button_sum_on"));
autoHideSkipSegmentButton.setSummaryOff(str("revanced_sb_enable_auto_hide_skip_segment_button_sum_off"));
category.addPreference(autoHideSkipSegmentButton);
autoHideSkipSegmentButton.setOnPreferenceChangeListener((preference1, newValue) -> {
Settings.SB_AUTO_HIDE_SKIP_BUTTON.save((Boolean) newValue);
updateUI();
return true;
});
compactSkipButton = new SwitchPreference(context); compactSkipButton = new SwitchPreference(context);
compactSkipButton.setTitle(str("revanced_sb_enable_compact_skip_button")); compactSkipButton.setTitle(str("revanced_sb_enable_compact_skip_button"));
compactSkipButton.setSummaryOn(str("revanced_sb_enable_compact_skip_button_sum_on")); compactSkipButton.setSummaryOn(str("revanced_sb_enable_compact_skip_button_sum_on"));
@ -186,13 +203,13 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment {
return true; return true;
}); });
autoHideSkipSegmentButton = new SwitchPreference(context); squareLayout = new SwitchPreference(context);
autoHideSkipSegmentButton.setTitle(str("revanced_sb_enable_auto_hide_skip_segment_button")); squareLayout.setTitle(str("revanced_sb_square_layout"));
autoHideSkipSegmentButton.setSummaryOn(str("revanced_sb_enable_auto_hide_skip_segment_button_sum_on")); squareLayout.setSummaryOn(str("revanced_sb_square_layout_sum_on"));
autoHideSkipSegmentButton.setSummaryOff(str("revanced_sb_enable_auto_hide_skip_segment_button_sum_off")); squareLayout.setSummaryOff(str("revanced_sb_square_layout_sum_off"));
category.addPreference(autoHideSkipSegmentButton); category.addPreference(squareLayout);
autoHideSkipSegmentButton.setOnPreferenceChangeListener((preference1, newValue) -> { squareLayout.setOnPreferenceChangeListener((preference1, newValue) -> {
Settings.SB_AUTO_HIDE_SKIP_BUTTON.save((Boolean) newValue); Settings.SB_SQUARE_LAYOUT.save((Boolean) newValue);
updateUI(); updateUI();
return true; return true;
}); });

View File

@ -85,7 +85,7 @@ public class SpoofStreamingDataSideEffectsPreference extends Preference {
String summary = str(key + "_summary"); String summary = str(key + "_summary");
// Android VR supports AV1 but all other clients do not. // Android VR supports AV1 but all other clients do not.
if (clientType != ClientType.ANDROID_VR && clientType != ClientType.ANDROID_VR_NO_AUTH) { if (clientType != ClientType.ANDROID_VR_AUTH && clientType != ClientType.ANDROID_VR_NO_AUTH) {
summary += '\n' + str("revanced_spoof_video_streams_about_no_av1"); summary += '\n' + str("revanced_spoof_video_streams_about_no_av1");
} }

View File

@ -2,10 +2,11 @@ package app.revanced.extension.youtube.sponsorblock.ui;
import android.content.Context; import android.content.Context;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.RippleDrawable; import android.graphics.drawable.RippleDrawable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageButton; import android.widget.ImageButton;
@ -14,15 +15,15 @@ import app.revanced.extension.youtube.settings.Settings;
import app.revanced.extension.youtube.sponsorblock.SponsorBlockUtils; import app.revanced.extension.youtube.sponsorblock.SponsorBlockUtils;
import app.revanced.extension.shared.Logger; import app.revanced.extension.shared.Logger;
import static app.revanced.extension.shared.Utils.getResourceColor;
import static app.revanced.extension.shared.Utils.getResourceDimensionPixelSize; import static app.revanced.extension.shared.Utils.getResourceDimensionPixelSize;
import static app.revanced.extension.shared.Utils.getResourceIdentifier; import static app.revanced.extension.shared.Utils.getResourceIdentifier;
public final class NewSegmentLayout extends FrameLayout { public final class NewSegmentLayout extends FrameLayout {
private static final ColorStateList rippleColorStateList = new ColorStateList( private static final ColorStateList rippleColorStateList = new ColorStateList(
new int[][]{new int[]{android.R.attr.state_enabled}}, new int[][]{new int[]{android.R.attr.state_enabled}},
new int[]{0x33ffffff} // sets the ripple color to white new int[]{0x33ffffff} // Ripple effect color (semi-transparent white)
); );
private final int rippleEffectId;
final int defaultBottomMargin; final int defaultBottomMargin;
final int ctaBottomMargin; final int ctaBottomMargin;
@ -47,10 +48,6 @@ public final class NewSegmentLayout extends FrameLayout {
getResourceIdentifier(context, "revanced_sb_new_segment", "layout"), this, true getResourceIdentifier(context, "revanced_sb_new_segment", "layout"), this, true
); );
TypedValue rippleEffect = new TypedValue();
context.getTheme().resolveAttribute(android.R.attr.selectableItemBackground, rippleEffect, true);
rippleEffectId = rippleEffect.resourceId;
initializeButton( initializeButton(
context, context,
"revanced_sb_new_segment_rewind", "revanced_sb_new_segment_rewind",
@ -120,6 +117,28 @@ public final class NewSegmentLayout extends FrameLayout {
}); });
} }
/**
* Update the layout of this UI control.
*/
public void updateLayout() {
final boolean squareLayout = Settings.SB_SQUARE_LAYOUT.get();
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) getLayoutParams();
final int margin = squareLayout
? 0
: SponsorBlockViewController.ROUNDED_LAYOUT_MARGIN;
params.setMarginStart(margin);
setLayoutParams(params);
GradientDrawable backgroundDrawable = new GradientDrawable();
backgroundDrawable.setColor(getResourceColor("skip_ad_button_background_color"));
final float cornerRadius = squareLayout
? 0
: 16 * getResources().getDisplayMetrics().density;
backgroundDrawable.setCornerRadius(cornerRadius);
setBackground(backgroundDrawable);
}
@FunctionalInterface @FunctionalInterface
private interface ButtonOnClickHandlerFunction { private interface ButtonOnClickHandlerFunction {
void apply(); void apply();

View File

@ -8,6 +8,7 @@ import static app.revanced.extension.shared.Utils.getResourceIdentifier;
import android.content.Context; import android.content.Context;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -19,11 +20,19 @@ import androidx.annotation.NonNull;
import java.util.Objects; import java.util.Objects;
import app.revanced.extension.youtube.settings.Settings;
import app.revanced.extension.youtube.sponsorblock.SegmentPlaybackController; import app.revanced.extension.youtube.sponsorblock.SegmentPlaybackController;
import app.revanced.extension.youtube.sponsorblock.objects.SponsorSegment; import app.revanced.extension.youtube.sponsorblock.objects.SponsorSegment;
public class SkipSponsorButton extends FrameLayout { public class SkipSponsorButton extends FrameLayout {
private static final boolean highContrast = true; /**
* Adds a high contrast border around the skip button.
*
* This feature is not currently used.
* If this is added, it needs an additional button width change because
* as-is the skip button text is clipped when this is on.
*/
private static final boolean highContrast = false;
private final LinearLayout skipSponsorBtnContainer; private final LinearLayout skipSponsorBtnContainer;
private final TextView skipSponsorTextView; private final TextView skipSponsorTextView;
private final Paint background; private final Paint background;
@ -49,18 +58,23 @@ public class SkipSponsorButton extends FrameLayout {
LayoutInflater.from(context).inflate(getResourceIdentifier(context, "revanced_sb_skip_sponsor_button", "layout"), this, true); // layout:skip_ad_button LayoutInflater.from(context).inflate(getResourceIdentifier(context, "revanced_sb_skip_sponsor_button", "layout"), this, true); // layout:skip_ad_button
setMinimumHeight(getResourceDimensionPixelSize("ad_skip_ad_button_min_height")); // dimen:ad_skip_ad_button_min_height setMinimumHeight(getResourceDimensionPixelSize("ad_skip_ad_button_min_height")); // dimen:ad_skip_ad_button_min_height
skipSponsorBtnContainer = Objects.requireNonNull((LinearLayout) findViewById(getResourceIdentifier(context, "revanced_sb_skip_sponsor_button_container", "id"))); // id:skip_ad_button_container skipSponsorBtnContainer = Objects.requireNonNull(findViewById(getResourceIdentifier(context, "revanced_sb_skip_sponsor_button_container", "id"))); // id:skip_ad_button_container
background = new Paint(); background = new Paint();
background.setColor(getResourceColor("skip_ad_button_background_color")); // color:skip_ad_button_background_color); background.setColor(getResourceColor("skip_ad_button_background_color")); // color:skip_ad_button_background_color);
background.setStyle(Paint.Style.FILL); background.setStyle(Paint.Style.FILL);
border = new Paint(); border = new Paint();
border.setColor(getResourceColor("skip_ad_button_border_color")); // color:skip_ad_button_border_color); border.setColor(getResourceColor("skip_ad_button_border_color")); // color:skip_ad_button_border_color);
border.setStrokeWidth(getResourceDimension("ad_skip_ad_button_border_width")); // dimen:ad_skip_ad_button_border_width); border.setStrokeWidth(getResourceDimension("ad_skip_ad_button_border_width")); // dimen:ad_skip_ad_button_border_width);
border.setStyle(Paint.Style.STROKE); border.setStyle(Paint.Style.STROKE);
skipSponsorTextView = Objects.requireNonNull((TextView) findViewById(getResourceIdentifier(context, "revanced_sb_skip_sponsor_button_text", "id"))); // id:skip_ad_button_text;
skipSponsorTextView = Objects.requireNonNull(findViewById(getResourceIdentifier(context, "revanced_sb_skip_sponsor_button_text", "id"))); // id:skip_ad_button_text;
defaultBottomMargin = getResourceDimensionPixelSize("skip_button_default_bottom_margin"); // dimen:skip_button_default_bottom_margin defaultBottomMargin = getResourceDimensionPixelSize("skip_button_default_bottom_margin"); // dimen:skip_button_default_bottom_margin
ctaBottomMargin = getResourceDimensionPixelSize("skip_button_cta_bottom_margin"); // dimen:skip_button_cta_bottom_margin ctaBottomMargin = getResourceDimensionPixelSize("skip_button_cta_bottom_margin"); // dimen:skip_button_cta_bottom_margin
updateLayout();
skipSponsorBtnContainer.setOnClickListener(v -> { skipSponsorBtnContainer.setOnClickListener(v -> {
// The view controller handles hiding this button, but hide it here as well just in case something goofs. // The view controller handles hiding this button, but hide it here as well just in case something goofs.
setVisibility(View.GONE); setVisibility(View.GONE);
@ -72,30 +86,56 @@ public class SkipSponsorButton extends FrameLayout {
protected final void dispatchDraw(Canvas canvas) { protected final void dispatchDraw(Canvas canvas) {
final int left = skipSponsorBtnContainer.getLeft(); final int left = skipSponsorBtnContainer.getLeft();
final int top = skipSponsorBtnContainer.getTop(); final int top = skipSponsorBtnContainer.getTop();
final int leftPlusWidth = (left + skipSponsorBtnContainer.getWidth()); final int right = left + skipSponsorBtnContainer.getWidth();
final int topPlusHeight = (top + skipSponsorBtnContainer.getHeight()); final int bottom = top + skipSponsorBtnContainer.getHeight();
canvas.drawRect(left, top, leftPlusWidth, topPlusHeight, background);
if (!highContrast) { // Determine corner radius for rounded button
canvas.drawLines(new float[]{ float cornerRadius = skipSponsorBtnContainer.getHeight() / 2f;
leftPlusWidth, top, left, top,
left, top, left, topPlusHeight, if (Settings.SB_SQUARE_LAYOUT.get()) {
left, topPlusHeight, leftPlusWidth, topPlusHeight}, // Square button.
border); canvas.drawRect(left, top, right, bottom, background);
if (highContrast) {
canvas.drawLines(new float[]{
right, top, left, top,
left, top, left, bottom,
left, bottom, right, bottom},
border); // Draw square border.
}
} else {
// Rounded button.
RectF rect = new RectF(left, top, right, bottom);
canvas.drawRoundRect(rect, cornerRadius, cornerRadius, background); // Draw rounded background.
if (highContrast) {
canvas.drawRoundRect(rect, cornerRadius, cornerRadius, border); // Draw rounded border.
}
} }
super.dispatchDraw(canvas); super.dispatchDraw(canvas);
} }
/** /**
* @return true, if this button state was changed * Update the layout of this button.
*/ */
public boolean updateSkipButtonText(@NonNull SponsorSegment segment) { public void updateLayout() {
if (Settings.SB_SQUARE_LAYOUT.get()) {
// No padding for square corners.
setPadding(0, 0, 0, 0);
} else {
// Apply padding for rounded corners.
final int padding = SponsorBlockViewController.ROUNDED_LAYOUT_MARGIN;
setPadding(padding, 0, padding, 0);
}
}
public void updateSkipButtonText(@NonNull SponsorSegment segment) {
this.segment = segment; this.segment = segment;
CharSequence newText = segment.getSkipButtonText(); CharSequence newText = segment.getSkipButtonText();
//noinspection StringEqualsCharSequence
if (newText.equals(skipSponsorTextView.getText())) { if (newText.equals(skipSponsorTextView.getText())) {
return false; return;
} }
skipSponsorTextView.setText(newText); skipSponsorTextView.setText(newText);
return true;
} }
} }

View File

@ -19,8 +19,11 @@ import app.revanced.extension.shared.Utils;
import app.revanced.extension.youtube.settings.Settings; import app.revanced.extension.youtube.settings.Settings;
import app.revanced.extension.youtube.shared.PlayerType; import app.revanced.extension.youtube.shared.PlayerType;
import app.revanced.extension.youtube.sponsorblock.objects.SponsorSegment; import app.revanced.extension.youtube.sponsorblock.objects.SponsorSegment;
import kotlin.Unit;
public class SponsorBlockViewController { public class SponsorBlockViewController {
public static final int ROUNDED_LAYOUT_MARGIN = 12;
private static WeakReference<RelativeLayout> inlineSponsorOverlayRef = new WeakReference<>(null); private static WeakReference<RelativeLayout> inlineSponsorOverlayRef = new WeakReference<>(null);
private static WeakReference<ViewGroup> youtubeOverlaysLayoutRef = new WeakReference<>(null); private static WeakReference<ViewGroup> youtubeOverlaysLayoutRef = new WeakReference<>(null);
private static WeakReference<SkipSponsorButton> skipHighlightButtonRef = new WeakReference<>(null); private static WeakReference<SkipSponsorButton> skipHighlightButtonRef = new WeakReference<>(null);
@ -36,7 +39,7 @@ public class SponsorBlockViewController {
static { static {
PlayerType.getOnChange().addObserver((PlayerType type) -> { PlayerType.getOnChange().addObserver((PlayerType type) -> {
playerTypeChanged(type); playerTypeChanged(type);
return null; return Unit.INSTANCE;
}); });
} }
@ -80,12 +83,16 @@ public class SponsorBlockViewController {
}); });
youtubeOverlaysLayoutRef = new WeakReference<>(viewGroup); youtubeOverlaysLayoutRef = new WeakReference<>(viewGroup);
skipHighlightButtonRef = new WeakReference<>( skipHighlightButtonRef = new WeakReference<>(Objects.requireNonNull(
Objects.requireNonNull(layout.findViewById(getResourceIdentifier("revanced_sb_skip_highlight_button", "id")))); layout.findViewById(getResourceIdentifier("revanced_sb_skip_highlight_button", "id"))));
skipSponsorButtonRef = new WeakReference<>(
Objects.requireNonNull(layout.findViewById(getResourceIdentifier("revanced_sb_skip_sponsor_button", "id")))); skipSponsorButtonRef = new WeakReference<>(Objects.requireNonNull(
newSegmentLayoutRef = new WeakReference<>( layout.findViewById(getResourceIdentifier("revanced_sb_skip_sponsor_button", "id"))));
Objects.requireNonNull(layout.findViewById(getResourceIdentifier("revanced_sb_new_segment_view", "id"))));
NewSegmentLayout newSegmentLayout = Objects.requireNonNull(
layout.findViewById(getResourceIdentifier("revanced_sb_new_segment_view", "id")));
newSegmentLayoutRef = new WeakReference<>(newSegmentLayout);
newSegmentLayout.updateLayout();
newSegmentLayoutVisible = false; newSegmentLayoutVisible = false;
skipHighlight = null; skipHighlight = null;
@ -101,6 +108,23 @@ public class SponsorBlockViewController {
hideNewSegmentLayout(); hideNewSegmentLayout();
} }
public static void updateLayout() {
SkipSponsorButton button = skipSponsorButtonRef.get();
if (button != null) {
button.updateLayout();
}
button = skipHighlightButtonRef.get();
if (button != null) {
button.updateLayout();
}
NewSegmentLayout newSegmentLayout = newSegmentLayoutRef.get();
if (newSegmentLayout != null) {
newSegmentLayout.updateLayout();
}
}
public static void showSkipHighlightButton(@NonNull SponsorSegment segment) { public static void showSkipHighlightButton(@NonNull SponsorSegment segment) {
skipHighlight = Objects.requireNonNull(segment); skipHighlight = Objects.requireNonNull(segment);
NewSegmentLayout newSegmentLayout = newSegmentLayoutRef.get(); NewSegmentLayout newSegmentLayout = newSegmentLayoutRef.get();

View File

@ -3,4 +3,4 @@ org.gradle.jvmargs = -Xms512M -Xmx2048M
org.gradle.parallel = true org.gradle.parallel = true
android.useAndroidX = true android.useAndroidX = true
kotlin.code.style = official kotlin.code.style = official
version = 5.11.0 version = 5.12.0-dev.7

View File

@ -3,7 +3,6 @@ revanced-patcher = "21.0.0"
# Tracking https://github.com/google/smali/issues/64. # Tracking https://github.com/google/smali/issues/64.
#noinspection GradleDependency #noinspection GradleDependency
smali = "3.0.5" smali = "3.0.5"
gson = "2.11.0"
# 8.3.0 causes java verifier error: https://github.com/ReVanced/revanced-patches/issues/2818. # 8.3.0 causes java verifier error: https://github.com/ReVanced/revanced-patches/issues/2818.
#noinspection GradleDependency #noinspection GradleDependency
agp = "8.2.2" agp = "8.2.2"
@ -11,10 +10,9 @@ annotation = "1.9.1"
appcompat = "1.7.0" appcompat = "1.7.0"
okhttp = "5.0.0-alpha.14" okhttp = "5.0.0-alpha.14"
retrofit = "2.11.0" retrofit = "2.11.0"
guava = "33.2.1-jre" guava = "33.4.0-jre"
[libraries] [libraries]
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" } annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }

24
package-lock.json generated
View File

@ -9,7 +9,7 @@
"@semantic-release/changelog": "^6.0.3", "@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1", "@semantic-release/git": "^10.0.1",
"gradle-semantic-release-plugin": "^1.10.1", "gradle-semantic-release-plugin": "^1.10.1",
"semantic-release": "^24.1.2" "semantic-release": "^24.2.1"
} }
}, },
"node_modules/@babel/code-frame": { "node_modules/@babel/code-frame": {
@ -6760,9 +6760,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/semantic-release": { "node_modules/semantic-release": {
"version": "24.1.2", "version": "24.2.1",
"resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-24.1.2.tgz", "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-24.2.1.tgz",
"integrity": "sha512-hvEJ7yI97pzJuLsDZCYzJgmRxF8kiEJvNZhf0oiZQcexw+Ycjy4wbdsn/sVMURgNCu8rwbAXJdBRyIxM4pe32g==", "integrity": "sha512-z0/3cutKNkLQ4Oy0HTi3lubnjTsdjjgOqmxdPjeYWe6lhFqUPfwslZxRHv3HDZlN4MhnZitb9SLihDkZNxOXfQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -6782,7 +6782,7 @@
"git-log-parser": "^1.2.0", "git-log-parser": "^1.2.0",
"hook-std": "^3.0.0", "hook-std": "^3.0.0",
"hosted-git-info": "^8.0.0", "hosted-git-info": "^8.0.0",
"import-from-esm": "^1.3.1", "import-from-esm": "^2.0.0",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"marked": "^12.0.0", "marked": "^12.0.0",
"marked-terminal": "^7.0.0", "marked-terminal": "^7.0.0",
@ -6926,6 +6926,20 @@
"node": ">=18.18.0" "node": ">=18.18.0"
} }
}, },
"node_modules/semantic-release/node_modules/import-from-esm": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/import-from-esm/-/import-from-esm-2.0.0.tgz",
"integrity": "sha512-YVt14UZCgsX1vZQ3gKjkWVdBdHQ6eu3MPU1TBgL1H5orXe2+jWD006WCPPtOuwlQm10NuzOW5WawiF1Q9veW8g==",
"dev": true,
"license": "MIT",
"dependencies": {
"debug": "^4.3.4",
"import-meta-resolve": "^4.0.0"
},
"engines": {
"node": ">=18.20"
}
},
"node_modules/semantic-release/node_modules/indent-string": { "node_modules/semantic-release/node_modules/indent-string": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz",

View File

@ -4,6 +4,6 @@
"@semantic-release/changelog": "^6.0.3", "@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1", "@semantic-release/git": "^10.0.1",
"gradle-semantic-release-plugin": "^1.10.1", "gradle-semantic-release-plugin": "^1.10.1",
"semantic-release": "^24.1.2" "semantic-release": "^24.2.1"
} }
} }

View File

@ -13,8 +13,6 @@ patches {
} }
dependencies { dependencies {
// Used by JsonGenerator.
implementation(libs.gson)
// Required due to smali, or build fails. Can be removed once smali is bumped. // Required due to smali, or build fails. Can be removed once smali is bumped.
implementation(libs.guava) implementation(libs.guava)
// Android API stubs defined here. // Android API stubs defined here.

View File

@ -8,7 +8,12 @@ val hideVideoAdsPatch = bytecodePatch(
name = "Hide music video ads", name = "Hide music video ads",
description = "Hides ads that appear while listening to or streaming music videos, podcasts, or songs.", description = "Hides ads that appear while listening to or streaming music videos, podcasts, or songs.",
) { ) {
compatibleWith("com.google.android.apps.youtube.music") compatibleWith(
"com.google.android.apps.youtube.music"(
"7.16.53",
"8.05.51"
)
)
execute { execute {
navigate(showVideoAdsParentFingerprint.originalMethod) navigate(showVideoAdsParentFingerprint.originalMethod)

View File

@ -1,24 +1,21 @@
package app.revanced.patches.music.audio.exclusiveaudio package app.revanced.patches.music.audio.exclusiveaudio
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.returnEarly
@Suppress("unused") @Suppress("unused")
val enableExclusiveAudioPlaybackPatch = bytecodePatch( val enableExclusiveAudioPlaybackPatch = bytecodePatch(
name = "Enable exclusive audio playback", name = "Enable exclusive audio playback",
description = "Enables the option to play audio without video.", description = "Enables the option to play audio without video.",
) { ) {
compatibleWith("com.google.android.apps.youtube.music") compatibleWith(
"com.google.android.apps.youtube.music"(
"7.16.53",
"8.05.51"
)
)
execute { execute {
allowExclusiveAudioPlaybackFingerprint.method.apply { allowExclusiveAudioPlaybackFingerprint.method.returnEarly(true)
addInstructions(
0,
"""
const/4 v0, 0x1
return v0
""",
)
}
} }
} }

View File

@ -9,16 +9,15 @@ internal val allowExclusiveAudioPlaybackFingerprint = fingerprint {
returns("Z") returns("Z")
parameters() parameters()
opcodes( opcodes(
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST, Opcode.CHECK_CAST,
Opcode.IF_NEZ, Opcode.IF_NEZ,
Opcode.IGET_OBJECT, Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL, Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT, Opcode.MOVE_RESULT
Opcode.GOTO,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.RETURN
) )
} }

View File

@ -11,10 +11,14 @@ val permanentRepeatPatch = bytecodePatch(
description = "Permanently remember your repeating preference even if the playlist ends or another track is played.", description = "Permanently remember your repeating preference even if the playlist ends or another track is played.",
use = false, use = false,
) { ) {
compatibleWith("com.google.android.apps.youtube.music") compatibleWith(
"com.google.android.apps.youtube.music"(
"7.16.53",
"8.05.51"
)
)
execute { execute {
val startIndex = repeatTrackFingerprint.patternMatch!!.endIndex val startIndex = repeatTrackFingerprint.patternMatch!!.endIndex
val repeatIndex = startIndex + 1 val repeatIndex = startIndex + 1

View File

@ -11,7 +11,12 @@ val hideCategoryBar = bytecodePatch(
description = "Hides the category bar at the top of the homepage.", description = "Hides the category bar at the top of the homepage.",
use = false, use = false,
) { ) {
compatibleWith("com.google.android.apps.youtube.music") compatibleWith(
"com.google.android.apps.youtube.music"(
"7.16.53",
"8.05.51"
)
)
execute { execute {
constructCategoryBarFingerprint.method.apply { constructCategoryBarFingerprint.method.apply {

View File

@ -11,7 +11,12 @@ val hideGetPremiumPatch = bytecodePatch(
name = "Hide 'Get Music Premium' label", name = "Hide 'Get Music Premium' label",
description = "Hides the \"Get Music Premium\" label from the account menu and settings.", description = "Hides the \"Get Music Premium\" label from the account menu and settings.",
) { ) {
compatibleWith("com.google.android.apps.youtube.music") compatibleWith(
"com.google.android.apps.youtube.music"(
"7.16.53",
"8.05.51"
)
)
execute { execute {
hideGetPremiumFingerprint.method.apply { hideGetPremiumFingerprint.method.apply {

View File

@ -18,7 +18,12 @@ val removeUpgradeButtonPatch = bytecodePatch(
name = "Remove upgrade button", name = "Remove upgrade button",
description = "Removes the upgrade tab from the pivot bar.", description = "Removes the upgrade tab from the pivot bar.",
) { ) {
compatibleWith("com.google.android.apps.youtube.music") compatibleWith(
"com.google.android.apps.youtube.music"(
"7.16.53",
"8.05.51"
)
)
execute { execute {
pivotBarConstructorFingerprint.method.apply { pivotBarConstructorFingerprint.method.apply {

View File

@ -8,7 +8,12 @@ val bypassCertificateChecksPatch = bytecodePatch(
name = "Bypass certificate checks", name = "Bypass certificate checks",
description = "Bypasses certificate checks which prevent YouTube Music from working on Android Auto.", description = "Bypasses certificate checks which prevent YouTube Music from working on Android Auto.",
) { ) {
compatibleWith("com.google.android.apps.youtube.music"("7.29.52")) compatibleWith(
"com.google.android.apps.youtube.music"(
"7.16.53",
"8.05.51"
)
)
execute { execute {
checkCertificateFingerprint.method.returnEarly(true) checkCertificateFingerprint.method.returnEarly(true)

View File

@ -4,8 +4,10 @@ import com.android.tools.smali.dexlib2.AccessFlags
import app.revanced.patcher.fingerprint import app.revanced.patcher.fingerprint
internal val checkCertificateFingerprint = fingerprint { internal val checkCertificateFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returns("Z") returns("Z")
parameters("Ljava/lang/String;") parameters("Ljava/lang/String;")
strings("X509", "Failed to get certificate.") strings(
"X509",
"Failed to get certificate" // Partial String match.
)
} }

View File

@ -8,7 +8,12 @@ val backgroundPlaybackPatch = bytecodePatch(
name = "Remove background playback restrictions", name = "Remove background playback restrictions",
description = "Removes restrictions on background playback, including playing kids videos in the background.", description = "Removes restrictions on background playback, including playing kids videos in the background.",
) { ) {
compatibleWith("com.google.android.apps.youtube.music") compatibleWith(
"com.google.android.apps.youtube.music"(
"7.16.53",
"8.05.51"
)
)
execute { execute {
kidsBackgroundPlaybackPolicyControllerFingerprint.method.addInstruction( kidsBackgroundPlaybackPolicyControllerFingerprint.method.addInstruction(

View File

@ -25,7 +25,12 @@ val spoofClientPatch = bytecodePatch(
name = "Spoof client", name = "Spoof client",
description = "Spoofs the client to fix playback.", description = "Spoofs the client to fix playback.",
) { ) {
compatibleWith("com.google.android.apps.youtube.music") compatibleWith(
"com.google.android.apps.youtube.music"(
"7.16.53",
"8.05.51"
)
)
dependsOn( dependsOn(
sharedExtensionPatch, sharedExtensionPatch,

View File

@ -56,8 +56,9 @@ val customThemePatch = resourcePatch(
document("res/values/colors.xml").use { document -> document("res/values/colors.xml").use { document ->
val resourcesNode = document.getElementsByTagName("resources").item(0) as Element val resourcesNode = document.getElementsByTagName("resources").item(0) as Element
for (i in 0 until resourcesNode.childNodes.length) { val childNodes = resourcesNode.childNodes
val node = resourcesNode.childNodes.item(i) as? Element ?: continue for (i in 0 until childNodes.length) {
val node = childNodes.item(i) as? Element ?: continue
node.textContent = node.textContent =
when (node.getAttribute("name")) { when (node.getAttribute("name")) {

View File

@ -3,9 +3,9 @@ package app.revanced.patches.windyapp.misc.unlockpro
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.bytecodePatch
@Deprecated("This patch no longer works and will be removed in the future.")
@Suppress("unused") @Suppress("unused")
val unlockProPatch = bytecodePatch( val unlockProPatch = bytecodePatch(
name = "Unlock pro",
description = "Unlocks all pro features.", description = "Unlocks all pro features.",
) { ) {
compatibleWith("co.windyapp.android") compatibleWith("co.windyapp.android")

View File

@ -78,8 +78,6 @@ val hideAdsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -25,8 +25,6 @@ val hideGetPremiumPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -23,8 +23,6 @@ val videoAdsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -53,8 +53,6 @@ val copyVideoUrlPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -24,8 +24,6 @@ val removeViewerDiscretionDialogPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -68,8 +68,6 @@ val downloadsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -23,8 +23,6 @@ val disablePreciseSeekingGesturePatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -26,8 +26,6 @@ val enableSeekbarTappingPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
// 18.38.44 patches but crashes on startup.
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -35,7 +35,6 @@ val enableSlideToSeekPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -19,7 +19,7 @@ private const val EXTENSION_CLASS_DESCRIPTOR =
val seekbarThumbnailsPatch = bytecodePatch( val seekbarThumbnailsPatch = bytecodePatch(
name = "Seekbar thumbnails", name = "Seekbar thumbnails",
description = "Adds an option to use high quality fullscreen seekbar thumbnails. " + description = "Adds an option to use high quality fullscreen seekbar thumbnails. " +
"Patching 19.16.39 or lower adds an option to restore old seekbar thumbnails.", "Patching 19.16.39 adds an option to restore old seekbar thumbnails.",
) { ) {
dependsOn( dependsOn(
sharedExtensionPatch, sharedExtensionPatch,
@ -29,8 +29,6 @@ val seekbarThumbnailsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -74,8 +74,6 @@ val swipeControlsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -22,8 +22,6 @@ val autoCaptionsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -43,8 +43,6 @@ val customBrandingPatch = resourcePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -41,8 +41,6 @@ val changeHeaderPatch = resourcePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",
@ -172,14 +170,16 @@ val changeHeaderPatch = resourcePatch(
// Instead change styles.xml to use the old drawable resources. // Instead change styles.xml to use the old drawable resources.
if (is_19_25_or_greater) { if (is_19_25_or_greater) {
document("res/values/styles.xml").use { document -> document("res/values/styles.xml").use { document ->
val documentChildNodes = document.childNodes
arrayOf( arrayOf(
"CairoLightThemeRingo2Updates" to variants[0], "CairoLightThemeRingo2Updates" to variants[0],
"CairoDarkThemeRingo2Updates" to variants[1] "CairoDarkThemeRingo2Updates" to variants[1]
).forEach { (styleName, theme) -> ).forEach { (styleName, theme) ->
val style = document.childNodes.findElementByAttributeValueOrThrow( val styleNodes = documentChildNodes.findElementByAttributeValueOrThrow(
"name", "name",
styleName, styleName,
) ).childNodes
val drawable = "@drawable/${HEADER_FILE_NAME}_${theme}" val drawable = "@drawable/${HEADER_FILE_NAME}_${theme}"
@ -187,7 +187,7 @@ val changeHeaderPatch = resourcePatch(
"ytWordmarkHeader", "ytWordmarkHeader",
"ytPremiumWordmarkHeader" "ytPremiumWordmarkHeader"
).forEach { itemName -> ).forEach { itemName ->
style.childNodes.findElementByAttributeValueOrThrow( styleNodes.findElementByAttributeValueOrThrow(
"name", "name",
itemName, itemName,
).textContent = drawable ).textContent = drawable

View File

@ -22,8 +22,6 @@ val hideButtonsPatch = resourcePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -40,8 +40,6 @@ val navigationButtonsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -54,8 +54,6 @@ val hidePlayerOverlayButtonsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -30,8 +30,6 @@ val changeFormFactorPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -56,8 +56,6 @@ val hideEndscreenCardsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -29,8 +29,6 @@ val disableFullscreenAmbientModePatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -125,8 +125,6 @@ val hideLayoutComponentsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -57,8 +57,6 @@ val hideInfoCardsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -24,8 +24,6 @@ val hidePlayerFlyoutMenuPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -29,8 +29,6 @@ val disableRollingNumberAnimationPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
// 18.43 is the earliest target this patch works.
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -25,8 +25,6 @@ val hideSeekbarPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -30,12 +30,6 @@ internal val createShortsButtonsFingerprint = fingerprint {
literal { reelPlayerRightCellButtonHeight } literal { reelPlayerRightCellButtonHeight }
} }
internal val reelConstructorFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
opcodes(Opcode.INVOKE_VIRTUAL)
literal { reelMultipleItemShelfId }
}
internal val renderBottomNavigationBarFingerprint = fingerprint { internal val renderBottomNavigationBarFingerprint = fingerprint {
returns("V") returns("V")
parameters("Ljava/lang/String;") parameters("Ljava/lang/String;")

View File

@ -18,7 +18,6 @@ import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.litho.filter.addLithoFilter import app.revanced.patches.youtube.misc.litho.filter.addLithoFilter
import app.revanced.patches.youtube.misc.litho.filter.lithoFilterPatch import app.revanced.patches.youtube.misc.litho.filter.lithoFilterPatch
import app.revanced.patches.youtube.misc.navigation.navigationBarHookPatch import app.revanced.patches.youtube.misc.navigation.navigationBarHookPatch
import app.revanced.patches.youtube.misc.playservice.is_19_03_or_greater
import app.revanced.patches.youtube.misc.playservice.is_19_41_or_greater import app.revanced.patches.youtube.misc.playservice.is_19_41_or_greater
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
import app.revanced.patches.youtube.misc.settings.PreferenceScreen import app.revanced.patches.youtube.misc.settings.PreferenceScreen
@ -27,11 +26,8 @@ import app.revanced.util.*
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction 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.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
import com.android.tools.smali.dexlib2.iface.reference.MethodReference import com.android.tools.smali.dexlib2.iface.reference.MethodReference
internal var reelMultipleItemShelfId = -1L
private set
internal var reelPlayerRightCellButtonHeight = -1L internal var reelPlayerRightCellButtonHeight = -1L
private set private set
internal var bottomBarContainer = -1L internal var bottomBarContainer = -1L
@ -155,13 +151,6 @@ private val hideShortsComponentsResourcePatch = resourcePatch {
"dimen", "dimen",
"reel_player_right_pivot_v2_size", "reel_player_right_pivot_v2_size",
] ]
if (!is_19_03_or_greater) {
reelMultipleItemShelfId = resourceMappings[
"dimen",
"reel_player_right_cell_button_height",
]
}
} }
} }
@ -183,8 +172,6 @@ val hideShortsComponentsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",
@ -199,25 +186,6 @@ val hideShortsComponentsPatch = bytecodePatch(
hideShortsWidgetOption() hideShortsWidgetOption()
execute { execute {
// region Hide the Shorts shelf.
// This patch point is not present in 19.03.x and greater.
if (!is_19_03_or_greater && reelConstructorFingerprint.methodOrNull != null) {
reelConstructorFingerprint.method.apply {
val insertIndex = reelConstructorFingerprint.patternMatch!!.startIndex + 2
val viewRegister = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
injectHideViewCall(
insertIndex,
viewRegister,
FILTER_CLASS_DESCRIPTOR,
"hideShortsShelf",
)
}
}
// endregion
// region Hide the Shorts buttons in older versions of YouTube. // region Hide the Shorts buttons in older versions of YouTube.
// Some Shorts buttons are views, hide them by setting their visibility to GONE. // Some Shorts buttons are views, hide them by setting their visibility to GONE.

View File

@ -54,8 +54,6 @@ val disableSuggestedVideoEndScreenPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -21,8 +21,6 @@ val hideTimestampPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -79,53 +79,52 @@ private val miniplayerResourcePatch = resourcePatch {
"player_overlays", "player_overlays",
] ]
if (is_19_16_or_greater) {
modernMiniplayerClose = resourceMappings[ modernMiniplayerClose = resourceMappings[
"id", "id",
"modern_miniplayer_close", "modern_miniplayer_close",
]
modernMiniplayerExpand = resourceMappings[
"id",
"modern_miniplayer_expand",
]
modernMiniplayerRewindButton = resourceMappings[
"id",
"modern_miniplayer_rewind_button",
]
modernMiniplayerForwardButton = resourceMappings[
"id",
"modern_miniplayer_forward_button",
]
// Resource id is not used during patching, but is used by extension.
// Verify the resource is present while patching.
resourceMappings[
"id",
"modern_miniplayer_subtitle_text",
]
// Only required for exactly 19.16
if (!is_19_17_or_greater) {
ytOutlinePictureInPictureWhite24 = resourceMappings[
"drawable",
"yt_outline_picture_in_picture_white_24",
] ]
modernMiniplayerExpand = resourceMappings[ ytOutlineXWhite24 = resourceMappings[
"id", "drawable",
"modern_miniplayer_expand", "yt_outline_x_white_24",
] ]
}
modernMiniplayerRewindButton = resourceMappings[ if (is_19_26_or_greater) {
"id", miniplayerMaxSize = resourceMappings[
"modern_miniplayer_rewind_button", "dimen",
"miniplayer_max_size",
] ]
modernMiniplayerForwardButton = resourceMappings[
"id",
"modern_miniplayer_forward_button",
]
// Resource id is not used during patching, but is used by extension.
// Verify the resource is present while patching.
resourceMappings[
"id",
"modern_miniplayer_subtitle_text",
]
// Only required for exactly 19.16
if (!is_19_17_or_greater) {
ytOutlinePictureInPictureWhite24 = resourceMappings[
"drawable",
"yt_outline_picture_in_picture_white_24",
]
ytOutlineXWhite24 = resourceMappings[
"drawable",
"yt_outline_x_white_24",
]
}
if (is_19_26_or_greater) {
miniplayerMaxSize = resourceMappings[
"dimen",
"miniplayer_max_size",
]
}
} }
} }
} }
@ -146,9 +145,6 @@ val miniplayerPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
// 18.49.37 // Could be supported, but no reason when 19.16 exists and has modern types.
// 19.14.43 // Incomplete code for modern miniplayers.
// 19.15.36 // Different code for handling subtitle texts and not worth supporting.
"19.16.39", // First with modern miniplayers. "19.16.39", // First with modern miniplayers.
// 19.17.41 // Works without issues, but no reason to recommend over 19.16. // 19.17.41 // Works without issues, but no reason to recommend over 19.16.
// 19.18.41 // Works without issues, but no reason to recommend over 19.16. // 19.18.41 // Works without issues, but no reason to recommend over 19.16.

View File

@ -21,8 +21,6 @@ val playerPopupPanelsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -12,8 +12,6 @@ val playerControlsBackgroundPatch = resourcePatch(
) { ) {
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -21,8 +21,6 @@ internal val exitFullscreenPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -52,8 +52,6 @@ val customPlayerOverlayOpacityPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -54,7 +54,6 @@ val returnYouTubeDislikePatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -29,8 +29,6 @@ val wideSearchbarPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -125,8 +125,10 @@ private val seekbarColorResourcePatch = resourcePatch {
fun setSplashDrawablePathFillColor(xmlFileNames: Iterable<String>, vararg resourceNames: String) { fun setSplashDrawablePathFillColor(xmlFileNames: Iterable<String>, vararg resourceNames: String) {
xmlFileNames.forEach { xmlFileName -> xmlFileNames.forEach { xmlFileName ->
document(xmlFileName).use { document -> document(xmlFileName).use { document ->
val childNodes = document.childNodes
resourceNames.forEach { elementId -> resourceNames.forEach { elementId ->
val element = document.childNodes.findElementByAttributeValueOrThrow( val element = childNodes.findElementByAttributeValueOrThrow(
"android:name", "android:name",
elementId elementId
) )

View File

@ -33,7 +33,6 @@ val shortsAutoplayPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -41,8 +41,6 @@ val openShortsInRegularPlayerPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -70,12 +70,7 @@ private val sponsorBlockResourcePatch = resourcePatch {
"revanced_sb_logo.xml", "revanced_sb_logo.xml",
"revanced_sb_publish.xml", "revanced_sb_publish.xml",
"revanced_sb_voting.xml", "revanced_sb_voting.xml",
), )
ResourceGroup(
// required resource for back button, because when the base APK is used, this resource will not exist
"drawable-xxxhdpi",
"quantum_ic_skip_next_white_24.png",
),
).forEach { resourceGroup -> ).forEach { resourceGroup ->
copyResources("sponsorblock", resourceGroup) copyResources("sponsorblock", resourceGroup)
} }
@ -111,8 +106,6 @@ val sponsorBlockPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -21,7 +21,7 @@ val spoofAppVersionPatch = bytecodePatch(
name = "Spoof app version", name = "Spoof app version",
description = "Adds an option to trick YouTube into thinking you are running an older version of the app. " + description = "Adds an option to trick YouTube into thinking you are running an older version of the app. " +
"This can be used to restore old UI elements and features. " + "This can be used to restore old UI elements and features. " +
"Patching 19.16.39 or lower includes additional older spoofing targets.", "Patching 19.16.39 includes additional older spoofing targets.",
) { ) {
dependsOn( dependsOn(
sharedExtensionPatch, sharedExtensionPatch,
@ -32,8 +32,6 @@ val spoofAppVersionPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
// "19.25.37", // Cannot be supported because the lowest spoof target is higher. // "19.25.37", // Cannot be supported because the lowest spoof target is higher.
// "19.34.42", // Cannot be supported because the lowest spoof target is higher. // "19.34.42", // Cannot be supported because the lowest spoof target is higher.

View File

@ -29,8 +29,6 @@ val changeStartPagePatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -31,8 +31,6 @@ val disableResumingShortsOnStartupPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -208,8 +208,6 @@ val themePatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -33,8 +33,6 @@ val alternativeThumbnailsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -27,8 +27,6 @@ val bypassImageRegionRestrictionsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -23,8 +23,6 @@ val announcementsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -24,8 +24,6 @@ val autoRepeatPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -48,8 +48,6 @@ val backgroundPlaybackPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -8,7 +8,6 @@ import app.revanced.patches.shared.misc.settings.preference.PreferenceScreenPref
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreenPreference.Sorting import app.revanced.patches.shared.misc.settings.preference.PreferenceScreenPreference.Sorting
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.playservice.is_19_16_or_greater
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
import app.revanced.patches.youtube.misc.settings.PreferenceScreen import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.misc.settings.settingsPatch import app.revanced.patches.youtube.misc.settings.settingsPatch
@ -32,8 +31,6 @@ val enableDebuggingPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",
@ -95,22 +92,21 @@ val enableDebuggingPatch = bytecodePatch(
) )
} }
if (is_19_16_or_greater) {
experimentalLongFeatureFlagFingerprint.match(
experimentalFeatureFlagParentFingerprint.originalClassDef
).method.apply {
val insertIndex = indexOfFirstInstructionOrThrow(Opcode.MOVE_RESULT_WIDE)
addInstructions( experimentalLongFeatureFlagFingerprint.match(
insertIndex, experimentalFeatureFlagParentFingerprint.originalClassDef
""" ).method.apply {
move-result-wide v0 val insertIndex = indexOfFirstInstructionOrThrow(Opcode.MOVE_RESULT_WIDE)
invoke-static/range { v0 .. v5 }, $EXTENSION_CLASS_DESCRIPTOR->isLongFeatureFlagEnabled(JJJ)J
move-result-wide v0 addInstructions(
return-wide v0 insertIndex,
""" """
) move-result-wide v0
} invoke-static/range { v0 .. v5 }, $EXTENSION_CLASS_DESCRIPTOR->isLongFeatureFlagEnabled(JJJ)J
move-result-wide v0
return-wide v0
"""
)
experimentalStringFeatureFlagFingerprint.match( experimentalStringFeatureFlagFingerprint.match(
experimentalFeatureFlagParentFingerprint.originalClassDef experimentalFeatureFlagParentFingerprint.originalClassDef

View File

@ -24,8 +24,6 @@ val spoofDeviceDimensionsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -21,8 +21,6 @@ val checkWatchHistoryDomainNameResolutionPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -35,8 +35,6 @@ val gmsCoreSupportPatch = gmsCoreSupportPatch(
compatibleWith( compatibleWith(
YOUTUBE_PACKAGE_NAME( YOUTUBE_PACKAGE_NAME(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -30,8 +30,6 @@ val bypassURLRedirectsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -41,8 +41,6 @@ val openLinksExternallyPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -76,10 +76,11 @@ val playerControlsResourcePatch = resourcePatch {
"android.support.constraint.ConstraintLayout", "android.support.constraint.ConstraintLayout",
).item(0) ).item(0)
var bottomInsertBeforeNode: Node = bottomTargetDocument.childNodes.findElementByAttributeValue( val bottomTargetDocumentChildNodes = bottomTargetDocument.childNodes
var bottomInsertBeforeNode: Node = bottomTargetDocumentChildNodes.findElementByAttributeValue(
"android:inflatedId", "android:inflatedId",
bottomLastLeftOf, bottomLastLeftOf,
) ?: bottomTargetDocument.childNodes.findElementByAttributeValueOrThrow( ) ?: bottomTargetDocumentChildNodes.findElementByAttributeValueOrThrow(
"android:id", // Older targets use non-inflated id. "android:id", // Older targets use non-inflated id.
bottomLastLeftOf, bottomLastLeftOf,
) )
@ -143,11 +144,13 @@ val playerControlsResourcePatch = resourcePatch {
} }
finalize { finalize {
val childNodes = bottomTargetDocument.childNodes
arrayOf( arrayOf(
"@id/bottom_end_container", "@id/bottom_end_container",
"@id/multiview_button", "@id/multiview_button",
).forEach { ).forEach {
bottomTargetDocument.childNodes.findElementByAttributeValue( childNodes.findElementByAttributeValue(
"android:id", "android:id",
it, it,
)?.setAttribute("yt:layout_constraintRight_toLeftOf", bottomLastLeftOf) )?.setAttribute("yt:layout_constraintRight_toLeftOf", bottomLastLeftOf)

View File

@ -5,10 +5,13 @@ package app.revanced.patches.youtube.misc.playservice
import app.revanced.patcher.patch.resourcePatch import app.revanced.patcher.patch.resourcePatch
import app.revanced.util.findElementByAttributeValueOrThrow import app.revanced.util.findElementByAttributeValueOrThrow
@Deprecated("19.16.39 is the lowest supported version")
var is_19_03_or_greater = false var is_19_03_or_greater = false
private set private set
@Deprecated("19.16.39 is the lowest supported version")
var is_19_04_or_greater = false var is_19_04_or_greater = false
private set private set
@Deprecated("19.16.39 is the lowest supported version")
var is_19_16_or_greater = false var is_19_16_or_greater = false
private set private set
var is_19_17_or_greater = false var is_19_17_or_greater = false

View File

@ -30,8 +30,6 @@ val removeTrackingQueryParameterPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -19,7 +19,6 @@ import app.revanced.patches.shared.misc.settings.settingsPatch
import app.revanced.patches.youtube.misc.check.checkEnvironmentPatch import app.revanced.patches.youtube.misc.check.checkEnvironmentPatch
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.fix.playbackspeed.fixPlaybackSpeedWhilePlayingPatch import app.revanced.patches.youtube.misc.fix.playbackspeed.fixPlaybackSpeedWhilePlayingPatch
import app.revanced.patches.youtube.misc.playservice.is_19_04_or_greater
import app.revanced.patches.youtube.misc.playservice.is_19_34_or_greater import app.revanced.patches.youtube.misc.playservice.is_19_34_or_greater
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
import app.revanced.util.* import app.revanced.util.*
@ -97,6 +96,8 @@ private val settingsResourcePatch = resourcePatch {
// Remove horizontal divider from the settings Preferences // Remove horizontal divider from the settings Preferences
// To better match the appearance of the stock YouTube settings. // To better match the appearance of the stock YouTube settings.
document("res/values/styles.xml").use { document -> document("res/values/styles.xml").use { document ->
val childNodes = document.childNodes
arrayOf( arrayOf(
"Theme.YouTube.Settings", "Theme.YouTube.Settings",
"Theme.YouTube.Settings.Dark", "Theme.YouTube.Settings.Dark",
@ -105,7 +106,7 @@ private val settingsResourcePatch = resourcePatch {
listDividerNode.setAttribute("name", "android:listDivider") listDividerNode.setAttribute("name", "android:listDivider")
listDividerNode.appendChild(document.createTextNode("@null")) listDividerNode.appendChild(document.createTextNode("@null"))
document.childNodes.findElementByAttributeValueOrThrow( childNodes.findElementByAttributeValueOrThrow(
"name", "name",
value, value,
).appendChild(listDividerNode) ).appendChild(listDividerNode)
@ -247,13 +248,10 @@ val settingsPatch = bytecodePatch(
} }
// Add setting to force cairo settings fragment on/off. // Add setting to force cairo settings fragment on/off.
if (is_19_04_or_greater) { cairoFragmentConfigFingerprint.method.insertFeatureFlagBooleanOverride(
cairoFragmentConfigFingerprint.method.insertFeatureFlagBooleanOverride( CAIRO_CONFIG_LITERAL_VALUE,
CAIRO_CONFIG_LITERAL_VALUE, "$activityHookClassDescriptor->useCairoSettingsFragment(Z)Z"
"$activityHookClassDescriptor->useCairoSettingsFragment(Z)Z" )
)
}
} }
finalize { finalize {

View File

@ -12,8 +12,6 @@ import app.revanced.patches.youtube.misc.settings.settingsPatch
val spoofVideoStreamsPatch = spoofVideoStreamsPatch({ val spoofVideoStreamsPatch = spoofVideoStreamsPatch({
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -21,8 +21,6 @@ val zoomHapticsPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -41,8 +41,6 @@ val forceOriginalAudioPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -28,8 +28,6 @@ val disableHdrPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

View File

@ -35,8 +35,6 @@ val rememberVideoQualityPatch = bytecodePatch(
compatibleWith( compatibleWith(
"com.google.android.youtube"( "com.google.android.youtube"(
"18.38.44",
"18.49.37",
"19.16.39", "19.16.39",
"19.25.37", "19.25.37",
"19.34.42", "19.34.42",

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