mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-25 19:51:03 +00:00
unofficial 20.39 work in progress (navigation bar notification tab icon fix is TODO)
This commit is contained in:
@@ -1601,6 +1601,7 @@ public final class app/revanced/patches/youtube/misc/playservice/VersionCheckPat
|
||||
public static final fun is_20_31_or_greater ()Z
|
||||
public static final fun is_20_34_or_greater ()Z
|
||||
public static final fun is_20_37_or_greater ()Z
|
||||
public static final fun is_20_39_or_greater ()Z
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/misc/privacy/SanitizeSharingLinksPatchKt {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.shortsplayer
|
||||
|
||||
import app.revanced.patcher.checkCast
|
||||
import app.revanced.patcher.fieldAccess
|
||||
import app.revanced.patcher.fingerprint
|
||||
import app.revanced.patcher.literal
|
||||
import app.revanced.patcher.methodCall
|
||||
@@ -7,10 +9,12 @@ import app.revanced.patcher.string
|
||||
import app.revanced.patches.shared.misc.mapping.ResourceType
|
||||
import app.revanced.patches.shared.misc.mapping.resourceLiteral
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
/**
|
||||
* Purpose of this method is not clear, and it's only used to identify
|
||||
* the obfuscated name of the videoId() method in PlaybackStartDescriptor.
|
||||
* 20.39 and lower.
|
||||
*/
|
||||
internal val playbackStartFeatureFlagFingerprint by fingerprint {
|
||||
returns("Z")
|
||||
@@ -26,6 +30,32 @@ internal val playbackStartFeatureFlagFingerprint by fingerprint {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose of this method is not entirely clear, and it's only used to identify
|
||||
* the obfuscated name of the videoId() method in PlaybackStartDescriptor.
|
||||
* 20.39+
|
||||
*/
|
||||
internal val watchPanelVideoIdFingerprint by fingerprint {
|
||||
returns("Ljava/lang/String;")
|
||||
parameters()
|
||||
instructions(
|
||||
fieldAccess(
|
||||
opcode = Opcode.IGET_OBJECT,
|
||||
type = "Lcom/google/android/apps/youtube/app/common/player/queue/WatchPanelId;"
|
||||
),
|
||||
checkCast("Lcom/google/android/apps/youtube/app/common/player/queue/DefaultWatchPanelId;"),
|
||||
methodCall(
|
||||
definingClass = "Lcom/google/android/apps/youtube/app/common/player/queue/DefaultWatchPanelId;",
|
||||
returnType = "Lcom/google/android/libraries/youtube/player/model/PlaybackStartDescriptor;"
|
||||
),
|
||||
methodCall(
|
||||
definingClass = "Lcom/google/android/libraries/youtube/player/model/PlaybackStartDescriptor;",
|
||||
returnType = "Ljava/lang/String;"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
// Pre 19.25
|
||||
internal val shortsPlaybackIntentLegacyFingerprint by fingerprint {
|
||||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
|
||||
|
||||
@@ -13,6 +13,7 @@ import app.revanced.patches.youtube.layout.player.fullscreen.openVideosFullscree
|
||||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.youtube.misc.navigation.navigationBarHookPatch
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_25_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.is_20_39_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
|
||||
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
||||
@@ -67,12 +68,16 @@ val openShortsInRegularPlayerPatch = bytecodePatch(
|
||||
)
|
||||
|
||||
// Find the obfuscated method name for PlaybackStartDescriptor.videoId()
|
||||
val playbackStartVideoIdMethodName = playbackStartFeatureFlagFingerprint.let {
|
||||
val stringMethodIndex = it.instructionMatches.first().index
|
||||
it.method.let {
|
||||
navigate(it).to(stringMethodIndex).stop().name
|
||||
val (videoIdStartMethod, videoIdIndex) = if (is_20_39_or_greater) {
|
||||
watchPanelVideoIdFingerprint.let {
|
||||
it.method to it.instructionMatches.last().index
|
||||
}
|
||||
} else {
|
||||
playbackStartFeatureFlagFingerprint.let {
|
||||
it.method to it.instructionMatches.first().index
|
||||
}
|
||||
}
|
||||
val playbackStartVideoIdMethodName = navigate(videoIdStartMethod).to(videoIdIndex).stop().name
|
||||
|
||||
fun extensionInstructions(playbackStartRegister: Int, freeRegister: Int) =
|
||||
"""
|
||||
|
||||
@@ -14,6 +14,7 @@ import app.revanced.patches.youtube.misc.playertype.playerTypeHookPatch
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_35_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.is_20_21_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.is_20_28_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.is_20_39_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
|
||||
import app.revanced.patches.youtube.shared.mainActivityOnBackPressedFingerprint
|
||||
import app.revanced.util.findFreeRegister
|
||||
@@ -28,6 +29,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||
import java.util.logging.Logger
|
||||
|
||||
internal const val EXTENSION_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/extension/youtube/shared/NavigationBar;"
|
||||
@@ -193,8 +195,14 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig
|
||||
)
|
||||
}
|
||||
|
||||
if (is_20_39_or_greater) {
|
||||
return@execute Logger.getLogger(this::class.java.name).warning(
|
||||
"20.39+ Navigation tab activity button selected state is not yet fixed."
|
||||
)
|
||||
}
|
||||
|
||||
// Fix YT bug of notification tab missing the filled icon.
|
||||
if (is_19_35_or_greater) {
|
||||
if (is_19_35_or_greater && !is_20_39_or_greater) { // FIXME: 20.39+ needs this fix.
|
||||
val cairoNotificationEnumReference = imageEnumConstructorFingerprint
|
||||
.instructionMatches.last().getInstruction<ReferenceInstruction>().reference
|
||||
|
||||
|
||||
@@ -81,6 +81,8 @@ var is_20_34_or_greater = false
|
||||
private set
|
||||
var is_20_37_or_greater = false
|
||||
private set
|
||||
var is_20_39_or_greater = false
|
||||
private set
|
||||
|
||||
val versionCheckPatch = resourcePatch(
|
||||
description = "Uses the Play Store service version to find the major/minor version of the YouTube target app.",
|
||||
@@ -125,5 +127,6 @@ val versionCheckPatch = resourcePatch(
|
||||
is_20_31_or_greater = 253205000 <= playStoreServicesVersion
|
||||
is_20_34_or_greater = 253505000 <= playStoreServicesVersion
|
||||
is_20_37_or_greater = 253805000 <= playStoreServicesVersion
|
||||
is_20_39_or_greater = 253980000 <= playStoreServicesVersion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user