chore: Merge branch dev to main (#4183)

This commit is contained in:
oSumAtrIX 2024-12-22 08:48:36 +01:00 committed by GitHub
commit 6e7bd4b580
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
74 changed files with 181 additions and 281 deletions

View File

@ -1,3 +1,38 @@
# [5.7.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.6.1-dev.4...v5.7.0-dev.1) (2024-12-21)
### Features
* **YouTube:** Support version `19.47.53` ([#4182](https://github.com/ReVanced/revanced-patches/issues/4182)) ([2089e61](https://github.com/ReVanced/revanced-patches/commit/2089e613d36c45352db7d852aaee0087b1c3e1a4))
## [5.6.1-dev.4](https://github.com/ReVanced/revanced-patches/compare/v5.6.1-dev.3...v5.6.1-dev.4) (2024-12-21)
### Bug Fixes
* **YouTube - Spoof video stream:** Remove UI client type setting. Allow setting default audio language. ([#4184](https://github.com/ReVanced/revanced-patches/issues/4184)) ([99f3f29](https://github.com/ReVanced/revanced-patches/commit/99f3f29c649bf7693c05bbce2bb49bd53e05f050))
## [5.6.1-dev.3](https://github.com/ReVanced/revanced-patches/compare/v5.6.1-dev.2...v5.6.1-dev.3) (2024-12-21)
### Bug Fixes
* **YouTube - Force original audio:** Use correct availability for settings UI ([a7eedcb](https://github.com/ReVanced/revanced-patches/commit/a7eedcb4cca6b7b12629c478c24c0899c80e3615))
## [5.6.1-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.6.1-dev.1...v5.6.1-dev.2) (2024-12-21)
### Bug Fixes
* **YouTube - Spoof video streams:** Remove iOS, add clients Android TV and Android Creator ([#4180](https://github.com/ReVanced/revanced-patches/issues/4180)) ([86abfb2](https://github.com/ReVanced/revanced-patches/commit/86abfb2b0d4675f0a1cb9ab244783075bfe89281))
## [5.6.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.6.0...v5.6.1-dev.1) (2024-12-21)
### Bug Fixes
* **YouTube:** Change fingerprints to support a wider range of target versions ([8a09174](https://github.com/ReVanced/revanced-patches/commit/8a09174def205a26ce49cb7815097e235069526a))
# [5.6.0](https://github.com/ReVanced/revanced-patches/compare/v5.5.1...v5.6.0) (2024-12-20)

View File

@ -3,10 +3,8 @@ package app.revanced.extension.shared.settings;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
import static app.revanced.extension.shared.settings.Setting.parent;
import static app.revanced.extension.shared.spoof.SpoofVideoStreamsPatch.SpoofiOSAvailability;
import app.revanced.extension.shared.spoof.AudioStreamLanguage;
import app.revanced.extension.shared.spoof.ClientType;
/**
* Settings shared across multiple apps.
@ -23,8 +21,4 @@ public class BaseSettings {
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<AudioStreamLanguage> SPOOF_VIDEO_STREAMS_LANGUAGE = new EnumSetting<>("revanced_spoof_video_streams_language", AudioStreamLanguage.DEFAULT, parent(SPOOF_VIDEO_STREAMS));
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());
public static final EnumSetting<ClientType> SPOOF_VIDEO_STREAMS_CLIENT_TYPE = new EnumSetting<>("revanced_spoof_video_streams_client_type", ClientType.IOS, true, parent(SPOOF_VIDEO_STREAMS));
}

View File

@ -4,47 +4,45 @@ import android.os.Build;
import androidx.annotation.Nullable;
import app.revanced.extension.shared.settings.BaseSettings;
public enum ClientType {
// Specific purpose for age restricted, or private videos, because the iOS client is not logged in.
// https://dumps.tadiphone.dev/dumps/oculus/eureka
ANDROID_VR(28,
ANDROID_VR_NO_AUTH( // Must be first so a default audio language can be set.
28,
"ANDROID_VR",
"Quest 3",
"12",
"com.google.android.apps.youtube.vr.oculus/1.56.21 (Linux; U; Android 12; GB) gzip",
"32", // Android 12.1
"1.56.21",
true
),
// Specific for kids videos.
IOS(5,
"IOS",
forceAVC()
? "iPhone12,5" // 11 Pro Max (last device with iOS 13)
: "iPhone17,2", // 16 Pro Max
// iOS 13 and earlier uses only AVC. 14+ adds VP9 and AV1.
forceAVC()
? "13.7.17H35" // Last release of iOS 13.
: "18.1.1.22B91",
forceAVC()
? "com.google.ios.youtube/17.40.5 (iPhone; U; CPU iOS 13_7 like Mac OS X)"
: "com.google.ios.youtube/19.49.5 (iPhone; U; CPU iOS 18_1_1 like Mac OS X)",
null,
// Version number should be a valid iOS release.
// https://www.ipa4fun.com/history/185230
forceAVC()
// Some newer versions can also force AVC,
// but 17.40 is the last version that supports iOS 13.
? "17.40.5"
: "19.49.5",
false
);
private static boolean forceAVC() {
return BaseSettings.SPOOF_VIDEO_STREAMS_IOS_FORCE_AVC.get();
}
false),
// Fall over to authenticated ('hl' is ignored and audio is same as language set in users Google account).
ANDROID_VR(
ANDROID_VR_NO_AUTH.id,
ANDROID_VR_NO_AUTH.clientName,
ANDROID_VR_NO_AUTH.deviceModel,
ANDROID_VR_NO_AUTH.osVersion,
ANDROID_VR_NO_AUTH.userAgent,
ANDROID_VR_NO_AUTH.androidSdkVersion,
ANDROID_VR_NO_AUTH.clientVersion,
true),
ANDROID_UNPLUGGED(
29,
"ANDROID_UNPLUGGED",
"Google TV Streamer",
"14",
"com.google.android.apps.youtube.unplugged/8.49.0 (Linux; U; Android 14; GB) gzip",
"34",
"8.49.0",
true), // Requires login.
ANDROID_CREATOR(
14,
"ANDROID_CREATOR",
"Android",
"11",
"com.google.android.apps.youtube.creator/24.45.100 (Linux; U; Android 11) gzip",
"30",
"24.45.100",
true); // Requires login.
/**
* YouTube

View File

@ -10,7 +10,6 @@ import java.util.Map;
import app.revanced.extension.shared.Logger;
import app.revanced.extension.shared.Utils;
import app.revanced.extension.shared.settings.BaseSettings;
import app.revanced.extension.shared.settings.EnumSetting;
import app.revanced.extension.shared.settings.Setting;
import app.revanced.extension.shared.spoof.requests.StreamingDataRequest;
@ -18,9 +17,6 @@ import app.revanced.extension.shared.spoof.requests.StreamingDataRequest;
public class SpoofVideoStreamsPatch {
private static final boolean SPOOF_STREAMING_DATA = BaseSettings.SPOOF_VIDEO_STREAMS.get();
private static final boolean FIX_HLS_CURRENT_TIME = SPOOF_STREAMING_DATA
&& BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get() == ClientType.IOS;
/**
* Any unreachable ip address. Used to intentionally fail requests.
*/
@ -34,20 +30,17 @@ public class SpoofVideoStreamsPatch {
return false; // Modified during patching.
}
public static final class NotSpoofingAndroidVrAvailability implements Setting.Availability {
public static final class NotSpoofingAndroidAvailability implements Setting.Availability {
@Override
public boolean isAvailable() {
if (SpoofVideoStreamsPatch.isPatchIncluded()) {
EnumSetting<ClientType> clientType = BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE;
return clientType.isAvailable() && clientType.get() != ClientType.ANDROID_VR;
return !BaseSettings.SPOOF_VIDEO_STREAMS.get();
}
return true;
}
}
/**
* Injection point.
* Blocks /get_watch requests by returning an unreachable URI.
@ -190,25 +183,4 @@ public class SpoofVideoStreamsPatch {
return postData;
}
/**
* Injection point.
*
* Fixes iOS livestreams starting from the beginning.
*/
public static boolean fixHLSCurrentTime(boolean original) {
if (FIX_HLS_CURRENT_TIME) {
return false;
}
return original;
}
public static final class SpoofiOSAvailability implements Setting.Availability {
@Override
public boolean isAvailable() {
return BaseSettings.SPOOF_VIDEO_STREAMS.get()
&& BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get() == ClientType.IOS;
}
}
}

View File

@ -35,7 +35,7 @@ import app.revanced.extension.shared.spoof.ClientType;
*/
public class StreamingDataRequest {
private static final ClientType[] CLIENT_ORDER_TO_USE;
private static final ClientType[] CLIENT_ORDER_TO_USE = ClientType.values();
private static final String AUTHORIZATION_HEADER = "Authorization";
private static final String[] REQUEST_HEADER_KEYS = {
AUTHORIZATION_HEADER, // Available only to logged-in users.
@ -67,21 +67,6 @@ public class StreamingDataRequest {
}
});
static {
ClientType[] allClientTypes = ClientType.values();
ClientType preferredClient = BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get();
CLIENT_ORDER_TO_USE = new ClientType[allClientTypes.length];
CLIENT_ORDER_TO_USE[0] = preferredClient;
int i = 1;
for (ClientType c : allClientTypes) {
if (c != preferredClient) {
CLIENT_ORDER_TO_USE[i++] = c;
}
}
}
private final String videoId;
private final Future<ByteBuffer> future;
@ -178,7 +163,7 @@ public class StreamingDataRequest {
// gzip encoding doesn't response with content length (-1),
// but empty response body does.
if (connection.getContentLength() == 0) {
Logger.printDebug(() -> "Received empty response for video: " + videoId);
Logger.printDebug(() -> "Received empty response for client: " + clientType);
} else {
try (InputStream inputStream = new BufferedInputStream(connection.getInputStream());
ByteArrayOutputStream baos = new ByteArrayOutputStream()) {

View File

@ -7,7 +7,7 @@ import static app.revanced.extension.shared.settings.Setting.migrateFromOldPrefe
import static app.revanced.extension.shared.settings.Setting.migrateOldSettingToNew;
import static app.revanced.extension.shared.settings.Setting.parent;
import static app.revanced.extension.shared.settings.Setting.parentsAny;
import static app.revanced.extension.shared.spoof.SpoofVideoStreamsPatch.NotSpoofingAndroidVrAvailability;
import static app.revanced.extension.shared.spoof.SpoofVideoStreamsPatch.NotSpoofingAndroidAvailability;
import static app.revanced.extension.youtube.patches.ChangeStartPagePatch.StartPage;
import static app.revanced.extension.youtube.patches.MiniplayerPatch.MiniplayerHideExpandCloseAvailability;
import static app.revanced.extension.youtube.patches.MiniplayerPatch.MiniplayerHorizontalDragAvailability;
@ -54,7 +54,7 @@ public class Settings extends BaseSettings {
public static final StringSetting CUSTOM_PLAYBACK_SPEEDS = new StringSetting("revanced_custom_playback_speeds",
"0.25\n0.5\n0.75\n0.9\n0.95\n1.0\n1.05\n1.1\n1.25\n1.5\n1.75\n2.0\n3.0\n4.0\n5.0", true);
// Audio
public static final BooleanSetting FORCE_ORIGINAL_AUDIO = new BooleanSetting("revanced_force_original_audio", FALSE, new NotSpoofingAndroidVrAvailability());
public static final BooleanSetting FORCE_ORIGINAL_AUDIO = new BooleanSetting("revanced_force_original_audio", FALSE, new NotSpoofingAndroidAvailability());
// Ads
public static final BooleanSetting HIDE_BUTTONED_ADS = new BooleanSetting("revanced_hide_buttoned_ads", TRUE);

View File

@ -1,85 +0,0 @@
package app.revanced.extension.youtube.settings.preference;
import static app.revanced.extension.shared.StringRef.str;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.util.AttributeSet;
import androidx.annotation.Nullable;
import app.revanced.extension.shared.Logger;
import app.revanced.extension.shared.Utils;
import app.revanced.extension.shared.settings.BaseSettings;
import app.revanced.extension.shared.settings.Setting;
import app.revanced.extension.shared.spoof.ClientType;
@SuppressWarnings({"deprecation", "unused"})
public class SpoofStreamingDataSideEffectsPreference extends Preference {
@Nullable
private ClientType currentClientType;
private final SharedPreferences.OnSharedPreferenceChangeListener listener = (sharedPreferences, str) -> {
// Because this listener may run before the ReVanced settings fragment updates Settings,
// this could show the prior config and not the current.
//
// Push this call to the end of the main run queue,
// so all other listeners are done and Settings is up to date.
Utils.runOnMainThread(this::updateUI);
};
public SpoofStreamingDataSideEffectsPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public SpoofStreamingDataSideEffectsPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public SpoofStreamingDataSideEffectsPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SpoofStreamingDataSideEffectsPreference(Context context) {
super(context);
}
private void addChangeListener() {
Setting.preferences.preferences.registerOnSharedPreferenceChangeListener(listener);
}
private void removeChangeListener() {
Setting.preferences.preferences.unregisterOnSharedPreferenceChangeListener(listener);
}
@Override
protected void onAttachedToHierarchy(PreferenceManager preferenceManager) {
super.onAttachedToHierarchy(preferenceManager);
updateUI();
addChangeListener();
}
@Override
protected void onPrepareForRemoval() {
super.onPrepareForRemoval();
removeChangeListener();
}
private void updateUI() {
ClientType clientType = BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get();
if (currentClientType == clientType) {
return;
}
Logger.printDebug(() -> "Updating spoof stream side effects preference");
setEnabled(BaseSettings.SPOOF_VIDEO_STREAMS.get());
String key = "revanced_spoof_video_streams_about_"
+ clientType.name().toLowerCase();
setTitle(str(key + "_title"));
setSummary(str(key + "_summary"));
}
}

View File

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

View File

@ -1,7 +1,6 @@
package app.revanced.patches.shared.misc.spoof
import app.revanced.patcher.fingerprint
import app.revanced.util.literal
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
@ -112,16 +111,6 @@ internal val buildMediaDataSourceFingerprint = fingerprint {
)
}
internal const val HLS_CURRENT_TIME_FEATURE_FLAG = 45355374L
internal val hlsCurrentTimeFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
parameters("Z", "L")
literal {
HLS_CURRENT_TIME_FEATURE_FLAG
}
}
internal val patchIncludedExtensionMethodFingerprint = fingerprint {
accessFlags(AccessFlags.PRIVATE, AccessFlags.STATIC)
returns("Z")

View File

@ -12,7 +12,6 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMu
import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.util.getReference
import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.insertFeatureFlagBooleanOverride
import app.revanced.util.returnEarly
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
@ -209,15 +208,6 @@ fun spoofVideoStreamsPatch(
}
// endregion
// region Fix iOS livestream current time.
hlsCurrentTimeFingerprint.method.insertFeatureFlagBooleanOverride(
HLS_CURRENT_TIME_FEATURE_FLAG,
"$EXTENSION_CLASS_DESCRIPTOR->fixHLSCurrentTime(Z)Z"
)
// endregion
executeBlock()
}
}

View File

@ -77,6 +77,7 @@ val hideAdsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -33,6 +33,7 @@ val hideGetPremiumPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -31,6 +31,7 @@ val videoAdsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -61,6 +61,7 @@ val copyVideoUrlPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -32,6 +32,7 @@ val removeViewerDiscretionDialogPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -76,6 +76,7 @@ val downloadsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -31,6 +31,7 @@ val disablePreciseSeekingGesturePatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -34,6 +34,7 @@ val enableSeekbarTappingPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -44,6 +44,7 @@ val enableSlideToSeekPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -37,6 +37,7 @@ val seekbarThumbnailsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
)
)

View File

@ -73,6 +73,7 @@ val swipeControlsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -30,6 +30,7 @@ val autoCaptionsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -51,6 +51,7 @@ val customBrandingPatch = resourcePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -49,6 +49,7 @@ val changeHeaderPatch = resourcePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
)
)

View File

@ -30,6 +30,7 @@ val hideButtonsPatch = resourcePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -48,6 +48,7 @@ val navigationButtonsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -62,6 +62,7 @@ val hidePlayerOverlayButtonsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -64,6 +64,7 @@ val hideEndscreenCardsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -37,6 +37,7 @@ val disableFullscreenAmbientModePatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -133,6 +133,7 @@ val hideLayoutComponentsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -65,6 +65,7 @@ val hideInfoCardsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -32,6 +32,7 @@ val hidePlayerFlyoutMenuPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -37,6 +37,7 @@ val disableRollingNumberAnimationPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -33,6 +33,7 @@ val hideSeekbarPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -190,6 +190,7 @@ val hideShortsComponentsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -62,6 +62,7 @@ val disableSuggestedVideoEndScreenPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -29,6 +29,7 @@ val hideTimestampPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -170,6 +170,7 @@ val miniplayerPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -29,6 +29,7 @@ val playerPopupPanelsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -20,6 +20,7 @@ val playerControlsBackgroundPatch = resourcePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -26,6 +26,7 @@ val openVideosFullscreenPatch = bytecodePatch(
compatibleWith(
"com.google.android.youtube"(
"19.46.42",
"19.47.53",
)
)

View File

@ -60,6 +60,7 @@ val customPlayerOverlayOpacityPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -61,6 +61,7 @@ val returnYouTubeDislikePatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -37,6 +37,7 @@ val wideSearchbarPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -40,6 +40,7 @@ val shortsAutoplayPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -49,6 +49,7 @@ val openShortsInRegularPlayerPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -119,6 +119,7 @@ val sponsorBlockPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -40,6 +40,7 @@ val spoofAppVersionPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -37,6 +37,7 @@ val changeStartPagePatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -39,6 +39,7 @@ val disableResumingShortsOnStartupPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -34,6 +34,7 @@ val enableTabletLayoutPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -198,6 +198,7 @@ val themePatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -41,6 +41,7 @@ val alternativeThumbnailsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -35,6 +35,7 @@ val bypassImageRegionRestrictionsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -31,6 +31,7 @@ val announcementsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -32,6 +32,7 @@ val autoRepeatPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -56,6 +56,7 @@ val backgroundPlaybackPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -40,6 +40,7 @@ val enableDebuggingPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -32,6 +32,7 @@ val spoofDeviceDimensionsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -25,6 +25,7 @@ val checkWatchHistoryDomainNameResolutionPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -15,22 +15,16 @@ internal val onBackPressedFingerprint = fingerprint {
}
}
internal val recyclerViewScrollingFingerprint = fingerprint {
accessFlags(AccessFlags.PRIVATE, AccessFlags.FINAL)
internal val scrollPositionFingerprint = fingerprint {
accessFlags(AccessFlags.PROTECTED, AccessFlags.FINAL)
returns("V")
parameters()
parameters("L")
opcodes(
Opcode.IGET_OBJECT,
Opcode.IGET_OBJECT,
Opcode.IF_EQZ,
Opcode.IGET_OBJECT,
Opcode.CHECK_CAST,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.IF_LEZ,
Opcode.IGET_OBJECT,
Opcode.CONST_4,
Opcode.IF_NEZ,
Opcode.INVOKE_DIRECT,
Opcode.RETURN_VOID
)
strings("scroll_position")
}
internal val recyclerViewTopScrollingFingerprint = fingerprint {

View File

@ -1,54 +1,49 @@
package app.revanced.patches.youtube.misc.fix.backtoexitgesture
import app.revanced.patcher.Fingerprint
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.util.getReference
import app.revanced.util.indexOfFirstInstructionOrThrow
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/FixBackToExitGesturePatch;"
internal val fixBackToExitGesturePatch = bytecodePatch(
description = "Fixes the swipe back to exit gesture.",
) {
execute {
/**
* Inject a call to a method from the extension.
*
* @param targetMethod The target method to call.
*/
fun Fingerprint.injectCall(targetMethod: ExtensionMethod) = method.addInstruction(
patternMatch!!.endIndex,
targetMethod.toString(),
)
recyclerViewTopScrollingFingerprint.match(recyclerViewTopScrollingParentFingerprint.originalClassDef)
.let {
it.method.addInstruction(
it.patternMatch!!.endIndex,
"invoke-static { }, $EXTENSION_CLASS_DESCRIPTOR->onTopView()V"
)
}
mapOf(
recyclerViewTopScrollingFingerprint.also {
it.match(recyclerViewTopScrollingParentFingerprint.originalClassDef)
} to ExtensionMethod(
methodName = "onTopView",
),
recyclerViewScrollingFingerprint to ExtensionMethod(
methodName = "onScrollingViews",
),
onBackPressedFingerprint to ExtensionMethod(
"p0",
"onBackPressed",
"Landroid/app/Activity;",
),
).forEach { (fingerprint, target) -> fingerprint.injectCall(target) }
scrollPositionFingerprint.let {
navigate(it.originalMethod)
.to(it.patternMatch!!.startIndex + 1)
.stop().apply {
val index = indexOfFirstInstructionOrThrow {
opcode == Opcode.INVOKE_VIRTUAL && getReference<MethodReference>()?.definingClass ==
"Landroid/support/v7/widget/RecyclerView;"
}
addInstruction(
index,
"invoke-static { }, $EXTENSION_CLASS_DESCRIPTOR->onScrollingViews()V"
)
}
}
onBackPressedFingerprint.let {
it.method.addInstruction(
it.patternMatch!!.endIndex,
"invoke-static { p0 }, $EXTENSION_CLASS_DESCRIPTOR->onBackPressed(Landroid/app/Activity;)V"
)
}
}
}
/**
* A reference to a method from the extension for [fixBackToExitGesturePatch].
*
* @param register The method registers.
* @param methodName The method name.
* @param parameterTypes The parameters of the method.
*/
private class ExtensionMethod(
val register: String = "",
val methodName: String,
val parameterTypes: String = "",
) {
override fun toString() =
"invoke-static {$register}, Lapp/revanced/extension/youtube/patches/FixBackToExitGesturePatch;->$methodName($parameterTypes)V"
}

View File

@ -43,6 +43,7 @@ val gmsCoreSupportPatch = gmsCoreSupportPatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)
}

View File

@ -38,6 +38,7 @@ val bypassURLRedirectsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -49,6 +49,7 @@ val openLinksExternallyPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -38,6 +38,7 @@ val removeTrackingQueryParameterPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -20,6 +20,7 @@ val spoofVideoStreamsPatch = spoofVideoStreamsPatch({
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)
@ -36,20 +37,11 @@ val spoofVideoStreamsPatch = spoofVideoStreamsPatch({
sorting = PreferenceScreenPreference.Sorting.UNSORTED,
preferences = setOf(
SwitchPreference("revanced_spoof_video_streams"),
ListPreference(
"revanced_spoof_video_streams_client_type",
summaryKey = null,
),
ListPreference(
"revanced_spoof_video_streams_language",
summaryKey = null
),
SwitchPreference("revanced_spoof_video_streams_ios_force_avc"),
NonInteractivePreference(
// Requires a key and title but the actual text is chosen at runtime.
key = "revanced_spoof_video_streams_about_android_vr",
tag = "app.revanced.extension.youtube.settings.preference.SpoofStreamingDataSideEffectsPreference"
),
NonInteractivePreference("revanced_spoof_video_streams_about")
),
),
)

View File

@ -29,6 +29,7 @@ val zoomHapticsPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -31,7 +31,8 @@ private const val EXTENSION_CLASS_DESCRIPTOR =
@Suppress("unused")
val forceOriginalAudioPatch = bytecodePatch(
name = "Force original audio",
description = "Adds an option to always use the original audio track.",
description = "Adds an option to always use the original audio track. " +
"This patch does nothing if 'Spoof video streams' is enabled.",
) {
dependsOn(
sharedExtensionPatch,
@ -49,6 +50,7 @@ val forceOriginalAudioPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -43,6 +43,7 @@ val rememberVideoQualityPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -27,6 +27,7 @@ val playbackSpeedPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)
}

View File

@ -82,6 +82,7 @@ val restoreOldVideoQualityMenuPatch = bytecodePatch(
"19.43.41",
"19.45.38",
"19.46.42",
"19.47.53",
),
)

View File

@ -1,16 +1,6 @@
<resources>
<app id="youtube">
<patch id="misc.fix.playback.spoofVideoStreamsPatch">
<string-array name="revanced_spoof_video_streams_client_type_entries">
<!-- Operating system names are not translatable, so no need to use strings.xml -->
<item>Android VR</item>
<item>iOS</item>
</string-array>
<string-array name="revanced_spoof_video_streams_client_type_entry_values">
<!-- Enum names from extension -->
<item>ANDROID_VR</item>
<item>IOS</item>
</string-array>
<string-array name="revanced_spoof_video_streams_language_entries">
<item>@string/revanced_spoof_video_streams_language_DEFAULT</item>
<item>@string/revanced_spoof_video_streams_language_AR</item>

View File

@ -1297,17 +1297,8 @@ Enabling this can unlock higher video qualities"</string>
Video playback may not work"</string>
<string name="revanced_spoof_video_streams_user_dialog_message">Turning off this setting may cause video playback issues.</string>
<string name="revanced_spoof_video_streams_client_type_title">Default client</string>
<string name="revanced_spoof_video_streams_ios_force_avc_title">Force AVC (H.264)</string>
<string name="revanced_spoof_video_streams_ios_force_avc_summary_on">Video codec is forced to AVC (H.264)</string>
<string name="revanced_spoof_video_streams_ios_force_avc_summary_off">Video codec is determined automatically</string>
<string name="revanced_spoof_video_streams_ios_force_avc_user_dialog_message">"Enabling this might improve battery life and fix playback stuttering.
AVC has a maximum resolution of 1080p, Opus audio codec is not available, and video playback will use more internet data than VP9 or AV1."</string>
<string name="revanced_spoof_video_streams_about_ios_title">iOS spoofing side effects</string>
<string name="revanced_spoof_video_streams_about_ios_summary">"• Private kids videos may not play
• Videos end 1 second early"</string>
<string name="revanced_spoof_video_streams_about_android_vr_title">Android VR spoofing side effects</string>
<string name="revanced_spoof_video_streams_about_android_vr_summary">"• Kids videos may not play
<string name="revanced_spoof_video_streams_about_title">Spoofing side effects</string>
<string name="revanced_spoof_video_streams_about_summary">"• Kids videos may not play
• Audio track menu is missing
• Stable volume is not available
• Force original audio is not available"</string>